[Devel] Re: [PATCH 3/3] proc: make UTS-related sysctls utsns aware
Dave Hansen
haveblue at us.ibm.com
Wed May 24 11:02:57 PDT 2006
On Tue, 2006-05-23 at 13:23 +1200, Sam Vilain wrote:
>
> + /* map the filename to the pointer. perhaps it would be
> better
> + to put struct offset pointers in table->data ? */
> + switch (filp->f_dentry->d_name.name[3]) {
> + case 'y': /* ostYpe */
> + which = uts_ns->name.sysname;
> + break;
> + case 't': /* hosTname */
> + which = uts_ns->name.nodename;
> + break;
> + case 'e': /* osrElease */
> + which = uts_ns->name.release;
> + break;
> + case 's': /* verSion */
> + which = uts_ns->name.version;
> + break;
> + case 'x': /* XXX - unreachable */
> + which = uts_ns->name.machine;
> + break;
> + case 'a': /* domAinname */
> + which = uts_ns->name.domainname;
> + break;
> + default:
> + printk("procfs: impossible uts part '%s'",
> + (char*)filp->f_dentry->d_name.name);
> + r = -EINVAL;
> + goto out;
> + }
Why not just switch on the ->ctl_name from the table? Wouldn't that be
easier?
-- Dave
More information about the Devel
mailing list