]> Zhao Yanbai Git Server - minix.git/commitdiff
Also dev_open opened block and character special files
authorBen Gras <ben@minix3.org>
Thu, 20 Oct 2005 20:32:09 +0000 (20:32 +0000)
committerBen Gras <ben@minix3.org>
Thu, 20 Oct 2005 20:32:09 +0000 (20:32 +0000)
servers/fs/device.c
servers/fs/dmap.c

index 50e4430653c2832ea463e374da1ec78775c6670a..2521b6eac5275ff20a637fd48b97a5b57b425973 100644 (file)
@@ -495,9 +495,13 @@ PUBLIC void dev_up(int maj)
         * dev_open()s them so the filesystem can be reused.
         */
        struct super_block *sb;
+       struct filp *fp;
        int r;
 
-       printf("dev_up for %d..\n", maj);
+       /* Open a device once for every filp that's opened on it,
+        * and once for every filesystem mounted from it.
+        */
+
        for(sb = super_block; sb < &super_block[NR_SUPERS]; sb++) {
                int minor;
                if(sb->s_dev == NO_DEV)
@@ -510,7 +514,23 @@ PUBLIC void dev_up(int maj)
                   sb->s_rd_only ? R_BIT : (R_BIT|W_BIT))) != OK) {
                        printf("FS: mounted dev %d/%d re-open failed: %d.\n",
                                maj, minor, r);
-               } else printf("FS: mounted dev %d/%d re-opened\n", maj, minor);
+               }
+       }
+
+       for(fp = filp; fp < &filp[NR_FILPS]; fp++) {
+               struct inode *in;
+               int minor;
+               if(fp->filp_count < 1 || !(in=fp->filp_ino)) continue;
+               if(((in->i_zone[0] >> MAJOR) & BYTE) != maj) continue;
+               if(!(in->i_mode & (I_BLOCK_SPECIAL|I_CHAR_SPECIAL))) continue;
+               
+               minor = ((in->i_zone[0] >> MINOR) & BYTE);
+
+               if((r = dev_open(in->i_dev, FS_PROC_NR,
+                  in->i_mode & (R_BIT|W_BIT))) != OK) {
+                       printf("FS: file on dev %d/%d re-open failed: %d.\n",
+                               maj, minor, r);
+               }
        }
 
        return;
index 5513cc1563a78ba0f57366376d70adb3cb28510c..1e114cb63c6ef19909cb0af5efa1db78a2dd133e 100644 (file)
@@ -233,7 +233,6 @@ PUBLIC void dmap_proc_up(int proc)
                        && dmap[i].dmap_driver == proc
                        && (dmap[i].dmap_flags & DMAP_BABY)) {
                        dmap[i].dmap_flags &= ~DMAP_BABY;
-                       printf("FS: %d execced\n", proc);
                        dev_up(i);
                }
        }