summaryrefslogtreecommitdiffstats
path: root/libmount/src/context_umount.c
diff options
context:
space:
mode:
authorKarel Zak2014-03-21 12:34:39 +0100
committerKarel Zak2014-03-21 12:34:39 +0100
commit83a783320b987a0ab9790ea5fad2eb2f77baaf3b (patch)
tree47631a02b043b87e7d07c6b5502bc54325aae707 /libmount/src/context_umount.c
parentinclude/debug: add another debug macros (diff)
downloadkernel-qcow2-util-linux-83a783320b987a0ab9790ea5fad2eb2f77baaf3b.tar.gz
kernel-qcow2-util-linux-83a783320b987a0ab9790ea5fad2eb2f77baaf3b.tar.xz
kernel-qcow2-util-linux-83a783320b987a0ab9790ea5fad2eb2f77baaf3b.zip
libmount: use new debug functions
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libmount/src/context_umount.c')
-rw-r--r--libmount/src/context_umount.c76
1 files changed, 37 insertions, 39 deletions
diff --git a/libmount/src/context_umount.c b/libmount/src/context_umount.c
index 2e22389f4..7df4c2cca 100644
--- a/libmount/src/context_umount.c
+++ b/libmount/src/context_umount.c
@@ -77,7 +77,7 @@ int mnt_context_find_umount_fs(struct libmnt_context *cxt,
if (!cxt || !tgt || !pfs)
return -EINVAL;
- DBG(CXT, mnt_debug_h(cxt, "umount: lookup FS for '%s'", tgt));
+ DBG(CXT, ul_debugobj(cxt, "umount: lookup FS for '%s'", tgt));
if (!*tgt)
return 1; /* empty string is not an error */
@@ -113,12 +113,12 @@ int mnt_context_find_umount_fs(struct libmnt_context *cxt,
}
if (rc) {
- DBG(CXT, mnt_debug_h(cxt, "umount: failed to read mtab"));
+ DBG(CXT, ul_debugobj(cxt, "umount: failed to read mtab"));
return rc;
}
if (mnt_table_get_nents(mtab) == 0) {
- DBG(CXT, mnt_debug_h(cxt, "umount: mtab empty"));
+ DBG(CXT, ul_debugobj(cxt, "umount: mtab empty"));
return 1;
}
@@ -136,14 +136,14 @@ try_loopdev:
mnt_fs_get_target(fs),
MNT_ITER_BACKWARD);
if (!fs1) {
- DBG(CXT, mnt_debug_h(cxt, "mtab is broken?!?!"));
+ DBG(CXT, ul_debugobj(cxt, "mtab is broken?!?!"));
rc = -EINVAL;
goto err;
}
if (fs != fs1) {
/* Something was stacked over `file' on the
* same mount point. */
- DBG(CXT, mnt_debug_h(cxt,
+ DBG(CXT, ul_debugobj(cxt,
"umount: %s: %s is mounted "
"over it on the same point",
tgt, mnt_fs_get_source(fs1)));
@@ -165,13 +165,13 @@ try_loopdev:
count = loopdev_count_by_backing_file(bf, &loopdev);
if (count == 1) {
- DBG(CXT, mnt_debug_h(cxt,
+ DBG(CXT, ul_debugobj(cxt,
"umount: %s --> %s (retry)", tgt, loopdev));
tgt = loopdev;
goto try_loopdev;
} else if (count > 1)
- DBG(CXT, mnt_debug_h(cxt,
+ DBG(CXT, ul_debugobj(cxt,
"umount: warning: %s is associated "
"with more than one loopdev", tgt));
}
@@ -181,7 +181,7 @@ try_loopdev:
*pfs = fs;
free(loopdev);
- DBG(CXT, mnt_debug_h(cxt, "umount fs: %s", fs ? mnt_fs_get_target(fs) :
+ DBG(CXT, ul_debugobj(cxt, "umount fs: %s", fs ? mnt_fs_get_target(fs) :
"<not found>"));
return fs ? 0 : 1;
err:
@@ -241,7 +241,7 @@ static int lookup_umount_fs(struct libmnt_context *cxt)
tgt = mnt_fs_get_target(cxt->fs);
if (!tgt) {
- DBG(CXT, mnt_debug_h(cxt, "umount: undefined target"));
+ DBG(CXT, ul_debugobj(cxt, "umount: undefined target"));
return -EINVAL;
}
@@ -282,7 +282,7 @@ static int lookup_umount_fs(struct libmnt_context *cxt)
}
}
if (type) {
- DBG(CXT, mnt_debug_h(cxt,
+ DBG(CXT, ul_debugobj(cxt,
"umount: mountinfo unnecessary [type=%s]", type));
return 0;
}
@@ -293,7 +293,7 @@ static int lookup_umount_fs(struct libmnt_context *cxt)
return rc;
if (rc == 1 || !fs) {
- DBG(CXT, mnt_debug_h(cxt, "umount: cannot find '%s' in mtab", tgt));
+ DBG(CXT, ul_debugobj(cxt, "umount: cannot find '%s' in mtab", tgt));
return 0; /* this is correct! */
}
@@ -304,10 +304,10 @@ static int lookup_umount_fs(struct libmnt_context *cxt)
mnt_fs_set_target(cxt->fs, NULL);
if (!mnt_copy_fs(cxt->fs, fs)) {
- DBG(CXT, mnt_debug_h(cxt, "umount: failed to copy FS"));
+ DBG(CXT, ul_debugobj(cxt, "umount: failed to copy FS"));
return -errno;
}
- DBG(CXT, mnt_debug_h(cxt, "umount: mtab applied"));
+ DBG(CXT, ul_debugobj(cxt, "umount: mtab applied"));
}
cxt->flags |= MNT_FL_TAB_APPLIED;
@@ -368,7 +368,7 @@ static int prepare_helper_from_options(struct libmnt_context *cxt,
if (!suffix)
return -ENOMEM;
- DBG(CXT, mnt_debug_h(cxt, "umount: umount.%s %s requested", suffix, name));
+ DBG(CXT, ul_debugobj(cxt, "umount: umount.%s %s requested", suffix, name));
return mnt_context_prepare_helper(cxt, "umount", suffix);
}
@@ -394,10 +394,10 @@ static int evaluate_permissions(struct libmnt_context *cxt)
if (!mnt_context_is_restricted(cxt))
return 0; /* superuser mount */
- DBG(CXT, mnt_debug_h(cxt, "umount: evaluating permissions"));
+ DBG(CXT, ul_debugobj(cxt, "umount: evaluating permissions"));
if (!mnt_context_tab_applied(cxt)) {
- DBG(CXT, mnt_debug_h(cxt,
+ DBG(CXT, ul_debugobj(cxt,
"cannot find %s in mtab and you are not root",
mnt_fs_get_target(cxt->fs)));
goto eperm;
@@ -424,7 +424,7 @@ static int evaluate_permissions(struct libmnt_context *cxt)
if (mnt_fs_get_bindsrc(cxt->fs)) {
src = mnt_fs_get_bindsrc(cxt->fs);
- DBG(CXT, mnt_debug_h(cxt,
+ DBG(CXT, ul_debugobj(cxt,
"umount: using bind source: %s", src));
}
@@ -451,7 +451,7 @@ static int evaluate_permissions(struct libmnt_context *cxt)
fs = NULL;
}
if (!fs) {
- DBG(CXT, mnt_debug_h(cxt,
+ DBG(CXT, ul_debugobj(cxt,
"umount %s: mtab disagrees with fstab",
tgt));
goto eperm;
@@ -477,7 +477,7 @@ static int evaluate_permissions(struct libmnt_context *cxt)
goto eperm;
if (u_flags & MNT_MS_USERS) {
- DBG(CXT, mnt_debug_h(cxt,
+ DBG(CXT, ul_debugobj(cxt,
"umount: promiscuous setting ('users') in fstab"));
return 0;
}
@@ -491,13 +491,13 @@ static int evaluate_permissions(struct libmnt_context *cxt)
char *mtab_user = NULL;
size_t sz;
- DBG(CXT, mnt_debug_h(cxt,
+ DBG(CXT, ul_debugobj(cxt,
"umount: checking user=<username> from mtab"));
curr_user = mnt_get_username(getuid());
if (!curr_user) {
- DBG(CXT, mnt_debug_h(cxt, "umount %s: cannot "
+ DBG(CXT, ul_debugobj(cxt, "umount %s: cannot "
"convert %d to username", tgt, getuid()));
goto eperm;
}
@@ -512,11 +512,11 @@ static int evaluate_permissions(struct libmnt_context *cxt)
}
if (ok) {
- DBG(CXT, mnt_debug_h(cxt, "umount %s is allowed", tgt));
+ DBG(CXT, ul_debugobj(cxt, "umount %s is allowed", tgt));
return 0;
}
eperm:
- DBG(CXT, mnt_debug_h(cxt, "umount is not allowed for you"));
+ DBG(CXT, ul_debugobj(cxt, "umount is not allowed for you"));
return -EPERM;
}
@@ -565,11 +565,9 @@ static int exec_helper(struct libmnt_context *cxt)
}
args[i] = NULL; /* 10 */
-#ifdef CONFIG_LIBMOUNT_DEBUG
for (i = 0; args[i]; i++)
- DBG(CXT, mnt_debug_h(cxt, "argv[%d] = \"%s\"",
+ DBG(CXT, ul_debugobj(cxt, "argv[%d] = \"%s\"",
i, args[i]));
-#endif
DBG_FLUSH;
execv(cxt->helper, (char * const *) args);
exit(EXIT_FAILURE);
@@ -580,7 +578,7 @@ static int exec_helper(struct libmnt_context *cxt)
wait(&st);
cxt->helper_status = WIFEXITED(st) ? WEXITSTATUS(st) : -1;
- DBG(CXT, mnt_debug_h(cxt, "%s executed [status=%d]",
+ DBG(CXT, ul_debugobj(cxt, "%s executed [status=%d]",
cxt->helper, cxt->helper_status));
cxt->helper_exec_status = rc = 0;
break;
@@ -588,7 +586,7 @@ static int exec_helper(struct libmnt_context *cxt)
case -1:
cxt->helper_exec_status = rc = -errno;
- DBG(CXT, mnt_debug_h(cxt, "fork() failed"));
+ DBG(CXT, ul_debugobj(cxt, "fork() failed"));
break;
}
@@ -673,7 +671,7 @@ static int do_umount(struct libmnt_context *cxt)
if (!target)
return -EINVAL;
- DBG(CXT, mnt_debug_h(cxt, "do umount"));
+ DBG(CXT, ul_debugobj(cxt, "do umount"));
if (cxt->restricted && !mnt_context_is_fake(cxt)) {
/*
@@ -696,7 +694,7 @@ static int do_umount(struct libmnt_context *cxt)
else if (mnt_context_is_force(cxt))
flags |= MNT_FORCE;
- DBG(CXT, mnt_debug_h(cxt, "umount(2) [target='%s', flags=0x%08x]%s",
+ DBG(CXT, ul_debugobj(cxt, "umount(2) [target='%s', flags=0x%08x]%s",
target, flags,
mnt_context_is_fake(cxt) ? " (FAKE)" : ""));
@@ -721,7 +719,7 @@ static int do_umount(struct libmnt_context *cxt)
MS_REMOUNT | MS_RDONLY));
mnt_context_enable_loopdel(cxt, FALSE);
- DBG(CXT, mnt_debug_h(cxt,
+ DBG(CXT, ul_debugobj(cxt,
"umount(2) failed [errno=%d] -- trying to remount read-only",
-cxt->syscall_status));
@@ -729,25 +727,25 @@ static int do_umount(struct libmnt_context *cxt)
MS_MGC_VAL | MS_REMOUNT | MS_RDONLY, NULL);
if (rc < 0) {
cxt->syscall_status = -errno;
- DBG(CXT, mnt_debug_h(cxt,
+ DBG(CXT, ul_debugobj(cxt,
"read-only re-mount(2) failed [errno=%d]",
-cxt->syscall_status));
return -cxt->syscall_status;
}
cxt->syscall_status = 0;
- DBG(CXT, mnt_debug_h(cxt, "read-only re-mount(2) success"));
+ DBG(CXT, ul_debugobj(cxt, "read-only re-mount(2) success"));
return 0;
}
if (rc < 0) {
- DBG(CXT, mnt_debug_h(cxt, "umount(2) failed [errno=%d]",
+ DBG(CXT, ul_debugobj(cxt, "umount(2) failed [errno=%d]",
-cxt->syscall_status));
return -cxt->syscall_status;
}
cxt->syscall_status = 0;
- DBG(CXT, mnt_debug_h(cxt, "umount(2) success"));
+ DBG(CXT, ul_debugobj(cxt, "umount(2) success"));
return 0;
}
@@ -808,7 +806,7 @@ int mnt_context_prepare_umount(struct libmnt_context *cxt)
}
if (rc) {
- DBG(CXT, mnt_debug_h(cxt, "umount: preparing failed"));
+ DBG(CXT, ul_debugobj(cxt, "umount: preparing failed"));
return rc;
}
cxt->flags |= MNT_FL_PREPARED;
@@ -932,7 +930,7 @@ int mnt_context_umount(struct libmnt_context *cxt)
assert(cxt->helper_exec_status == 1);
assert(cxt->syscall_status == 1);
- DBG(CXT, mnt_debug_h(cxt, "umount: %s", mnt_context_get_target(cxt)));
+ DBG(CXT, ul_debugobj(cxt, "umount: %s", mnt_context_get_target(cxt)));
rc = mnt_context_prepare_umount(cxt);
if (!rc)
@@ -1007,7 +1005,7 @@ int mnt_context_next_umount(struct libmnt_context *cxt,
tgt = mnt_fs_get_target(*fs);
} while (!tgt);
- DBG(CXT, mnt_debug_h(cxt, "next-umount: trying %s", tgt));
+ DBG(CXT, ul_debugobj(cxt, "next-umount: trying %s", tgt));
/* ignore filesystems which don't match options patterns */
if ((cxt->fstype_pattern && !mnt_fs_match_fstype(*fs,
@@ -1018,7 +1016,7 @@ int mnt_context_next_umount(struct libmnt_context *cxt,
cxt->optstr_pattern))) {
if (ignored)
*ignored = 1;
- DBG(CXT, mnt_debug_h(cxt, "next-umount: not-match "
+ DBG(CXT, ul_debugobj(cxt, "next-umount: not-match "
"[fstype: %s, t-pattern: %s, options: %s, O-pattern: %s]",
mnt_fs_get_fstype(*fs),
cxt->fstype_pattern,