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>
18 #include <sys/types.h>
23 getfh_old (struct sockaddr *addr, dev_t dev, ino_t ino)
26 struct nfsctl_arg arg;
27 static struct nfs_fh_len rfh;
29 arg.ca_version = NFSCTL_VERSION;
30 arg.ca_getfh.gf_version = 2; /* obsolete */
31 arg.ca_getfh.gf_dev = dev;
32 arg.ca_getfh.gf_ino = ino;
33 memcpy(&arg.ca_getfh.gf_addr, addr, sizeof(struct sockaddr_in));
35 if (nfsctl(NFSCTL_GETFH, &arg, &res) < 0)
39 memcpy(rfh.fh_handle, &res.cr_getfh, 32);
44 getfh(struct sockaddr *addr, const char *path)
46 static union nfsctl_res res;
47 struct nfsctl_arg arg;
48 static struct nfs_fh_len rfh;
50 arg.ca_version = NFSCTL_VERSION;
51 arg.ca_getfd.gd_version = 2; /* obsolete */
52 strncpy(arg.ca_getfd.gd_path, path,
53 sizeof(arg.ca_getfd.gd_path) - 1);
54 arg.ca_getfd.gd_path[sizeof (arg.ca_getfd.gd_path) - 1] = '\0';
55 memcpy(&arg.ca_getfd.gd_addr, addr, sizeof(struct sockaddr_in));
57 if (nfsctl(NFSCTL_GETFD, &arg, &res) < 0)
61 memcpy(rfh.fh_handle, &res.cr_getfh, 32);
66 getfh_size(struct sockaddr *addr, const char *path, int size)
68 static union nfsctl_res res;
69 struct nfsctl_arg arg;
71 arg.ca_version = NFSCTL_VERSION;
72 strncpy(arg.ca_getfs.gd_path, path,
73 sizeof(arg.ca_getfs.gd_path) - 1);
74 arg.ca_getfs.gd_path[sizeof (arg.ca_getfs.gd_path) - 1] = '\0';
75 memcpy(&arg.ca_getfs.gd_addr, addr, sizeof(struct sockaddr_in));
76 arg.ca_getfs.gd_maxlen = size;
78 if (nfsctl(NFSCTL_GETFS, &arg, &res) < 0)