der Mouse sez:
/*
* > struct diskaccess da[1]; /* contains a struct diskpart */
* > da->disk="sd0";
* > fd=open("/dev/diskpart", O_RDWR)
* > ioctl(fd, DKIOCGDTAB, &da);
*
* > and the diskpart driver would automagically handle the routing.
*
* The first problem that comes to mind with this is that it means that
* anyone who can open /dev/diskpart for read or write can read or write
* *any* disk's partition table.
Possible responses:
1. "No, you're reading more into what I wrote than what is there. I
was trying to imply 'O_RDWR or O_RDONLY as appropriate.' Got lost
somewhere in there, sorry."
2. "So have permission bits in there somewhere."
Okay, okay, that's a hack, I admit it. But you've gotta admit that there's
a certain degree of elegance in being able to do it this way:
- you only need one more device.
- the kernel side handles the routing.
*
* I can easily see myself wanting to give random users the ability to
* frob the partition table on /dev/sd3? (the zip drive) but being not
* about to let them do likewise with sd[012]? (root, /usr, etc).
How about a check for the kind of drive it is, such as removable/fixed
media? That's a pretty big (as in 'obvious') flag. If you have a fixed
drive, it could refuse read-write to anyone not in the group owning
/dev/diskpart.
hack, kludge, wheeze, cough, okay, it's hokey.
But SOMETHING along these lines could be made to work, and work well.
The permission thing, is, however, a sticky wicket.
* der Mouse
*
* mouse@rodents.montreal.qc.ca
* 7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B
*/
--*greywolf;
--
Just because memory, disk and cpu speed are cheap is no excuse for
shoddy programming.