Re: [PATCH 3/3] proc: make UTS-related sysctls utsns aware

From: Dave Hansen
Date: Wed May 24 2006 - 14:02:22 EST


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

-
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/