Jan Kara <jack@xxxxxxx> wrote: > > AFAIK, Linux does getcwd() in kernel as Solaris does, so it should be possible > > to get the path for a mount point, in case that path was not kept during the > > mount(2) operation. > Jorg, maybe I'm missing something but look: > quack:/tmp/foo # l > total 700 > drwxr-xr-x 2 root root 4096 2011-12-13 16:54 ./ > drwxrwxrwt 74 root root 712704 2011-12-13 16:54 ../ > quack:/tmp/foo # mkdir -p bar/baz > quack:/tmp/foo # mkdir bar2 > quack:/tmp/foo # mount -t ext3 -o loop ~jack/fs-images/ext3-image bar/baz/ > quack:/tmp/foo # mkdir bar/baz/dir > quack:/tmp/foo # touch bar/baz/dir/some_file > quack:/tmp/foo # mount --bind bar/baz/dir/ bar2 This looks loks a loopback mount. Note that I am using the semantically correct word for that beast. Loopback mounts have been invented in 1986 on SunOS by Sun. What Linux calls "loopback mounts" is what I invented in 1988 as "fbk" driver (file emulates blockdevice). > quack:/tmp/foo # ls bar2 > some_file > quack:/tmp/foo # ls bar/baz/ > aquota.group aquota.user dir > quack:/tmp/foo # mount -t ext2 -o loop ~jack/fs-images/ext2-image bar/ > quack:/tmp/foo # l bar > total 18 > drwxr-xr-x 4 10005 users 1024 2011-02-24 12:18 ./ > drwxr-xr-x 4 root root 4096 2011-12-13 16:55 ../ > drwx------ 2 root root 12288 2010-03-10 12:21 lost+found/ > drwxrwxrwx 6 root root 1024 2011-02-24 12:18 t/ > quack:/tmp/foo # > > So to summarize we have directory structure like: > /tmp > | > foo > / \ > bar bar2 > | | > here is ext2_image here is subtree of 'dir' from ext3_image If this is implemented the way it is implemented in Solaris, there is a nearly empty vfs layer, specific to the loopback mount that indirectly calls the vfs functions for the base FS. So on Solaris this is possible and it would work as expected. See: http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/common/fs/lofs/lofs_vnops.c#937 Jörg -- EMail:joerg@xxxxxxxxxx (home) Jörg Schilling D-13353 Berlin js@xxxxxxxxxxxxxxx (uni) joerg.schilling@xxxxxxxxxxxxxxxxxxx (work) Blog: http://schily.blogspot.com/ URL: http://cdrecord.berlios.de/private/ ftp://ftp.berlios.de/pub/schily -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html