home *** CD-ROM | disk | FTP | other *** search
- /* RPC code for the mount protocol
-
- ©1999 Joseph Walton
-
- This software is distributed under the terms of the GNU General Public
- License; either version 2 of the License, or (at your option) any
- later version.
- */
-
- #include "mount.h"
- #include "nfs.h"
-
- #include "mount_functions.h"
-
- /* This is actually a fairly large buffer */
- static char pathBuffer[MNTPATHLEN + 1];
-
- int mount_procedure(struct Call *call, int32 *ptr, int32 *limit,
- int32 *rptr, int32 *rlimit)
- {
- if (call->c_version != MOUNT_VERSION) {
- *rptr++ = P_ENUM(PROG_MISMATCH);
- *rptr++ = P_UINT(MOUNT_VERSION);
- *rptr++ = P_UINT(MOUNT_VERSION);
- return 8;
- }
-
- switch (call->c_procedure) {
- case MOUNT_PROC_NULL:
- *rptr++ = P_ENUM(SUCCESS);
- return 6;
-
- case MOUNT_PROC_MNT:
- ptr = getString(ptr, limit, pathBuffer, sizeof(pathBuffer));
-
- if (!ptr) {
- *rptr++ = P_ENUM(GARBAGE_ARGS);
- return 6;
- }
-
- *rptr++ = P_ENUM(SUCCESS);
-
- if ((*rptr = mountproc_mnt(call, pathBuffer, rptr + 1))
- == NFS_OK)
- {
- return 7 + INT32S(NFS_FHSIZE);
- }
-
- /* Failed, so we return without the handle */
- return 7;
-
- case MOUNT_PROC_UMNT:
- ptr = getString(ptr, limit, pathBuffer, sizeof(pathBuffer));
-
- if (!ptr) {
- *rptr++ = P_ENUM(GARBAGE_ARGS);
- return 6;
- }
-
- /* Succeed at doing nothing */
- *rptr = P_ENUM(SUCCESS);
-
- mountproc_umnt(call, pathBuffer);
- return 6;
-
- default:
- *rptr++ = P_ENUM(PROC_UNAVAIL);
- return 6;
- }
- }
-
-