NFSPROC3_MKNOD - Create a Special Device
-
-
struct devicedata3 {
sattr3 dev_attributes;
specdata3 spec;
};
union mknoddata3 switch (ftype3 type) {
case NF3CHR:
case NF3BLK:
devicedata3 device;
case NF3SOCK:
case NF3FIFO:
sattr3 pipe_attributes;
default:
void;
};
struct MKNOD3args {
diropargs3 where;
mknoddata3 what;
};
-
-
struct MKNOD3resok {
post_op_fh3 obj;
post_op_attr obj_attributes;
wcc_data dir_wcc;
};
struct MKNOD3resfail {
wcc_data dir_wcc;
};
union MKNOD3res switch (nfsstat3 status) {
case NFS3_OK:
MKNOD3resok resok;
default:
MKNOD3resfail resfail;
};
-
-
MKNOD3res
NFSPROC3_MKNOD(MKNOD3args) = 11;
Procedure MKNOD creates a new special file of the type what.type. Special files can be device files or named pipes.On entry, the arguments in MKNOD3args are:
- where
- The location of the special file to be created:
- dir
- The file handle for the directory in which the special file is to be created.
- name
- The name that is to be associated with the created special file. See
General File Name Requirements for more information on file names.
- what
- A discriminated union identifying the type of the special file to be created along with the data and attributes appropriate to the type of the special file:
- type
- The type of the object to be created.
When creating a character special file (.IR what.type is NF3CHR) or a block special file (.IR what.type is NF3BLK), what includes:
- device
- A devicedata3 structure with the following components:
- dev_attributes
The initial attributes for the special file.
- spec
- The major number stored in device.spec.specdata1 and the minor number stored in device.spec.specdata2.
When creating a socket (.IR what.type is NF3SOCK) or a FIFO (.IR what.type is NF3FIFO), what includes:
- pipe_attributes
- The initial attributes for the special file.
Upon successful return, MKNOD3res.status is NFS3_OK and MKNOD3res.resok contains:
- obj
- The file handle for the newly created special file.
- obj_attributes
- The attributes for the newly created special file.
- dir_wcc
- Weak cache consistency data for the directory where.dir. For a client that requires only the post-.IR MKNOD directory attributes, these can be found in dir_wcc.after.
Otherwise, MKNOD3res.status contains the error on failure and MKNOD3res.resfail contains the following:
- dir_wcc
- Weak cache consistency data for the directory where.dir. For a client that requires only the post-.IR MKNOD directory attributes, these can be found in dir_wcc.after. Even though the MKNOD failed, full wcc_data is returned to allow the client to determine whether the failing MKNOD changed the directory.
SeeGeneral File Name Requirements for more information on file names.Without explicit support for special file type creation in the NFS Version 2 protocol, fields in the CREATE arguments were overloaded to indicate creation of certain types of objects. This overloading is not necessary in the NFS Version 3 protocol.
If the server does not support any of the defined types, the NFS3ERR_NOTSUPP error should be returned. Otherwise, if the server does not support the target type or the target type is invalid, the NFS3ERR_BADTYPE error should be returned. Note that NF3REG, NF3DIR and NF3LNK are invalid types for MKNOD. The procedures, CREATE, MKDIR and SYMLINK should be used to create these file types, respectively, instead of MKNOD.
- NFS3ERR_IO
- I/O error. Some sort of hard error occurred when the operation was in progress. This could be a disk error, for example.
- NFS3ERR_ACCES
- Permission denied. The caller does not have the correct permission to perform the requested operation. Contrast this with NFS3ERR_PERM, which restricts itself to owner permission failures.
- NFS3ERR_EXIST
- File exists. The file specified already exists.
- NFS3ERR_NOTDIR
- Not a directory. The caller specified a non-directory in a directory operation.
- NFS3ERR_NOSPC
- No space left on device. The operation would have caused the server's file system to exceed its limit.
- NFS3ERR_ROFS
- Read-only file system. A modifying operation was attempted on a read-only file system.
- NFS3ERR_NAMETOOLONG
The filename in an operation was too long.
- NFS3ERR_DQUOT
- Resource (quota) hard limit exceeded. The user's resource limit on the server has been exceeded.
- NFS3ERR_STALE
- Invalid file handle. The file handle given in the arguments was invalid. The file referred to by that file handle no longer exists or access to it has been revoked.
- NFS3ERR_BADHANDLE
Invalid NFS file handle. The file handle failed internal consistency checks.
- NFS3ERR_NOTSUPP
The operation is not supported.
- NFS3ERR_SERVERFAULT
An error occurred on the server, which does not map to any of the valid NFS Version 3 protocol error values. The client should translate this into an appropriate error. Clients based on an XPG system may choose to translate this to EIO.
- NFS3ERR_BADTYPE
An attempt was made to create an object of a type not supported by the server.
Contents | Next section | Index |