7 |
* |
* |
8 |
* Licensed under GPL version 2, see file LICENSE in this tarball for details. |
* Licensed under GPL version 2, see file LICENSE in this tarball for details. |
9 |
*/ |
*/ |
|
|
|
10 |
#include <mntent.h> |
#include <mntent.h> |
11 |
|
#include <sys/mount.h> |
12 |
|
/* Make sure we have all the new mount flags we actually try to use. */ |
13 |
|
#ifndef MS_BIND |
14 |
|
# define MS_BIND (1 << 12) |
15 |
|
#endif |
16 |
|
#ifndef MS_MOVE |
17 |
|
# define MS_MOVE (1 << 13) |
18 |
|
#endif |
19 |
|
#ifndef MS_RECURSIVE |
20 |
|
# define MS_RECURSIVE (1 << 14) |
21 |
|
#endif |
22 |
|
#ifndef MS_SILENT |
23 |
|
# define MS_SILENT (1 << 15) |
24 |
|
#endif |
25 |
|
/* The shared subtree stuff, which went in around 2.6.15. */ |
26 |
|
#ifndef MS_UNBINDABLE |
27 |
|
# define MS_UNBINDABLE (1 << 17) |
28 |
|
#endif |
29 |
|
#ifndef MS_PRIVATE |
30 |
|
# define MS_PRIVATE (1 << 18) |
31 |
|
#endif |
32 |
|
#ifndef MS_SLAVE |
33 |
|
# define MS_SLAVE (1 << 19) |
34 |
|
#endif |
35 |
|
#ifndef MS_SHARED |
36 |
|
# define MS_SHARED (1 << 20) |
37 |
|
#endif |
38 |
|
#ifndef MS_RELATIME |
39 |
|
# define MS_RELATIME (1 << 21) |
40 |
|
#endif |
41 |
#include "libbb.h" |
#include "libbb.h" |
42 |
|
|
43 |
#if defined(__dietlibc__) |
#if defined(__dietlibc__) |
98 |
fp = setmntent(bb_path_mtab_file, "r"); |
fp = setmntent(bb_path_mtab_file, "r"); |
99 |
if (!fp) { |
if (!fp) { |
100 |
if (opt & OPT_ALL) |
if (opt & OPT_ALL) |
101 |
bb_error_msg_and_die("can't open %s", bb_path_mtab_file); |
bb_error_msg_and_die("can't open '%s'", bb_path_mtab_file); |
102 |
} else { |
} else { |
103 |
while (getmntent_r(fp, &me, path, PATH_MAX)) { |
while (getmntent_r(fp, &me, path, PATH_MAX)) { |
104 |
/* Match fstype if passed */ |
/* Match fstype if passed */ |
105 |
if (fstype && match_fstype(&me, fstype)) |
if (!match_fstype(&me, fstype)) |
106 |
continue; |
continue; |
107 |
m = xmalloc(sizeof(struct mtab_list)); |
m = xzalloc(sizeof(*m)); |
108 |
m->next = mtl; |
m->next = mtl; |
109 |
m->device = xstrdup(me.mnt_fsname); |
m->device = xstrdup(me.mnt_fsname); |
110 |
m->dir = xstrdup(me.mnt_dir); |
m->dir = xstrdup(me.mnt_dir); |