Преглед изворни кода

[PATCH] sysctl: implement CTL_UNNUMBERED

This patch takes the CTL_UNNUMBERD concept from NFS and makes it available to
all new sysctl users.

At the same time the sysctl binary interface maintenance documentation is
updated to mention and to describe what is needed to successfully maintain the
sysctl binary interface.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Acked-by: Alan Cox <alan@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Eric W. Biederman пре 18 година
родитељ
комит
7cc13edc13
3 измењених фајлова са 11 додато и 11 уклоњено
  1. 0 3
      fs/lockd/svc.c
  2. 0 5
      fs/nfs/sysctl.c
  3. 11 3
      include/linux/sysctl.h

+ 0 - 3
fs/lockd/svc.c

@@ -353,9 +353,6 @@ EXPORT_SYMBOL(lockd_down);
  * Sysctl parameters (same as module parameters, different interface).
  * Sysctl parameters (same as module parameters, different interface).
  */
  */
 
 
-/* Something that isn't CTL_ANY, CTL_NONE or a value that may clash. */
-#define CTL_UNNUMBERED		-2
-
 static ctl_table nlm_sysctls[] = {
 static ctl_table nlm_sysctls[] = {
 	{
 	{
 		.ctl_name	= CTL_UNNUMBERED,
 		.ctl_name	= CTL_UNNUMBERED,

+ 0 - 5
fs/nfs/sysctl.c

@@ -18,11 +18,6 @@
 static const int nfs_set_port_min = 0;
 static const int nfs_set_port_min = 0;
 static const int nfs_set_port_max = 65535;
 static const int nfs_set_port_max = 65535;
 static struct ctl_table_header *nfs_callback_sysctl_table;
 static struct ctl_table_header *nfs_callback_sysctl_table;
-/*
- * Something that isn't CTL_ANY, CTL_NONE or a value that may clash.
- * Use the same values as fs/lockd/svc.c
- */
-#define CTL_UNNUMBERED -2
 
 
 static ctl_table nfs_cb_sysctls[] = {
 static ctl_table nfs_cb_sysctls[] = {
 #ifdef CONFIG_NFS_V4
 #ifdef CONFIG_NFS_V4

+ 11 - 3
include/linux/sysctl.h

@@ -6,10 +6,17 @@
  ****************************************************************
  ****************************************************************
  ****************************************************************
  ****************************************************************
  **
  **
+ **  WARNING:
  **  The values in this file are exported to user space via 
  **  The values in this file are exported to user space via 
- **  the sysctl() binary interface.  However this interface
- **  is unstable and deprecated and will be removed in the future. 
- **  For a stable interface use /proc/sys.
+ **  the sysctl() binary interface.  Do *NOT* change the
+ **  numbering of any existing values here, and do not change
+ **  any numbers within any one set of values.  If you have to
+ **  have to redefine an existing interface, use a new number for it.
+ **  The kernel will then return -ENOTDIR to any application using
+ **  the old binary interface.
+ **
+ **  For new interfaces unless you really need a binary number
+ **  please use CTL_UNNUMBERED.
  **
  **
  ****************************************************************
  ****************************************************************
  ****************************************************************
  ****************************************************************
@@ -48,6 +55,7 @@ struct __sysctl_args {
 #ifdef __KERNEL__
 #ifdef __KERNEL__
 #define CTL_ANY		-1	/* Matches any name */
 #define CTL_ANY		-1	/* Matches any name */
 #define CTL_NONE	0
 #define CTL_NONE	0
+#define CTL_UNNUMBERED	CTL_NONE	/* sysctl without a binary number */
 #endif
 #endif
 
 
 enum
 enum