1 --- util-linux-2.12p/mount/mount.c.ocfs2 2005-07-12 16:31:16.000000000 +0200
2 +++ util-linux-2.12p/mount/mount.c 2005-07-12 16:31:46.000000000 +0200
7 + * check_special_mountprog()
8 + * If there is a special mount program for this type, exec it.
9 + * returns: 0: no exec was done, 1: exec was done, status has result
13 +check_special_mountprog(const char *spec, const char *node, const char *type, int flags,
14 + char *extra_opts, int *status) {
15 + char mountprog[120];
16 + struct stat statbuf;
19 + if (!external_allowed)
22 + if (type && strlen(type) < 100) {
23 + sprintf(mountprog, "/sbin/mount.%s", type);
24 + if (stat(mountprog, &statbuf) == 0) {
27 + char *oo, *mountargs[10];
32 + oo = fix_opts_string (flags, extra_opts, NULL);
33 + mountargs[i++] = mountprog;
34 + mountargs[i++] = spec;
35 + mountargs[i++] = node;
37 + mountargs[i++] = "-n";
39 + mountargs[i++] = "-v";
41 + mountargs[i++] = "-o";
42 + mountargs[i++] = oo;
44 + mountargs[i] = NULL;
45 + execv(mountprog, mountargs);
46 + exit(1); /* exec failed */
47 + } else if (res != -1) {
50 + *status = (WIFEXITED(st) ? WEXITSTATUS(st) : EX_SYSERR);
54 + error(_("mount: cannot fork: %s"), strerror(errsv));
62 * guess_fstype_and_mount()
63 * Mount a single file system. Guess the type when unknown.
64 * returns: 0: OK, -1: error in errno, 1: other error
68 guess_fstype_and_mount(const char *spec, const char *node, const char **types,
69 - int flags, char *mount_opts) {
70 + int flags, char *mount_opts, int *special, int *status) {
71 struct mountargs args = { spec, node, NULL, flags & ~MS_NOSYS, mount_opts };
75 if (*types && strcasecmp (*types, "auto") == 0)
80 if (!*types && !(flags & MS_REMOUNT)) {
81 *types = guess_fstype(spec);
82 - if (*types && !strcmp(*types, "swap")) {
83 - error(_("%s looks like swapspace - not mounted"), spec);
87 + if (!strcmp(*types, "swap")) {
88 + error(_("%s looks like swapspace - not mounted"), spec);
91 + } else if (check_special_mountprog(spec, node, *types, flags,
92 + mount_opts, status)) {
103 - * check_special_mountprog()
104 - * If there is a special mount program for this type, exec it.
105 - * returns: 0: no exec was done, 1: exec was done, status has result
109 -check_special_mountprog(const char *spec, const char *node, const char *type,
110 - int flags, char *extra_opts, int *status) {
111 - char mountprog[120];
112 - struct stat statbuf;
115 - if (!external_allowed)
118 - if (type && strlen(type) < 100) {
119 - sprintf(mountprog, "/sbin/mount.%s", type);
120 - if (stat(mountprog, &statbuf) == 0) {
123 - const char *oo, *mountargs[10];
128 - oo = fix_opts_string (flags, extra_opts, NULL);
129 - mountargs[i++] = mountprog;
130 - mountargs[i++] = spec;
131 - mountargs[i++] = node;
133 - mountargs[i++] = "-n";
135 - mountargs[i++] = "-v";
137 - mountargs[i++] = "-o";
138 - mountargs[i++] = oo;
140 - mountargs[i] = NULL;
141 - execv(mountprog, (char **) mountargs);
142 - exit(1); /* exec failed */
143 - } else if (res != -1) {
146 - *status = (WIFEXITED(st) ? WEXITSTATUS(st) : EX_SYSERR);
150 - error(_("mount: cannot fork: %s"), strerror(errsv));
159 * Try to mount one file system. When "bg" is 1, this is a retry
160 * in the background. One additional exit code EX_BG is used here.
163 try_mount_one (const char *spec0, const char *node0, const char *types0,
164 const char *opts0, int freq, int pass, int bg, int ro) {
165 - int res = 0, status;
166 + int res = 0, status, special;
167 int mnt5_res = 0; /* only for gcc */
171 block_signals (SIG_BLOCK);
176 mnt5_res = guess_fstype_and_mount (spec, node, &types, flags & ~MS_NOSYS,
178 + mount_opts, &special, &status);
181 + block_signals (SIG_UNBLOCK);
186 if (fake || mnt5_res == 0) {
187 /* Mount succeeded, report this (if verbose) and write mtab entry. */