Re: [PATCH] Add MOUNT_STATUS ioctl to cdrom device

Samphan Raruenrom
2003-08-26T09:12:29Z

Christoph Hellwig wrote:
>>(my random idea)
>>- fcntl(open("/dev/cdrom", F_MNTSTAT)
>>- umount2("/dev/cdrom", MS_TEST) // not actually perform
>>- new system call! e.g. mntstat(open("/dev/cdrom"))
> In userspace. Or you could tell me what you want to actually
> archive - your call by itself doesn't make any sense.

To get the same result in userspace, it means scanning /proc
like fuser, right? Do you think it is ok to do that? Because
the daemon (patched magicdev) poll the cdrom device very often
(every 2 sec.)
That's why I thought that faster is better (less load to
the system) and push the job to kernel-space.

This is what I really want to achive - "enable the eject button,
by locking the drive only when the device is really in use,
unlock otherwise".

I implement this as a modified version of GNOME magicdev.
http://bugzilla.gnome.org/show_bug.cgi?id=119892

The only visible feature of this new magicdev is that now
GNOME users can eject there CDs (the discs' icon will
disappear). The eject button now act as 'umount' command.

One new requirement from this new magicdev is the question
"will umount failed?". I have no preference on any way to
implement it. Should there be the right way to do it, I'll
do so. I can think of many way to implement it (including
adding a new lazy-lock mode to cdrom device) but since
I have no kernel hacking experience, I need everyone
advices. Novice users need this 'eject' button after all.

--
Samphan Raruenrom,
The Open Source Project,
National Electronics and Computer Technology Center,
National Science and Technology Development Agency,
Thailand.