55#define NFS_RSIZE 100000
128 DBGC ( nfs,
"NFS_OPEN %p freed\n", nfs );
147 DBGC ( nfs,
"NFS_OPEN %p completed (%s)\n", nfs,
strerror (
rc ) );
160 if ( ! intf || ! hostname || !
port )
164 memset ( &local, 0,
sizeof ( local ) );
183 DBGC ( nfs,
"NFS_OPEN %p GETPORT call (mount)\n", nfs );
196 DBGC ( nfs,
"NFS_OPEN %p GETPORT call (nfs)\n", nfs );
227 DBGC ( nfs,
"NFS_OPEN %p got GETPORT reply (mount)\n", nfs );
245 DBGC ( nfs,
"NFS_OPEN %p got GETPORT reply (nfs)\n", nfs );
277 DBGC ( nfs,
"NFS_OPEN %p MNT call (%s)\n", nfs,
290 DBGC ( nfs,
"NFS_OPEN %p UMNT call\n", nfs );
318 DBGC ( nfs,
"NFS_OPEN %p got MNT reply\n", nfs );
321 switch ( mnt_reply.
status ) {
338 DBGC ( nfs,
"NFS_OPEN %p MNT failed retrying with " \
355 DBGC ( nfs,
"NFS_OPEN %p got UMNT reply\n", nfs );
371 char *path_component;
379 DBGC ( nfs,
"NFS_OPEN %p LOOKUP call (%s)\n", nfs,
393 DBGC ( nfs,
"NFS_OPEN %p READLINK call\n", nfs );
405 DBGC ( nfs,
"NFS_OPEN %p READ call\n", nfs );
439 DBGC ( nfs,
"NFS_OPEN %p got LOOKUP reply\n", nfs );
465 DBGC ( nfs,
"NFS_OPEN %p got READLINK reply\n", nfs );
487 DBGC ( nfs,
"NFS_OPEN %p new path: %s\n", nfs,
497 DBGC ( nfs,
"NFS_OPEN %p got READ reply\n", nfs );
506 DBGC2 ( nfs,
"NFS_OPEN %p size: %llu bytes\n",
515 nfs->
eof = read_reply.
eof;
524 DBGC ( nfs,
"NFS_OPEN %p got %zd bytes\n", nfs,
615 DBGC ( nfs,
"NFS_OPEN %p URI parsed: (mountpoint=%s, path=%s)\n",
636 nfs =
zalloc (
sizeof ( *nfs ) );
658 DBGC ( nfs,
"NFS_OPEN %p connecting to port mapper (%s:%d)...\n", nfs,
struct arbelprm_rc_send_wqe rc
unsigned long long uint64_t
struct bofm_section_header done
uint8_t meta
Metadata flags.
#define __unused
Declare a variable or data structure as unused.
#define DHCP_EB_FEATURE_NFS
NFS protocol.
#define FEATURE_PROTOCOL
Network protocols.
#define EINVAL
Invalid argument.
#define EPROTO
Protocol error.
#define ENOMEM
Not enough space.
#define ECONNRESET
Connection reset.
#define FILE_SECBOOT(_status)
Declare a file's UEFI Secure Boot permission status.
Transport-network layer interface.
@ TCPIP_BIND_PRIVILEGED
Bind to a privileged port (less than 1024)
void * memset(void *dest, int character, size_t len) __nonnull
void intf_close(struct interface *intf, int rc)
Close an object interface.
void intf_plug_plug(struct interface *a, struct interface *b)
Plug two object interfaces together.
void intf_shutdown(struct interface *intf, int rc)
Shut down an object interface.
#define INTF_DESC(object_type, intf, operations)
Define an object interface descriptor.
#define INTF_DESC_PASSTHRU(object_type, intf, operations, passthru)
Define an object interface descriptor with pass-through interface.
static void intf_init(struct interface *intf, struct interface_descriptor *desc, struct refcnt *refcnt)
Initialise an object interface.
#define INTF_OP(op_type, object_type, op_func)
Define an object interface operation.
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
#define iob_disown(iobuf)
Disown an I/O buffer.
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
#define iob_unput(iobuf, len)
#define FEATURE(category, text, feature_opt, version)
Declare a feature.
void * zalloc(size_t size)
Allocate cleared memory.
int mount_umnt(struct interface *intf, struct oncrpc_session *session, const char *mountpoint)
Send a UMNT request.
int mount_mnt(struct interface *intf, struct oncrpc_session *session, const char *mountpoint)
Send a MNT request.
int mount_get_mnt_reply(struct mount_mnt_reply *mnt_reply, struct oncrpc_reply *reply)
Parse an MNT reply.
#define MOUNT_VERS
NFS MOUNT protocol version.
#define MNT3ERR_NOENT
No such file or directory.
static void mount_init_session(struct oncrpc_session *session, struct oncrpc_cred *credential)
Prepare an ONC RPC session to be used as a MOUNT session.
#define MNT3ERR_NOTDIR
Not a directory.
#define MNT3ERR_ACCES
Permission denied.
#define ONCRPC_MOUNT
NFS MOUNT protocol number.
struct mschapv2_challenge peer
Peer challenge.
int nfs_get_read_reply(struct nfs_read_reply *read_reply, struct oncrpc_reply *reply)
Parse a READ reply.
int nfs_get_lookup_reply(struct nfs_lookup_reply *lookup_reply, struct oncrpc_reply *reply)
Parse a LOOKUP reply.
int nfs_readlink(struct interface *intf, struct oncrpc_session *session, const struct nfs_fh *fh)
Send a READLINK request.
#define NFS_READ
NFS READ procedure.
#define NFS_READLINK
NFS READLINK procedure.
int nfs_lookup(struct interface *intf, struct oncrpc_session *session, const struct nfs_fh *fh, const char *filename)
Send a LOOKUP request.
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.
int nfs_get_readlink_reply(struct nfs_readlink_reply *readlink_reply, struct oncrpc_reply *reply)
Parse a READLINK reply.
#define NFS_LOOKUP
NFS LOOKUP procedure.
Network File System protocol.
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.
#define ONCRPC_NFS
NFS protocol number.
#define NFS_VERS
NFS protocol version.
static struct interface_operation nfs_pm_operations[]
static struct interface_descriptor nfs_desc
static int nfs_open(struct interface *xfer, struct uri *uri)
Initiate a NFS connection.
static struct interface_descriptor nfs_pm_desc
static void nfs_step(struct nfs_request *nfs)
static void nfs_free(struct refcnt *refcnt)
Free NFS request.
static int nfs_parse_uri(struct nfs_request *nfs, const struct uri *uri)
static int nfs_connect(struct interface *intf, uint16_t port, const char *hostname)
static void nfs_mount_step(struct nfs_request *nfs)
static struct interface_operation nfs_operations[]
static int nfs_mount_deliver(struct nfs_request *nfs, struct io_buffer *io_buf, struct xfer_metadata *meta __unused)
static struct interface_operation nfs_xfer_operations[]
static struct interface_operation nfs_mount_operations[]
static int nfs_pm_deliver(struct nfs_request *nfs, struct io_buffer *io_buf, struct xfer_metadata *meta __unused)
static struct interface_descriptor nfs_mount_desc
static struct interface_descriptor nfs_xfer_desc
NFS data transfer interface descriptor.
static void nfs_pm_step(struct nfs_request *nfs)
static void nfs_done(struct nfs_request *nfs, int rc)
Mark NFS operation as complete.
static int nfs_deliver(struct nfs_request *nfs, struct io_buffer *io_buf, struct xfer_metadata *meta __unused)
Network File System protocol.
int nfs_uri_next_mountpoint(struct nfs_uri *uri)
char * nfs_uri_next_path_component(struct nfs_uri *uri)
void nfs_uri_free(struct nfs_uri *uri)
char * nfs_uri_mountpoint(const struct nfs_uri *uri)
int nfs_uri_symlink(struct nfs_uri *uri, const char *symlink)
int nfs_uri_init(struct nfs_uri *nfs_uri, const struct uri *uri)
Network File System protocol URI handling functions.
int oncrpc_get_reply(struct oncrpc_session *session __unused, struct oncrpc_reply *reply, struct io_buffer *io_buf)
Parse an I/O buffer to extract a ONC RPC REPLY.
int oncrpc_init_cred_sys(struct oncrpc_cred_sys *auth_sys)
Initialize an ONC RPC AUTH SYS credential structure.
Data transfer interface opening.
#define __uri_opener
Register a URI opener.
int portmap_getport(struct interface *intf, struct oncrpc_session *session, uint32_t prog, uint32_t vers, uint32_t proto)
Send a GETPORT request.
int portmap_get_getport_reply(struct portmap_getport_reply *getport_reply, struct oncrpc_reply *reply)
Parse a GETPORT reply.
static void portmap_init_session(struct oncrpc_session *session, struct oncrpc_cred *credential)
Prepare an ONC RPC session to be used as a PORTMAP session.
#define PORTMAP_PORT
PORTMAP default port.
#define PORTMAP_PROTO_TCP
TCP protocol number.
static void(* free)(struct refcnt *refcnt))
#define ref_put(refcnt)
Drop reference to object.
#define ref_init(refcnt, free)
Initialise a reference counter.
int xfer_open_named_socket(struct interface *xfer, int semantics, struct sockaddr *peer, const char *name, struct sockaddr *local)
Open named socket.
#define container_of(ptr, type, field)
Get containing structure.
char * strerror(int errno)
Retrieve string representation of error number.
int strcmp(const char *first, const char *second)
Compare strings.
char * strdup(const char *src)
Duplicate string.
char * strndup(const char *src, size_t max)
Duplicate string.
An object interface descriptor.
An object interface operation.
uint32_t status
Reply status.
struct nfs_fh fh
Root file handle.
enum nfs_attr_type ent_type
Entity type.
struct nfs_fh fh
File handle.
uint32_t count
Bytes read.
uint32_t eof
End-of-File indicator.
uint64_t filesize
File size.
uint32_t path_len
File path length.
struct oncrpc_session pm_session
struct interface nfs_intf
enum nfs_mount_state mount_state
enum nfs_pm_state pm_state
struct interface xfer
Data transfer interface.
struct oncrpc_session nfs_session
struct refcnt refcnt
Reference counter.
struct oncrpc_cred_sys auth_sys
struct nfs_fh readlink_fh
struct oncrpc_session mount_session
struct interface mount_intf
struct oncrpc_cred credential
uint32_t port
Port returned.
Generalized socket address structure.
A Uniform Resource Identifier.
const char * path
Path (after URI decoding)
const char * host
Host name.
Uniform Resource Identifiers.
size_t xfer_window(struct interface *intf)
Check flow control window.
int xfer_deliver(struct interface *intf, struct io_buffer *iobuf, struct xfer_metadata *meta)
Deliver datagram.
void xfer_window_changed(struct interface *intf)
Report change of flow control window.
int xfer_seek(struct interface *intf, off_t offset)
Seek to position.
int xfer_deliver_iob(struct interface *intf, struct io_buffer *iobuf)
Deliver datagram as I/O buffer without metadata.
Data transfer interfaces.