iPXE
|
Network File System protocol. More...
Go to the source code of this file.
Data Structures | |
struct | nfs_fh |
A NFS file handle. More... | |
struct | nfs_lookup_reply |
A NFS LOOKUP reply. More... | |
struct | nfs_readlink_reply |
A NFS READLINK reply. More... | |
struct | nfs_read_reply |
A NFS READ reply. More... | |
Macros | |
#define | ONCRPC_NFS 100003 |
NFS protocol number. More... | |
#define | NFS_VERS 3 |
NFS protocol version. More... | |
#define | NFS3_OK 0 |
No error. More... | |
#define | NFS3ERR_PERM 1 |
Not owner. More... | |
#define | NFS3ERR_NOENT 2 |
No such file or directory. More... | |
#define | NFS3ERR_IO 5 |
I/O error. More... | |
#define | NFS3ERR_NXIO 6 |
No such device or address. More... | |
#define | NFS3ERR_ACCES 13 |
Permission denied. More... | |
#define | NFS3ERR_EXIST 17 |
The file specified already exists. More... | |
#define | NFS3ERR_XDEV 18 |
Attempt to do a cross-device hard link. More... | |
#define | NFS3ERR_NODEV 19 |
No such device. More... | |
#define | NFS3ERR_NOTDIR 20 |
Not a directory. More... | |
#define | NFS3ERR_ISDIR 21 |
Is a directory. More... | |
#define | NFS3ERR_INVAL 22 |
Invalid argument. More... | |
#define | NFS3ERR_NAMETOOLONG 63 |
Filename too long. More... | |
#define | NFS3ERR_STALE 70 |
Invalid file handle. More... | |
#define | NFS3ERR_REMOTE 71 |
Too many levels of remote in path. More... | |
#define | NFS3ERR_BADHANDLE 10001 |
Illegal NFS file handle. More... | |
#define | NFS3ERR_BAD_COOKIE 10003 |
READDIR or READDIRPLUS cookie is stale. More... | |
#define | NFS3ERR_NOTSUPP 10004 |
Operation not supported. More... | |
#define | NFS3ERR_TOOSMALL 10005 |
Buffer or request is too small. More... | |
#define | NFS3ERR_SERVERFAULT 10006 |
An error occurred on the server which does not map to any of the legal NFS version 3 protocol error values. More... | |
#define | NFS3ERR_JUKEBOX 10008 |
The server initiated the request, but was not able to complete it in a timely fashion. More... | |
Enumerations | |
enum | nfs_attr_type { NFS_ATTR_SYMLINK = 5 } |
Functions | |
FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
size_t | nfs_iob_get_fh (struct io_buffer *io_buf, struct nfs_fh *fh) |
Extract a file handle from the beginning of an I/O buffer. More... | |
size_t | nfs_iob_add_fh (struct io_buffer *io_buf, const struct nfs_fh *fh) |
Add a file handle to the end of an I/O buffer. More... | |
static void | nfs_init_session (struct oncrpc_session *session, struct oncrpc_cred *credential) |
Prepare an ONC RPC session to be used as a NFS session. More... | |
int | nfs_lookup (struct interface *intf, struct oncrpc_session *session, const struct nfs_fh *fh, const char *filename) |
Send a LOOKUP request. More... | |
int | nfs_readlink (struct interface *intf, struct oncrpc_session *session, const struct nfs_fh *fh) |
Send a READLINK request. More... | |
int | nfs_read (struct interface *intf, struct oncrpc_session *session, const struct nfs_fh *fh, uint64_t offset, uint32_t count) |
Send a READ request. More... | |
int | nfs_get_lookup_reply (struct nfs_lookup_reply *lookup_reply, struct oncrpc_reply *reply) |
Parse a LOOKUP reply. More... | |
int | nfs_get_readlink_reply (struct nfs_readlink_reply *readlink_reply, struct oncrpc_reply *reply) |
Parse a READLINK reply. More... | |
int | nfs_get_read_reply (struct nfs_read_reply *read_reply, struct oncrpc_reply *reply) |
Parse a READ reply. More... | |
Network File System protocol.
Definition in file nfs.h.
#define NFS3ERR_XDEV 18 |
#define NFS3ERR_BAD_COOKIE 10003 |
#define NFS3ERR_SERVERFAULT 10006 |
#define NFS3ERR_JUKEBOX 10008 |
enum nfs_attr_type |
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
Extract a file handle from the beginning of an I/O buffer.
io_buf | I/O buffer |
fh | File handle |
size | Size of the data read |
Definition at line 59 of file nfs.c.
References io_buffer::data, nfs_fh::fh, iob_pull, memcpy(), oncrpc_iob_get_int, and nfs_fh::size.
Referenced by mount_get_mnt_reply(), and nfs_get_lookup_reply().
Add a file handle to the end of an I/O buffer.
io_buf | I/O buffer |
fh | File handle |
size | Size of the data written |
Definition at line 78 of file nfs.c.
References nfs_fh::fh, iob_put, memcpy(), oncrpc_iob_add_int(), and nfs_fh::size.
|
inlinestatic |
Prepare an ONC RPC session to be used as a NFS session.
session | ONC RPC session |
credential | ONC RPC credential |
The credential parameter must not be NULL, use 'oncrpc_auth_none' if you don't want a particular scheme to be used.
Definition at line 137 of file nfs.h.
References NFS_VERS, oncrpc_auth_none, oncrpc_init_session(), and ONCRPC_NFS.
Referenced by nfs_open().
int nfs_lookup | ( | struct interface * | intf, |
struct oncrpc_session * | session, | ||
const struct nfs_fh * | fh, | ||
const char * | filename | ||
) |
Send a LOOKUP request.
intf | Interface to send the request on |
session | ONC RPC session |
fh | The file handle of the the directory |
filename | The file name |
rc | Return status code |
Definition at line 96 of file nfs.c.
References array, nfs_fh::fh, NFS_LOOKUP, oncrpc_call(), ONCRPC_FIELD, ONCRPC_FIELD_END, ONCRPC_SUBFIELD, and nfs_fh::size.
Referenced by nfs_step().
int nfs_readlink | ( | struct interface * | intf, |
struct oncrpc_session * | session, | ||
const struct nfs_fh * | fh | ||
) |
Send a READLINK request.
intf | Interface to send the request on |
session | ONC RPC session |
fh | The symlink file handle |
rc | Return status code |
Definition at line 115 of file nfs.c.
References array, nfs_fh::fh, NFS_READLINK, oncrpc_call(), ONCRPC_FIELD_END, ONCRPC_SUBFIELD, and nfs_fh::size.
Referenced by nfs_step().
int nfs_read | ( | struct interface * | intf, |
struct oncrpc_session * | session, | ||
const struct nfs_fh * | fh, | ||
uint64_t | offset, | ||
uint32_t | count | ||
) |
Send a READ request.
intf | Interface to send the request on |
session | ONC RPC session |
fh | The file handle |
offset | Offset |
count | Byte count |
rc | Return status code |
Definition at line 135 of file nfs.c.
References array, count, nfs_fh::fh, NFS_READ, offset, oncrpc_call(), ONCRPC_FIELD, ONCRPC_FIELD_END, ONCRPC_SUBFIELD, and nfs_fh::size.
Referenced by nfs_step().
int nfs_get_lookup_reply | ( | struct nfs_lookup_reply * | lookup_reply, |
struct oncrpc_reply * | reply | ||
) |
Parse a LOOKUP reply.
lookup_reply | A structure where the data will be saved |
reply | The ONC RPC reply to get data from |
rc | Return status code |
Definition at line 154 of file nfs.c.
References oncrpc_reply::data, EACCES, EINVAL, EIO, ENAMETOOLONG, ENOENT, ENOTDIR, nfs_lookup_reply::ent_type, EPERM, EPROTO, ESTALE, nfs_lookup_reply::fh, NFS3_OK, NFS3ERR_ACCES, NFS3ERR_BADHANDLE, NFS3ERR_IO, NFS3ERR_NAMETOOLONG, NFS3ERR_NOENT, NFS3ERR_NOTDIR, NFS3ERR_PERM, NFS3ERR_SERVERFAULT, NFS3ERR_STALE, nfs_iob_get_fh(), oncrpc_iob_get_int, and nfs_lookup_reply::status.
Referenced by nfs_deliver().
int nfs_get_readlink_reply | ( | struct nfs_readlink_reply * | readlink_reply, |
struct oncrpc_reply * | reply | ||
) |
Parse a READLINK reply.
readlink_reply | A structure where the data will be saved |
reply | The ONC RPC reply to get data from |
rc | Return status code |
Definition at line 198 of file nfs.c.
References io_buffer::data, oncrpc_reply::data, EACCES, EINVAL, EIO, ENOTSUP, EPROTO, ESTALE, iob_pull, NFS3_OK, NFS3ERR_ACCES, NFS3ERR_BADHANDLE, NFS3ERR_INVAL, NFS3ERR_IO, NFS3ERR_NOTSUPP, NFS3ERR_SERVERFAULT, NFS3ERR_STALE, oncrpc_iob_get_int, nfs_readlink_reply::path, nfs_readlink_reply::path_len, and nfs_readlink_reply::status.
Referenced by nfs_deliver().
int nfs_get_read_reply | ( | struct nfs_read_reply * | read_reply, |
struct oncrpc_reply * | reply | ||
) |
Parse a READ reply.
read_reply | A structure where the data will be saved |
reply | The ONC RPC reply to get data from |
rc | Return status code |
Definition at line 241 of file nfs.c.
References nfs_read_reply::count, io_buffer::data, oncrpc_reply::data, nfs_read_reply::data, nfs_read_reply::data_len, EACCES, EINVAL, EIO, ENOENT, ENXIO, nfs_read_reply::eof, EPERM, EPROTO, ESTALE, nfs_read_reply::filesize, iob_pull, NFS3_OK, NFS3ERR_ACCES, NFS3ERR_BADHANDLE, NFS3ERR_INVAL, NFS3ERR_IO, NFS3ERR_NOENT, NFS3ERR_NXIO, NFS3ERR_PERM, NFS3ERR_SERVERFAULT, NFS3ERR_STALE, oncrpc_iob_get_int, oncrpc_iob_get_int64, and nfs_read_reply::status.
Referenced by nfs_deliver().