]> Zhao Yanbai Git Server - minix.git/commitdiff
reduced cdprobe debug; stadir unbreakfix
authorBen Gras <ben@minix3.org>
Fri, 5 Aug 2005 16:08:49 +0000 (16:08 +0000)
committerBen Gras <ben@minix3.org>
Fri, 5 Aug 2005 16:08:49 +0000 (16:08 +0000)
servers/fs/cdprobe.c
servers/fs/stadir.c

index 2fd89b6c7b0c94492a85516e38a23ab3cb6e4c1c..6283b4caf5183731ef8b9294afb7f88527be9052 100644 (file)
@@ -33,74 +33,57 @@ PUBLIC int cdprobe(void)
 
                dev = (AT_MAJOR << MAJOR) | minors[i];
 
-               /* 1. The drive should be a CD - which is not write-openable.
-                *    Check for this.
+               /* Open device readonly. (This fails if the device
+                * is also writable, which a CD isn't.)
                 */
-               if((r = dev_open(dev, FS_PROC_NR, R_BIT|W_BIT)) == OK) {
-                       printf("%d. no - can open r/w, so no cd\n", i);
-                       dev_close(dev);
-                       continue;
-               }
-               printf("passed no-r/w test ", i);
-
-               /* 2. The drive should be a CD. Open whole drive and 
-                *    check for the PVD.
-                */
-               if((r = dev_open(dev, FS_PROC_NR, R_BIT)) != OK) {
-                       printf("%d. no - can't open readonly\n", i);
+               printf("%d", i);
+               if((r = dev_open(dev, FS_PROC_NR, RO_BIT)) != OK) {
+                       printf("ro", i);
                        continue;
                }
-               printf("%d. passed open-readonly test ", i);
 
                if((r = dev_io(DEV_READ, dev, FS_PROC_NR, pvd,
                        16*CD_SECTOR, sizeof(pvd), 0)) != sizeof(pvd)) {
-                       printf("%d. no - can't read pvd (%d)\n", i, r);
+                       printf("rpvd", i);
                        dev_close(dev);
                        continue;
                }
                dev_close(dev);
-               printf("%d. passed read pvd test ", i);
 
                /* Check PVD ID. */
                if(pvd[0] !=  1  || pvd[1] != 'C' || pvd[2] != 'D' ||
                   pvd[3] != '0' || pvd[4] != '0' || pvd[5] != '1' || pvd[6] != 1 ||
                   strncmp(pvd + 40, "MINIX", 5)) {
-                       printf("%d. no - cd signature or minix label not found\n", i, r);
+                       printf("vpvd", i, r);
                        continue;
                   }
-               printf("%d. pvd id test ", i);
 
                /* 3. Both c0dXp1 and p2 should have a superblock. */
                for(minor = minors[i]+2; minor <= minors[i]+3; minor++) {
                        dev = (AT_MAJOR << MAJOR) | minor;
                        if((r = dev_open(dev, FS_PROC_NR, R_BIT)) != OK) {
-                               printf("%d. no - couldn't open subdev %d\n", i, dev);
+                               printf("[o%d]\n", minor);
                                break;
                        }
                        probe_super.s_dev = dev;
                        r = read_super(&probe_super);
                        dev_close(dev);
                        if(r != OK) {
-                               printf("%d. subdev %d doesn't contain a superblock\n", i, dev);
+                               printf("fs[%d]", minor);
                                break;
                        }
-                       printf("%d. (%d) passed superblock test ", i, minor);
                }
 
                if(minor > minors[i]+3) {
                        /* Success? Then set dev to p1. */
                        dev = (AT_MAJOR << MAJOR) | (minors[i]+2);
                        found = 1;
-                       printf("%d. YES - passed all tests, root is %d\n", i, dev);
                        break;
-               } else  printf("%d. no superblock(s)\n", i);
-       }
-
-       if(!found) {
-               return NO_DEV;
+               }
        }
+       printf("\n");
 
-       printf("\nCD probing done.\n");
+       if(!found) return NO_DEV;
 
        return dev;
 }
index 5e804f40ce9aeb9ed0f8a783a4097d101a721171..25c3e54a12358b289bed90c6e4b593aa854df5dd 100644 (file)
@@ -34,7 +34,6 @@ PUBLIC int do_fchdir()
 
        /* Is the file descriptor valid? */
        if ( (rfilp = get_filp(m_in.fd)) == NIL_FILP) return(err_code);
-       dup_inode(rfilp->filp_ino);
        return change_into(&fp->fp_workdir, rfilp->filp_ino);
 }