From: Ben Gras Date: Thu, 20 Oct 2005 20:32:09 +0000 (+0000) Subject: Also dev_open opened block and character special files X-Git-Tag: v3.1.2a~591 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zlib_tech.html?a=commitdiff_plain;h=8d99d24ce64afc08f3be7f38abe8ebb2ef244dc4;p=minix.git Also dev_open opened block and character special files --- diff --git a/servers/fs/device.c b/servers/fs/device.c index 50e443065..2521b6eac 100644 --- a/servers/fs/device.c +++ b/servers/fs/device.c @@ -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; diff --git a/servers/fs/dmap.c b/servers/fs/dmap.c index 5513cc156..1e114cb63 100644 --- a/servers/fs/dmap.c +++ b/servers/fs/dmap.c @@ -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); } }