Re: multimounting cdroms ???

From: Alexander Viro (viro@math.psu.edu)
Date: Thu Jul 27 2000 - 21:39:17 EST


On 27 Jul 2000, H. Peter Anvin wrote:

> Followup to: <Pine.GSO.4.10.10007271618130.4986-100000@weyl.math.psu.edu>
> By author: Alexander Viro <viro@math.psu.edu>
> In newsgroup: linux.dev.kernel
> >
> > BTW, I'm going to put the warning about "-t bind" being deprecated and
> > killing it completely in favour of new syntax in 2.4.0-release, so at some
> > point I'ld like to know _which_ syntax you are putting into mount(8) ;-)
> >
>
> If so, *please* give us a *reliable* way of detecting the presence or
> absence of this feature!

mkdir foo
mount -t bind foo foo >/dev/null 2>/dev/null
if [ grep `pwd`/foo /proc/mounts ]; then
        have_it = "yes"
else
        have_it = "no"
fi
umount foo
rmdir foo

should do it quite fine, no? Or C equivalent... Same goes for new API,
except that there C equivalent is even simpler - mount("foo","foo","",
MS_MGC_VAL|MS_BIND, NULL) and check the return value. It will always fail
on the kernels that do not support the thing ("" is impossible as an
fstype) and it will succeed on the kernels that do (provided that you are
root, indeed, and that nobody will rmdir foo in the meanwhile).

BTW, if we don't want to support 2.3.99 and 2.4.0-test after the release
of 2.4.0 - it's even simpler. Then >= 2.4.0 means MS_BIND and <2.3.0 means
that we don't have it.

Choose whatever you like more...

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Jul 31 2000 - 21:00:25 EST