diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2015-12-30 20:11:34 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2015-12-30 20:11:34 +0100 |
commit | 911d265faf34c90158f5ba0ef81d1d558ec595e6 (patch) | |
tree | 964f68fc509436203e49de5c4fad1cf142759a73 | |
parent | ce4bc1ed048233e89ee4cb95830bf6f01d523d1e (diff) | |
download | busybox-w32-911d265faf34c90158f5ba0ef81d1d558ec595e6.tar.gz busybox-w32-911d265faf34c90158f5ba0ef81d1d558ec595e6.tar.bz2 busybox-w32-911d265faf34c90158f5ba0ef81d1d558ec595e6.zip |
mount: support "nofail" option. Closes 8551
function old new delta
singlemount 1045 1060 +15
mount_option_str 338 345 +7
mount_it_now 355 361 +6
mount_options 172 176 +4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/0 up/down: 32/0) Total: 32 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | util-linux/mount.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/util-linux/mount.c b/util-linux/mount.c index cb40c802d..c428f5827 100644 --- a/util-linux/mount.c +++ b/util-linux/mount.c | |||
@@ -259,9 +259,11 @@ static struct mntent *getmntent_r(FILE* stream, struct mntent* result, | |||
259 | 259 | ||
260 | // Not real flags, but we want to be able to check for this. | 260 | // Not real flags, but we want to be able to check for this. |
261 | enum { | 261 | enum { |
262 | MOUNT_USERS = (1 << 28) * ENABLE_DESKTOP, | 262 | MOUNT_USERS = (1 << 27) * ENABLE_DESKTOP, |
263 | MOUNT_NOFAIL = (1 << 28) * ENABLE_DESKTOP, | ||
263 | MOUNT_NOAUTO = (1 << 29), | 264 | MOUNT_NOAUTO = (1 << 29), |
264 | MOUNT_SWAP = (1 << 30), | 265 | MOUNT_SWAP = (1 << 30), |
266 | MOUNT_FAKEFLAGS = MOUNT_USERS | MOUNT_NOFAIL | MOUNT_NOAUTO | MOUNT_SWAP | ||
265 | }; | 267 | }; |
266 | 268 | ||
267 | 269 | ||
@@ -326,6 +328,7 @@ static const int32_t mount_options[] = { | |||
326 | /* "swap" */ MOUNT_SWAP, | 328 | /* "swap" */ MOUNT_SWAP, |
327 | IF_DESKTOP(/* "user" */ MOUNT_USERS,) | 329 | IF_DESKTOP(/* "user" */ MOUNT_USERS,) |
328 | IF_DESKTOP(/* "users" */ MOUNT_USERS,) | 330 | IF_DESKTOP(/* "users" */ MOUNT_USERS,) |
331 | IF_DESKTOP(/* "nofail" */ MOUNT_NOFAIL,) | ||
329 | /* "_netdev" */ 0, | 332 | /* "_netdev" */ 0, |
330 | IF_DESKTOP(/* "comment=" */ 0,) /* systemd uses this in fstab */ | 333 | IF_DESKTOP(/* "comment=" */ 0,) /* systemd uses this in fstab */ |
331 | ) | 334 | ) |
@@ -385,6 +388,7 @@ static const char mount_option_str[] = | |||
385 | "swap\0" | 388 | "swap\0" |
386 | IF_DESKTOP("user\0") | 389 | IF_DESKTOP("user\0") |
387 | IF_DESKTOP("users\0") | 390 | IF_DESKTOP("users\0") |
391 | IF_DESKTOP("nofail\0") | ||
388 | "_netdev\0" | 392 | "_netdev\0" |
389 | IF_DESKTOP("comment=\0") /* systemd uses this in fstab */ | 393 | IF_DESKTOP("comment=\0") /* systemd uses this in fstab */ |
390 | ) | 394 | ) |
@@ -672,6 +676,8 @@ static int mount_it_now(struct mntent *mp, unsigned long vfsflags, char *filtero | |||
672 | { | 676 | { |
673 | int rc = 0; | 677 | int rc = 0; |
674 | 678 | ||
679 | vfsflags &= ~(unsigned long)MOUNT_FAKEFLAGS; | ||
680 | |||
675 | if (FAKE_IT) { | 681 | if (FAKE_IT) { |
676 | if (verbose >= 2) | 682 | if (verbose >= 2) |
677 | bb_error_msg("would do mount('%s','%s','%s',0x%08lx,'%s')", | 683 | bb_error_msg("would do mount('%s','%s','%s',0x%08lx,'%s')", |
@@ -2061,6 +2067,8 @@ static int singlemount(struct mntent *mp, int ignore_busy) | |||
2061 | 2067 | ||
2062 | if (errno == EBUSY && ignore_busy) | 2068 | if (errno == EBUSY && ignore_busy) |
2063 | return 0; | 2069 | return 0; |
2070 | if (errno == ENOENT && (vfsflags & MOUNT_NOFAIL)) | ||
2071 | return 0; | ||
2064 | if (rc != 0) | 2072 | if (rc != 0) |
2065 | bb_perror_msg("mounting %s on %s failed", mp->mnt_fsname, mp->mnt_dir); | 2073 | bb_perror_msg("mounting %s on %s failed", mp->mnt_fsname, mp->mnt_dir); |
2066 | return rc; | 2074 | return rc; |