/* * mnt_context_helper_setopt() backend. * * This function applies umount.type command line option (for example parsed * by getopt() or getopt_long()) to @cxt. All unknown options are ignored and * then 1 is returned. * * Returns: negative number on error, 1 if @c is unknown option, 0 on success. */ int mnt_context_umount_setopt(struct libmnt_context *cxt, int c, char *arg) { int rc = -EINVAL; assert(cxt); assert(cxt->action == MNT_ACT_UMOUNT); switch(c) { case 'n': rc = mnt_context_disable_mtab(cxt, TRUE); break; case 'l': rc = mnt_context_enable_lazy(cxt, TRUE); break; case 'f': rc = mnt_context_enable_force(cxt, TRUE); break; case 'v': rc = mnt_context_enable_verbose(cxt, TRUE); break; case 'r': rc = mnt_context_enable_rdonly_umount(cxt, TRUE); break; case 't': if (arg) rc = mnt_context_set_fstype(cxt, arg); break; default: return 1; break; } return rc; }
/* * mnt_context_helper_setopt() backend * * This function applies mount.type command line option (for example parsed * by getopt() or getopt_long()) to @cxt. All unknown options are ignored and * then 1 is returned. * * Returns: negative number on error, 1 if @c is unknown option, 0 on success. */ int mnt_context_mount_setopt(struct libmnt_context *cxt, int c, char *arg) { int rc = -EINVAL; assert(cxt); assert(cxt->action == MNT_ACT_MOUNT); switch(c) { case 'f': rc = mnt_context_enable_fake(cxt, TRUE); break; case 'n': rc = mnt_context_disable_mtab(cxt, TRUE); break; case 'r': rc = mnt_context_append_options(cxt, "ro"); break; case 'v': rc = mnt_context_enable_verbose(cxt, TRUE); break; case 'w': rc = mnt_context_append_options(cxt, "rw"); break; case 'o': if (arg) rc = mnt_context_append_options(cxt, arg); break; case 's': rc = mnt_context_enable_sloppy(cxt, TRUE); break; case 't': if (arg) rc = mnt_context_set_fstype(cxt, arg); break; default: return 1; break; } return rc; }