Representation of file systems
3. Opening a file
-
One of the most important operations when accessing data
is opening a file with the system call open.
-
The system not only has to make the appropriate preparations
to ensure access to data without problems, but also has to check the authorizations
for the process.
-
After finding the file, the open_namei() function
then performs a number of tests, such as
-
if the file is a directory and if the process is seeking
write permission, the function returns error,
-
if access to devices has been prohibited and if the file
is a device fie, return error,
-
if the file is not a device file and if if the process is
attempting to gain write access to a read-only file system, error.
-
...
-
If the file survives all of those tests, the operation do_open()
and open() takes care of the actions specific to the file type
-
If no error is returned by any of those open functions, the
file has been successfully opened.
[next]