diff options
author | Karel Zak | 2016-02-16 15:03:22 +0100 |
---|---|---|
committer | Karel Zak | 2016-02-16 15:03:22 +0100 |
commit | 7bbde59c8caa64ce572c935169e60d1b5c6b782b (patch) | |
tree | ee642ee5d2d1206a01c7baed0939f8024650c57e /libmount | |
parent | build-sys: use $PKG_CONFIG (diff) | |
download | kernel-qcow2-util-linux-7bbde59c8caa64ce572c935169e60d1b5c6b782b.tar.gz kernel-qcow2-util-linux-7bbde59c8caa64ce572c935169e60d1b5c6b782b.tar.xz kernel-qcow2-util-linux-7bbde59c8caa64ce572c935169e60d1b5c6b782b.zip |
libmount: add loop to debug output
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libmount')
-rw-r--r-- | libmount/src/context_loopdev.c | 33 | ||||
-rw-r--r-- | libmount/src/init.c | 1 | ||||
-rw-r--r-- | libmount/src/mountP.h | 1 |
3 files changed, 19 insertions, 16 deletions
diff --git a/libmount/src/context_loopdev.c b/libmount/src/context_loopdev.c index 787114228..a1ff971c6 100644 --- a/libmount/src/context_loopdev.c +++ b/libmount/src/context_loopdev.c @@ -36,7 +36,7 @@ int mnt_context_is_loopdev(struct libmnt_context *cxt) MNT_MS_OFFSET | MNT_MS_SIZELIMIT)) { - DBG(CXT, ul_debugobj(cxt, "loopdev specific options detected")); + DBG(LOOP, ul_debugobj(cxt, "loopdev specific options detected")); return 1; } @@ -62,7 +62,7 @@ int mnt_context_is_loopdev(struct libmnt_context *cxt) if (stat(src, &st) == 0 && S_ISREG(st.st_mode) && st.st_size > 1024) { - DBG(CXT, ul_debugobj(cxt, "automatically enabling loop= option")); + DBG(LOOP, ul_debugobj(cxt, "automatically enabling loop= option")); cxt->user_mountflags |= MNT_MS_LOOP; mnt_optstr_append_option(&cxt->fs->user_optstr, "loop", NULL); return 1; @@ -96,7 +96,7 @@ is_mounted_same_loopfile(struct libmnt_context *cxt, if (!target || !backing_file || mnt_context_get_mtab(cxt, &tb)) return 0; - DBG(CXT, ul_debugobj(cxt, "checking if %s mounted on %s", + DBG(LOOP, ul_debugobj(cxt, "checking if %s mounted on %s", backing_file, target)); cache = mnt_context_get_cache(cxt); @@ -130,7 +130,7 @@ is_mounted_same_loopfile(struct libmnt_context *cxt, } } if (rc) - DBG(CXT, ul_debugobj(cxt, "%s already mounted", backing_file)); + DBG(LOOP, ul_debugobj(cxt, "%s already mounted", backing_file)); return rc; } @@ -151,10 +151,10 @@ int mnt_context_setup_loopdev(struct libmnt_context *cxt) if (!backing_file) return -EINVAL; - DBG(CXT, ul_debugobj(cxt, "trying to setup loopdev for %s", backing_file)); + DBG(LOOP, ul_debugobj(cxt, "trying to setup device for %s", backing_file)); if (cxt->mountflags & MS_RDONLY) { - DBG(CXT, ul_debugobj(cxt, "enabling READ-ONLY flag")); + DBG(LOOP, ul_debugobj(cxt, "enabling READ-ONLY flag")); lo_flags |= LO_FLAGS_READ_ONLY; } @@ -185,7 +185,7 @@ int mnt_context_setup_loopdev(struct libmnt_context *cxt) mnt_optstr_get_option(optstr, "offset", &val, &len) == 0) { rc = mnt_parse_offset(val, len, &offset); if (rc) { - DBG(CXT, ul_debugobj(cxt, "failed to parse offset=")); + DBG(LOOP, ul_debugobj(cxt, "failed to parse offset=")); rc = -MNT_ERR_MOUNTOPT; } } @@ -197,7 +197,7 @@ int mnt_context_setup_loopdev(struct libmnt_context *cxt) mnt_optstr_get_option(optstr, "sizelimit", &val, &len) == 0) { rc = mnt_parse_offset(val, len, &sizelimit); if (rc) { - DBG(CXT, ul_debugobj(cxt, "failed to parse sizelimit=")); + DBG(LOOP, ul_debugobj(cxt, "failed to parse sizelimit=")); rc = -MNT_ERR_MOUNTOPT; } } @@ -207,7 +207,7 @@ int mnt_context_setup_loopdev(struct libmnt_context *cxt) */ if (rc == 0 && (cxt->user_mountflags & MNT_MS_ENCRYPTION) && mnt_optstr_get_option(optstr, "encryption", &val, &len) == 0) { - DBG(CXT, ul_debugobj(cxt, "encryption no longer supported")); + DBG(LOOP, ul_debugobj(cxt, "encryption no longer supported")); rc = -MNT_ERR_MOUNTOPT; } @@ -224,7 +224,7 @@ int mnt_context_setup_loopdev(struct libmnt_context *cxt) */ if (get_linux_version() >= KERNEL_VERSION(2, 6, 37) || !mnt_context_mtab_writable(cxt)) { - DBG(CXT, ul_debugobj(cxt, "enabling AUTOCLEAR flag")); + DBG(LOOP, ul_debugobj(cxt, "enabling AUTOCLEAR flag")); lo_flags |= LO_FLAGS_AUTOCLEAR; } @@ -234,7 +234,7 @@ int mnt_context_setup_loopdev(struct libmnt_context *cxt) rc = loopcxt_find_unused(&lc); if (rc) goto done; - DBG(CXT, ul_debugobj(cxt, "trying to use %s", + DBG(LOOP, ul_debugobj(cxt, "trying to use %s", loopcxt_get_device(&lc))); } @@ -250,7 +250,7 @@ int mnt_context_setup_loopdev(struct libmnt_context *cxt) if (!rc) loopcxt_set_flags(&lc, lo_flags); if (rc) { - DBG(CXT, ul_debugobj(cxt, "failed to set loopdev attributes")); + DBG(LOOP, ul_debugobj(cxt, "failed to set loop attributes")); goto done; } @@ -260,11 +260,11 @@ int mnt_context_setup_loopdev(struct libmnt_context *cxt) break; /* success */ if (loopdev || rc != -EBUSY) { - DBG(CXT, ul_debugobj(cxt, "failed to setup device")); + DBG(LOOP, ul_debugobj(cxt, "failed to setup device")); rc = -MNT_ERR_LOOPDEV; goto done; } - DBG(CXT, ul_debugobj(cxt, "loopdev stolen...trying again")); + DBG(LOOP, ul_debugobj(cxt, "device stolen...trying again")); } while (1); if (!rc) @@ -280,6 +280,7 @@ int mnt_context_setup_loopdev(struct libmnt_context *cxt) * autoclear flag accepted by the kernel, don't store * the "loop=" option to mtab. */ + DBG(LOOP, ul_debugobj(cxt, "removing unnecessary loop= from mtab")); cxt->user_mountflags &= ~MNT_MS_LOOP; mnt_optstr_remove_option(&cxt->fs->user_optstr, "loop"); } @@ -325,7 +326,7 @@ int mnt_context_delete_loopdev(struct libmnt_context *cxt) cxt->flags &= ~MNT_FL_LOOPDEV_READY; cxt->loopdev_fd = -1; - DBG(CXT, ul_debugobj(cxt, "loopdev deleted [rc=%d]", rc)); + DBG(LOOP, ul_debugobj(cxt, "deleted [rc=%d]", rc)); return rc; } @@ -348,7 +349,7 @@ int mnt_context_clear_loopdev(struct libmnt_context *cxt) /* * mount(2) success, close the device */ - DBG(CXT, ul_debugobj(cxt, "closing loopdev FD")); + DBG(LOOP, ul_debugobj(cxt, "closing FD")); close(cxt->loopdev_fd); } cxt->loopdev_fd = -1; diff --git a/libmount/src/init.c b/libmount/src/init.c index 917008dc2..9d3e4b539 100644 --- a/libmount/src/init.c +++ b/libmount/src/init.c @@ -25,6 +25,7 @@ UL_DEBUG_DEFINE_MASKNAMES(libmount) = { "fs", MNT_DEBUG_FS, "FS abstraction" }, { "help", MNT_DEBUG_HELP, "this help" }, { "locks", MNT_DEBUG_LOCKS, "mtab and utab locking" }, + { "loop", MNT_DEBUG_LOOP, "loop devices routines" }, { "options", MNT_DEBUG_OPTIONS, "mount options parsing" }, { "tab", MNT_DEBUG_TAB, "fstab, mtab, mounninfo routines" }, { "update", MNT_DEBUG_UPDATE, "mtab, utab updates" }, diff --git a/libmount/src/mountP.h b/libmount/src/mountP.h index 0bc67e5f7..46919f2a0 100644 --- a/libmount/src/mountP.h +++ b/libmount/src/mountP.h @@ -41,6 +41,7 @@ #define MNT_DEBUG_DIFF (1 << 10) #define MNT_DEBUG_MONITOR (1 << 11) #define MNT_DEBUG_BTRFS (1 << 12) +#define MNT_DEBUG_LOOP (1 << 13) #define MNT_DEBUG_ALL 0xFFFF |