[pvrusb2] Re: Why sysfs only root-writeable?

Mike Isely isely at isely.net
Sun Sep 11 17:16:36 CDT 2005


Bad news here folks.

I can't at all influence the uid or gid of any sysfs file from within the
kernel.  While I can set the mode for anything when the file is created by
the kernel, there simply does not exist any kind of interface for also
specifying alternate uid or gids.  So this entire idea of having module
options to set these just isn't going to work.  Damnit.

Best I can tell is that sysfs when viewed from the kernel simply has no
concept of uid or gid.

There is another possibility.  It is something that a userland app or
script has to do but the driver can do nothing for it.  I just did an
experiment and it *is* possible to chown or chgrp any inode in sysfs from
the shell.  This means it's possible to script some kind of solution to
this.  In fact, I imagine it should be possible to do something in hotplug
to notice when a pvrusb2 device appears and to issue appropriate chown /
chgrp commands to fix up the sysfs entries.

I invite someone here to consider this possibility and try hacking up a
solution...

  -Mike


On Fri, 2 Sep 2005, Mike Isely wrote:

> On Fri, 2 Sep 2005, Bill Crowell wrote:
>
> > Please make this option set /sys /proc and any /dev entries created by
> > the driver as this will make it all in the same context.
>
> No, that isn't possible.  Different subsystems manage these different
> pieces.
>
> I issue calls to create /sys entries and I can control the uid and gid of
> such inodes.  The module options I plan to add will allow setting of the
> uid and gid for these inodes.
>
> I issue calls to the v4l core to create character device structures in the
> kernel, BUT udevd or devfsd is the entity that creates the /dev entries in
> the file system.  Therefore I have no way in the driver to control
> attributes of such inodes.  This is the same point I was making earlier.
> It's up to udevd of devfsd to assign those attributes.  Out of my hands.
>
> I don't issue any calls in the kernel to create entries under /proc,
> however the USB core creates inodes there (under the usbfs mount point
> within /proc) for USB devices that exist in the system.  So technically
> there will be something there that relates to the pvrusb2 device.  But I
> don't control it, so I can't decide its attributes.
>
>   -Mike
>
>

-- 
                        |         Mike Isely          |     PGP fingerprint
     Spammers Die!!     |                             | 03 54 43 4D 75 E5 CC 92
                        |   isely @ pobox (dot) com   | 71 16 01 E2 B5 F5 C1 E8
                        |                             |


More information about the pvrusb2 mailing list