📄 nfs.rfc.ms
字号:
The type.I filename is used for passing file names or pathname components..LP.KS.NH 3\&path.IX "NFS data types" path "" \fIpath\fP.DStypedef string path<MAXPATHLEN>;.DE.KEThe type.I path is a pathname. The server considers it as a stringwith no internal structure, but to the client it is the name of anode in a filesystem tree..LP.KS.NH 3\&attrstat.IX "NFS data types" attrstat "" \fIattrstat\fP.DSunion attrstat switch (stat status) { case NFS_OK: fattr attributes; default: void;};.DE.KEThe .I attrstat structure is a common procedure result. It containsa "status" and, if the call succeeded, it also contains theattributes of the file on which the operation was done..LP.KS.NH 3\&diropargs.IX "NFS data types" diropargs "" \fIdiropargs\fP.DSstruct diropargs { fhandle dir; filename name;};.DE.KEThe .I diropargs structure is used in directory operations. The"fhandle" "dir" is the directory in which to find the file "name".A directory operation is one in which the directory is affected..LP.KS.NH 3\&diropres.IX "NFS data types" diropres "" \fIdiropres\fP.DSunion diropres switch (stat status) { case NFS_OK: struct { fhandle file; fattr attributes; } diropok; default: void;};.DE.KEThe results of a directory operation are returned in a .I diropres structure. If the call succeeded, a new file handle "file" and the"attributes" associated with that file are returned along with the"status"..NH 2\&Server Procedures.IX "NFS server procedures" "" "" "" PAGE MAJOR.LPThe protocol definition is given as a set of procedures witharguments and results defined using the RPC language. A briefdescription of the function of each procedure should provide enoughinformation to allow implementation..LPAll of the procedures in the NFS protocol are assumed to besynchronous. When a procedure returns to the client, the clientcan assume that the operation has completed and any data associatedwith the request is now on stable storage. For example, a client.I WRITE request may cause the server to update data blocks,filesystem information blocks (such as indirect blocks), and fileattribute information (size and modify times). When the .I WRITE returns to the client, it can assume that the write is safe, evenin case of a server crash, and it can discard the data written.This is a very important part of the statelessness of the server.If the server waited to flush data from remote requests, the clientwould have to save those requests so that it could resend them incase of a server crash..ie t .DS.el .DS L.ft I/** Remote file service routines*/.ft CWprogram NFS_PROGRAM { version NFS_VERSION { void NFSPROC_NULL(void) = 0; attrstat NFSPROC_GETATTR(fhandle) = 1; attrstat NFSPROC_SETATTR(sattrargs) = 2; void NFSPROC_ROOT(void) = 3; diropres NFSPROC_LOOKUP(diropargs) = 4; readlinkres NFSPROC_READLINK(fhandle) = 5; readres NFSPROC_READ(readargs) = 6; void NFSPROC_WRITECACHE(void) = 7; attrstat NFSPROC_WRITE(writeargs) = 8; diropres NFSPROC_CREATE(createargs) = 9; stat NFSPROC_REMOVE(diropargs) = 10; stat NFSPROC_RENAME(renameargs) = 11; stat NFSPROC_LINK(linkargs) = 12; stat NFSPROC_SYMLINK(symlinkargs) = 13; diropres NFSPROC_MKDIR(createargs) = 14; stat NFSPROC_RMDIR(diropargs) = 15; readdirres NFSPROC_READDIR(readdirargs) = 16; statfsres NFSPROC_STATFS(fhandle) = 17; } = 2;} = 100003;.DE.KS.NH 3\&Do Nothing.IX "NFS server procedures" NFSPROC_NULL() "" \fINFSPROC_NULL()\fP.DSvoid NFSPROC_NULL(void) = 0;.DE.KEThis procedure does no work. It is made available in all RPCservices to allow server response testing and timing..KS.NH 3\&Get File Attributes.IX "NFS server procedures" NFSPROC_GETATTR() "" \fINFSPROC_GETATTR()\fP.DSattrstat NFSPROC_GETATTR (fhandle) = 1;.DE.KEIf the reply status is .I NFS_OK ,then the reply attributes containsthe attributes for the file given by the input fhandle..KS.NH 3\&Set File Attributes.IX "NFS server procedures" NFSPROC_SETATTR() "" \fINFSPROC_SETATTR()\fP.DSstruct sattrargs { fhandle file; sattr attributes; };attrstatNFSPROC_SETATTR (sattrargs) = 2;.DE.KEThe "attributes" argument contains fields which are either -1 orare the new value for the attributes of "file". If the replystatus is .I NFS_OK ,then the reply attributes have the attributes ofthe file after the "SETATTR" operation has completed..LPNote: The use of -1 to indicate an unused field in "attributes" ischanged in the next version of the protocol..KS.NH 3\&Get Filesystem Root.IX "NFS server procedures" NFSPROC_ROOT "" \fINFSPROC_ROOT\fP.DSvoid NFSPROC_ROOT(void) = 3;.DE.KEObsolete. This procedure is no longer used because finding theroot file handle of a filesystem requires moving pathnames betweenclient and server. To do this right we would have to define anetwork standard representation of pathnames. Instead, thefunction of looking up the root file handle is done by the.I MNTPROC_MNT() procedure. (See the.I "Mount Protocol Definition"later in this chapter for details)..KS.NH 3\&Look Up File Name.IX "NFS server procedures" NFSPROC_LOOKUP() "" \fINFSPROC_LOOKUP()\fP.DSdiropresNFSPROC_LOOKUP(diropargs) = 4;.DE.KEIf the reply "status" is .I NFS_OK ,then the reply "file" and reply"attributes" are the file handle and attributes for the file "name"in the directory given by "dir" in the argument..KS.NH 3\&Read From Symbolic Link.IX "NFS server procedures" NFSPROC_READLINK() "" \fINFSPROC_READLINK()\fP.DSunion readlinkres switch (stat status) { case NFS_OK: path data; default: void;};readlinkresNFSPROC_READLINK(fhandle) = 5;.DE.KEIf "status" has the value .I NFS_OK ,then the reply "data" is the data in the symbolic link given by the file referred to by the fhandle argument..LPNote: since NFS always parses pathnames on the client, thepathname in a symbolic link may mean something different (or bemeaningless) on a different client or on the server if a differentpathname syntax is used..KS.NH 3\&Read From File.IX "NFS server procedures" NFSPROC_READ "" \fINFSPROC_READ\fP.DSstruct readargs { fhandle file; unsigned offset; unsigned count; unsigned totalcount;};union readres switch (stat status) { case NFS_OK: fattr attributes; opaque data<NFS_MAXDATA>; default: void;};readresNFSPROC_READ(readargs) = 6;.DE.KEReturns up to "count" bytes of "data" from the file given by"file", starting at "offset" bytes from the beginning of the file.The first byte of the file is at offset zero. The file attributesafter the read takes place are returned in "attributes"..LPNote: The argument "totalcount" is unused, and is removed in thenext protocol revision..KS.NH 3\&Write to Cache.IX "NFS server procedures" NFSPROC_WRITECACHE() "" \fINFSPROC_WRITECACHE()\fP.DSvoidNFSPROC_WRITECACHE(void) = 7;.DE.KETo be used in the next protocol revision..KS.NH 3\&Write to File.IX "NFS server procedures" NFSPROC_WRITE() "" \fINFSPROC_WRITE()\fP.DSstruct writeargs { fhandle file; unsigned beginoffset; unsigned offset; unsigned totalcount; opaque data<NFS_MAXDATA>;};attrstat NFSPROC_WRITE(writeargs) = 8;.DE.KEWrites "data" beginning "offset" bytes from the beginning of"file". The first byte of the file is at offset zero. If thereply "status" is NFS_OK, then the reply "attributes" contains theattributes of the file after the write has completed. The writeoperation is atomic. Data from this call to .I WRITE will not be mixed with data from another client's calls..LPNote: The arguments "beginoffset" and "totalcount" are ignored andare removed in the next protocol revision..KS.NH 3\&Create File.IX "NFS server procedures" NFSPROC_CREATE() "" \fINFSPROC_CREATE()\fP.DSstruct createargs { diropargs where; sattr attributes;};diropresNFSPROC_CREATE(createargs) = 9;.DE.KEThe file "name" is created in the directory given by "dir". Theinitial attributes of the new file are given by "attributes". Areply "status" of NFS_OK indicates that the file was created, andreply "file" and reply "attributes" are its file handle andattributes. Any other reply "status" means that the operationfailed and no file was created..LPNote: This routine should pass an exclusive create flag, meaning"create the file only if it is not already there"..KS.NH 3\&Remove File.IX "NFS server procedures" NFSPROC_REMOVE() "" \fINFSPROC_REMOVE()\fP.DSstatNFSPROC_REMOVE(diropargs) = 10;.DE.KEThe file "name" is removed from the directory given by "dir". Areply of NFS_OK means the directory entry was removed..LPNote: possibly non-idempotent operation..KS.NH 3\&Rename File.IX "NFS server procedures" NFSPROC_RENAME() "" \fINFSPROC_RENAME()\fP.DSstruct renameargs { diropargs from; diropargs to;};statNFSPROC_RENAME(renameargs) = 11;.DE.KEThe existing file "from.name" in the directory given by "from.dir"is renamed to "to.name" in the directory given by "to.dir". If thereply is .I NFS_OK ,the file was renamed. The RENAME operation isatomic on the server; it cannot be interrupted in the middle..LPNote: possibly non-idempotent operation..KS.NH 3\&Create Link to File.IX "NFS server procedures" NFSPROC_LINK() "" \fINFSPROC_LINK()\fP.DSstruct linkargs { fhandle from; diropargs to;};statNFSPROC_LINK(linkargs) = 12;.DE.KECreates the file "to.name" in the directory given by "to.dir",which is a hard link to the existing file given by "from". If thereturn value is .I NFS_OK ,a link was created. Any other return valueindicates an error, and the link was not created..LPA hard link should have the property that changes to either of thelinked files are reflected in both files. When a hard link is madeto a file, the attributes for the file should have a value for"nlink" that is one greater than the value before the link..LPNote: possibly non-idempotent operation..KS.NH 3\&Create Symbolic Link.IX "NFS server procedures" NFSPROC_SYMLINK() "" \fINFSPROC_SYMLINK()\fP.DSstruct symlinkargs { diropargs from; path to; sattr attributes;};statNFSPROC_SYMLINK(symlinkargs) = 13;.DE.KECreates the file "from.name" with ftype .I NFLNK in the directorygiven by "from.dir". The new file contains the pathname "to" andhas initial attributes given by "attributes". If the return valueis .I NFS_OK ,a link was created. Any other return value indicates anerror, and the link was not created..LPA symbolic link is a pointer to another file. The name given in"to" is not interpreted by the server, only stored in the newlycreated file. When the client references a file that is a symboliclink, the contents of the symbolic link are normally transparentlyreinterpreted as a pathname to substitute. A .I READLINK operation returns the data to the client for interpretation..LPNote: On UNIX servers the attributes are never used, sincesymbolic links always have mode 0777..KS.NH 3\&Create Directory.IX "NFS server procedures" NFSPROC_MKDIR() "" \fINFSPROC_MKDIR()\fP.DSdiropresNFSPROC_MKDIR (createargs) = 14;.DE.KEThe new directory "where.name" is created in the directory given by"where.dir". The initial attributes of the new directory are givenby "attributes". A reply "status" of NFS_OK indicates that the newdirectory was created, and reply "file" and reply "attributes" areits file handle and attributes. Any other reply "status" meansthat the operation failed and no directory was created..LPNote: possibly non-idempotent operation..KS.NH 3\&Remove Directory.IX "NFS server procedures" NFSPROC_RMDIR() "" \fINFSPROC_RMDIR()\fP.DSstatNFSPROC_RMDIR(diropargs) = 15;.DE.KEThe existing empty directory "name" in the directory given by "dir"is removed. If the reply is .I NFS_OK ,the directory was removed..LPNote: possibly non-idempotent operation..KS.NH 3
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -