Update of /cvsroot/libsysio/libsysio/src
In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv13033
Modified Files:
Tag: unification
mount.c
Log Message:
Modified to work with the new graph architecture semantics.
Index: mount.c
===================================================================
RCS file: /cvsroot/libsysio/libsysio/src/mount.c,v
retrieving revision 1.21.4.2
retrieving revision 1.21.4.3
diff -u -w -b -B -p -r1.21.4.2 -r1.21.4.3
--- mount.c 10 Apr 2007 21:25:31 -0000 1.21.4.2
+++ mount.c 12 Apr 2007 17:27:53 -0000 1.21.4.3
@@ -166,13 +166,8 @@ _sysio_do_mount(struct filesys *fs,
goto error;
}
/*
- * It may have been a while since the root inode was validated;
- * better validate again. And it better be a directory!
+ * It better be a directory!
*/
- err = _sysio_p_validate(mnt->mnt_root, NULL, NULL);
- if (err)
- goto error;
-
if (!S_ISDIR(mnt->mnt_root->p_base->pb_ino->i_stbuf.st_mode)) {
err = -ENOTDIR;
goto error;
@@ -198,7 +193,7 @@ _sysio_do_mount(struct filesys *fs,
error:
if (mnt->mnt_root) {
P_RELE(mnt->mnt_root);
- _sysio_p_prune(mnt->mnt_root);
+ _sysio_p_gone(mnt->mnt_root);
}
free(mnt);
return err;
@@ -211,6 +206,7 @@ int
_sysio_do_unmount(struct mount *mnt)
{
struct pnode *root;
+ struct pnode_base *rootpb;
struct filesys *fs;
root = mnt->mnt_root;
@@ -241,7 +237,10 @@ _sysio_do_unmount(struct mount *mnt)
*/
P_RELE(root);
root->p_cover = NULL;
+ rootpb = root->p_base;
_sysio_p_gone(root);
+ if (!(rootpb->pb_aliases.lh_first || rootpb->pb_children.lh_first))
+ _sysio_pb_gone(rootpb);
/*
* Release mount record resource.
*/
@@ -370,6 +369,7 @@ SYSIO_INTERFACE_NAME(umount)(const char
{
int err;
struct pnode *pno;
+ struct mount *mnt;
SYSIO_INTERFACE_DISPLAY_BLOCK;
SYSIO_INTERFACE_ENTER(umount, target);
@@ -379,7 +379,12 @@ SYSIO_INTERFACE_NAME(umount)(const char
err = _sysio_namei(_sysio_cwd, target, 0, NULL, &pno);
if (err)
goto out;
+ mnt = pno->p_mount;
+ if (!err && mnt->mnt_root != pno)
+ err = -EINVAL;
P_RELE(pno); /* was ref'd */
+ if (err)
+ goto out;
/*
* Do the deed.
@@ -390,8 +395,7 @@ SYSIO_INTERFACE_NAME(umount)(const char
goto error;
}
#endif
- assert(pno->p_mount);
- err = _sysio_do_unmount(pno->p_mount);
+ err = _sysio_do_unmount(mnt);
out:
SYSIO_INTERFACE_RETURN(err ? -1 : 0, err, umount, 0);
@@ -419,23 +423,9 @@ _sysio_unmount_all()
*/
if (!_sysio_p_prune(pno))
continue;
-#ifdef notdef
- /*
- * Need a ref but only if this is not the root of a
- * disconnected graph. If it is, then it is covered by itself
- * and, so, already referenced.
- */
- if (pno->p_cover != pno)
- P_REF(pno);
-#endif
err = _sysio_do_unmount(mnt);
- if (err) {
-#ifdef notdef
- if (pno->p_cover != pno)
- P_RELE(pno);
-#endif
+ if (err)
break;
- }
if (pno == _sysio_root)
_sysio_root = NULL;
}
|