blob: dae0faea28070a594c49d886458e1ebc4934a477 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
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 Torvalds1da177e2005-04-16 15:20:36 -070014# 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>
21#include <linux/nfsd/auth.h>
22
23/*
24 * Version of the syscall interface
25 */
26#define NFSCTL_VERSION 0x0201
27
28/*
29 * These are the commands understood by nfsctl().
30 */
31#define NFSCTL_SVC 0 /* This is a server process. */
32#define NFSCTL_ADDCLIENT 1 /* Add an NFS client. */
33#define NFSCTL_DELCLIENT 2 /* Remove an NFS client. */
34#define NFSCTL_EXPORT 3 /* export a file system. */
35#define NFSCTL_UNEXPORT 4 /* unexport a file system. */
36/*#define NFSCTL_UGIDUPDATE 5 / * update a client's uid/gid map. DISCARDED */
37/*#define NFSCTL_GETFH 6 / * get an fh by ino DISCARDED */
38#define NFSCTL_GETFD 7 /* get an fh by path (used by mountd) */
39#define NFSCTL_GETFS 8 /* get an fh by path with max FH len */
40
NeilBrown70c3b762005-11-07 01:00:25 -080041/*
42 * Macros used to set version
43 */
44#define NFSCTL_VERSET(_cltbits, _v) ((_cltbits) |= (1 << (_v)))
45#define NFSCTL_VERUNSET(_cltbits, _v) ((_cltbits) &= ~(1 << (_v)))
46#define NFSCTL_VERISSET(_cltbits, _v) ((_cltbits) & (1 << (_v)))
47
48#if defined(CONFIG_NFSD_V4)
49#define NFSCTL_VERALL (0x1c /* 0b011100 */)
50#elif defined(CONFIG_NFSD_V3)
51#define NFSCTL_VERALL (0x0c /* 0b001100 */)
52#else
53#define NFSCTL_VERALL (0x04 /* 0b000100 */)
54#endif
55
Linus Torvalds1da177e2005-04-16 15:20:36 -070056/* SVC */
57struct nfsctl_svc {
58 unsigned short svc_port;
59 int svc_nthreads;
60};
61
62/* ADDCLIENT/DELCLIENT */
63struct nfsctl_client {
64 char cl_ident[NFSCLNT_IDMAX+1];
65 int cl_naddr;
66 struct in_addr cl_addrlist[NFSCLNT_ADDRMAX];
67 int cl_fhkeytype;
68 int cl_fhkeylen;
69 unsigned char cl_fhkey[NFSCLNT_KEYMAX];
70};
71
72/* EXPORT/UNEXPORT */
73struct nfsctl_export {
74 char ex_client[NFSCLNT_IDMAX+1];
75 char ex_path[NFS_MAXPATHLEN+1];
76 __kernel_old_dev_t ex_dev;
77 __kernel_ino_t ex_ino;
78 int ex_flags;
79 __kernel_uid_t ex_anon_uid;
80 __kernel_gid_t ex_anon_gid;
81};
82
83/* GETFD */
84struct nfsctl_fdparm {
85 struct sockaddr gd_addr;
86 char gd_path[NFS_MAXPATHLEN+1];
87 int gd_version;
88};
89
90/* GETFS - GET Filehandle with Size */
91struct nfsctl_fsparm {
92 struct sockaddr gd_addr;
93 char gd_path[NFS_MAXPATHLEN+1];
94 int gd_maxlen;
95};
96
97/*
98 * This is the argument union.
99 */
100struct nfsctl_arg {
101 int ca_version; /* safeguard */
102 union {
103 struct nfsctl_svc u_svc;
104 struct nfsctl_client u_client;
105 struct nfsctl_export u_export;
106 struct nfsctl_fdparm u_getfd;
107 struct nfsctl_fsparm u_getfs;
108 /*
109 * The following dummy member is needed to preserve binary compatibility
110 * on platforms where alignof(void*)>alignof(int). It's needed because
111 * this union used to contain a member (u_umap) which contained a
112 * pointer.
113 */
114 void *u_ptr;
115 } u;
116#define ca_svc u.u_svc
117#define ca_client u.u_client
118#define ca_export u.u_export
119#define ca_getfd u.u_getfd
120#define ca_getfs u.u_getfs
121};
122
123union nfsctl_res {
124 __u8 cr_getfh[NFS_FHSIZE];
125 struct knfsd_fh cr_getfs;
126};
127
128#ifdef __KERNEL__
129/*
130 * Kernel syscall implementation.
131 */
132extern int exp_addclient(struct nfsctl_client *ncp);
133extern int exp_delclient(struct nfsctl_client *ncp);
134extern int exp_export(struct nfsctl_export *nxp);
135extern int exp_unexport(struct nfsctl_export *nxp);
136
NeilBrown70c3b762005-11-07 01:00:25 -0800137extern unsigned int nfsd_versbits;
138
Linus Torvalds1da177e2005-04-16 15:20:36 -0700139#endif /* __KERNEL__ */
140
141#endif /* NFSD_SYSCALL_H */