/* when 0 or -1 is returned, *types contains the type used */
/* when 1 is returned, *types is NULL */
int
-fsprobe_procfsloop_mount( int (*mount_fn)(struct mountargs *),
- struct mountargs *args,
- const char **types)
+fsprobe_procfsloop_mount(int (*mount_fn)(struct mountargs *, int *, int *),
+ struct mountargs *args,
+ const char **types,
+ int *special, int *status)
{
char *files[2] = { ETC_FILESYSTEMS, PROC_FILESYSTEMS };
FILE *procfs;
printf(_("Trying %s\n"), fsname);
fflush(stdout);
}
- if ((*mount_fn) (args) == 0) {
+ if ((*mount_fn) (args, special, status) == 0) {
*types = fsname;
ret = 0;
break;
*opt_speed, *opt_comment, *opt_uhelper;
static int mounted (const char *spec0, const char *node0);
+static int check_special_mountprog(const char *spec, const char *node,
+ const char *type, int flags, char *extra_opts, int *status);
static struct string_opt_map {
char *tag;
static int
do_mount_syscall (struct mountargs *args) {
int flags = args->flags;
- int ret;
if ((flags & MS_MGC_MSK) == 0)
flags |= MS_MGC_VAL;
"filesystemtype: \"%s\", mountflags: %d, data: %s\n",
args->spec, args->node, args->type, flags, (char *) args->data);
- ret = mount (args->spec, args->node, args->type, flags, args->data);
+ return mount (args->spec, args->node, args->type, flags, args->data);
+}
+
+/*
+ * do_mount()
+ * Mount a single file system, possibly invoking an external handler to
+ * do so. Keep track of successes.
+ * returns: 0: OK, -1: error in errno
+ */
+static int
+do_mount (struct mountargs *args, int *special, int *status) {
+ int ret;
+ if (check_special_mountprog(args->spec, args->node, args->type,
+ args->flags, args->data, status)) {
+ *special = 1;
+ ret = 0;
+ } else
+ ret = do_mount_syscall(args);
+
if (ret == 0)
mountcount++;
return ret;
* If there is a special mount program for this type, exec it.
* returns: 0: no exec was done, 1: exec was done, status has result
*/
-
static int
check_special_mountprog(const char *spec, const char *node, const char *type, int flags,
char *extra_opts, int *status) {
setgid(getgid());
oo = fix_opts_string (flags, extra_opts, NULL);
mountargs[i++] = mountprog; /* 1 */
- mountargs[i++] = spec; /* 2 */
- mountargs[i++] = node; /* 3 */
+ mountargs[i++] = (char *) spec; /* 2 */
+ mountargs[i++] = (char *) node; /* 3 */
if (sloppy && strncmp(type, "nfs", 3) == 0)
mountargs[i++] = "-s"; /* 4 */
if (fake)
error(_("%s looks like swapspace - not mounted"), spec);
*types = NULL;
return 1;
- } else if (check_special_mountprog(spec, node, *types, flags,
- mount_opts, status)) {
- *special = 1;
- return 0;
+ } else {
+ args.type = *types;
+ return do_mount (&args, special, status);
}
}
}
while((p = index(t,',')) != NULL) {
*p = 0;
args.type = *types = t;
- if(do_mount_syscall (&args) == 0)
+ if (do_mount (&args, special, status) == 0)
return 0;
t = p+1;
}
if (*types || (flags & MS_REMOUNT)) {
args.type = *types;
- return do_mount_syscall (&args);
+ return do_mount (&args, special, status);
}
- return fsprobe_procfsloop_mount(do_mount_syscall, &args, types);
+ return fsprobe_procfsloop_mount(do_mount, &args, types, special, status);
}
/*
if (special) {
block_signals (SIG_UNBLOCK);
- return status;
+ res = status;
+ goto out;
}
}