Topen tag [2] fid [2] mode [1] Ropen tag [2] fid [2] qid [8] Tcreate tag [2] fid [2] name [28] perm [4] mode [1] Rcreate tag [2] fid [2] qid [8]
The mode field expresses the type of I/O requested and is checked against the permissions for the file. Additional options can also be requested. The allowed values are shown below. If other bits are set in mode they will be ignored.
It is illegal to write a directory, truncate it, or attempt to remove it on close.
The create Transaction
The create request asks the file server to create a new file with the name supplied, in the directory (dir) represented by fid. This request and requires write permission in the directory. The owner of the file is the implied user id of the request and the group of the file is the same as dir.
(perm&(~8r777|8r111)) | (dir.perm&perm&8r666)For directories, the formula is
(perm&~8r777) | (dir.perm&perm&8r777)This means, for example, that if the create allows read permission to others, but the containing directory does not, then the created file will not allow others to read the file.
Finally, the newly created file is opened according to mode, and fid will represent the newly opened file. The mode is not checked against the permissions in perm.
The qid for the new file is returned with the create reply message.
Directories are created by setting the CHDIR bit (16r80000000) in the perm.
The names '.' and '..' are special. It is illegal to create files with these names.
It is an error if the fid is already the product of a successful open or create message.
An attempt to create a file in a directory where the given name already exists will be rejected. The create system call uses open with truncation. (see open, create - open/create a file for reading or writing in Chapter 8)
The algorithm used by the create system call is:
bind, mount, unmount - change file name space in Chapter 8
|
open, create - open/create a file for reading or writing in Chapter 8
|
stat, wstat - inquire or change file attributes
|