iPXE
|
Network File System protocol. More...
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <errno.h>
#include <libgen.h>
#include <byteswap.h>
#include <ipxe/time.h>
#include <ipxe/iobuf.h>
#include <ipxe/open.h>
#include <ipxe/features.h>
#include <ipxe/nfs.h>
#include <ipxe/oncrpc.h>
#include <ipxe/oncrpc_iob.h>
#include <ipxe/portmap.h>
#include <ipxe/mount.h>
#include <ipxe/settings.h>
Go to the source code of this file.
Macros | |
#define | NFS_LOOKUP 3 |
NFS LOOKUP procedure. More... | |
#define | NFS_READLINK 5 |
NFS READLINK procedure. More... | |
#define | NFS_READ 6 |
NFS READ procedure. More... | |
Functions | |
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... | |
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.c.
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.
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().