diff options
Diffstat (limited to 'util-linux')
| -rw-r--r-- | util-linux/mount.c | 32 | ||||
| -rw-r--r-- | util-linux/umount.c | 14 |
2 files changed, 23 insertions, 23 deletions
diff --git a/util-linux/mount.c b/util-linux/mount.c index 755a3fb13..ae4417cb8 100644 --- a/util-linux/mount.c +++ b/util-linux/mount.c | |||
| @@ -127,7 +127,7 @@ do_mount(char *specialfile, char *dir, char *filesystemtype, | |||
| 127 | char *lofile = NULL; | 127 | char *lofile = NULL; |
| 128 | #endif | 128 | #endif |
| 129 | 129 | ||
| 130 | if (fakeIt == FALSE) | 130 | if (! fakeIt) |
| 131 | { | 131 | { |
| 132 | #if defined CONFIG_FEATURE_MOUNT_LOOP | 132 | #if defined CONFIG_FEATURE_MOUNT_LOOP |
| 133 | if (use_loop==TRUE) { | 133 | if (use_loop==TRUE) { |
| @@ -163,7 +163,7 @@ do_mount(char *specialfile, char *dir, char *filesystemtype, | |||
| 163 | if (status == 0 || fakeIt==TRUE) { | 163 | if (status == 0 || fakeIt==TRUE) { |
| 164 | 164 | ||
| 165 | #if defined CONFIG_FEATURE_MTAB_SUPPORT | 165 | #if defined CONFIG_FEATURE_MTAB_SUPPORT |
| 166 | if (useMtab == TRUE) { | 166 | if (useMtab) { |
| 167 | erase_mtab(specialfile); // Clean any stale entries | 167 | erase_mtab(specialfile); // Clean any stale entries |
| 168 | write_mtab(specialfile, dir, filesystemtype, flags, mtab_opts); | 168 | write_mtab(specialfile, dir, filesystemtype, flags, mtab_opts); |
| 169 | } | 169 | } |
| @@ -210,19 +210,19 @@ parse_mount_options(char *options, int *flags, char *strflags) | |||
| 210 | f++; | 210 | f++; |
| 211 | } | 211 | } |
| 212 | #if defined CONFIG_FEATURE_MOUNT_LOOP | 212 | #if defined CONFIG_FEATURE_MOUNT_LOOP |
| 213 | if (gotone == FALSE && !strcasecmp("loop", options)) { /* loop device support */ | 213 | if (! gotone && !strcasecmp("loop", options)) { /* loop device support */ |
| 214 | use_loop = TRUE; | 214 | use_loop = TRUE; |
| 215 | gotone = TRUE; | 215 | gotone = TRUE; |
| 216 | } | 216 | } |
| 217 | #endif | 217 | #endif |
| 218 | if (*strflags && strflags != '\0' && gotone == FALSE) { | 218 | if (*strflags && strflags != '\0' && ! gotone) { |
| 219 | char *temp = strflags; | 219 | char *temp = strflags; |
| 220 | 220 | ||
| 221 | temp += strlen(strflags); | 221 | temp += strlen(strflags); |
| 222 | *temp++ = ','; | 222 | *temp++ = ','; |
| 223 | *temp++ = '\0'; | 223 | *temp++ = '\0'; |
| 224 | } | 224 | } |
| 225 | if (gotone == FALSE) | 225 | if (! gotone) |
| 226 | strcat(strflags, options); | 226 | strcat(strflags, options); |
| 227 | if (comma) { | 227 | if (comma) { |
| 228 | *comma = ','; | 228 | *comma = ','; |
| @@ -261,7 +261,7 @@ mount_one(char *blockDevice, char *directory, char *filesystemType, | |||
| 261 | status = do_mount(blockDevice, directory, filesystemType, | 261 | status = do_mount(blockDevice, directory, filesystemType, |
| 262 | flags | MS_MGC_VAL, string_flags, | 262 | flags | MS_MGC_VAL, string_flags, |
| 263 | useMtab, fakeIt, mtab_opts, mount_all); | 263 | useMtab, fakeIt, mtab_opts, mount_all); |
| 264 | if (status == TRUE) | 264 | if (status) |
| 265 | break; | 265 | break; |
| 266 | } | 266 | } |
| 267 | } | 267 | } |
| @@ -286,7 +286,7 @@ mount_one(char *blockDevice, char *directory, char *filesystemType, | |||
| 286 | status = do_mount(blockDevice, directory, filesystemType, | 286 | status = do_mount(blockDevice, directory, filesystemType, |
| 287 | flags | MS_MGC_VAL, string_flags, | 287 | flags | MS_MGC_VAL, string_flags, |
| 288 | useMtab, fakeIt, mtab_opts, mount_all); | 288 | useMtab, fakeIt, mtab_opts, mount_all); |
| 289 | if (status == TRUE) | 289 | if (status) |
| 290 | break; | 290 | break; |
| 291 | } | 291 | } |
| 292 | } | 292 | } |
| @@ -299,8 +299,8 @@ mount_one(char *blockDevice, char *directory, char *filesystemType, | |||
| 299 | fakeIt, mtab_opts, mount_all); | 299 | fakeIt, mtab_opts, mount_all); |
| 300 | } | 300 | } |
| 301 | 301 | ||
| 302 | if (status == FALSE) { | 302 | if (! status) { |
| 303 | if (whineOnErrors == TRUE) { | 303 | if (whineOnErrors) { |
| 304 | perror_msg("Mounting %s on %s failed", blockDevice, directory); | 304 | perror_msg("Mounting %s on %s failed", blockDevice, directory); |
| 305 | } | 305 | } |
| 306 | return (FALSE); | 306 | return (FALSE); |
| @@ -433,7 +433,7 @@ extern int mount_main(int argc, char **argv) | |||
| 433 | if (optind + 1 < argc) | 433 | if (optind + 1 < argc) |
| 434 | directory = simplify_path(argv[optind + 1]); | 434 | directory = simplify_path(argv[optind + 1]); |
| 435 | 435 | ||
| 436 | if (all == TRUE || optind + 1 == argc) { | 436 | if (all || optind + 1 == argc) { |
| 437 | struct mntent *m = NULL; | 437 | struct mntent *m = NULL; |
| 438 | FILE *f = setmntent("/etc/fstab", "r"); | 438 | FILE *f = setmntent("/etc/fstab", "r"); |
| 439 | fstabmount = TRUE; | 439 | fstabmount = TRUE; |
| @@ -442,20 +442,20 @@ extern int mount_main(int argc, char **argv) | |||
| 442 | perror_msg_and_die( "\nCannot read /etc/fstab"); | 442 | perror_msg_and_die( "\nCannot read /etc/fstab"); |
| 443 | 443 | ||
| 444 | while ((m = getmntent(f)) != NULL) { | 444 | while ((m = getmntent(f)) != NULL) { |
| 445 | if (all == FALSE && optind + 1 == argc && ( | 445 | if (! all && optind + 1 == argc && ( |
| 446 | (strcmp(device, m->mnt_fsname) != 0) && | 446 | (strcmp(device, m->mnt_fsname) != 0) && |
| 447 | (strcmp(device, m->mnt_dir) != 0) ) ) { | 447 | (strcmp(device, m->mnt_dir) != 0) ) ) { |
| 448 | continue; | 448 | continue; |
| 449 | } | 449 | } |
| 450 | 450 | ||
| 451 | if (all == TRUE && ( // If we're mounting 'all' | 451 | if (all && ( // If we're mounting 'all' |
| 452 | (strstr(m->mnt_opts, "noauto")) || // and the file system isn't noauto, | 452 | (strstr(m->mnt_opts, "noauto")) || // and the file system isn't noauto, |
| 453 | (strstr(m->mnt_type, "swap")) || // and isn't swap or nfs, then mount it | 453 | (strstr(m->mnt_type, "swap")) || // and isn't swap or nfs, then mount it |
| 454 | (strstr(m->mnt_type, "nfs")) ) ) { | 454 | (strstr(m->mnt_type, "nfs")) ) ) { |
| 455 | continue; | 455 | continue; |
| 456 | } | 456 | } |
| 457 | 457 | ||
| 458 | if (all == TRUE || flags == 0) { // Allow single mount to override fstab flags | 458 | if (all || flags == 0) { // Allow single mount to override fstab flags |
| 459 | flags = 0; | 459 | flags = 0; |
| 460 | string_flags = string_flags_buf; | 460 | string_flags = string_flags_buf; |
| 461 | *string_flags = '\0'; | 461 | *string_flags = '\0'; |
| @@ -483,13 +483,13 @@ singlemount: | |||
| 483 | string_flags, useMtab, fakeIt, extra_opts, TRUE, all)) | 483 | string_flags, useMtab, fakeIt, extra_opts, TRUE, all)) |
| 484 | rc = EXIT_FAILURE; | 484 | rc = EXIT_FAILURE; |
| 485 | 485 | ||
| 486 | if (all == FALSE) | 486 | if (! all) |
| 487 | break; | 487 | break; |
| 488 | } | 488 | } |
| 489 | if (fstabmount == TRUE) | 489 | if (fstabmount) |
| 490 | endmntent(f); | 490 | endmntent(f); |
| 491 | 491 | ||
| 492 | if (all == FALSE && fstabmount == TRUE && m == NULL) | 492 | if (! all && fstabmount && m == NULL) |
| 493 | fprintf(stderr, "Can't find %s in /etc/fstab\n", device); | 493 | fprintf(stderr, "Can't find %s in /etc/fstab\n", device); |
| 494 | 494 | ||
| 495 | return rc; | 495 | return rc; |
diff --git a/util-linux/umount.c b/util-linux/umount.c index 99db3084c..29e2e3b66 100644 --- a/util-linux/umount.c +++ b/util-linux/umount.c | |||
| @@ -179,19 +179,19 @@ static int do_umount(const char *name) | |||
| 179 | status = umount(name); | 179 | status = umount(name); |
| 180 | 180 | ||
| 181 | #if defined CONFIG_FEATURE_MOUNT_LOOP | 181 | #if defined CONFIG_FEATURE_MOUNT_LOOP |
| 182 | if (freeLoop == TRUE && blockDevice != NULL && !strncmp("/dev/loop", blockDevice, 9)) | 182 | if (freeLoop && blockDevice != NULL && !strncmp("/dev/loop", blockDevice, 9)) |
| 183 | /* this was a loop device, delete it */ | 183 | /* this was a loop device, delete it */ |
| 184 | del_loop(blockDevice); | 184 | del_loop(blockDevice); |
| 185 | #endif | 185 | #endif |
| 186 | #if defined CONFIG_FEATURE_MOUNT_FORCE | 186 | #if defined CONFIG_FEATURE_MOUNT_FORCE |
| 187 | if (status != 0 && doForce == TRUE) { | 187 | if (status != 0 && doForce) { |
| 188 | status = umount2(blockDevice, MNT_FORCE); | 188 | status = umount2(blockDevice, MNT_FORCE); |
| 189 | if (status != 0) { | 189 | if (status != 0) { |
| 190 | error_msg_and_die("forced umount of %s failed!", blockDevice); | 190 | error_msg_and_die("forced umount of %s failed!", blockDevice); |
| 191 | } | 191 | } |
| 192 | } | 192 | } |
| 193 | #endif | 193 | #endif |
| 194 | if (status != 0 && doRemount == TRUE && errno == EBUSY) { | 194 | if (status != 0 && doRemount && errno == EBUSY) { |
| 195 | status = mount(blockDevice, name, NULL, | 195 | status = mount(blockDevice, name, NULL, |
| 196 | MS_MGC_VAL | MS_REMOUNT | MS_RDONLY, NULL); | 196 | MS_MGC_VAL | MS_REMOUNT | MS_RDONLY, NULL); |
| 197 | if (status == 0) { | 197 | if (status == 0) { |
| @@ -202,7 +202,7 @@ static int do_umount(const char *name) | |||
| 202 | } | 202 | } |
| 203 | if (status == 0) { | 203 | if (status == 0) { |
| 204 | #if defined CONFIG_FEATURE_MTAB_SUPPORT | 204 | #if defined CONFIG_FEATURE_MTAB_SUPPORT |
| 205 | if (useMtab == TRUE) | 205 | if (useMtab) |
| 206 | erase_mtab(name); | 206 | erase_mtab(name); |
| 207 | #endif | 207 | #endif |
| 208 | return (TRUE); | 208 | return (TRUE); |
| @@ -282,15 +282,15 @@ extern int umount_main(int argc, char **argv) | |||
| 282 | } | 282 | } |
| 283 | 283 | ||
| 284 | mtab_read(); | 284 | mtab_read(); |
| 285 | if (umountAll == TRUE) { | 285 | if (umountAll) { |
| 286 | if (umount_all() == TRUE) | 286 | if (umount_all()) |
| 287 | return EXIT_SUCCESS; | 287 | return EXIT_SUCCESS; |
| 288 | else | 288 | else |
| 289 | return EXIT_FAILURE; | 289 | return EXIT_FAILURE; |
| 290 | } | 290 | } |
| 291 | if (realpath(*argv, path) == NULL) | 291 | if (realpath(*argv, path) == NULL) |
| 292 | perror_msg_and_die("%s", path); | 292 | perror_msg_and_die("%s", path); |
| 293 | if (do_umount(path) == TRUE) | 293 | if (do_umount(path)) |
| 294 | return EXIT_SUCCESS; | 294 | return EXIT_SUCCESS; |
| 295 | perror_msg_and_die("%s", *argv); | 295 | perror_msg_and_die("%s", *argv); |
| 296 | } | 296 | } |
