[mythtv] [PATCH] MythVideo & Mediamonitoring (suite)

Xavier Hervy maxpower44 at tiscali.fr
Wed Jun 16 14:31:56 EDT 2004


I have kernel 2-4-20, it's will that's work for me.
  then i modify a little your test program :

#include <stdio.h>
#include <fcntl.h>
#include <linux/cdrom.h>

main()
{
         int fh, rc;
         rc = system("mount /mnt/CD-Rom");
         if (rc==0)
         if ((fh = open("/dev/cdrom",O_RDONLY | O_NONBLOCK | O_EXCL)) < 0) {
                 printf("When mounted Cant Open\n");
                 if (rc==0){
                    rc = system("umount /mnt/CD-Rom");
                    printf("When mounted, umount rc = %d\n",rc);
                 }
         }
         else {
                printf("When mounted, Can Open \n");
                if (ioctl(fh,CDROM_LOCKDOOR,0) < 0) {
                         perror("CDROM_LOCKDOOR");
                 }
                 if (rc==0){
                      rc = system("umount /mnt/CD-Rom");
                      printf("When mounted and opened,  umount rc: 
%d\n", rc);
                 }
                 close(fh);
         }
         if ((fh = open("/dev/cdrom",O_RDONLY | O_NONBLOCK | O_EXCL)) < 0) {
                 perror("Open before mount:");
         }else{
               rc = system("mount /mnt/CD-Rom");
               printf("When Opened, mount rc: %d\n", rc);
               if (ioctl(fh,CDROM_LOCKDOOR,0) < 0) {
                         printf("CDROM_LOCKDOOR");
               }
               if (rc==0){
                    rc = system("umount /mnt/CD-Rom");
                    printf("when opened, unmount rc = %d\n",rc);
               }
               close(fh);
         }
}


Result for kernel 2.4.20 :
When mounted Cant Open
When mounted, umount rc = 0
When Opened, mount rc: 0
when opened, unmount rc = 0

Result for kernel 2.6.3  :
When mounted Cant Open
When mounted, umount rc = 0
When Opened, mount rc: 8192

result for kernel 2.6.3 with supermount option :
When mounted, Can Open
When mounted and opened,  umount rc: 0
When Opened, mount rc: 0
when opened, unmount rc = 0

To resume, we can controle lockdoor on 2.4.20 with my patch.
with 2.6.3 without supermount option, we never can't control lockdoor 
because we can open a mount device and we can't mount an open device.
with supermount option, we don't need to control lockdoor.

Then I think that my patch should work with supermount option, i can't 
try it because i have some trouble with 2.6.3 and i don't want to spend 
time about that now. Can you try it with supermount option ?
Xavier









More information about the mythtv-dev mailing list