diff options
author | Erik Andersen <andersen@codepoet.org> | 2000-05-05 19:49:33 +0000 |
---|---|---|
committer | Erik Andersen <andersen@codepoet.org> | 2000-05-05 19:49:33 +0000 |
commit | 6c5f2c602174c7fe0830a1fc4fe5b3dde5ed7068 (patch) | |
tree | e5b0d03dee3ca473422d617ce6985d60f0985c04 /util-linux | |
parent | 9b15e50835dba5b9c86df2cfa89aa8d8ce67cb4a (diff) | |
download | busybox-w32-6c5f2c602174c7fe0830a1fc4fe5b3dde5ed7068.tar.gz busybox-w32-6c5f2c602174c7fe0830a1fc4fe5b3dde5ed7068.tar.bz2 busybox-w32-6c5f2c602174c7fe0830a1fc4fe5b3dde5ed7068.zip |
Add support for "noatime" and "nodiratime" mount flags to mount.
Change umount "-f" to mean force, and actually use umount2.
Change umount "-l" to mean "Do not free loop device".
Updates docs accordingly.
-Erik
Diffstat (limited to 'util-linux')
-rw-r--r-- | util-linux/mount.c | 32 | ||||
-rw-r--r-- | util-linux/umount.c | 24 |
2 files changed, 40 insertions, 16 deletions
diff --git a/util-linux/mount.c b/util-linux/mount.c index 456e45235..00a774a53 100644 --- a/util-linux/mount.c +++ b/util-linux/mount.c | |||
@@ -66,26 +66,28 @@ extern const char mtab_file[]; /* Defined in utility.c */ | |||
66 | 66 | ||
67 | static const char mount_usage[] = "\tmount [flags]\n" | 67 | static const char mount_usage[] = "\tmount [flags]\n" |
68 | "\tmount [flags] device directory [-o options,more-options]\n" | 68 | "\tmount [flags] device directory [-o options,more-options]\n" |
69 | "\n" "Flags:\n" "\t-a:\tMount all file systems in fstab.\n" | 69 | "\n" "Flags:\n" |
70 | "\t-a:\t\tMount all file systems in fstab.\n" | ||
70 | #ifdef BB_MTAB | 71 | #ifdef BB_MTAB |
71 | "\t-f:\t\"Fake\" mount. Add entry to mount table but don't mount it.\n" | 72 | "\t-f:\t\t\"Fake\" mount. Add entry to mount table but don't mount it.\n" |
72 | "\t-n:\tDon't write a mount table entry.\n" | 73 | "\t-n:\t\tDon't write a mount table entry.\n" |
73 | #endif | 74 | #endif |
74 | "\t-o option:\tOne of many filesystem options, listed below.\n" | 75 | "\t-o option:\tOne of many filesystem options, listed below.\n" |
75 | "\t-r:\tMount the filesystem read-only.\n" | 76 | "\t-r:\t\tMount the filesystem read-only.\n" |
76 | "\t-t filesystem-type:\tSpecify the filesystem type.\n" | 77 | "\t-t fs-type:\tSpecify the filesystem type.\n" |
77 | "\t-w:\tMount for reading and writing (default).\n" | 78 | "\t-w:\t\tMount for reading and writing (default).\n" |
78 | "\n" | 79 | "\n" |
79 | "Options for use with the \"-o\" flag:\n" | 80 | "Options for use with the \"-o\" flag:\n" |
80 | "\tasync / sync:\tWrites are asynchronous / synchronous.\n" | 81 | "\tasync/sync:\tWrites are asynchronous / synchronous.\n" |
81 | "\tdev / nodev:\tAllow use of special device files / disallow them.\n" | 82 | "\tatime/noatime:\tEnable / disable updates to inode access times.\n" |
82 | "\texec / noexec:\tAllow use of executable files / disallow them.\n" | 83 | "\tdev/nodev:\tAllow use of special device files / disallow them.\n" |
84 | "\texec/noexec:\tAllow use of executable files / disallow them.\n" | ||
83 | #if defined BB_FEATURE_MOUNT_LOOP | 85 | #if defined BB_FEATURE_MOUNT_LOOP |
84 | "\tloop: Mounts a file via loop device.\n" | 86 | "\tloop:\t\tMounts a file via loop device.\n" |
85 | #endif | 87 | #endif |
86 | "\tsuid / nosuid:\tAllow set-user-id-root programs / disallow them.\n" | 88 | "\tsuid/nosuid:\tAllow set-user-id-root programs / disallow them.\n" |
87 | "\tremount: Re-mount a currently-mounted filesystem, changing its flags.\n" | 89 | "\tremount:\tRe-mount a currently-mounted filesystem, changing its flags.\n" |
88 | "\tro / rw: Mount for read-only / read-write.\n" | 90 | "\tro/rw:\t\tMount for read-only / read-write.\n" |
89 | "There are EVEN MORE flags that are specific to each filesystem.\n" | 91 | "There are EVEN MORE flags that are specific to each filesystem.\n" |
90 | "You'll have to see the written documentation for those.\n"; | 92 | "You'll have to see the written documentation for those.\n"; |
91 | 93 | ||
@@ -98,10 +100,14 @@ struct mount_options { | |||
98 | 100 | ||
99 | static const struct mount_options mount_options[] = { | 101 | static const struct mount_options mount_options[] = { |
100 | {"async", ~MS_SYNCHRONOUS, 0}, | 102 | {"async", ~MS_SYNCHRONOUS, 0}, |
103 | {"atime", ~0, ~MS_NOATIME}, | ||
101 | {"defaults", ~0, 0}, | 104 | {"defaults", ~0, 0}, |
102 | {"dev", ~MS_NODEV, 0}, | 105 | {"dev", ~MS_NODEV, 0}, |
106 | {"diratime", ~0, ~MS_NODIRATIME}, | ||
103 | {"exec", ~MS_NOEXEC, 0}, | 107 | {"exec", ~MS_NOEXEC, 0}, |
108 | {"noatime", ~0, MS_NOATIME}, | ||
104 | {"nodev", ~0, MS_NODEV}, | 109 | {"nodev", ~0, MS_NODEV}, |
110 | {"nodiratime", ~0, MS_NODIRATIME}, | ||
105 | {"noexec", ~0, MS_NOEXEC}, | 111 | {"noexec", ~0, MS_NOEXEC}, |
106 | {"nosuid", ~0, MS_NOSUID}, | 112 | {"nosuid", ~0, MS_NOSUID}, |
107 | {"remount", ~0, MS_REMOUNT}, | 113 | {"remount", ~0, MS_REMOUNT}, |
diff --git a/util-linux/umount.c b/util-linux/umount.c index ad7de2d20..18a5afe80 100644 --- a/util-linux/umount.c +++ b/util-linux/umount.c | |||
@@ -38,8 +38,11 @@ static const char umount_usage[] = | |||
38 | "\n" | 38 | "\n" |
39 | #endif | 39 | #endif |
40 | "\t-r:\tTry to remount devices as read-only if mount is busy\n" | 40 | "\t-r:\tTry to remount devices as read-only if mount is busy\n" |
41 | #if defined BB_FEATURE_MOUNT_FORCE | ||
42 | "\t-f:\tForce filesystem umount (i.e. unreachable NFS server)\n" | ||
43 | #endif | ||
41 | #if defined BB_FEATURE_MOUNT_LOOP | 44 | #if defined BB_FEATURE_MOUNT_LOOP |
42 | "\t-f:\tDo not free loop device (if a loop device has been used)\n" | 45 | "\t-l:\tDo not free loop device (if a loop device has been used)\n" |
43 | #endif | 46 | #endif |
44 | ; | 47 | ; |
45 | 48 | ||
@@ -53,6 +56,9 @@ static struct _mtab_entry_t *mtab_cache = NULL; | |||
53 | 56 | ||
54 | 57 | ||
55 | 58 | ||
59 | #if defined BB_FEATURE_MOUNT_FORCE | ||
60 | static int doForce = FALSE; | ||
61 | #endif | ||
56 | #if defined BB_FEATURE_MOUNT_LOOP | 62 | #if defined BB_FEATURE_MOUNT_LOOP |
57 | static int freeLoop = TRUE; | 63 | static int freeLoop = TRUE; |
58 | #endif | 64 | #endif |
@@ -176,13 +182,20 @@ static int do_umount(const char *name, int useMtab) | |||
176 | /* this was a loop device, delete it */ | 182 | /* this was a loop device, delete it */ |
177 | del_loop(blockDevice); | 183 | del_loop(blockDevice); |
178 | #endif | 184 | #endif |
185 | #if defined BB_FEATURE_MOUNT_FORCE | ||
186 | if (status != 0 && doForce == TRUE) { | ||
187 | status = umount2(blockDevice, MNT_FORCE); | ||
188 | if (status != 0) { | ||
189 | fatalError("umount: forced umount of %s failed!\n", blockDevice); | ||
190 | } | ||
191 | } | ||
192 | #endif | ||
179 | if (status != 0 && doRemount == TRUE && errno == EBUSY) { | 193 | if (status != 0 && doRemount == TRUE && errno == EBUSY) { |
180 | status = mount(blockDevice, name, NULL, | 194 | status = mount(blockDevice, name, NULL, |
181 | MS_MGC_VAL | MS_REMOUNT | MS_RDONLY, NULL); | 195 | MS_MGC_VAL | MS_REMOUNT | MS_RDONLY, NULL); |
182 | if (status == 0) { | 196 | if (status == 0) { |
183 | fprintf(stderr, "umount: %s busy - remounted read-only\n", | 197 | fprintf(stderr, "umount: %s busy - remounted read-only\n", |
184 | blockDevice); | 198 | blockDevice); |
185 | /* TODO: update mtab if BB_MTAB is defined */ | ||
186 | } else { | 199 | } else { |
187 | fprintf(stderr, "umount: Cannot remount %s read-only\n", | 200 | fprintf(stderr, "umount: Cannot remount %s read-only\n", |
188 | blockDevice); | 201 | blockDevice); |
@@ -240,7 +253,7 @@ extern int umount_main(int argc, char **argv) | |||
240 | umountAll = TRUE; | 253 | umountAll = TRUE; |
241 | break; | 254 | break; |
242 | #if defined BB_FEATURE_MOUNT_LOOP | 255 | #if defined BB_FEATURE_MOUNT_LOOP |
243 | case 'f': | 256 | case 'l': |
244 | freeLoop = FALSE; | 257 | freeLoop = FALSE; |
245 | break; | 258 | break; |
246 | #endif | 259 | #endif |
@@ -249,6 +262,11 @@ extern int umount_main(int argc, char **argv) | |||
249 | useMtab = FALSE; | 262 | useMtab = FALSE; |
250 | break; | 263 | break; |
251 | #endif | 264 | #endif |
265 | #ifdef BB_FEATURE_MOUNT_FORCE | ||
266 | case 'f': | ||
267 | doForce = TRUE; | ||
268 | break; | ||
269 | #endif | ||
252 | case 'r': | 270 | case 'r': |
253 | doRemount = TRUE; | 271 | doRemount = TRUE; |
254 | break; | 272 | break; |