2 * Copyright (C) 2013 Marin Hannache <ipxe@mareo.fr>.
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2 of the
7 * License, or any later version.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
28 #include <ipxe/time.h>
29 #include <ipxe/iobuf.h>
30 #include <ipxe/open.h>
31 #include <ipxe/features.h>
32 #include <ipxe/oncrpc.h>
33 #include <ipxe/oncrpc_iob.h>
35 #include <ipxe/mount.h>
43 /** MNT procedure number */
45 /** UMNT procedure number */
51 * @v intf Interface to send the request on
52 * @v session ONC RPC session
53 * @v mountpoinrt The path of the directory to mount.
54 * @ret rc Return status code
56 int mount_mnt ( struct interface
*intf
, struct oncrpc_session
*session
,
57 const char *mountpoint
) {
58 struct oncrpc_field fields
[] = {
59 ONCRPC_FIELD ( str
, mountpoint
),
63 return oncrpc_call ( intf
, session
, MOUNT_MNT
, fields
);
69 * @v intf Interface to send the request on
70 * @v session ONC RPC session
71 * @v mountpoinrt The path of the directory to unmount.
72 * @ret rc Return status code
74 int mount_umnt ( struct interface
*intf
, struct oncrpc_session
*session
,
75 const char *mountpoint
) {
76 struct oncrpc_field fields
[] = {
77 ONCRPC_FIELD ( str
, mountpoint
),
81 return oncrpc_call ( intf
, session
, MOUNT_UMNT
, fields
);
87 * @v mnt_reply A structure where the data will be saved
88 * @v reply The ONC RPC reply to get data from
89 * @ret rc Return status code
91 int mount_get_mnt_reply ( struct mount_mnt_reply
*mnt_reply
,
92 struct oncrpc_reply
*reply
) {
93 if ( ! mnt_reply
|| ! reply
)
96 mnt_reply
->status
= oncrpc_iob_get_int ( reply
->data
);
98 switch ( mnt_reply
->status
)
110 case MNT3ERR_NAMETOOLONG
:
111 return -ENAMETOOLONG
;
116 nfs_iob_get_fh ( reply
->data
, &mnt_reply
->fh
);