Re: [PATCH 08/10] sysctl: Remove broken cdrom binary sysctls

From: Eric W. Biederman
Date: Fri Aug 10 2007 - 14:32:21 EST


Alan Cox <alan@xxxxxxxxxxxxxxxxxxx> writes:

>> I just wanted something stupid and simple, so the -mm tree would not
>> be full of broken sysctls.
>
> Well I'd like you to not replace one pile of hard to clean up but easy to
> locate crap by smearing other hard to fix in one go crap over the kernel.

I'm not certain I see the difference. I just replaced the comparison
of one label with another. There may have been more beauty in one or
the other but it really should not have made a difference maintenance
wise. Perhaps I'm just short some cdrom context here to understand
your problem.

Regardless. Looking at the code I think we can do something straightforward
and even more stupid without needing any comparisons.

Alan does this look a little better?

static int cdrom_sysctl_handler(struct ctl_table *ctl, int write, struct file * filp,
void __user *buffer, size_t *lenp, loff_t *ppos)
{
int *valp = ctl->data;
int val = *valp;
int ret;

ret = proc_dointvec(ctl, write, filp, buffer, lenp, ppos);

if (write) {

/* we only care for 1 or 0. */
autoclose = !!cdrom_sysctl_settings.autoclose;
autoeject = !!cdrom_sysctl_settings.autoeject;
debug = !!cdrom_sysctl_settings.debug;
lockdoor = !!cdrom_sysctl_settings.lock;
check_media_type = !!cdrom_sysctl_settings.check;

/* update the option flags according to the changes. we
don't have per device options through sysctl yet,
but we will have and then this will disappear. */
cdrom_update_settings();
}

return ret;
}

Eric
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/