4 * Get the FH for a given client and directory. This function takes
5 * the NFS protocol version number as an additional argument.
7 * This function has nothing in common with the SunOS getfh function,
8 * which is a front-end to the RPC mount call.
10 * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de>
16 #include <sys/types.h>
21 getfh_old (struct sockaddr *addr, dev_t dev, ino_t ino)
24 struct nfsctl_arg arg;
25 static struct nfs_fh_len rfh;
27 arg.ca_version = NFSCTL_VERSION;
28 arg.ca_getfh.gf_version = 2; /* obsolete */
29 arg.ca_getfh.gf_dev = dev;
30 arg.ca_getfh.gf_ino = ino;
31 memcpy(&arg.ca_getfh.gf_addr, addr, sizeof(struct sockaddr_in));
33 if (nfsctl(NFSCTL_GETFH, &arg, &res) < 0)
37 memcpy(rfh.fh_handle, &res.cr_getfh, 32);
42 getfh(struct sockaddr *addr, const char *path)
44 static union nfsctl_res res;
45 struct nfsctl_arg arg;
46 static struct nfs_fh_len rfh;
48 arg.ca_version = NFSCTL_VERSION;
49 arg.ca_getfd.gd_version = 2; /* obsolete */
50 strncpy(arg.ca_getfd.gd_path, path,
51 sizeof(arg.ca_getfd.gd_path) - 1);
52 arg.ca_getfd.gd_path[sizeof (arg.ca_getfd.gd_path) - 1] = '\0';
53 memcpy(&arg.ca_getfd.gd_addr, addr, sizeof(struct sockaddr_in));
55 if (nfsctl(NFSCTL_GETFD, &arg, &res) < 0)
59 memcpy(rfh.fh_handle, &res.cr_getfh, 32);
64 getfh_size(struct sockaddr *addr, const char *path, int size)
66 static union nfsctl_res res;
67 struct nfsctl_arg arg;
69 arg.ca_version = NFSCTL_VERSION;
70 strncpy(arg.ca_getfs.gd_path, path,
71 sizeof(arg.ca_getfs.gd_path) - 1);
72 arg.ca_getfs.gd_path[sizeof (arg.ca_getfs.gd_path) - 1] = '\0';
73 memcpy(&arg.ca_getfs.gd_addr, addr, sizeof(struct sockaddr_in));
74 arg.ca_getfs.gd_maxlen = size;
76 if (nfsctl(NFSCTL_GETFS, &arg, &res) < 0)