Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1557d330 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
* git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/sysctl-2.6: (43 commits)
  security/tomoyo: Remove now unnecessary handling of security_sysctl.
  security/tomoyo: Add a special case to handle accesses through the internal proc mount.
  sysctl: Drop & in front of every proc_handler.
  sysctl: Remove CTL_NONE and CTL_UNNUMBERED
  sysctl: kill dead ctl_handler definitions.
  sysctl: Remove the last of the generic binary sysctl support
  sysctl net: Remove unused binary sysctl code
  sysctl security/tomoyo: Don't look at ctl_name
  sysctl arm: Remove binary sysctl support
  sysctl x86: Remove dead binary sysctl support
  sysctl sh: Remove dead binary sysctl support
  sysctl powerpc: Remove dead binary sysctl support
  sysctl ia64: Remove dead binary sysctl support
  sysctl s390: Remove dead sysctl binary support
  sysctl frv: Remove dead binary sysctl support
  sysctl mips/lasat: Remove dead binary sysctl support
  sysctl drivers: Remove dead binary sysctl support
  sysctl crypto: Remove dead binary sysctl support
  sysctl security/keys: Remove dead binary sysctl support
  sysctl kernel: Remove binary sysctl logic
  ...
parents 6ec22f9b c656ae95
Loading
Loading
Loading
Loading
+0 −22
Original line number Diff line number Diff line

Except for a few extremely rare exceptions user space applications do not use
the binary sysctl interface.  Instead everyone uses /proc/sys/...  with
readable ascii names.

Recently the kernel has started supporting setting the binary sysctl value to
CTL_UNNUMBERED so we no longer need to assign a binary sysctl path to allow
sysctls to show up in /proc/sys.

Assigning binary sysctl numbers is an endless source of conflicts in sysctl.h,
breaking of the user space ABI (because of those conflicts), and maintenance
problems.  A complete pass through all of the sysctl users revealed multiple
instances where the sysctl binary interface was broken and had gone undetected
for years.

So please do not add new binary sysctl numbers.  They are unneeded and
problematic.

If you really need a new binary sysctl number please first merge your sysctl
into the kernel and then as a separate patch allocate a binary sysctl number.

(ebiederm@xmission.com, June 2007)
+6 −11
Original line number Diff line number Diff line
@@ -22,47 +22,42 @@ static unsigned int isa_membase, isa_portbase, isa_portshift;

static ctl_table ctl_isa_vars[4] = {
	{
		.ctl_name	= BUS_ISA_MEM_BASE,
		.procname	= "membase",
		.data		= &isa_membase, 
		.maxlen		= sizeof(isa_membase),
		.mode		= 0444,
		.proc_handler	= &proc_dointvec,
		.proc_handler	= proc_dointvec,
	}, {
		.ctl_name	= BUS_ISA_PORT_BASE,
		.procname	= "portbase",
		.data		= &isa_portbase, 
		.maxlen		= sizeof(isa_portbase),
		.mode		= 0444,
		.proc_handler	= &proc_dointvec,
		.proc_handler	= proc_dointvec,
	}, {
		.ctl_name	= BUS_ISA_PORT_SHIFT,
		.procname	= "portshift",
		.data		= &isa_portshift, 
		.maxlen		= sizeof(isa_portshift),
		.mode		= 0444,
		.proc_handler	= &proc_dointvec,
	}, {0}
		.proc_handler	= proc_dointvec,
	}, {}
};

static struct ctl_table_header *isa_sysctl_header;

static ctl_table ctl_isa[2] = {
	{
		.ctl_name	= CTL_BUS_ISA,
		.procname	= "isa",
		.mode		= 0555,
		.child		= ctl_isa_vars,
	}, {0}
	}, {}
};

static ctl_table ctl_bus[2] = {
	{
		.ctl_name	= CTL_BUS,
		.procname	= "bus",
		.mode		= 0555,
		.child		= ctl_isa,
	}, {0}
	}, {}
};

void __init
+1 −7
Original line number Diff line number Diff line
@@ -47,10 +47,6 @@ HW_DECLARE_SPINLOCK(gpio)
    EXPORT_SYMBOL(bcmring_gpio_reg_lock);
#endif

/* FIXME: temporary solution */
#define BCM_SYSCTL_REBOOT_WARM               1
#define CTL_BCM_REBOOT                 112

/* sysctl */
int bcmring_arch_warm_reboot;	/* do a warm reboot on hard reset */

@@ -58,18 +54,16 @@ static struct ctl_table_header *bcmring_sysctl_header;

static struct ctl_table bcmring_sysctl_warm_reboot[] = {
	{
	 .ctl_name = BCM_SYSCTL_REBOOT_WARM,
	 .procname = "warm",
	 .data = &bcmring_arch_warm_reboot,
	 .maxlen = sizeof(int),
	 .mode = 0644,
	 .proc_handler = &proc_dointvec},
	 .proc_handler = proc_dointvec},
	{}
};

static struct ctl_table bcmring_sysctl_reboot[] = {
	{
	 .ctl_name = CTL_BCM_REBOOT,
	 .procname = "reboot",
	 .mode = 0555,
	 .child = bcmring_sysctl_warm_reboot},
+6 −108
Original line number Diff line number Diff line
@@ -211,37 +211,6 @@ static int cmode_procctl(ctl_table *ctl, int write,
	return try_set_cmode(new_cmode)?:*lenp;
}

static int cmode_sysctl(ctl_table *table,
			void __user *oldval, size_t __user *oldlenp,
			void __user *newval, size_t newlen)
{
	if (oldval && oldlenp) {
		size_t oldlen;

		if (get_user(oldlen, oldlenp))
			return -EFAULT;

		if (oldlen != sizeof(int))
			return -EINVAL;

		if (put_user(clock_cmode_current, (unsigned __user *)oldval) ||
		    put_user(sizeof(int), oldlenp))
			return -EFAULT;
	}
	if (newval && newlen) {
		int new_cmode;

		if (newlen != sizeof(int))
			return -EINVAL;

		if (get_user(new_cmode, (int __user *)newval))
			return -EFAULT;

		return try_set_cmode(new_cmode)?:1;
	}
	return 1;
}

static int try_set_p0(int new_p0)
{
	unsigned long flags, clkc;
@@ -314,37 +283,6 @@ static int p0_procctl(ctl_table *ctl, int write,
	return try_set_p0(new_p0)?:*lenp;
}

static int p0_sysctl(ctl_table *table,
		     void __user *oldval, size_t __user *oldlenp,
		     void __user *newval, size_t newlen)
{
	if (oldval && oldlenp) {
		size_t oldlen;

		if (get_user(oldlen, oldlenp))
			return -EFAULT;

		if (oldlen != sizeof(int))
			return -EINVAL;

		if (put_user(clock_p0_current, (unsigned __user *)oldval) ||
		    put_user(sizeof(int), oldlenp))
			return -EFAULT;
	}
	if (newval && newlen) {
		int new_p0;

		if (newlen != sizeof(int))
			return -EINVAL;

		if (get_user(new_p0, (int __user *)newval))
			return -EFAULT;

		return try_set_p0(new_p0)?:1;
	}
	return 1;
}

static int cm_procctl(ctl_table *ctl, int write,
		      void __user *buffer, size_t *lenp, loff_t *fpos)
{
@@ -358,87 +296,47 @@ static int cm_procctl(ctl_table *ctl, int write,
	return try_set_cm(new_cm)?:*lenp;
}

static int cm_sysctl(ctl_table *table,
		     void __user *oldval, size_t __user *oldlenp,
		     void __user *newval, size_t newlen)
{
	if (oldval && oldlenp) {
		size_t oldlen;

		if (get_user(oldlen, oldlenp))
			return -EFAULT;

		if (oldlen != sizeof(int))
			return -EINVAL;

		if (put_user(clock_cm_current, (unsigned __user *)oldval) ||
		    put_user(sizeof(int), oldlenp))
			return -EFAULT;
	}
	if (newval && newlen) {
		int new_cm;

		if (newlen != sizeof(int))
			return -EINVAL;

		if (get_user(new_cm, (int __user *)newval))
			return -EFAULT;

		return try_set_cm(new_cm)?:1;
	}
	return 1;
}


static struct ctl_table pm_table[] =
{
	{
		.ctl_name	= CTL_PM_SUSPEND,
		.procname	= "suspend",
		.data		= NULL,
		.maxlen		= 0,
		.mode		= 0200,
		.proc_handler	= &sysctl_pm_do_suspend,
		.proc_handler	= sysctl_pm_do_suspend,
	},
	{
		.ctl_name	= CTL_PM_CMODE,
		.procname	= "cmode",
		.data		= &clock_cmode_current,
		.maxlen		= sizeof(int),
		.mode		= 0644,
		.proc_handler	= &cmode_procctl,
		.strategy	= &cmode_sysctl,
		.proc_handler	= cmode_procctl,
	},
	{
		.ctl_name	= CTL_PM_P0,
		.procname	= "p0",
		.data		= &clock_p0_current,
		.maxlen		= sizeof(int),
		.mode		= 0644,
		.proc_handler	= &p0_procctl,
		.strategy	= &p0_sysctl,
		.proc_handler	= p0_procctl,
	},
	{
		.ctl_name	= CTL_PM_CM,
		.procname	= "cm",
		.data		= &clock_cm_current,
		.maxlen		= sizeof(int),
		.mode		= 0644,
		.proc_handler	= &cm_procctl,
		.strategy	= &cm_sysctl,
		.proc_handler	= cm_procctl,
	},
	{ .ctl_name = 0}
	{ }
};

static struct ctl_table pm_dir_table[] =
{
	{
		.ctl_name	= CTL_PM,
		.procname	= "pm",
		.mode		= 0555,
		.child		= pm_table,
	},
	{ .ctl_name = 0}
	{ }
};

/*
+2 −5
Original line number Diff line number Diff line
@@ -176,21 +176,19 @@ static int procctl_frv_pin_cxnr(ctl_table *table, int write, struct file *filp,
static struct ctl_table frv_table[] =
{
	{
		.ctl_name 	= 1,
		.procname 	= "cache-mode",
		.data		= NULL,
		.maxlen		= 0,
		.mode		= 0644,
		.proc_handler	= &procctl_frv_cachemode,
		.proc_handler	= procctl_frv_cachemode,
	},
#ifdef CONFIG_MMU
	{
		.ctl_name	= 2,
		.procname	= "pin-cxnr",
		.data		= NULL,
		.maxlen		= 0,
		.mode		= 0644,
		.proc_handler	= &procctl_frv_pin_cxnr
		.proc_handler	= procctl_frv_pin_cxnr
	},
#endif
	{}
@@ -203,7 +201,6 @@ static struct ctl_table frv_table[] =
static struct ctl_table frv_dir_table[] =
{
	{
		.ctl_name	= CTL_FRV,
		.procname	= "frv",
		.mode 		= 0555,
		.child		= frv_table
Loading