[Libsysio-commit] HEAD: libsysio/src mount.c
Brought to you by:
lward
From: Lee W. <lw...@us...> - 2007-09-24 19:00:19
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv10952/src Modified Files: mount.c Log Message: All the drivers, in their mount routines, do something like: rootpb = _sysio_pb_new(&noname, NULL, rootino); err = _sysio_do_mount(..., rootpb, ...); This is clumsy. Crafted a convenience function called _sysio_mounti to do this for them. This simplifies the whole process a bit. Don't have to clean up the root pb node on error, for instance. The function is called exactly like _sysio_do_mount but with a ptr to the root inode instead of a ptr to the root pb node. Index: mount.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/mount.c,v retrieving revision 1.25 retrieving revision 1.26 diff -u -w -b -B -p -r1.25 -r1.26 --- mount.c 21 Sep 2007 19:41:37 -0000 1.25 +++ mount.c 24 Sep 2007 19:00:03 -0000 1.26 @@ -200,6 +200,29 @@ error: } /* + * Mount unrooted sub-tree somewhere in the existing name space. + */ +int +_sysio_mounti(struct filesys *fs, + struct inode *rootino, + unsigned flags, + struct pnode *tocover, + struct mount **mntp) +{ + static struct qstr noname = { NULL, 0, 0 }; + struct pnode_base *rootpb; + int err; + + rootpb = _sysio_pb_new(&noname, NULL, rootino); + if (!rootpb) + return -ENOMEM; + err = _sysio_do_mount(fs, rootpb, flags, tocover, mntp); + if (err) + _sysio_pb_gone(rootpb); + return err; +} + +/* * Remove mounted sub-tree from the system. */ int |