diff options
author | NeilBrown <neilb@suse.de> | 2010-09-21 22:55:07 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2010-09-22 15:33:14 -0400 |
commit | 1e1405673e4e40a94ed7620553eb440a21040402 (patch) | |
tree | 2553812b11feeefbf2b68c226f45d52e7a12f5b5 | |
parent | c67874f942e30039442d925b03793e0a46ddcddd (diff) |
nfsd: allow deprecated interface to be compiled out.
Add CONFIG_NFSD_DEPRECATED, default to y.
Only include deprecated interface if this is defined.
This allows distros to remove this interface before the official
removal, and allows developers to test without it.
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
-rw-r--r-- | fs/Makefile | 5 | ||||
-rw-r--r-- | fs/compat.c | 2 | ||||
-rw-r--r-- | fs/nfsd/Kconfig | 12 | ||||
-rw-r--r-- | fs/nfsd/export.c | 22 | ||||
-rw-r--r-- | fs/nfsd/nfsctl.c | 10 |
5 files changed, 43 insertions, 8 deletions
diff --git a/fs/Makefile b/fs/Makefile index e6ec1d309b1d..26956fcec917 100644 --- a/fs/Makefile +++ b/fs/Makefile | |||
@@ -29,10 +29,7 @@ obj-$(CONFIG_EVENTFD) += eventfd.o | |||
29 | obj-$(CONFIG_AIO) += aio.o | 29 | obj-$(CONFIG_AIO) += aio.o |
30 | obj-$(CONFIG_FILE_LOCKING) += locks.o | 30 | obj-$(CONFIG_FILE_LOCKING) += locks.o |
31 | obj-$(CONFIG_COMPAT) += compat.o compat_ioctl.o | 31 | obj-$(CONFIG_COMPAT) += compat.o compat_ioctl.o |
32 | 32 | obj-$(CONFIG_NFSD_DEPRECATED) += nfsctl.o | |
33 | nfsd-$(CONFIG_NFSD) := nfsctl.o | ||
34 | obj-y += $(nfsd-y) $(nfsd-m) | ||
35 | |||
36 | obj-$(CONFIG_BINFMT_AOUT) += binfmt_aout.o | 33 | obj-$(CONFIG_BINFMT_AOUT) += binfmt_aout.o |
37 | obj-$(CONFIG_BINFMT_EM86) += binfmt_em86.o | 34 | obj-$(CONFIG_BINFMT_EM86) += binfmt_em86.o |
38 | obj-$(CONFIG_BINFMT_MISC) += binfmt_misc.o | 35 | obj-$(CONFIG_BINFMT_MISC) += binfmt_misc.o |
diff --git a/fs/compat.c b/fs/compat.c index 718c7062aec1..df5e671f0015 100644 --- a/fs/compat.c +++ b/fs/compat.c | |||
@@ -1963,7 +1963,7 @@ asmlinkage long compat_sys_ppoll(struct pollfd __user *ufds, | |||
1963 | } | 1963 | } |
1964 | #endif /* HAVE_SET_RESTORE_SIGMASK */ | 1964 | #endif /* HAVE_SET_RESTORE_SIGMASK */ |
1965 | 1965 | ||
1966 | #if defined(CONFIG_NFSD) || defined(CONFIG_NFSD_MODULE) | 1966 | #if (defined(CONFIG_NFSD) || defined(CONFIG_NFSD_MODULE)) && !defined(CONFIG_NFSD_DEPRECATED) |
1967 | /* Stuff for NFS server syscalls... */ | 1967 | /* Stuff for NFS server syscalls... */ |
1968 | struct compat_nfsctl_svc { | 1968 | struct compat_nfsctl_svc { |
1969 | u16 svc32_port; | 1969 | u16 svc32_port; |
diff --git a/fs/nfsd/Kconfig b/fs/nfsd/Kconfig index 4264377552e2..18b3e8975fe0 100644 --- a/fs/nfsd/Kconfig +++ b/fs/nfsd/Kconfig | |||
@@ -28,6 +28,18 @@ config NFSD | |||
28 | 28 | ||
29 | If unsure, say N. | 29 | If unsure, say N. |
30 | 30 | ||
31 | config NFSD_DEPRECATED | ||
32 | bool "Include support for deprecated syscall interface to NFSD" | ||
33 | depends on NFSD | ||
34 | default y | ||
35 | help | ||
36 | The syscall interface to nfsd was obsoleted in 2.6.0 by a new | ||
37 | filesystem based interface. The old interface is due for removal | ||
38 | in 2.6.40. If you wish to remove the interface before then | ||
39 | say N. | ||
40 | |||
41 | In unsure, say Y. | ||
42 | |||
31 | config NFSD_V2_ACL | 43 | config NFSD_V2_ACL |
32 | bool | 44 | bool |
33 | depends on NFSD | 45 | depends on NFSD |
diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c index e56827b88fd2..a3c7d0ceb24f 100644 --- a/fs/nfsd/export.c +++ b/fs/nfsd/export.c | |||
@@ -28,9 +28,6 @@ | |||
28 | typedef struct auth_domain svc_client; | 28 | typedef struct auth_domain svc_client; |
29 | typedef struct svc_export svc_export; | 29 | typedef struct svc_export svc_export; |
30 | 30 | ||
31 | static void exp_do_unexport(svc_export *unexp); | ||
32 | static int exp_verify_string(char *cp, int max); | ||
33 | |||
34 | /* | 31 | /* |
35 | * We have two caches. | 32 | * We have two caches. |
36 | * One maps client+vfsmnt+dentry to export options - the export map | 33 | * One maps client+vfsmnt+dentry to export options - the export map |
@@ -802,6 +799,7 @@ exp_find_key(svc_client *clp, int fsid_type, u32 *fsidv, struct cache_req *reqp) | |||
802 | return ek; | 799 | return ek; |
803 | } | 800 | } |
804 | 801 | ||
802 | #ifdef CONFIG_NFSD_DEPRECATED | ||
805 | static int exp_set_key(svc_client *clp, int fsid_type, u32 *fsidv, | 803 | static int exp_set_key(svc_client *clp, int fsid_type, u32 *fsidv, |
806 | struct svc_export *exp) | 804 | struct svc_export *exp) |
807 | { | 805 | { |
@@ -852,6 +850,7 @@ exp_get_fsid_key(svc_client *clp, int fsid) | |||
852 | 850 | ||
853 | return exp_find_key(clp, FSID_NUM, fsidv, NULL); | 851 | return exp_find_key(clp, FSID_NUM, fsidv, NULL); |
854 | } | 852 | } |
853 | #endif | ||
855 | 854 | ||
856 | static svc_export *exp_get_by_name(svc_client *clp, const struct path *path, | 855 | static svc_export *exp_get_by_name(svc_client *clp, const struct path *path, |
857 | struct cache_req *reqp) | 856 | struct cache_req *reqp) |
@@ -893,6 +892,7 @@ static struct svc_export *exp_parent(svc_client *clp, struct path *path) | |||
893 | return exp; | 892 | return exp; |
894 | } | 893 | } |
895 | 894 | ||
895 | #ifdef CONFIG_NFSD_DEPRECATED | ||
896 | /* | 896 | /* |
897 | * Hashtable locking. Write locks are placed only by user processes | 897 | * Hashtable locking. Write locks are placed only by user processes |
898 | * wanting to modify export information. | 898 | * wanting to modify export information. |
@@ -925,6 +925,19 @@ exp_writeunlock(void) | |||
925 | { | 925 | { |
926 | up_write(&hash_sem); | 926 | up_write(&hash_sem); |
927 | } | 927 | } |
928 | #else | ||
929 | |||
930 | /* hash_sem not needed once deprecated interface is removed */ | ||
931 | void exp_readlock(void) {} | ||
932 | static inline void exp_writelock(void){} | ||
933 | void exp_readunlock(void) {} | ||
934 | static inline void exp_writeunlock(void){} | ||
935 | |||
936 | #endif | ||
937 | |||
938 | #ifdef CONFIG_NFSD_DEPRECATED | ||
939 | static void exp_do_unexport(svc_export *unexp); | ||
940 | static int exp_verify_string(char *cp, int max); | ||
928 | 941 | ||
929 | static void exp_fsid_unhash(struct svc_export *exp) | 942 | static void exp_fsid_unhash(struct svc_export *exp) |
930 | { | 943 | { |
@@ -1147,6 +1160,7 @@ out_unlock: | |||
1147 | exp_writeunlock(); | 1160 | exp_writeunlock(); |
1148 | return err; | 1161 | return err; |
1149 | } | 1162 | } |
1163 | #endif /* CONFIG_NFSD_DEPRECATED */ | ||
1150 | 1164 | ||
1151 | /* | 1165 | /* |
1152 | * Obtain the root fh on behalf of a client. | 1166 | * Obtain the root fh on behalf of a client. |
@@ -1529,6 +1543,7 @@ const struct seq_operations nfs_exports_op = { | |||
1529 | .show = e_show, | 1543 | .show = e_show, |
1530 | }; | 1544 | }; |
1531 | 1545 | ||
1546 | #ifdef CONFIG_NFSD_DEPRECATED | ||
1532 | /* | 1547 | /* |
1533 | * Add or modify a client. | 1548 | * Add or modify a client. |
1534 | * Change requests may involve the list of host addresses. The list of | 1549 | * Change requests may involve the list of host addresses. The list of |
@@ -1618,6 +1633,7 @@ exp_verify_string(char *cp, int max) | |||
1618 | printk(KERN_NOTICE "nfsd: couldn't validate string %s\n", cp); | 1633 | printk(KERN_NOTICE "nfsd: couldn't validate string %s\n", cp); |
1619 | return 0; | 1634 | return 0; |
1620 | } | 1635 | } |
1636 | #endif /* CONFIG_NFSD_DEPRECATED */ | ||
1621 | 1637 | ||
1622 | /* | 1638 | /* |
1623 | * Initialize the exports module. | 1639 | * Initialize the exports module. |
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c index 7f0fc8861b85..b278e444e2f4 100644 --- a/fs/nfsd/nfsctl.c +++ b/fs/nfsd/nfsctl.c | |||
@@ -22,6 +22,7 @@ | |||
22 | */ | 22 | */ |
23 | enum { | 23 | enum { |
24 | NFSD_Root = 1, | 24 | NFSD_Root = 1, |
25 | #ifdef CONFIG_NFSD_DEPRECATED | ||
25 | NFSD_Svc, | 26 | NFSD_Svc, |
26 | NFSD_Add, | 27 | NFSD_Add, |
27 | NFSD_Del, | 28 | NFSD_Del, |
@@ -29,6 +30,7 @@ enum { | |||
29 | NFSD_Unexport, | 30 | NFSD_Unexport, |
30 | NFSD_Getfd, | 31 | NFSD_Getfd, |
31 | NFSD_Getfs, | 32 | NFSD_Getfs, |
33 | #endif | ||
32 | NFSD_List, | 34 | NFSD_List, |
33 | NFSD_Export_features, | 35 | NFSD_Export_features, |
34 | NFSD_Fh, | 36 | NFSD_Fh, |
@@ -54,6 +56,7 @@ enum { | |||
54 | /* | 56 | /* |
55 | * write() for these nodes. | 57 | * write() for these nodes. |
56 | */ | 58 | */ |
59 | #ifdef CONFIG_NFSD_DEPRECATED | ||
57 | static ssize_t write_svc(struct file *file, char *buf, size_t size); | 60 | static ssize_t write_svc(struct file *file, char *buf, size_t size); |
58 | static ssize_t write_add(struct file *file, char *buf, size_t size); | 61 | static ssize_t write_add(struct file *file, char *buf, size_t size); |
59 | static ssize_t write_del(struct file *file, char *buf, size_t size); | 62 | static ssize_t write_del(struct file *file, char *buf, size_t size); |
@@ -61,6 +64,7 @@ static ssize_t write_export(struct file *file, char *buf, size_t size); | |||
61 | static ssize_t write_unexport(struct file *file, char *buf, size_t size); | 64 | static ssize_t write_unexport(struct file *file, char *buf, size_t size); |
62 | static ssize_t write_getfd(struct file *file, char *buf, size_t size); | 65 | static ssize_t write_getfd(struct file *file, char *buf, size_t size); |
63 | static ssize_t write_getfs(struct file *file, char *buf, size_t size); | 66 | static ssize_t write_getfs(struct file *file, char *buf, size_t size); |
67 | #endif | ||
64 | static ssize_t write_filehandle(struct file *file, char *buf, size_t size); | 68 | static ssize_t write_filehandle(struct file *file, char *buf, size_t size); |
65 | static ssize_t write_unlock_ip(struct file *file, char *buf, size_t size); | 69 | static ssize_t write_unlock_ip(struct file *file, char *buf, size_t size); |
66 | static ssize_t write_unlock_fs(struct file *file, char *buf, size_t size); | 70 | static ssize_t write_unlock_fs(struct file *file, char *buf, size_t size); |
@@ -76,6 +80,7 @@ static ssize_t write_recoverydir(struct file *file, char *buf, size_t size); | |||
76 | #endif | 80 | #endif |
77 | 81 | ||
78 | static ssize_t (*write_op[])(struct file *, char *, size_t) = { | 82 | static ssize_t (*write_op[])(struct file *, char *, size_t) = { |
83 | #ifdef CONFIG_NFSD_DEPRECATED | ||
79 | [NFSD_Svc] = write_svc, | 84 | [NFSD_Svc] = write_svc, |
80 | [NFSD_Add] = write_add, | 85 | [NFSD_Add] = write_add, |
81 | [NFSD_Del] = write_del, | 86 | [NFSD_Del] = write_del, |
@@ -83,6 +88,7 @@ static ssize_t (*write_op[])(struct file *, char *, size_t) = { | |||
83 | [NFSD_Unexport] = write_unexport, | 88 | [NFSD_Unexport] = write_unexport, |
84 | [NFSD_Getfd] = write_getfd, | 89 | [NFSD_Getfd] = write_getfd, |
85 | [NFSD_Getfs] = write_getfs, | 90 | [NFSD_Getfs] = write_getfs, |
91 | #endif | ||
86 | [NFSD_Fh] = write_filehandle, | 92 | [NFSD_Fh] = write_filehandle, |
87 | [NFSD_FO_UnlockIP] = write_unlock_ip, | 93 | [NFSD_FO_UnlockIP] = write_unlock_ip, |
88 | [NFSD_FO_UnlockFS] = write_unlock_fs, | 94 | [NFSD_FO_UnlockFS] = write_unlock_fs, |
@@ -196,6 +202,7 @@ static const struct file_operations pool_stats_operations = { | |||
196 | * payload - write methods | 202 | * payload - write methods |
197 | */ | 203 | */ |
198 | 204 | ||
205 | #ifdef CONFIG_NFSD_DEPRECATED | ||
199 | /** | 206 | /** |
200 | * write_svc - Start kernel's NFSD server | 207 | * write_svc - Start kernel's NFSD server |
201 | * | 208 | * |
@@ -491,6 +498,7 @@ static ssize_t write_getfd(struct file *file, char *buf, size_t size) | |||
491 | out: | 498 | out: |
492 | return err; | 499 | return err; |
493 | } | 500 | } |
501 | #endif /* CONFIG_NFSD_DEPRECATED */ | ||
494 | 502 | ||
495 | /** | 503 | /** |
496 | * write_unlock_ip - Release all locks used by a client | 504 | * write_unlock_ip - Release all locks used by a client |
@@ -1365,6 +1373,7 @@ static ssize_t write_recoverydir(struct file *file, char *buf, size_t size) | |||
1365 | static int nfsd_fill_super(struct super_block * sb, void * data, int silent) | 1373 | static int nfsd_fill_super(struct super_block * sb, void * data, int silent) |
1366 | { | 1374 | { |
1367 | static struct tree_descr nfsd_files[] = { | 1375 | static struct tree_descr nfsd_files[] = { |
1376 | #ifdef CONFIG_NFSD_DEPRECATED | ||
1368 | [NFSD_Svc] = {".svc", &transaction_ops, S_IWUSR}, | 1377 | [NFSD_Svc] = {".svc", &transaction_ops, S_IWUSR}, |
1369 | [NFSD_Add] = {".add", &transaction_ops, S_IWUSR}, | 1378 | [NFSD_Add] = {".add", &transaction_ops, S_IWUSR}, |
1370 | [NFSD_Del] = {".del", &transaction_ops, S_IWUSR}, | 1379 | [NFSD_Del] = {".del", &transaction_ops, S_IWUSR}, |
@@ -1372,6 +1381,7 @@ static int nfsd_fill_super(struct super_block * sb, void * data, int silent) | |||
1372 | [NFSD_Unexport] = {".unexport", &transaction_ops, S_IWUSR}, | 1381 | [NFSD_Unexport] = {".unexport", &transaction_ops, S_IWUSR}, |
1373 | [NFSD_Getfd] = {".getfd", &transaction_ops, S_IWUSR|S_IRUSR}, | 1382 | [NFSD_Getfd] = {".getfd", &transaction_ops, S_IWUSR|S_IRUSR}, |
1374 | [NFSD_Getfs] = {".getfs", &transaction_ops, S_IWUSR|S_IRUSR}, | 1383 | [NFSD_Getfs] = {".getfs", &transaction_ops, S_IWUSR|S_IRUSR}, |
1384 | #endif | ||
1375 | [NFSD_List] = {"exports", &exports_operations, S_IRUGO}, | 1385 | [NFSD_List] = {"exports", &exports_operations, S_IRUGO}, |
1376 | [NFSD_Export_features] = {"export_features", | 1386 | [NFSD_Export_features] = {"export_features", |
1377 | &export_features_operations, S_IRUGO}, | 1387 | &export_features_operations, S_IRUGO}, |