1 #ifndef _IPXE_MOUNT_H
2 #define _IPXE_MOUNT_H
3
4 #include <ipxe/nfs.h>
5
6 /** @file
7 *
8 * NFS MOUNT protocol.
9 *
10 */
11
12 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
13
14 /** NFS MOUNT protocol number */
15 #define ONCRPC_MOUNT 100005
16 /** NFS MOUNT protocol version */
17 #define MOUNT_VERS 3
18
19
20 /** No error */
21 #define MNT3_OK 0
22 /** Not owner */
23 #define MNT3ERR_PERM 1
24 /** No such file or directory */
25 #define MNT3ERR_NOENT 2
26 /** I/O error */
27 #define MNT3ERR_IO 5
28 /** Permission denied */
29 #define MNT3ERR_ACCES 13
30 /** Not a directory */
31 #define MNT3ERR_NOTDIR 20
32 /** Invalid argument */
33 #define MNT3ERR_INVAL 22
34 /** Filename too long */
35 #define MNT3ERR_NAMETOOLONG 63
36 /** Operation not supported */
37 #define MNT3ERR_NOTSUPP 10004
38 /** A failure on the server */
39 #define MNT3ERR_SERVERFAULT 10006
40
41
42 /**
43 * A MOUNT MNT reply
44 *
45 */
46 struct mount_mnt_reply {
47 /** Reply status */
48 uint32_t status;
49 /** Root file handle */
50 struct nfs_fh fh;
51 };
52
53 /**
54 * Prepare an ONC RPC session to be used as a MOUNT session
55 *
56 * @v session ONC RPC session
57 * @v credential ONC RPC credential
58 *
59 * The credential parameter must not be NULL, use 'oncrpc_auth_none' if you
60 * don't want a particular scheme to be used.
61 */
mount_init_session(struct oncrpc_session * session,struct oncrpc_cred * credential)62 static inline void mount_init_session ( struct oncrpc_session *session,
63 struct oncrpc_cred *credential ) {
64 oncrpc_init_session ( session, credential, &oncrpc_auth_none,
65 ONCRPC_MOUNT, MOUNT_VERS );
66 }
67
68 int mount_mnt ( struct interface *intf, struct oncrpc_session *session,
69 const char *mountpoint );
70 int mount_umnt ( struct interface *intf, struct oncrpc_session *session,
71 const char *mountpoint );
72
73 int mount_get_mnt_reply ( struct mount_mnt_reply *mnt_reply,
74 struct oncrpc_reply *reply );
75
76 #endif /* _IPXE_MOUNT_H */
77