Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * include/linux/nfsd/syscall.h |
| 3 | * |
| 4 | * This file holds all declarations for the knfsd syscall interface. |
| 5 | * |
| 6 | * Copyright (C) 1995-1997 Olaf Kirch <okir@monad.swb.de> |
| 7 | */ |
| 8 | |
| 9 | #ifndef NFSD_SYSCALL_H |
| 10 | #define NFSD_SYSCALL_H |
| 11 | |
| 12 | #include <asm/types.h> |
| 13 | #ifdef __KERNEL__ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14 | # include <linux/types.h> |
| 15 | # include <linux/in.h> |
| 16 | #endif |
| 17 | #include <linux/posix_types.h> |
| 18 | #include <linux/nfsd/const.h> |
| 19 | #include <linux/nfsd/export.h> |
| 20 | #include <linux/nfsd/nfsfh.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 21 | |
| 22 | /* |
| 23 | * Version of the syscall interface |
| 24 | */ |
| 25 | #define NFSCTL_VERSION 0x0201 |
| 26 | |
| 27 | /* |
| 28 | * These are the commands understood by nfsctl(). |
| 29 | */ |
| 30 | #define NFSCTL_SVC 0 /* This is a server process. */ |
| 31 | #define NFSCTL_ADDCLIENT 1 /* Add an NFS client. */ |
| 32 | #define NFSCTL_DELCLIENT 2 /* Remove an NFS client. */ |
| 33 | #define NFSCTL_EXPORT 3 /* export a file system. */ |
| 34 | #define NFSCTL_UNEXPORT 4 /* unexport a file system. */ |
| 35 | /*#define NFSCTL_UGIDUPDATE 5 / * update a client's uid/gid map. DISCARDED */ |
| 36 | /*#define NFSCTL_GETFH 6 / * get an fh by ino DISCARDED */ |
| 37 | #define NFSCTL_GETFD 7 /* get an fh by path (used by mountd) */ |
| 38 | #define NFSCTL_GETFS 8 /* get an fh by path with max FH len */ |
| 39 | |
| 40 | /* SVC */ |
| 41 | struct nfsctl_svc { |
| 42 | unsigned short svc_port; |
| 43 | int svc_nthreads; |
| 44 | }; |
| 45 | |
| 46 | /* ADDCLIENT/DELCLIENT */ |
| 47 | struct nfsctl_client { |
| 48 | char cl_ident[NFSCLNT_IDMAX+1]; |
| 49 | int cl_naddr; |
| 50 | struct in_addr cl_addrlist[NFSCLNT_ADDRMAX]; |
| 51 | int cl_fhkeytype; |
| 52 | int cl_fhkeylen; |
| 53 | unsigned char cl_fhkey[NFSCLNT_KEYMAX]; |
| 54 | }; |
| 55 | |
| 56 | /* EXPORT/UNEXPORT */ |
| 57 | struct nfsctl_export { |
| 58 | char ex_client[NFSCLNT_IDMAX+1]; |
| 59 | char ex_path[NFS_MAXPATHLEN+1]; |
| 60 | __kernel_old_dev_t ex_dev; |
| 61 | __kernel_ino_t ex_ino; |
| 62 | int ex_flags; |
| 63 | __kernel_uid_t ex_anon_uid; |
| 64 | __kernel_gid_t ex_anon_gid; |
| 65 | }; |
| 66 | |
| 67 | /* GETFD */ |
| 68 | struct nfsctl_fdparm { |
| 69 | struct sockaddr gd_addr; |
| 70 | char gd_path[NFS_MAXPATHLEN+1]; |
| 71 | int gd_version; |
| 72 | }; |
| 73 | |
| 74 | /* GETFS - GET Filehandle with Size */ |
| 75 | struct nfsctl_fsparm { |
| 76 | struct sockaddr gd_addr; |
| 77 | char gd_path[NFS_MAXPATHLEN+1]; |
| 78 | int gd_maxlen; |
| 79 | }; |
| 80 | |
| 81 | /* |
| 82 | * This is the argument union. |
| 83 | */ |
| 84 | struct nfsctl_arg { |
| 85 | int ca_version; /* safeguard */ |
| 86 | union { |
| 87 | struct nfsctl_svc u_svc; |
| 88 | struct nfsctl_client u_client; |
| 89 | struct nfsctl_export u_export; |
| 90 | struct nfsctl_fdparm u_getfd; |
| 91 | struct nfsctl_fsparm u_getfs; |
| 92 | /* |
| 93 | * The following dummy member is needed to preserve binary compatibility |
| 94 | * on platforms where alignof(void*)>alignof(int). It's needed because |
| 95 | * this union used to contain a member (u_umap) which contained a |
| 96 | * pointer. |
| 97 | */ |
| 98 | void *u_ptr; |
| 99 | } u; |
| 100 | #define ca_svc u.u_svc |
| 101 | #define ca_client u.u_client |
| 102 | #define ca_export u.u_export |
| 103 | #define ca_getfd u.u_getfd |
| 104 | #define ca_getfs u.u_getfs |
| 105 | }; |
| 106 | |
| 107 | union nfsctl_res { |
| 108 | __u8 cr_getfh[NFS_FHSIZE]; |
| 109 | struct knfsd_fh cr_getfs; |
| 110 | }; |
| 111 | |
| 112 | #ifdef __KERNEL__ |
| 113 | /* |
| 114 | * Kernel syscall implementation. |
| 115 | */ |
| 116 | extern int exp_addclient(struct nfsctl_client *ncp); |
| 117 | extern int exp_delclient(struct nfsctl_client *ncp); |
| 118 | extern int exp_export(struct nfsctl_export *nxp); |
| 119 | extern int exp_unexport(struct nfsctl_export *nxp); |
| 120 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 121 | #endif /* __KERNEL__ */ |
| 122 | |
| 123 | #endif /* NFSD_SYSCALL_H */ |