#include "c.h"
#include "env.h"
#include "optutils.h"
-#include "exitcodes.h"
#include "closestream.h"
#include "pathnames.h"
#include "canonicalize.h"
fputs(*p++, stdout);
}
fputs(")\n", stdout);
- exit(MOUNT_EX_SUCCESS);
+ exit(MNT_EX_SUCCESS);
}
static void __attribute__((__noreturn__)) usage(FILE *out)
{
fputs(USAGE_VERSION, out);
fprintf(out, USAGE_MAN_TAIL("umount(8)"));
- exit(out == stderr ? MOUNT_EX_USAGE : MOUNT_EX_SUCCESS);
+ exit(out == stderr ? MNT_EX_USAGE : MNT_EX_SUCCESS);
}
static void __attribute__((__noreturn__)) exit_non_root(const char *option)
if (ruid == 0 && euid != 0) {
/* user is root, but setuid to non-root */
if (option)
- errx(MOUNT_EX_USAGE,
+ errx(MNT_EX_USAGE,
_("only root can use \"--%s\" option "
"(effective UID is %u)"),
option, euid);
- errx(MOUNT_EX_USAGE, _("only root can do that "
+ errx(MNT_EX_USAGE, _("only root can do that "
"(effective UID is %u)"), euid);
}
if (option)
- errx(MOUNT_EX_USAGE, _("only root can use \"--%s\" option"), option);
- errx(MOUNT_EX_USAGE, _("only root can do that"));
+ errx(MNT_EX_USAGE, _("only root can use \"--%s\" option"), option);
+ errx(MNT_EX_USAGE, _("only root can do that"));
}
static void success_message(struct libmnt_context *cxt)
itr = mnt_new_iter(MNT_ITER_BACKWARD);
if (!itr) {
warn(_("failed to initialize libmount iterator"));
- return MOUNT_EX_SYSERR;
+ return MNT_EX_SYSERR;
}
while (mnt_context_next_umount(cxt, itr, &fs, &mntrc, &ignored) == 0) {
} else {
int xrc = mk_exit_code(cxt, mntrc);
- if (xrc == MOUNT_EX_SUCCESS
+ if (xrc == MNT_EX_SUCCESS
&& mnt_context_is_verbose(cxt))
printf("%-25s: successfully unmounted\n", tgt);
rc |= xrc;
int rc;
if (!spec)
- return MOUNT_EX_SOFTWARE;
+ return MNT_EX_SOFTWARE;
if (mnt_context_set_target(cxt, spec))
- err(MOUNT_EX_SYSERR, _("failed to set umount target"));
+ err(MNT_EX_SYSERR, _("failed to set umount target"));
rc = mnt_context_umount(cxt);
rc = mk_exit_code(cxt, rc);
- if (rc == MOUNT_EX_SUCCESS && mnt_context_is_verbose(cxt))
+ if (rc == MNT_EX_SUCCESS && mnt_context_is_verbose(cxt))
success_message(cxt);
mnt_reset_context(cxt);
{
struct libmnt_table *tb = mnt_new_table();
if (!tb)
- err(MOUNT_EX_SYSERR, _("libmount table allocation failed"));
+ err(MNT_EX_SYSERR, _("libmount table allocation failed"));
mnt_table_set_parser_errcb(tb, table_parser_errcb);
mnt_table_set_cache(tb, mnt_context_get_cache(cxt));
rc = mnt_context_find_umount_fs(cxt, spec, &fs);
if (rc == 1) {
- rc = MOUNT_EX_SUCCESS; /* already unmounted */
+ rc = MNT_EX_SUCCESS; /* already unmounted */
mnt_reset_context(cxt);
} else if (rc < 0) {
rc = mk_exit_code(cxt, rc); /* error */
int rc;
if (!itr)
- err(MOUNT_EX_SYSERR, _("libmount iterator allocation failed"));
+ err(MNT_EX_SYSERR, _("libmount iterator allocation failed"));
/* umount all children */
for (;;) {
if (rc < 0) {
warnx(_("failed to get child fs of %s"),
mnt_fs_get_target(fs));
- rc = MOUNT_EX_SOFTWARE;
+ rc = MNT_EX_SOFTWARE;
goto done;
} else if (rc == 1)
break; /* no more children */
rc = umount_do_recurse(cxt, tb, child);
- if (rc != MOUNT_EX_SUCCESS)
+ if (rc != MNT_EX_SUCCESS)
goto done;
}
tb = new_mountinfo(cxt);
if (!tb)
- return MOUNT_EX_SOFTWARE;
+ return MNT_EX_SOFTWARE;
/* it's always real mountpoint, don't assume that the target maybe a device */
mnt_context_disable_swapmatch(cxt, 1);
if (fs)
rc = umount_do_recurse(cxt, tb, fs);
else {
- rc = MOUNT_EX_USAGE;
+ rc = MNT_EX_USAGE;
warnx(access(spec, F_OK) == 0 ?
_("%s: not mounted") :
_("%s: not found"), spec);
*/
rc = mnt_context_find_umount_fs(cxt, spec, &fs);
if (rc == 1) {
- rc = MOUNT_EX_USAGE;
+ rc = MNT_EX_USAGE;
warnx(access(spec, F_OK) == 0 ?
_("%s: not mounted") :
_("%s: not found"), spec);
return mk_exit_code(cxt, rc); /* error */
if (!mnt_fs_get_srcpath(fs) || !mnt_fs_get_devno(fs))
- errx(MOUNT_EX_USAGE, _("%s: failed to determine source "
+ errx(MNT_EX_USAGE, _("%s: failed to determine source "
"(--all-targets is unsupported on systems with "
"regular mtab file)."), spec);
itr = mnt_new_iter(MNT_ITER_BACKWARD);
if (!itr)
- err(MOUNT_EX_SYSERR, _("libmount iterator allocation failed"));
+ err(MNT_EX_SYSERR, _("libmount iterator allocation failed"));
/* get on @cxt independent mountinfo */
tb = new_mountinfo(cxt);
if (!tb) {
- rc = MOUNT_EX_SOFTWARE;
+ rc = MNT_EX_SOFTWARE;
goto done;
}
else
rc = umount_one_if_mounted(cxt, mnt_fs_get_target(fs));
- if (rc != MOUNT_EX_SUCCESS)
+ if (rc != MNT_EX_SUCCESS)
break;
}
p = canonicalize_path_restricted(path);
if (!p)
- err(MOUNT_EX_USAGE, "%s", path);
+ err(MNT_EX_USAGE, "%s", path);
return p;
}
mnt_init_debug(0);
cxt = mnt_new_context();
if (!cxt)
- err(MOUNT_EX_SYSERR, _("libmount context allocation failed"));
+ err(MNT_EX_SYSERR, _("libmount context allocation failed"));
mnt_context_set_tables_errcb(cxt, table_parser_errcb);
break;
case 'O':
if (mnt_context_set_options_pattern(cxt, optarg))
- err(MOUNT_EX_SYSERR, _("failed to set options pattern"));
+ err(MNT_EX_SYSERR, _("failed to set options pattern"));
break;
case 't':
types = optarg;
print_version();
break;
default:
- errtryhelp(MOUNT_EX_USAGE);
+ errtryhelp(MNT_EX_USAGE);
}
}