[Libsysio-commit] HEAD: libsysio/drivers/yod fs_yod.c
Brought to you by:
lward
From: Lee W. <lw...@us...> - 2003-10-20 17:06:44
|
Update of /cvsroot/libsysio/libsysio/drivers/yod In directory sc8-pr-cvs1:/tmp/cvs-serv9788/yod Modified Files: fs_yod.c Log Message: From Ruth Klundt; If a file is opened twice the first close destroys the file descriptor in the low-level driver. Further use by the second, then, will get EBADF or, on close, aborts. Why was the open ref count code ifdef'd out? I did it and can't for the life of me recall why. Anyway, it's back now. Index: fs_yod.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/yod/fs_yod.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -w -b -B -p -r1.6 -r1.7 --- fs_yod.c 20 Oct 2003 16:34:00 -0000 1.6 +++ fs_yod.c 20 Oct 2003 16:44:36 -0000 1.7 @@ -144,9 +144,7 @@ struct yod_inode { struct file_identifier ni_fileid; /* ditto */ int ni_fd; /* host fildes */ int ni_oflags; /* flags, from open */ -#if 0 unsigned ni_nopens; /* soft ref count */ -#endif off_t ni_fpos; /* current pos */ }; @@ -303,9 +301,7 @@ yod_i_new(struct filesys *fs, struct int nino->ni_fileid.fid_len = sizeof(nino->ni_ident); nino->ni_fd = -1; nino->ni_oflags = 0; -#if 0 nino->ni_nopens = 0; -#endif nino->ni_fpos = 0; ino = _sysio_i_new(fs, @@ -876,10 +872,8 @@ yod_inop_open(struct pnode *pno, int fla * Remember this new open. */ nino = I2NI(pno->p_base->pb_ino); -#if 0 nino->ni_nopens++; assert(nino->ni_nopens); -#endif if (nino->ni_fd >= 0) { if ((nino->ni_oflags & O_RDWR) || @@ -910,14 +904,12 @@ yod_inop_close(struct inode *ino) if (nino->ni_fd < 0) abort(); -#if 0 - assert(nino->ni_nopens); - if (--nino->ni_nopens) - return 0; -#endif err = close_yod(nino->ni_fd); if (err) return -errno; + assert(nino->ni_nopens); + if (--nino->ni_nopens) + return 0; nino->ni_fd = -1; nino->ni_fpos = 0; return 0; |