libmount: add MNT_ERR_MOUNTOPT
Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
parent
10389b1e45
commit
61f5ff6cb4
|
@ -181,8 +181,10 @@ int mnt_context_setup_loopdev(struct libmnt_context *cxt)
|
||||||
if (rc == 0 && (cxt->user_mountflags & MNT_MS_OFFSET) &&
|
if (rc == 0 && (cxt->user_mountflags & MNT_MS_OFFSET) &&
|
||||||
mnt_optstr_get_option(optstr, "offset", &val, &len) == 0) {
|
mnt_optstr_get_option(optstr, "offset", &val, &len) == 0) {
|
||||||
rc = mnt_parse_offset(val, len, &offset);
|
rc = mnt_parse_offset(val, len, &offset);
|
||||||
if (rc)
|
if (rc) {
|
||||||
DBG(CXT, mnt_debug_h(cxt, "failed to parse offset="));
|
DBG(CXT, mnt_debug_h(cxt, "failed to parse offset="));
|
||||||
|
rc = -MNT_ERR_MOUNTOPT;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -191,8 +193,10 @@ int mnt_context_setup_loopdev(struct libmnt_context *cxt)
|
||||||
if (rc == 0 && (cxt->user_mountflags & MNT_MS_SIZELIMIT) &&
|
if (rc == 0 && (cxt->user_mountflags & MNT_MS_SIZELIMIT) &&
|
||||||
mnt_optstr_get_option(optstr, "sizelimit", &val, &len) == 0) {
|
mnt_optstr_get_option(optstr, "sizelimit", &val, &len) == 0) {
|
||||||
rc = mnt_parse_offset(val, len, &sizelimit);
|
rc = mnt_parse_offset(val, len, &sizelimit);
|
||||||
if (rc)
|
if (rc) {
|
||||||
DBG(CXT, mnt_debug_h(cxt, "failed to parse sizelimit="));
|
DBG(CXT, mnt_debug_h(cxt, "failed to parse sizelimit="));
|
||||||
|
rc = -MNT_ERR_MOUNTOPT;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -141,6 +141,9 @@ done:
|
||||||
DBG(CXT, mnt_debug_h(cxt, "fixed options [rc=%d]: "
|
DBG(CXT, mnt_debug_h(cxt, "fixed options [rc=%d]: "
|
||||||
"vfs: '%s' fs: '%s' user: '%s', optstr: '%s'", rc,
|
"vfs: '%s' fs: '%s' user: '%s', optstr: '%s'", rc,
|
||||||
fs->vfs_optstr, fs->fs_optstr, fs->user_optstr, fs->optstr));
|
fs->vfs_optstr, fs->fs_optstr, fs->user_optstr, fs->optstr));
|
||||||
|
|
||||||
|
if (rc)
|
||||||
|
rc = -MNT_ERR_MOUNTOPT;
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -127,6 +127,7 @@ enum {
|
||||||
#define MNT_ERR_NOFSTYPE 5001 /* failed to detect filesystem type */
|
#define MNT_ERR_NOFSTYPE 5001 /* failed to detect filesystem type */
|
||||||
#define MNT_ERR_NOSOURCE 5002 /* required mount source undefined */
|
#define MNT_ERR_NOSOURCE 5002 /* required mount source undefined */
|
||||||
#define MNT_ERR_LOOPDEV 5003 /* loopdev setup failed, errno set by libc */
|
#define MNT_ERR_LOOPDEV 5003 /* loopdev setup failed, errno set by libc */
|
||||||
|
#define MNT_ERR_MOUNTOPT 5004 /* failed to parse/use userspace mount options */
|
||||||
|
|
||||||
/* init.c */
|
/* init.c */
|
||||||
extern void mnt_init_debug(int mask);
|
extern void mnt_init_debug(int mask);
|
||||||
|
|
|
@ -539,6 +539,7 @@ int mnt_get_uid(const char *username, uid_t *uid)
|
||||||
} else {
|
} else {
|
||||||
DBG(UTILS, mnt_debug(
|
DBG(UTILS, mnt_debug(
|
||||||
"cannot convert '%s' username to UID", username));
|
"cannot convert '%s' username to UID", username));
|
||||||
|
rc = errno ? -errno : -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
free(buf);
|
free(buf);
|
||||||
|
@ -566,6 +567,7 @@ int mnt_get_gid(const char *groupname, gid_t *gid)
|
||||||
} else {
|
} else {
|
||||||
DBG(UTILS, mnt_debug(
|
DBG(UTILS, mnt_debug(
|
||||||
"cannot convert '%s' groupname to GID", groupname));
|
"cannot convert '%s' groupname to GID", groupname));
|
||||||
|
rc = errno ? -errno : -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
free(buf);
|
free(buf);
|
||||||
|
|
|
@ -367,6 +367,12 @@ try_readonly:
|
||||||
else
|
else
|
||||||
warnx(_("mount source not defined"));
|
warnx(_("mount source not defined"));
|
||||||
return MOUNT_EX_USAGE;
|
return MOUNT_EX_USAGE;
|
||||||
|
case -MNT_ERR_MOUNTOPT:
|
||||||
|
if (errno)
|
||||||
|
warn(_("failed to parse mount options"));
|
||||||
|
else
|
||||||
|
warnx(_("failed to parse mount options"));
|
||||||
|
return MOUNT_EX_USAGE;
|
||||||
case -MNT_ERR_LOOPDEV:
|
case -MNT_ERR_LOOPDEV:
|
||||||
if (errno == ENOENT
|
if (errno == ENOENT
|
||||||
&& (uflags & MNT_MS_ENCRYPTION)
|
&& (uflags & MNT_MS_ENCRYPTION)
|
||||||
|
|
Loading…
Reference in New Issue