iPXE
Data Structures | Macros | Enumerations | Functions | Variables
nfs_open.c File Reference

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/socket.h>
#include <ipxe/tcpip.h>
#include <ipxe/in.h>
#include <ipxe/iobuf.h>
#include <ipxe/xfer.h>
#include <ipxe/open.h>
#include <ipxe/uri.h>
#include <ipxe/features.h>
#include <ipxe/nfs.h>
#include <ipxe/nfs_open.h>
#include <ipxe/oncrpc.h>
#include <ipxe/oncrpc_iob.h>
#include <ipxe/portmap.h>
#include <ipxe/mount.h>
#include <ipxe/nfs_uri.h>

Go to the source code of this file.

Data Structures

struct  nfs_request
 A NFS request. More...
 

Macros

#define NFS_RSIZE   100000
 

Enumerations

enum  nfs_pm_state { NFS_PORTMAP_NONE = 0, NFS_PORTMAP_MOUNTPORT, NFS_PORTMAP_NFSPORT, MFS_PORTMAP_CLOSED }
 
enum  nfs_mount_state { NFS_MOUNT_NONE = 0, NFS_MOUNT_MNT, NFS_MOUNT_UMNT, NFS_MOUNT_CLOSED }
 
enum  nfs_state {
  NFS_NONE = 0, NFS_LOOKUP, NFS_LOOKUP_SENT, NFS_READLINK,
  NFS_READLINK_SENT, NFS_READ, NFS_READ_SENT, NFS_CLOSED
}
 

Functions

 FEATURE (FEATURE_PROTOCOL, "NFS", DHCP_EB_FEATURE_NFS, 1)
 
static void nfs_step (struct nfs_request *nfs)
 
static void nfs_free (struct refcnt *refcnt)
 Free NFS request. More...
 
static void nfs_done (struct nfs_request *nfs, int rc)
 Mark NFS operation as complete. More...
 
static int nfs_connect (struct interface *intf, uint16_t port, const char *hostname)
 
static void nfs_pm_step (struct nfs_request *nfs)
 
static int nfs_pm_deliver (struct nfs_request *nfs, struct io_buffer *io_buf, struct xfer_metadata *meta __unused)
 
static void nfs_mount_step (struct nfs_request *nfs)
 
static int nfs_mount_deliver (struct nfs_request *nfs, struct io_buffer *io_buf, struct xfer_metadata *meta __unused)
 
static int nfs_deliver (struct nfs_request *nfs, struct io_buffer *io_buf, struct xfer_metadata *meta __unused)
 
static int nfs_parse_uri (struct nfs_request *nfs, const struct uri *uri)
 
static int nfs_open (struct interface *xfer, struct uri *uri)
 Initiate a NFS connection. More...
 

Variables

static struct interface_operation nfs_xfer_operations []
 
static struct interface_descriptor nfs_xfer_desc
 NFS data transfer interface descriptor. More...
 
static struct interface_operation nfs_pm_operations []
 
static struct interface_descriptor nfs_pm_desc
 
static struct interface_operation nfs_mount_operations []
 
static struct interface_descriptor nfs_mount_desc
 
static struct interface_operation nfs_operations []
 
static struct interface_descriptor nfs_desc
 
struct uri_opener nfs_uri_opener __uri_opener
 NFS URI opener. More...
 

Detailed Description

Network File System protocol.

Definition in file nfs_open.c.

Macro Definition Documentation

◆ NFS_RSIZE

#define NFS_RSIZE   100000

Definition at line 53 of file nfs_open.c.

Enumeration Type Documentation

◆ nfs_pm_state

Enumerator
NFS_PORTMAP_NONE 
NFS_PORTMAP_MOUNTPORT 
NFS_PORTMAP_NFSPORT 
MFS_PORTMAP_CLOSED 

Definition at line 55 of file nfs_open.c.

◆ nfs_mount_state

Enumerator
NFS_MOUNT_NONE 
NFS_MOUNT_MNT 
NFS_MOUNT_UMNT 
NFS_MOUNT_CLOSED 

Definition at line 62 of file nfs_open.c.

◆ nfs_state

enum nfs_state
Enumerator
NFS_NONE 
NFS_LOOKUP 
NFS_LOOKUP_SENT 
NFS_READLINK 
NFS_READLINK_SENT 
NFS_READ 
NFS_READ_SENT 
NFS_CLOSED 

Definition at line 69 of file nfs_open.c.

Function Documentation

◆ FEATURE()

FEATURE ( FEATURE_PROTOCOL  ,
"NFS"  ,
DHCP_EB_FEATURE_NFS  ,
 
)

◆ nfs_step()

static void nfs_step ( struct nfs_request nfs)
static

Definition at line 367 of file nfs_open.c.

367  {
368  int rc;
369  char *path_component;
370 
371  if ( ! xfer_window ( &nfs->nfs_intf ) )
372  return;
373 
374  if ( nfs->nfs_state == NFS_LOOKUP ) {
375  path_component = nfs_uri_next_path_component ( &nfs->uri );
376 
377  DBGC ( nfs, "NFS_OPEN %p LOOKUP call (%s)\n", nfs,
378  path_component );
379 
380  rc = nfs_lookup ( &nfs->nfs_intf, &nfs->nfs_session,
381  &nfs->current_fh, path_component );
382  if ( rc != 0 )
383  goto err;
384 
385  nfs->nfs_state++;
386  return;
387  }
388 
389 
390  if ( nfs->nfs_state == NFS_READLINK ) {
391  DBGC ( nfs, "NFS_OPEN %p READLINK call\n", nfs );
392 
393  rc = nfs_readlink ( &nfs->nfs_intf, &nfs->nfs_session,
394  &nfs->readlink_fh );
395  if ( rc != 0 )
396  goto err;
397 
398  nfs->nfs_state++;
399  return;
400  }
401 
402  if ( nfs->nfs_state == NFS_READ ) {
403  DBGC ( nfs, "NFS_OPEN %p READ call\n", nfs );
404 
405  rc = nfs_read ( &nfs->nfs_intf, &nfs->nfs_session,
406  &nfs->current_fh, nfs->file_offset,
407  NFS_RSIZE );
408  if ( rc != 0 )
409  goto err;
410 
411  nfs->nfs_state++;
412  return;
413  }
414 
415  return;
416 err:
417  nfs_done ( nfs, rc );
418 }
struct interface nfs_intf
Definition: nfs_open.c:92
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
static void nfs_done(struct nfs_request *nfs, int rc)
Mark NFS operation as complete.
Definition: nfs_open.c:141
struct nfs_uri uri
Definition: nfs_open.c:105
#define DBGC(...)
Definition: compiler.h:505
size_t xfer_window(struct interface *intf)
Check flow control window.
Definition: xfer.c:116
uint64_t file_offset
Definition: nfs_open.c:109
int nfs_lookup(struct interface *intf, struct oncrpc_session *session, const struct nfs_fh *fh, const char *filename)
Send a LOOKUP request.
Definition: nfs.c:96
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.
Definition: nfs.c:135
struct nfs_fh readlink_fh
Definition: nfs_open.c:107
enum nfs_state nfs_state
Definition: nfs_open.c:96
struct nfs_fh current_fh
Definition: nfs_open.c:108
int nfs_readlink(struct interface *intf, struct oncrpc_session *session, const struct nfs_fh *fh)
Send a READLINK request.
Definition: nfs.c:115
struct oncrpc_session nfs_session
Definition: nfs_open.c:100
char * nfs_uri_next_path_component(struct nfs_uri *uri)
Definition: nfs_uri.c:121
#define NFS_RSIZE
Definition: nfs_open.c:53

References nfs_request::current_fh, DBGC, nfs_request::file_offset, nfs_done(), nfs_request::nfs_intf, NFS_LOOKUP, nfs_lookup(), NFS_READ, nfs_read(), NFS_READLINK, nfs_readlink(), NFS_RSIZE, nfs_request::nfs_session, nfs_request::nfs_state, nfs_uri_next_path_component(), rc, nfs_request::readlink_fh, nfs_request::uri, and xfer_window().

Referenced by nfs_deliver(), and nfs_mount_deliver().

◆ nfs_free()

static void nfs_free ( struct refcnt refcnt)
static

Free NFS request.

Parameters
refcntReference counter

Definition at line 122 of file nfs_open.c.

122  {
123  struct nfs_request *nfs;
124 
125  nfs = container_of ( refcnt, struct nfs_request, refcnt );
126  DBGC ( nfs, "NFS_OPEN %p freed\n", nfs );
127 
128  nfs_uri_free ( &nfs->uri );
129 
130  free ( nfs->hostname );
131  free ( nfs->auth_sys.hostname );
132  free ( nfs );
133 }
void nfs_uri_free(struct nfs_uri *uri)
Definition: nfs_uri.c:143
struct nfs_uri uri
Definition: nfs_open.c:105
#define DBGC(...)
Definition: compiler.h:505
A NFS request.
Definition: nfs_open.c:84
struct oncrpc_cred_sys auth_sys
Definition: nfs_open.c:102
A reference counter.
Definition: refcnt.h:26
#define container_of(ptr, type, field)
Get containing structure.
Definition: stddef.h:35
static void(* free)(struct refcnt *refcnt))
Definition: refcnt.h:54
char * hostname
Definition: oncrpc.h:54
char * hostname
Definition: nfs_open.c:104

References nfs_request::auth_sys, container_of, DBGC, free, oncrpc_cred_sys::hostname, nfs_request::hostname, nfs_uri_free(), and nfs_request::uri.

Referenced by nfs_open().

◆ nfs_done()

static void nfs_done ( struct nfs_request nfs,
int  rc 
)
static

Mark NFS operation as complete.

Parameters
nfsNFS request
rcReturn status code

Definition at line 141 of file nfs_open.c.

141  {
142  if ( rc == 0 && nfs->nfs_state != NFS_CLOSED )
143  rc = -ECONNRESET;
144 
145  DBGC ( nfs, "NFS_OPEN %p completed (%s)\n", nfs, strerror ( rc ) );
146 
147  intf_shutdown ( &nfs->xfer, rc );
148  intf_shutdown ( &nfs->pm_intf, rc );
149  intf_shutdown ( &nfs->mount_intf, rc );
150  intf_shutdown ( &nfs->nfs_intf, rc );
151 }
struct interface nfs_intf
Definition: nfs_open.c:92
#define ECONNRESET
Connection reset.
Definition: errno.h:363
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
void intf_shutdown(struct interface *intf, int rc)
Shut down an object interface.
Definition: interface.c:278
struct interface xfer
Data transfer interface.
Definition: nfs_open.c:88
#define DBGC(...)
Definition: compiler.h:505
enum nfs_state nfs_state
Definition: nfs_open.c:96
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
struct interface mount_intf
Definition: nfs_open.c:91
struct interface pm_intf
Definition: nfs_open.c:90

References DBGC, ECONNRESET, intf_shutdown(), nfs_request::mount_intf, NFS_CLOSED, nfs_request::nfs_intf, nfs_request::nfs_state, nfs_request::pm_intf, rc, strerror(), and nfs_request::xfer.

Referenced by nfs_deliver(), nfs_mount_deliver(), nfs_mount_step(), nfs_pm_deliver(), nfs_pm_step(), and nfs_step().

◆ nfs_connect()

static int nfs_connect ( struct interface intf,
uint16_t  port,
const char *  hostname 
)
static

Definition at line 153 of file nfs_open.c.

154  {
155  struct sockaddr_tcpip peer;
156  struct sockaddr_tcpip local;
157 
158  if ( ! intf || ! hostname || ! port )
159  return -EINVAL;
160 
161  memset ( &peer, 0, sizeof ( peer ) );
162  memset ( &local, 0, sizeof ( local ) );
163  peer.st_port = htons ( port );
164 
165  /* Use a local port < 1024 to avoid using the 'insecure' option in
166  * /etc/exports file. */
167  local.st_flags = TCPIP_BIND_PRIVILEGED;
168 
169  return xfer_open_named_socket ( intf, SOCK_STREAM,
170  ( struct sockaddr * ) &peer, hostname,
171  ( struct sockaddr * ) &local );
172 }
#define EINVAL
Invalid argument.
Definition: errno.h:428
TCP/IP socket address.
Definition: tcpip.h:75
Bind to a privileged port (less than 1024)
Definition: tcpip.h:66
u8 port
Port number.
Definition: CIB_PRM.h:31
Generalized socket address structure.
Definition: socket.h:96
#define SOCK_STREAM
Definition: socket.h:24
struct mschapv2_challenge peer
Peer challenge.
Definition: mschapv2.h:12
#define htons(value)
Definition: byteswap.h:135
int xfer_open_named_socket(struct interface *xfer, int semantics, struct sockaddr *peer, const char *name, struct sockaddr *local)
Open named socket.
Definition: resolv.c:402
void * memset(void *dest, int character, size_t len) __nonnull

References EINVAL, htons, memset(), peer, port, SOCK_STREAM, sockaddr_tcpip::st_flags, TCPIP_BIND_PRIVILEGED, and xfer_open_named_socket().

Referenced by nfs_open(), and nfs_pm_deliver().

◆ nfs_pm_step()

static void nfs_pm_step ( struct nfs_request nfs)
static

Definition at line 174 of file nfs_open.c.

174  {
175  int rc;
176 
177  if ( ! xfer_window ( &nfs->pm_intf ) )
178  return;
179 
180  if ( nfs->pm_state == NFS_PORTMAP_NONE ) {
181  DBGC ( nfs, "NFS_OPEN %p GETPORT call (mount)\n", nfs );
182 
183  rc = portmap_getport ( &nfs->pm_intf, &nfs->pm_session,
186  if ( rc != 0 )
187  goto err;
188 
189  nfs->pm_state++;
190  return;
191  }
192 
193  if ( nfs->pm_state == NFS_PORTMAP_NFSPORT ) {
194  DBGC ( nfs, "NFS_OPEN %p GETPORT call (nfs)\n", nfs );
195 
196  rc = portmap_getport ( &nfs->pm_intf, &nfs->pm_session,
199  if ( rc != 0 )
200  goto err;
201 
202  return;
203  }
204 
205  return;
206 err:
207  nfs_done ( nfs, rc );
208 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
enum nfs_pm_state pm_state
Definition: nfs_open.c:94
static void nfs_done(struct nfs_request *nfs, int rc)
Mark NFS operation as complete.
Definition: nfs_open.c:141
#define ONCRPC_NFS
NFS protocol number.
Definition: nfs.h:16
#define DBGC(...)
Definition: compiler.h:505
#define NFS_VERS
NFS protocol version.
Definition: nfs.h:19
#define ONCRPC_MOUNT
NFS MOUNT protocol number.
Definition: mount.h:15
#define PORTMAP_PROTO_TCP
TCP protocol number.
Definition: portmap.h:26
size_t xfer_window(struct interface *intf)
Check flow control window.
Definition: xfer.c:116
#define MOUNT_VERS
NFS MOUNT protocol version.
Definition: mount.h:17
struct oncrpc_session pm_session
Definition: nfs_open.c:98
int portmap_getport(struct interface *intf, struct oncrpc_session *session, uint32_t prog, uint32_t vers, uint32_t proto)
Send a GETPORT request.
Definition: portmap.c:59
struct interface pm_intf
Definition: nfs_open.c:90

References DBGC, MOUNT_VERS, nfs_done(), NFS_PORTMAP_NFSPORT, NFS_PORTMAP_NONE, NFS_VERS, ONCRPC_MOUNT, ONCRPC_NFS, nfs_request::pm_intf, nfs_request::pm_session, nfs_request::pm_state, portmap_getport(), PORTMAP_PROTO_TCP, rc, and xfer_window().

Referenced by nfs_pm_deliver().

◆ nfs_pm_deliver()

static int nfs_pm_deliver ( struct nfs_request nfs,
struct io_buffer io_buf,
struct xfer_metadata *meta  __unused 
)
static

Definition at line 210 of file nfs_open.c.

212  {
213  int rc;
214  struct oncrpc_reply reply;
215  struct portmap_getport_reply getport_reply;
216 
217  oncrpc_get_reply ( &nfs->pm_session, &reply, io_buf );
218  if ( reply.accept_state != 0 )
219  {
220  rc = -EPROTO;
221  goto err;
222  }
223 
224  if ( nfs->pm_state == NFS_PORTMAP_MOUNTPORT ) {
225  DBGC ( nfs, "NFS_OPEN %p got GETPORT reply (mount)\n", nfs );
226 
227  rc = portmap_get_getport_reply ( &getport_reply, &reply );
228  if ( rc != 0 )
229  goto err;
230 
231  rc = nfs_connect ( &nfs->mount_intf, getport_reply.port,
232  nfs->hostname );
233  if ( rc != 0 )
234  goto err;
235 
236  nfs->pm_state++;
237  nfs_pm_step ( nfs );
238 
239  goto done;
240  }
241 
242  if ( nfs->pm_state == NFS_PORTMAP_NFSPORT ) {
243  DBGC ( nfs, "NFS_OPEN %p got GETPORT reply (nfs)\n", nfs );
244 
245  rc = portmap_get_getport_reply ( &getport_reply, &reply );
246  if ( rc != 0 )
247  goto err;
248 
249  rc = nfs_connect ( &nfs->nfs_intf, getport_reply.port,
250  nfs->hostname );
251  if ( rc != 0 )
252  goto err;
253 
254  intf_shutdown ( &nfs->pm_intf, 0 );
255  nfs->pm_state++;
256 
257  goto done;
258  }
259 
260  rc = -EPROTO;
261 err:
262  nfs_done ( nfs, rc );
263 done:
264  free_iob ( io_buf );
265  return 0;
266 }
struct interface nfs_intf
Definition: nfs_open.c:92
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
enum nfs_pm_state pm_state
Definition: nfs_open.c:94
void intf_shutdown(struct interface *intf, int rc)
Shut down an object interface.
Definition: interface.c:278
static void nfs_done(struct nfs_request *nfs, int rc)
Mark NFS operation as complete.
Definition: nfs_open.c:141
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
Definition: iobuf.c:146
#define DBGC(...)
Definition: compiler.h:505
static int nfs_connect(struct interface *intf, uint16_t port, const char *hostname)
Definition: nfs_open.c:153
int portmap_get_getport_reply(struct portmap_getport_reply *getport_reply, struct oncrpc_reply *reply)
Parse a GETPORT reply.
Definition: portmap.c:80
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.
Definition: oncrpc.c:215
#define EPROTO
Protocol error.
Definition: errno.h:624
struct interface mount_intf
Definition: nfs_open.c:91
struct oncrpc_session pm_session
Definition: nfs_open.c:98
static void nfs_pm_step(struct nfs_request *nfs)
Definition: nfs_open.c:174
char * hostname
Definition: nfs_open.c:104
struct bofm_section_header done
Definition: bofm_test.c:46
A PORTMAP GETPORT reply.
Definition: portmap.h:35
struct interface pm_intf
Definition: nfs_open.c:90

References oncrpc_reply::accept_state, DBGC, done, EPROTO, free_iob(), nfs_request::hostname, intf_shutdown(), nfs_request::mount_intf, nfs_connect(), nfs_done(), nfs_request::nfs_intf, nfs_pm_step(), NFS_PORTMAP_MOUNTPORT, NFS_PORTMAP_NFSPORT, oncrpc_get_reply(), nfs_request::pm_intf, nfs_request::pm_session, nfs_request::pm_state, portmap_getport_reply::port, portmap_get_getport_reply(), and rc.

◆ nfs_mount_step()

static void nfs_mount_step ( struct nfs_request nfs)
static

Definition at line 268 of file nfs_open.c.

268  {
269  int rc;
270 
271  if ( ! xfer_window ( &nfs->mount_intf ) )
272  return;
273 
274  if ( nfs->mount_state == NFS_MOUNT_NONE ) {
275  DBGC ( nfs, "NFS_OPEN %p MNT call (%s)\n", nfs,
276  nfs_uri_mountpoint ( &nfs->uri ) );
277 
278  rc = mount_mnt ( &nfs->mount_intf, &nfs->mount_session,
279  nfs_uri_mountpoint ( &nfs->uri ) );
280  if ( rc != 0 )
281  goto err;
282 
283  nfs->mount_state++;
284  return;
285  }
286 
287  if ( nfs->mount_state == NFS_MOUNT_UMNT ) {
288  DBGC ( nfs, "NFS_OPEN %p UMNT call\n", nfs );
289 
290  rc = mount_umnt ( &nfs->mount_intf, &nfs->mount_session,
291  nfs_uri_mountpoint ( &nfs->uri ) );
292  if ( rc != 0 )
293  goto err;
294  }
295 
296  return;
297 err:
298  nfs_done ( nfs, rc );
299 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
struct oncrpc_session mount_session
Definition: nfs_open.c:99
static void nfs_done(struct nfs_request *nfs, int rc)
Mark NFS operation as complete.
Definition: nfs_open.c:141
struct nfs_uri uri
Definition: nfs_open.c:105
#define DBGC(...)
Definition: compiler.h:505
enum nfs_mount_state mount_state
Definition: nfs_open.c:95
size_t xfer_window(struct interface *intf)
Check flow control window.
Definition: xfer.c:116
struct interface mount_intf
Definition: nfs_open.c:91
char * nfs_uri_mountpoint(const struct nfs_uri *uri)
Definition: nfs_uri.c:54
int mount_mnt(struct interface *intf, struct oncrpc_session *session, const char *mountpoint)
Send a MNT request.
Definition: mount.c:56
int mount_umnt(struct interface *intf, struct oncrpc_session *session, const char *mountpoint)
Send a UMNT request.
Definition: mount.c:74

References DBGC, nfs_request::mount_intf, mount_mnt(), nfs_request::mount_session, nfs_request::mount_state, mount_umnt(), nfs_done(), NFS_MOUNT_NONE, NFS_MOUNT_UMNT, nfs_uri_mountpoint(), rc, nfs_request::uri, and xfer_window().

Referenced by nfs_deliver(), and nfs_mount_deliver().

◆ nfs_mount_deliver()

static int nfs_mount_deliver ( struct nfs_request nfs,
struct io_buffer io_buf,
struct xfer_metadata *meta  __unused 
)
static

Definition at line 301 of file nfs_open.c.

303  {
304  int rc;
305  struct oncrpc_reply reply;
306  struct mount_mnt_reply mnt_reply;
307 
308  oncrpc_get_reply ( &nfs->mount_session, &reply, io_buf );
309  if ( reply.accept_state != 0 )
310  {
311  rc = -EPROTO;
312  goto err;
313  }
314 
315  if ( nfs->mount_state == NFS_MOUNT_MNT ) {
316  DBGC ( nfs, "NFS_OPEN %p got MNT reply\n", nfs );
317  rc = mount_get_mnt_reply ( &mnt_reply, &reply );
318  if ( rc != 0 ) {
319  switch ( mnt_reply.status ) {
320  case MNT3ERR_NOTDIR:
321  case MNT3ERR_NOENT:
322  case MNT3ERR_ACCES:
323  break;
324 
325  default:
326  goto err;
327  }
328 
329  if ( ! strcmp ( nfs_uri_mountpoint ( &nfs->uri ),
330  "/" ) )
331  goto err;
332 
333  if ( ( rc = nfs_uri_next_mountpoint ( &nfs->uri ) ) )
334  goto err;
335 
336  DBGC ( nfs, "NFS_OPEN %p MNT failed retrying with " \
337  "%s\n", nfs, nfs_uri_mountpoint ( &nfs->uri ) );
338 
339  nfs->mount_state--;
340  nfs_mount_step ( nfs );
341 
342  goto done;
343  }
344 
345  nfs->current_fh = mnt_reply.fh;
346  nfs->nfs_state = NFS_LOOKUP;
347  nfs_step ( nfs );
348 
349  goto done;
350  }
351 
352  if ( nfs->mount_state == NFS_MOUNT_UMNT ) {
353  DBGC ( nfs, "NFS_OPEN %p got UMNT reply\n", nfs );
354  nfs_done ( nfs, 0 );
355 
356  goto done;
357  }
358 
359  rc = -EPROTO;
360 err:
361  nfs_done ( nfs, rc );
362 done:
363  free_iob ( io_buf );
364  return 0;
365 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
int mount_get_mnt_reply(struct mount_mnt_reply *mnt_reply, struct oncrpc_reply *reply)
Parse an MNT reply.
Definition: mount.c:91
struct oncrpc_session mount_session
Definition: nfs_open.c:99
static void nfs_done(struct nfs_request *nfs, int rc)
Mark NFS operation as complete.
Definition: nfs_open.c:141
uint8_t fh[64]
Definition: nfs.h:75
struct nfs_uri uri
Definition: nfs_open.c:105
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
Definition: iobuf.c:146
#define DBGC(...)
Definition: compiler.h:505
enum nfs_mount_state mount_state
Definition: nfs_open.c:95
enum nfs_state nfs_state
Definition: nfs_open.c:96
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.
Definition: oncrpc.c:215
#define EPROTO
Protocol error.
Definition: errno.h:624
#define MNT3ERR_NOENT
No such file or directory.
Definition: mount.h:25
char * nfs_uri_mountpoint(const struct nfs_uri *uri)
Definition: nfs_uri.c:54
struct nfs_fh current_fh
Definition: nfs_open.c:108
int strcmp(const char *first, const char *second)
Compare strings.
Definition: string.c:173
static void nfs_step(struct nfs_request *nfs)
Definition: nfs_open.c:367
static void nfs_mount_step(struct nfs_request *nfs)
Definition: nfs_open.c:268
int nfs_uri_next_mountpoint(struct nfs_uri *uri)
Definition: nfs_uri.c:62
A MOUNT MNT reply.
Definition: mount.h:46
struct bofm_section_header done
Definition: bofm_test.c:46
#define MNT3ERR_ACCES
Permission denied.
Definition: mount.h:29
#define MNT3ERR_NOTDIR
Not a directory.
Definition: mount.h:31

References oncrpc_reply::accept_state, nfs_request::current_fh, DBGC, done, EPROTO, mount_mnt_reply::fh, free_iob(), MNT3ERR_ACCES, MNT3ERR_NOENT, MNT3ERR_NOTDIR, mount_get_mnt_reply(), nfs_request::mount_session, nfs_request::mount_state, nfs_done(), NFS_LOOKUP, NFS_MOUNT_MNT, nfs_mount_step(), NFS_MOUNT_UMNT, nfs_request::nfs_state, nfs_step(), nfs_uri_mountpoint(), nfs_uri_next_mountpoint(), oncrpc_get_reply(), rc, mount_mnt_reply::status, strcmp(), and nfs_request::uri.

◆ nfs_deliver()

static int nfs_deliver ( struct nfs_request nfs,
struct io_buffer io_buf,
struct xfer_metadata *meta  __unused 
)
static

Definition at line 420 of file nfs_open.c.

422  {
423  int rc;
424  struct oncrpc_reply reply;
425 
426  if ( nfs->remaining == 0 ) {
427  oncrpc_get_reply ( &nfs->nfs_session, &reply, io_buf );
428  if ( reply.accept_state != 0 ) {
429  rc = -EPROTO;
430  goto err;
431  }
432  }
433 
434  if ( nfs->nfs_state == NFS_LOOKUP_SENT ) {
435  struct nfs_lookup_reply lookup_reply;
436 
437  DBGC ( nfs, "NFS_OPEN %p got LOOKUP reply\n", nfs );
438 
439  rc = nfs_get_lookup_reply ( &lookup_reply, &reply );
440  if ( rc != 0 )
441  goto err;
442 
443  if ( lookup_reply.ent_type == NFS_ATTR_SYMLINK ) {
444  nfs->readlink_fh = lookup_reply.fh;
445  nfs->nfs_state = NFS_READLINK;
446  } else {
447  nfs->current_fh = lookup_reply.fh;
448 
449  if ( nfs->uri.lookup_pos[0] == '\0' )
450  nfs->nfs_state = NFS_READ;
451  else
452  nfs->nfs_state--;
453  }
454 
455  nfs_step ( nfs );
456  goto done;
457  }
458 
459  if ( nfs->nfs_state == NFS_READLINK_SENT ) {
460  char *path;
461  struct nfs_readlink_reply readlink_reply;
462 
463  DBGC ( nfs, "NFS_OPEN %p got READLINK reply\n", nfs );
464 
465  rc = nfs_get_readlink_reply ( &readlink_reply, &reply );
466  if ( rc != 0 )
467  goto err;
468 
469  if ( readlink_reply.path_len == 0 )
470  {
471  rc = -EINVAL;
472  goto err;
473  }
474 
475  if ( ! ( path = strndup ( readlink_reply.path,
476  readlink_reply.path_len ) ) )
477  {
478  rc = -ENOMEM;
479  goto err;
480  }
481 
482  nfs_uri_symlink ( &nfs->uri, path );
483  free ( path );
484 
485  DBGC ( nfs, "NFS_OPEN %p new path: %s\n", nfs,
486  nfs->uri.path );
487 
488  nfs->nfs_state = NFS_LOOKUP;
489  nfs_step ( nfs );
490  goto done;
491  }
492 
493  if ( nfs->nfs_state == NFS_READ_SENT ) {
494  if ( nfs->remaining == 0 ) {
495  DBGC ( nfs, "NFS_OPEN %p got READ reply\n", nfs );
496 
497  struct nfs_read_reply read_reply;
498 
499  rc = nfs_get_read_reply ( &read_reply, &reply );
500  if ( rc != 0 )
501  goto err;
502 
503  if ( nfs->file_offset == 0 ) {
504  DBGC2 ( nfs, "NFS_OPEN %p size: %llu bytes\n",
505  nfs, read_reply.filesize );
506 
507  xfer_seek ( &nfs->xfer, read_reply.filesize );
508  xfer_seek ( &nfs->xfer, 0 );
509  }
510 
511  nfs->file_offset += read_reply.count;
512  nfs->remaining = read_reply.count;
513  nfs->eof = read_reply.eof;
514  }
515 
516  size_t len = iob_len ( io_buf );
517  if ( len > nfs->remaining )
518  iob_unput ( io_buf, len - nfs->remaining );
519 
520  nfs->remaining -= iob_len ( io_buf );
521 
522  DBGC ( nfs, "NFS_OPEN %p got %zd bytes\n", nfs,
523  iob_len ( io_buf ) );
524 
525  rc = xfer_deliver_iob ( &nfs->xfer, iob_disown ( io_buf ) );
526  if ( rc != 0 )
527  goto err;
528 
529  if ( nfs->remaining == 0 ) {
530  if ( ! nfs->eof ) {
531  nfs->nfs_state--;
532  nfs_step ( nfs );
533  } else {
534  intf_shutdown ( &nfs->nfs_intf, 0 );
535  nfs->nfs_state++;
536  nfs->mount_state++;
537  nfs_mount_step ( nfs );
538  }
539  }
540 
541  return 0;
542  }
543 
544  rc = -EPROTO;
545 err:
546  nfs_done ( nfs, rc );
547 done:
548  free_iob ( io_buf );
549  return 0;
550 }
struct interface nfs_intf
Definition: nfs_open.c:92
#define EINVAL
Invalid argument.
Definition: errno.h:428
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
void intf_shutdown(struct interface *intf, int rc)
Shut down an object interface.
Definition: interface.c:278
static void nfs_done(struct nfs_request *nfs, int rc)
Mark NFS operation as complete.
Definition: nfs_open.c:141
int xfer_deliver_iob(struct interface *intf, struct io_buffer *iobuf)
Deliver datagram as I/O buffer without metadata.
Definition: xfer.c:255
int nfs_get_read_reply(struct nfs_read_reply *read_reply, struct oncrpc_reply *reply)
Parse a READ reply.
Definition: nfs.c:241
uint8_t fh[64]
Definition: nfs.h:75
int nfs_get_lookup_reply(struct nfs_lookup_reply *lookup_reply, struct oncrpc_reply *reply)
Parse a LOOKUP reply.
Definition: nfs.c:154
struct interface xfer
Data transfer interface.
Definition: nfs_open.c:88
struct nfs_uri uri
Definition: nfs_open.c:105
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
Definition: iobuf.c:146
size_t remaining
Definition: nfs_open.c:111
#define DBGC(...)
Definition: compiler.h:505
enum nfs_mount_state mount_state
Definition: nfs_open.c:95
uint64_t file_offset
Definition: nfs_open.c:109
char * lookup_pos
Definition: nfs_uri.h:18
A NFS LOOKUP reply.
Definition: nfs.h:83
#define ENOMEM
Not enough space.
Definition: errno.h:534
#define iob_disown(iobuf)
Disown an I/O buffer.
Definition: iobuf.h:212
struct nfs_fh readlink_fh
Definition: nfs_open.c:107
enum nfs_state nfs_state
Definition: nfs_open.c:96
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.
Definition: oncrpc.c:215
#define EPROTO
Protocol error.
Definition: errno.h:624
int xfer_seek(struct interface *intf, off_t offset)
Seek to position.
Definition: xfer.c:351
#define iob_unput(iobuf, len)
Definition: iobuf.h:135
static void(* free)(struct refcnt *refcnt))
Definition: refcnt.h:54
A NFS READ reply.
Definition: nfs.h:110
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
Definition: iobuf.h:155
struct nfs_fh current_fh
Definition: nfs_open.c:108
uint32_t len
Length.
Definition: ena.h:14
#define DBGC2(...)
Definition: compiler.h:522
struct oncrpc_session nfs_session
Definition: nfs_open.c:100
char * strndup(const char *src, size_t max)
Duplicate string.
Definition: string.c:392
static void nfs_step(struct nfs_request *nfs)
Definition: nfs_open.c:367
static void nfs_mount_step(struct nfs_request *nfs)
Definition: nfs_open.c:268
int nfs_get_readlink_reply(struct nfs_readlink_reply *readlink_reply, struct oncrpc_reply *reply)
Parse a READLINK reply.
Definition: nfs.c:198
int nfs_uri_symlink(struct nfs_uri *uri, const char *symlink)
Definition: nfs_uri.c:84
struct bofm_section_header done
Definition: bofm_test.c:46
char * path
Definition: nfs_uri.h:17

References oncrpc_reply::accept_state, nfs_read_reply::count, nfs_request::current_fh, DBGC, DBGC2, done, EINVAL, ENOMEM, nfs_lookup_reply::ent_type, nfs_request::eof, nfs_read_reply::eof, EPROTO, nfs_lookup_reply::fh, nfs_request::file_offset, nfs_read_reply::filesize, free, free_iob(), intf_shutdown(), iob_disown, iob_len(), iob_unput, len, nfs_uri::lookup_pos, nfs_request::mount_state, NFS_ATTR_SYMLINK, nfs_done(), nfs_get_lookup_reply(), nfs_get_read_reply(), nfs_get_readlink_reply(), nfs_request::nfs_intf, NFS_LOOKUP, NFS_LOOKUP_SENT, nfs_mount_step(), NFS_READ, NFS_READ_SENT, NFS_READLINK, NFS_READLINK_SENT, nfs_request::nfs_session, nfs_request::nfs_state, nfs_step(), nfs_uri_symlink(), oncrpc_get_reply(), nfs_uri::path, nfs_readlink_reply::path, nfs_readlink_reply::path_len, rc, nfs_request::readlink_fh, nfs_request::remaining, strndup(), nfs_request::uri, nfs_request::xfer, xfer_deliver_iob(), and xfer_seek().

◆ nfs_parse_uri()

static int nfs_parse_uri ( struct nfs_request nfs,
const struct uri uri 
)
static

Definition at line 599 of file nfs_open.c.

599  {
600  int rc;
601 
602  if ( ! uri || ! uri->host || ! uri->path )
603  return -EINVAL;
604 
605  if ( ( rc = nfs_uri_init ( &nfs->uri, uri ) ) != 0 )
606  return rc;
607 
608  if ( ! ( nfs->hostname = strdup ( uri->host ) ) ) {
609  rc = -ENOMEM;
610  goto err_hostname;
611  }
612 
613  DBGC ( nfs, "NFS_OPEN %p URI parsed: (mountpoint=%s, path=%s)\n",
614  nfs, nfs_uri_mountpoint ( &nfs->uri), nfs->uri.path );
615 
616  return 0;
617 
618 err_hostname:
619  nfs_uri_free ( &nfs->uri );
620  return rc;
621 }
void nfs_uri_free(struct nfs_uri *uri)
Definition: nfs_uri.c:143
#define EINVAL
Invalid argument.
Definition: errno.h:428
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
struct nfs_uri uri
Definition: nfs_open.c:105
#define DBGC(...)
Definition: compiler.h:505
#define ENOMEM
Not enough space.
Definition: errno.h:534
const char * path
Path (after URI decoding)
Definition: uri.h:80
int nfs_uri_init(struct nfs_uri *nfs_uri, const struct uri *uri)
Definition: nfs_uri.c:32
char * strdup(const char *src)
Duplicate string.
Definition: string.c:380
char * nfs_uri_mountpoint(const struct nfs_uri *uri)
Definition: nfs_uri.c:54
const char * host
Host name.
Definition: uri.h:76
char * hostname
Definition: nfs_open.c:104
A Uniform Resource Identifier.
Definition: uri.h:64
char * path
Definition: nfs_uri.h:17

References DBGC, EINVAL, ENOMEM, uri::host, nfs_request::hostname, nfs_uri_free(), nfs_uri_init(), nfs_uri_mountpoint(), nfs_uri::path, uri::path, rc, strdup(), and nfs_request::uri.

Referenced by nfs_open().

◆ nfs_open()

static int nfs_open ( struct interface xfer,
struct uri uri 
)
static

Initiate a NFS connection.

Parameters
xferData transfer interface
uriUniform Resource Identifier
Return values
rcReturn status code

Definition at line 630 of file nfs_open.c.

630  {
631  int rc;
632  struct nfs_request *nfs;
633 
634  nfs = zalloc ( sizeof ( *nfs ) );
635  if ( ! nfs )
636  return -ENOMEM;
637 
638  rc = nfs_parse_uri( nfs, uri );
639  if ( rc != 0 )
640  goto err_uri;
641 
642  rc = oncrpc_init_cred_sys ( &nfs->auth_sys );
643  if ( rc != 0 )
644  goto err_cred;
645 
646  ref_init ( &nfs->refcnt, nfs_free );
647  intf_init ( &nfs->xfer, &nfs_xfer_desc, &nfs->refcnt );
648  intf_init ( &nfs->pm_intf, &nfs_pm_desc, &nfs->refcnt );
649  intf_init ( &nfs->mount_intf, &nfs_mount_desc, &nfs->refcnt );
650  intf_init ( &nfs->nfs_intf, &nfs_desc, &nfs->refcnt );
651 
655 
656  DBGC ( nfs, "NFS_OPEN %p connecting to port mapper (%s:%d)...\n", nfs,
657  nfs->hostname, PORTMAP_PORT );
658 
659  rc = nfs_connect ( &nfs->pm_intf, PORTMAP_PORT, nfs->hostname );
660  if ( rc != 0 )
661  goto err_connect;
662 
663  /* Attach to parent interface, mortalise self, and return */
664  intf_plug_plug ( &nfs->xfer, xfer );
665  ref_put ( &nfs->refcnt );
666 
667  return 0;
668 
669 err_connect:
670  free ( nfs->auth_sys.hostname );
671 err_cred:
672  nfs_uri_free ( &nfs->uri );
673  free ( nfs->hostname );
674 err_uri:
675  free ( nfs );
676  return rc;
677 }
void nfs_uri_free(struct nfs_uri *uri)
Definition: nfs_uri.c:143
struct interface nfs_intf
Definition: nfs_open.c:92
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
struct oncrpc_session mount_session
Definition: nfs_open.c:99
#define ref_init(refcnt, free)
Initialise a reference counter.
Definition: refcnt.h:64
struct interface xfer
Data transfer interface.
Definition: nfs_open.c:88
struct nfs_uri uri
Definition: nfs_open.c:105
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.
Definition: nfs.h:137
static void nfs_free(struct refcnt *refcnt)
Free NFS request.
Definition: nfs_open.c:122
#define DBGC(...)
Definition: compiler.h:505
A NFS request.
Definition: nfs_open.c:84
void intf_plug_plug(struct interface *a, struct interface *b)
Plug two object interfaces together.
Definition: interface.c:107
static struct interface_descriptor nfs_xfer_desc
NFS data transfer interface descriptor.
Definition: nfs_open.c:562
static int nfs_connect(struct interface *intf, uint16_t port, const char *hostname)
Definition: nfs_open.c:153
struct oncrpc_cred_sys auth_sys
Definition: nfs_open.c:102
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.
Definition: portmap.h:50
static struct interface_descriptor nfs_desc
Definition: nfs_open.c:589
#define ENOMEM
Not enough space.
Definition: errno.h:534
int oncrpc_init_cred_sys(struct oncrpc_cred_sys *auth_sys)
Initialize an ONC RPC AUTH SYS credential structure.
Definition: oncrpc.c:84
static struct interface_descriptor nfs_pm_desc
Definition: nfs_open.c:571
static void(* free)(struct refcnt *refcnt))
Definition: refcnt.h:54
void * zalloc(size_t size)
Allocate cleared memory.
Definition: malloc.c:624
#define PORTMAP_PORT
PORTMAP default port.
Definition: portmap.h:16
struct interface mount_intf
Definition: nfs_open.c:91
char * hostname
Definition: oncrpc.h:54
struct oncrpc_session pm_session
Definition: nfs_open.c:98
static int nfs_parse_uri(struct nfs_request *nfs, const struct uri *uri)
Definition: nfs_open.c:599
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.
Definition: mount.h:62
char * hostname
Definition: nfs_open.c:104
struct oncrpc_session nfs_session
Definition: nfs_open.c:100
static struct interface_descriptor nfs_mount_desc
Definition: nfs_open.c:580
A Uniform Resource Identifier.
Definition: uri.h:64
struct refcnt refcnt
Reference counter.
Definition: nfs_open.c:86
static void intf_init(struct interface *intf, struct interface_descriptor *desc, struct refcnt *refcnt)
Initialise an object interface.
Definition: interface.h:203
struct oncrpc_cred credential
Definition: oncrpc.h:52
#define ref_put(refcnt)
Drop reference to object.
Definition: refcnt.h:106
struct interface pm_intf
Definition: nfs_open.c:90

References nfs_request::auth_sys, oncrpc_cred_sys::credential, DBGC, ENOMEM, free, oncrpc_cred_sys::hostname, nfs_request::hostname, intf_init(), intf_plug_plug(), mount_init_session(), nfs_request::mount_intf, nfs_request::mount_session, nfs_connect(), nfs_desc, nfs_free(), nfs_init_session(), nfs_request::nfs_intf, nfs_mount_desc, nfs_parse_uri(), nfs_pm_desc, nfs_request::nfs_session, nfs_uri_free(), nfs_xfer_desc, oncrpc_init_cred_sys(), nfs_request::pm_intf, nfs_request::pm_session, portmap_init_session(), PORTMAP_PORT, rc, ref_init, ref_put, nfs_request::refcnt, nfs_request::uri, nfs_request::xfer, and zalloc().

Variable Documentation

◆ nfs_xfer_operations

struct interface_operation nfs_xfer_operations[]
static
Initial value:
= {
}
void intf_close(struct interface *intf, int rc)
Close an object interface.
Definition: interface.c:249
static void nfs_done(struct nfs_request *nfs, int rc)
Mark NFS operation as complete.
Definition: nfs_open.c:141
A NFS request.
Definition: nfs_open.c:84
#define INTF_OP(op_type, object_type, op_func)
Define an object interface operation.
Definition: interface.h:32

Definition at line 557 of file nfs_open.c.

◆ nfs_xfer_desc

struct interface_descriptor nfs_xfer_desc
static
Initial value:
=
struct interface xfer
Data transfer interface.
Definition: nfs_open.c:88
A NFS request.
Definition: nfs_open.c:84
static struct interface_operation nfs_xfer_operations[]
Definition: nfs_open.c:557
#define INTF_DESC(object_type, intf, operations)
Define an object interface descriptor.
Definition: interface.h:80

NFS data transfer interface descriptor.

Definition at line 562 of file nfs_open.c.

Referenced by nfs_open().

◆ nfs_pm_operations

struct interface_operation nfs_pm_operations[]
static
Initial value:
= {
}
void xfer_window_changed(struct interface *intf)
Report change of flow control window.
Definition: xfer.c:146
void intf_close(struct interface *intf, int rc)
Close an object interface.
Definition: interface.c:249
static void nfs_done(struct nfs_request *nfs, int rc)
Mark NFS operation as complete.
Definition: nfs_open.c:141
A NFS request.
Definition: nfs_open.c:84
#define INTF_OP(op_type, object_type, op_func)
Define an object interface operation.
Definition: interface.h:32
int xfer_deliver(struct interface *intf, struct io_buffer *iobuf, struct xfer_metadata *meta)
Deliver datagram.
Definition: xfer.c:194
static void nfs_pm_step(struct nfs_request *nfs)
Definition: nfs_open.c:174
static int nfs_pm_deliver(struct nfs_request *nfs, struct io_buffer *io_buf, struct xfer_metadata *meta __unused)
Definition: nfs_open.c:210

Definition at line 565 of file nfs_open.c.

◆ nfs_pm_desc

struct interface_descriptor nfs_pm_desc
static
Initial value:
=
A NFS request.
Definition: nfs_open.c:84
static struct interface_operation nfs_pm_operations[]
Definition: nfs_open.c:565
#define INTF_DESC(object_type, intf, operations)
Define an object interface descriptor.
Definition: interface.h:80
struct interface pm_intf
Definition: nfs_open.c:90

Definition at line 571 of file nfs_open.c.

Referenced by nfs_open().

◆ nfs_mount_operations

struct interface_operation nfs_mount_operations[]
static
Initial value:
= {
}
void xfer_window_changed(struct interface *intf)
Report change of flow control window.
Definition: xfer.c:146
void intf_close(struct interface *intf, int rc)
Close an object interface.
Definition: interface.c:249
static void nfs_done(struct nfs_request *nfs, int rc)
Mark NFS operation as complete.
Definition: nfs_open.c:141
static int nfs_mount_deliver(struct nfs_request *nfs, struct io_buffer *io_buf, struct xfer_metadata *meta __unused)
Definition: nfs_open.c:301
A NFS request.
Definition: nfs_open.c:84
#define INTF_OP(op_type, object_type, op_func)
Define an object interface operation.
Definition: interface.h:32
int xfer_deliver(struct interface *intf, struct io_buffer *iobuf, struct xfer_metadata *meta)
Deliver datagram.
Definition: xfer.c:194
static void nfs_mount_step(struct nfs_request *nfs)
Definition: nfs_open.c:268

Definition at line 574 of file nfs_open.c.

◆ nfs_mount_desc

struct interface_descriptor nfs_mount_desc
static
Initial value:
=
A NFS request.
Definition: nfs_open.c:84
struct interface mount_intf
Definition: nfs_open.c:91
#define INTF_DESC(object_type, intf, operations)
Define an object interface descriptor.
Definition: interface.h:80
static struct interface_operation nfs_mount_operations[]
Definition: nfs_open.c:574

Definition at line 580 of file nfs_open.c.

Referenced by nfs_open().

◆ nfs_operations

struct interface_operation nfs_operations[]
static
Initial value:
= {
}
void xfer_window_changed(struct interface *intf)
Report change of flow control window.
Definition: xfer.c:146
void intf_close(struct interface *intf, int rc)
Close an object interface.
Definition: interface.c:249
static void nfs_done(struct nfs_request *nfs, int rc)
Mark NFS operation as complete.
Definition: nfs_open.c:141
A NFS request.
Definition: nfs_open.c:84
#define INTF_OP(op_type, object_type, op_func)
Define an object interface operation.
Definition: interface.h:32
int xfer_deliver(struct interface *intf, struct io_buffer *iobuf, struct xfer_metadata *meta)
Deliver datagram.
Definition: xfer.c:194
static void nfs_step(struct nfs_request *nfs)
Definition: nfs_open.c:367
static int nfs_deliver(struct nfs_request *nfs, struct io_buffer *io_buf, struct xfer_metadata *meta __unused)
Definition: nfs_open.c:420

Definition at line 583 of file nfs_open.c.

◆ nfs_desc

struct interface_descriptor nfs_desc
static
Initial value:
=
xfer )
struct interface nfs_intf
Definition: nfs_open.c:92
struct interface xfer
Data transfer interface.
Definition: nfs_open.c:88
static struct interface_operation nfs_operations[]
Definition: nfs_open.c:583
A NFS request.
Definition: nfs_open.c:84
#define INTF_DESC_PASSTHRU(object_type, intf, operations, passthru)
Define an object interface descriptor with pass-through interface.
Definition: interface.h:97

Definition at line 589 of file nfs_open.c.

Referenced by nfs_open().

◆ __uri_opener

struct uri_opener nfs_uri_opener __uri_opener
Initial value:
= {
.scheme = "nfs",
.open = nfs_open,
}
static int nfs_open(struct interface *xfer, struct uri *uri)
Initiate a NFS connection.
Definition: nfs_open.c:630

NFS URI opener.

Definition at line 680 of file nfs_open.c.