[xiph-commits] r11807 - trunk/cdparanoia/interface

xiphmont at svn.xiph.org xiphmont at svn.xiph.org
Tue Aug 29 13:57:57 PDT 2006


Author: xiphmont
Date: 2006-08-29 13:57:56 -0700 (Tue, 29 Aug 2006)
New Revision: 11807

Modified:
   trunk/cdparanoia/interface/scan_devices.c
Log:
Back out O_EXCL functionality from pjones's original SG_IO work as it
alters behavior in a way I don't believe has been justified.



Modified: trunk/cdparanoia/interface/scan_devices.c
===================================================================
--- trunk/cdparanoia/interface/scan_devices.c	2006-08-29 19:51:10 UTC (rev 11806)
+++ trunk/cdparanoia/interface/scan_devices.c	2006-08-29 20:57:56 UTC (rev 11807)
@@ -182,12 +182,7 @@
     /* Yay, ATAPI... */
     /* Ping for CDROM-ness */
     
-    fd=open(device,O_RDONLY|O_NONBLOCK|O_EXCL);
-    for (i = 0; (i<10) && (fd == -1); i++) {
-      fprintf(stderr, "Error trying to open %s exclusively (%s). retrying in 1 second.\n", device, strerror(errno));
-      usleep(1000000 + 100000.0 * rand()/(RAND_MAX+1.0));
-      fd = open(device,O_RDONLY|O_NONBLOCK|O_EXCL);
-    }
+    fd=open(device,O_RDONLY|O_NONBLOCK);
     if(fd==-1){
       idperror(messagedest,messages,"\t\tUnable to open %s",device);
       free(device);
@@ -310,19 +305,12 @@
 			char *devfs_test,
 			char *devfs_other,
 			char *prompt,int messagedest,char **messages){
-  int dev=-1;
+  int dev=open(device,O_RDONLY|O_NONBLOCK);
   scsiid a,b;
 
   int i,j;
   char buffer[200];
 
-  dev=open(device,O_RDONLY|O_NONBLOCK|O_EXCL);
-  for (i = 0; (i<10) && (dev == -1); i++) {
-    fprintf(stderr, "Error trying to open %s exclusively (%s). retrying in 1 second.\n", device, strerror(errno));
-    usleep(1000000 + 100000.0 * rand()/(RAND_MAX+1.0));
-    dev = open(device,O_RDONLY|O_NONBLOCK|O_EXCL);
-  }
-
   /* if we're running under /devfs, build the device name from the
      device we already have */
   if(!strncmp(device,devfs_test,strlen(devfs_test))){
@@ -620,26 +608,16 @@
   }
 
   if(specialized_device) {
-    for(i=0; (i<10) && (i_fd==-1); i++) {
-      if(use_sgio)
-	i_fd=open(specialized_device,O_RDWR|O_NONBLOCK|O_EXCL);
-      else
-	i_fd=open(specialized_device,O_RDONLY|O_NONBLOCK|O_EXCL);
-      if(i_fd!=-1)break;
-      fprintf(stderr, "Error trying to open %s exclusively (%s). retrying in 1 second.\n", specialized_device, strerror(errno));
-      usleep(1000000 + 100000.0 * rand()/(RAND_MAX+1.0));
-    }
+    if(use_sgio)
+      i_fd=open(specialized_device,O_RDWR|O_NONBLOCK);
+    else
+      i_fd=open(specialized_device,O_RDONLY|O_NONBLOCK);
   }
 
-  if(generic_device) {
-    g_fd=open(generic_device,O_RDWR|O_EXCL);
-    for(i=0; (i<10) && (g_fd==-1); i++) {
-      fprintf(stderr, "Error trying to open %s exclusively (%s). retrying in 1 second.\n", generic_device, strerror(errno));
-      usleep(1000000 + 100000.0 * rand()/(RAND_MAX+1.0));
-      g_fd=open(generic_device,O_RDWR|O_EXCL);
-    }
-  }
+  if(generic_device)
+    g_fd=open(generic_device,O_RDWR);
   
+  
   if(specialized_device && i_fd==-1){
     idperror(messagedest,messages,"\t\tCould not open cdrom device "
 	     "%s (continuing)",specialized_device);
@@ -651,7 +629,7 @@
 	     "%s",generic_device);
     goto cdda_identify_scsi_fail;
   }
-    
+  
   if(i_fd!=-1){
     type=(int)(i_st.st_rdev>>8);
 
@@ -815,14 +793,7 @@
     return(NULL);
   }
 
-  /* I'm not certain this one nees O_EXCL, but it can't hurt */
-  fd=open(filename,O_RDONLY|O_EXCL);
-  for(i=0; (i<10) && (fd==-1); i++) {
-    fprintf(stderr, "Error trying to open %s exclusively (%s). retrying in 1 second.\n", filename, strerror(errno));
-    usleep(1000000 + 100000.0 * rand()/(RAND_MAX+1.0));
-    fd=open(filename,O_RDONLY|O_EXCL);
-  }
-  
+  fd=open(filename,O_RDONLY);
   if(fd==-1){
     idperror(messagedest,messages,"\t\tCould not open file %s",filename);
     return(NULL);



More information about the commits mailing list