Hi, this patch adds support for doing loopback mounts using
the mount_bind module:
--- autofs-3.1.7/modules/mount_bind.c.loopy 2000-11-04 07:05:17.000000000 +0000
+++ autofs-3.1.7/modules/mount_bind.c 2002-11-26 16:36:08.000000000 +0000
@@ -118,6 +118,7 @@
{
char *fullpath;
int err = 0;
+ struct stat st;
fullpath = alloca(strlen(root)+name_len+2);
if ( !fullpath ) {
@@ -133,10 +134,17 @@
return 1;
}
- syslog(LOG_DEBUG, MODPREFIX "calling mount --bind %s %s",
- what, fullpath);
- err = spawnl(LOG_NOTICE, PATH_MOUNT, PATH_MOUNT, "--bind",
- what, fullpath, NULL);
+ if ( stat(what, &st) == 0 && S_ISREG(st.st_mode) ) {
+ syslog(LOG_DEBUG, MODPREFIX "calling mount -o loop %s %s",
+ what, fullpath);
+ err = spawnl(LOG_NOTICE, PATH_MOUNT, PATH_MOUNT, "-o", "loop",
+ what, fullpath, NULL);
+ } else {
+ syslog(LOG_DEBUG, MODPREFIX "calling mount --bind %s %s",
+ what, fullpath);
+ err = spawnl(LOG_NOTICE, PATH_MOUNT, PATH_MOUNT, "--bind",
+ what, fullpath, NULL);
+ }
if ( err ) {
if ( rmdir(fullpath) && errno == EBUSY ) {
_______________________________________________
autofs mailing list
[EMAIL PROTECTED]
http://linux.kernel.org/mailman/listinfo/autofs