[mythtv] [PATCH] MythVideo & Mediamonitoring (suite)
Leo Weppelman
leo at wau.mis.ah.nl
Wed Jun 16 11:43:01 EDT 2004
On Wed, Jun 16, 2004 at 03:06:07PM +0200, Xavier Hervy wrote:
>
> Thx to try this patch :)
No thanks, just trying to build something I'd like to use ;-)
> I remove the close at the start of MythMediaDevice because when i made
> my test, i made 3 observations :
> - I can mount a drive even if the device is open
> - I can't unmout drive if the device is open
> - i can't open device if the device is mounted.
>
> see this thread for more information :
> http://www.gossamer-threads.com/lists/mythtv/dev/71755
> Can you explicitly make the test which is describe in the post ?
> it's why i remove the close at the beginning, if i close it,
> mediamonitor can't open the device to check the status.
> But i can make a mistake then i will try again and send feedback
I did. See the attached program and it's output... It looks like I can
either mount or open de cdrom device but not both... It's weird that
it works otherwise on your system. This is kernel 2.6.5-1-686, maybe
that makes a difference?
Leo.
-------------- next part --------------
#include <stdio.h>
#include <fcntl.h>
#include <linux/cdrom.h>
main()
{
int fh, rc;
rc = system("mount /cdrom");
printf(" mount rc: %d\n", rc);
if ((fh = open("/dev/cdrom",O_RDONLY | O_NONBLOCK | O_EXCL)) < 0) {
perror("Open after mount:");
}
else {
if (ioctl(fh,CDROM_LOCKDOOR,0) < 0) {
perror("CDROM_LOCKDOOR");
}
close(fh);
}
system("umount /cdrom");
system("df");
if ((fh = open("/dev/cdrom",O_RDONLY | O_NONBLOCK | O_EXCL)) < 0) {
perror("Open before mount:");
}
rc = system("mount /cdrom");
printf(" mount rc: %d\n", rc);
if (fh >= 0) {
if (ioctl(fh,CDROM_LOCKDOOR,0) < 0) {
perror("CDROM_LOCKDOOR");
}
close(fh);
}
system("umount /cdrom");
system("df");
}
========== It's output ========
mount rc: 0
Open after mount:: Device or resource busy
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/vol1/var 103212320 45749892 52219548 47% /var
/dev/vol1/tmp 495844 8298 461946 2% /tmp
tmpfs 254076 0 254076 0% /dev/shm
mount: /dev/cdrom already mounted or /cdrom busy
mount rc: 8192
umount: /cdrom is not mounted (according to mtab)
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/vol1/var 103212320 45749892 52219548 47% /var
/dev/vol1/tmp 495844 8298 461946 2% /tmp
tmpfs 254076 0 254076 0% /dev/shm
More information about the mythtv-dev
mailing list