Commit 1e1405673e4e40a94ed7620553eb440a21040402

Authored by NeilBrown
Committed by J. Bruce Fields
1 parent c67874f942

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>

Showing 5 changed files with 43 additions and 8 deletions Side-by-side Diff

... ... @@ -29,10 +29,7 @@
29 29 obj-$(CONFIG_AIO) += aio.o
30 30 obj-$(CONFIG_FILE_LOCKING) += locks.o
31 31 obj-$(CONFIG_COMPAT) += compat.o compat_ioctl.o
32   -
33   -nfsd-$(CONFIG_NFSD) := nfsctl.o
34   -obj-y += $(nfsd-y) $(nfsd-m)
35   -
  32 +obj-$(CONFIG_NFSD_DEPRECATED) += nfsctl.o
36 33 obj-$(CONFIG_BINFMT_AOUT) += binfmt_aout.o
37 34 obj-$(CONFIG_BINFMT_EM86) += binfmt_em86.o
38 35 obj-$(CONFIG_BINFMT_MISC) += binfmt_misc.o
... ... @@ -1963,7 +1963,7 @@
1963 1963 }
1964 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 1967 /* Stuff for NFS server syscalls... */
1968 1968 struct compat_nfsctl_svc {
1969 1969 u16 svc32_port;
... ... @@ -28,6 +28,18 @@
28 28  
29 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 43 config NFSD_V2_ACL
32 44 bool
33 45 depends on NFSD
... ... @@ -28,9 +28,6 @@
28 28 typedef struct auth_domain svc_client;
29 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 32 * We have two caches.
36 33 * One maps client+vfsmnt+dentry to export options - the export map
... ... @@ -802,6 +799,7 @@
802 799 return ek;
803 800 }
804 801  
  802 +#ifdef CONFIG_NFSD_DEPRECATED
805 803 static int exp_set_key(svc_client *clp, int fsid_type, u32 *fsidv,
806 804 struct svc_export *exp)
807 805 {
... ... @@ -852,6 +850,7 @@
852 850  
853 851 return exp_find_key(clp, FSID_NUM, fsidv, NULL);
854 852 }
  853 +#endif
855 854  
856 855 static svc_export *exp_get_by_name(svc_client *clp, const struct path *path,
857 856 struct cache_req *reqp)
... ... @@ -893,6 +892,7 @@
893 892 return exp;
894 893 }
895 894  
  895 +#ifdef CONFIG_NFSD_DEPRECATED
896 896 /*
897 897 * Hashtable locking. Write locks are placed only by user processes
898 898 * wanting to modify export information.
899 899  
... ... @@ -925,7 +925,20 @@
925 925 {
926 926 up_write(&hash_sem);
927 927 }
  928 +#else
928 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);
  941 +
929 942 static void exp_fsid_unhash(struct svc_export *exp)
930 943 {
931 944 struct svc_expkey *ek;
... ... @@ -1147,6 +1160,7 @@
1147 1160 exp_writeunlock();
1148 1161 return err;
1149 1162 }
  1163 +#endif /* CONFIG_NFSD_DEPRECATED */
1150 1164  
1151 1165 /*
1152 1166 * Obtain the root fh on behalf of a client.
... ... @@ -1529,6 +1543,7 @@
1529 1543 .show = e_show,
1530 1544 };
1531 1545  
  1546 +#ifdef CONFIG_NFSD_DEPRECATED
1532 1547 /*
1533 1548 * Add or modify a client.
1534 1549 * Change requests may involve the list of host addresses. The list of
... ... @@ -1618,6 +1633,7 @@
1618 1633 printk(KERN_NOTICE "nfsd: couldn't validate string %s\n", cp);
1619 1634 return 0;
1620 1635 }
  1636 +#endif /* CONFIG_NFSD_DEPRECATED */
1621 1637  
1622 1638 /*
1623 1639 * Initialize the exports module.
... ... @@ -22,6 +22,7 @@
22 22 */
23 23 enum {
24 24 NFSD_Root = 1,
  25 +#ifdef CONFIG_NFSD_DEPRECATED
25 26 NFSD_Svc,
26 27 NFSD_Add,
27 28 NFSD_Del,
... ... @@ -29,6 +30,7 @@
29 30 NFSD_Unexport,
30 31 NFSD_Getfd,
31 32 NFSD_Getfs,
  33 +#endif
32 34 NFSD_List,
33 35 NFSD_Export_features,
34 36 NFSD_Fh,
... ... @@ -54,6 +56,7 @@
54 56 /*
55 57 * write() for these nodes.
56 58 */
  59 +#ifdef CONFIG_NFSD_DEPRECATED
57 60 static ssize_t write_svc(struct file *file, char *buf, size_t size);
58 61 static ssize_t write_add(struct file *file, char *buf, size_t size);
59 62 static ssize_t write_del(struct file *file, char *buf, size_t size);
... ... @@ -61,6 +64,7 @@
61 64 static ssize_t write_unexport(struct file *file, char *buf, size_t size);
62 65 static ssize_t write_getfd(struct file *file, char *buf, size_t size);
63 66 static ssize_t write_getfs(struct file *file, char *buf, size_t size);
  67 +#endif
64 68 static ssize_t write_filehandle(struct file *file, char *buf, size_t size);
65 69 static ssize_t write_unlock_ip(struct file *file, char *buf, size_t size);
66 70 static ssize_t write_unlock_fs(struct file *file, char *buf, size_t size);
... ... @@ -76,6 +80,7 @@
76 80 #endif
77 81  
78 82 static ssize_t (*write_op[])(struct file *, char *, size_t) = {
  83 +#ifdef CONFIG_NFSD_DEPRECATED
79 84 [NFSD_Svc] = write_svc,
80 85 [NFSD_Add] = write_add,
81 86 [NFSD_Del] = write_del,
... ... @@ -83,6 +88,7 @@
83 88 [NFSD_Unexport] = write_unexport,
84 89 [NFSD_Getfd] = write_getfd,
85 90 [NFSD_Getfs] = write_getfs,
  91 +#endif
86 92 [NFSD_Fh] = write_filehandle,
87 93 [NFSD_FO_UnlockIP] = write_unlock_ip,
88 94 [NFSD_FO_UnlockFS] = write_unlock_fs,
... ... @@ -196,6 +202,7 @@
196 202 * payload - write methods
197 203 */
198 204  
  205 +#ifdef CONFIG_NFSD_DEPRECATED
199 206 /**
200 207 * write_svc - Start kernel's NFSD server
201 208 *
... ... @@ -491,6 +498,7 @@
491 498 out:
492 499 return err;
493 500 }
  501 +#endif /* CONFIG_NFSD_DEPRECATED */
494 502  
495 503 /**
496 504 * write_unlock_ip - Release all locks used by a client
... ... @@ -1365,6 +1373,7 @@
1365 1373 static int nfsd_fill_super(struct super_block * sb, void * data, int silent)
1366 1374 {
1367 1375 static struct tree_descr nfsd_files[] = {
  1376 +#ifdef CONFIG_NFSD_DEPRECATED
1368 1377 [NFSD_Svc] = {".svc", &transaction_ops, S_IWUSR},
1369 1378 [NFSD_Add] = {".add", &transaction_ops, S_IWUSR},
1370 1379 [NFSD_Del] = {".del", &transaction_ops, S_IWUSR},
... ... @@ -1372,6 +1381,7 @@
1372 1381 [NFSD_Unexport] = {".unexport", &transaction_ops, S_IWUSR},
1373 1382 [NFSD_Getfd] = {".getfd", &transaction_ops, S_IWUSR|S_IRUSR},
1374 1383 [NFSD_Getfs] = {".getfs", &transaction_ops, S_IWUSR|S_IRUSR},
  1384 +#endif
1375 1385 [NFSD_List] = {"exports", &exports_operations, S_IRUGO},
1376 1386 [NFSD_Export_features] = {"export_features",
1377 1387 &export_features_operations, S_IRUGO},