From: Karel Zak Date: Tue, 18 Sep 2012 09:40:44 +0000 (+0200) Subject: libmount: append loop option when automatically create loopdev X-Git-Tag: v2.23-rc1~692 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e8cd1819675bdda61d7edee6d951bf9f2b5d9091;p=thirdparty%2Futil-linux.git libmount: append loop option when automatically create loopdev The loop option is optional, mount(8) is able to detect that the source path is regular file (image) with known filesystem -- then a loop device is automatically created. In this case we have to store "loop" option to mtab on systems without autoclear loopdev flag. Signed-off-by: Karel Zak --- diff --git a/libmount/src/context_loopdev.c b/libmount/src/context_loopdev.c index 532057870f..fc8da9fe78 100644 --- a/libmount/src/context_loopdev.c +++ b/libmount/src/context_loopdev.c @@ -60,8 +60,12 @@ int mnt_context_is_loopdev(struct libmnt_context *cxt) struct stat st; if (stat(src, &st) == 0 && S_ISREG(st.st_mode) && - st.st_size > 1024) + st.st_size > 1024) { + DBG(CXT, mnt_debug_h(cxt, "automatically enabling loop= option")); + cxt->user_mountflags |= MNT_MS_LOOP; + mnt_optstr_append_option(&cxt->fs->user_optstr, "loop", NULL); return 1; + } } return 0;