5 #include <ipxe/oncrpc.h>
9 * Network File System protocol.
13 FILE_LICENCE ( GPL2_OR_LATER );
15 /** NFS protocol number */
16 #define ONCRPC_NFS 100003
18 /** NFS protocol version */
24 #define NFS3ERR_PERM 1
25 /** No such file or directory */
26 #define NFS3ERR_NOENT 2
29 /** No such device or address */
30 #define NFS3ERR_NXIO 6
31 /** Permission denied */
32 #define NFS3ERR_ACCES 13
33 /** The file specified already exists */
34 #define NFS3ERR_EXIST 17
35 /** Attempt to do a cross-device hard link */
36 #define NFS3ERR_XDEV 18
38 #define NFS3ERR_NODEV 19
39 /** Not a directory */
40 #define NFS3ERR_NOTDIR 20
42 #define NFS3ERR_ISDIR 21
43 /** Invalid argument */
44 #define NFS3ERR_INVAL 22
45 /** Filename too long */
46 #define NFS3ERR_NAMETOOLONG 63
47 /** Invalid file handle */
48 #define NFS3ERR_STALE 70
49 /** Too many levels of remote in path */
50 #define NFS3ERR_REMOTE 71
51 /** Illegal NFS file handle */
52 #define NFS3ERR_BADHANDLE 10001
53 /** READDIR or READDIRPLUS cookie is stale */
54 #define NFS3ERR_BAD_COOKIE 10003
55 /** Operation not supported */
56 #define NFS3ERR_NOTSUPP 10004
57 /** Buffer or request is too small */
58 #define NFS3ERR_TOOSMALL 10005
59 /** An error occurred on the server which does not map to any of the legal NFS
60 * version 3 protocol error values */
61 #define NFS3ERR_SERVERFAULT 10006
62 /** The server initiated the request, but was not able to complete it in a
64 #define NFS3ERR_JUKEBOX 10008
83 struct nfs_lookup_reply {
87 enum nfs_attr_type ent_type;
93 * A NFS READLINK reply
96 struct nfs_readlink_reply {
99 /** File path length */
110 struct nfs_read_reply {
117 /** End-of-File indicator */
125 size_t nfs_iob_get_fh ( struct io_buffer *io_buf, struct nfs_fh *fh );
126 size_t nfs_iob_add_fh ( struct io_buffer *io_buf, const struct nfs_fh *fh );
129 * Prepare an ONC RPC session to be used as a NFS session
131 * @v session ONC RPC session
132 * @v credential ONC RPC credential
134 * The credential parameter must not be NULL, use 'oncrpc_auth_none' if you
135 * don't want a particular scheme to be used.
137 static inline void nfs_init_session ( struct oncrpc_session *session,
138 struct oncrpc_cred *credential ) {
139 oncrpc_init_session ( session, credential, &oncrpc_auth_none,
140 ONCRPC_NFS, NFS_VERS );
143 int nfs_lookup ( struct interface *intf, struct oncrpc_session *session,
144 const struct nfs_fh *fh, const char *filename );
145 int nfs_readlink ( struct interface *intf, struct oncrpc_session *session,
146 const struct nfs_fh *fh );
147 int nfs_read ( struct interface *intf, struct oncrpc_session *session,
148 const struct nfs_fh *fh, uint64_t offset, uint32_t count );
150 int nfs_get_lookup_reply ( struct nfs_lookup_reply *lookup_reply,
151 struct oncrpc_reply *reply );
152 int nfs_get_readlink_reply ( struct nfs_readlink_reply *readlink_reply,
153 struct oncrpc_reply *reply );
154 int nfs_get_read_reply ( struct nfs_read_reply *read_reply,
155 struct oncrpc_reply *reply );
157 #endif /* _IPXE_NFS_H */