diff options
| author | Ron Yorston <rmy@pobox.com> | 2014-01-06 12:15:28 +0000 |
|---|---|---|
| committer | Ron Yorston <rmy@pobox.com> | 2014-01-06 12:15:28 +0000 |
| commit | efa0cd7dd196cffdd253417ab6a06271fd655abf (patch) | |
| tree | 37ce49f767bda54bf38e9ca4f4d32374a84ab8aa /coreutils | |
| parent | 81d958ea6cc8ce98b69148896ebced6458a9715a (diff) | |
| download | busybox-w32-efa0cd7dd196cffdd253417ab6a06271fd655abf.tar.gz busybox-w32-efa0cd7dd196cffdd253417ab6a06271fd655abf.tar.bz2 busybox-w32-efa0cd7dd196cffdd253417ab6a06271fd655abf.zip | |
Remove feature that allows stat -f to be disabled
Diffstat (limited to 'coreutils')
| -rw-r--r-- | coreutils/Config.src | 9 | ||||
| -rw-r--r-- | coreutils/stat.c | 21 |
2 files changed, 4 insertions, 26 deletions
diff --git a/coreutils/Config.src b/coreutils/Config.src index 8e43c38e1..b5701217e 100644 --- a/coreutils/Config.src +++ b/coreutils/Config.src | |||
| @@ -599,15 +599,6 @@ config FEATURE_STAT_FORMAT | |||
| 599 | users can pass a custom format string for output. This adds about | 599 | users can pass a custom format string for output. This adds about |
| 600 | 7k to a nonstatic build on amd64. | 600 | 7k to a nonstatic build on amd64. |
| 601 | 601 | ||
| 602 | config FEATURE_STAT_FILESYSTEM | ||
| 603 | bool "Enable display of filesystem status (-f)" | ||
| 604 | default y | ||
| 605 | depends on STAT | ||
| 606 | select PLATFORM_LINUX # statfs() | ||
| 607 | help | ||
| 608 | Without this, stat will not support the '-f' option to display | ||
| 609 | information about filesystem status. | ||
| 610 | |||
| 611 | config STTY | 602 | config STTY |
| 612 | bool "stty" | 603 | bool "stty" |
| 613 | default y | 604 | default y |
diff --git a/coreutils/stat.c b/coreutils/stat.c index 6cee2ce23..e501fb41d 100644 --- a/coreutils/stat.c +++ b/coreutils/stat.c | |||
| @@ -20,9 +20,7 @@ | |||
| 20 | //usage: IF_FEATURE_STAT_FORMAT( | 20 | //usage: IF_FEATURE_STAT_FORMAT( |
| 21 | //usage: "\n -c fmt Use the specified format" | 21 | //usage: "\n -c fmt Use the specified format" |
| 22 | //usage: ) | 22 | //usage: ) |
| 23 | //usage: IF_FEATURE_STAT_FILESYSTEM( | ||
| 24 | //usage: "\n -f Display filesystem status" | 23 | //usage: "\n -f Display filesystem status" |
| 25 | //usage: ) | ||
| 26 | //usage: "\n -L Follow links" | 24 | //usage: "\n -L Follow links" |
| 27 | //usage: "\n -t Display info in terse form" | 25 | //usage: "\n -t Display info in terse form" |
| 28 | //usage: IF_SELINUX( | 26 | //usage: IF_SELINUX( |
| @@ -56,7 +54,6 @@ | |||
| 56 | //usage: " %Y Time of last modification as seconds since Epoch\n" | 54 | //usage: " %Y Time of last modification as seconds since Epoch\n" |
| 57 | //usage: " %z Time of last change\n" | 55 | //usage: " %z Time of last change\n" |
| 58 | //usage: " %Z Time of last change as seconds since Epoch\n" | 56 | //usage: " %Z Time of last change as seconds since Epoch\n" |
| 59 | //usage: IF_FEATURE_STAT_FILESYSTEM( | ||
| 60 | //usage: "\nValid format sequences for file systems:\n" | 57 | //usage: "\nValid format sequences for file systems:\n" |
| 61 | //usage: " %a Free blocks available to non-superuser\n" | 58 | //usage: " %a Free blocks available to non-superuser\n" |
| 62 | //usage: " %b Total data blocks in file system\n" | 59 | //usage: " %b Total data blocks in file system\n" |
| @@ -74,13 +71,12 @@ | |||
| 74 | //usage: " %t Type in hex\n" | 71 | //usage: " %t Type in hex\n" |
| 75 | //usage: " %T Type in human readable form" | 72 | //usage: " %T Type in human readable form" |
| 76 | //usage: ) | 73 | //usage: ) |
| 77 | //usage: ) | ||
| 78 | 74 | ||
| 79 | #include "libbb.h" | 75 | #include "libbb.h" |
| 80 | 76 | ||
| 81 | #define OPT_TERSE (1 << 0) | 77 | #define OPT_FILESYS (1 << 0) |
| 82 | #define OPT_DEREFERENCE (1 << 1) | 78 | #define OPT_TERSE (1 << 1) |
| 83 | #define OPT_FILESYS (1 << 2) | 79 | #define OPT_DEREFERENCE (1 << 2) |
| 84 | #define OPT_SELINUX (1 << 3) | 80 | #define OPT_SELINUX (1 << 3) |
| 85 | 81 | ||
| 86 | #if ENABLE_FEATURE_STAT_FORMAT | 82 | #if ENABLE_FEATURE_STAT_FORMAT |
| @@ -136,7 +132,6 @@ static const char *human_time(time_t t) | |||
| 136 | #undef buf | 132 | #undef buf |
| 137 | } | 133 | } |
| 138 | 134 | ||
| 139 | #if ENABLE_FEATURE_STAT_FILESYSTEM | ||
| 140 | /* Return the type of the specified file system. | 135 | /* Return the type of the specified file system. |
| 141 | * Some systems have statfvs.f_basetype[FSTYPSZ]. (AIX, HP-UX, and Solaris) | 136 | * Some systems have statfvs.f_basetype[FSTYPSZ]. (AIX, HP-UX, and Solaris) |
| 142 | * Others have statfs.f_fstypename[MFSNAMELEN]. (NetBSD 1.5.2) | 137 | * Others have statfs.f_fstypename[MFSNAMELEN]. (NetBSD 1.5.2) |
| @@ -207,7 +202,6 @@ static unsigned long long get_f_fsid(const struct statfs *statfsbuf) | |||
| 207 | while (--sz > 0); | 202 | while (--sz > 0); |
| 208 | return r; | 203 | return r; |
| 209 | } | 204 | } |
| 210 | #endif /* FEATURE_STAT_FILESYSTEM */ | ||
| 211 | 205 | ||
| 212 | #if ENABLE_FEATURE_STAT_FORMAT | 206 | #if ENABLE_FEATURE_STAT_FORMAT |
| 213 | static void strcatc(char *str, char c) | 207 | static void strcatc(char *str, char c) |
| @@ -223,7 +217,6 @@ static void printfs(char *pformat, const char *msg) | |||
| 223 | printf(pformat, msg); | 217 | printf(pformat, msg); |
| 224 | } | 218 | } |
| 225 | 219 | ||
| 226 | #if ENABLE_FEATURE_STAT_FILESYSTEM | ||
| 227 | /* print statfs info */ | 220 | /* print statfs info */ |
| 228 | static void FAST_FUNC print_statfs(char *pformat, const char m, | 221 | static void FAST_FUNC print_statfs(char *pformat, const char m, |
| 229 | const char *const filename, const void *data | 222 | const char *const filename, const void *data |
| @@ -270,7 +263,6 @@ static void FAST_FUNC print_statfs(char *pformat, const char m, | |||
| 270 | printf(pformat, m); | 263 | printf(pformat, m); |
| 271 | } | 264 | } |
| 272 | } | 265 | } |
| 273 | #endif | ||
| 274 | 266 | ||
| 275 | /* print stat info */ | 267 | /* print stat info */ |
| 276 | static void FAST_FUNC print_stat(char *pformat, const char m, | 268 | static void FAST_FUNC print_stat(char *pformat, const char m, |
| @@ -435,7 +427,6 @@ static void print_it(const char *masterformat, | |||
| 435 | } | 427 | } |
| 436 | #endif /* FEATURE_STAT_FORMAT */ | 428 | #endif /* FEATURE_STAT_FORMAT */ |
| 437 | 429 | ||
| 438 | #if ENABLE_FEATURE_STAT_FILESYSTEM | ||
| 439 | /* Stat the file system and print what we find. */ | 430 | /* Stat the file system and print what we find. */ |
| 440 | #if !ENABLE_FEATURE_STAT_FORMAT | 431 | #if !ENABLE_FEATURE_STAT_FORMAT |
| 441 | #define do_statfs(filename, format) do_statfs(filename) | 432 | #define do_statfs(filename, format) do_statfs(filename) |
| @@ -551,7 +542,6 @@ static bool do_statfs(const char *filename, const char *format) | |||
| 551 | #endif /* FEATURE_STAT_FORMAT */ | 542 | #endif /* FEATURE_STAT_FORMAT */ |
| 552 | return 1; | 543 | return 1; |
| 553 | } | 544 | } |
| 554 | #endif /* FEATURE_STAT_FILESYSTEM */ | ||
| 555 | 545 | ||
| 556 | /* stat the file and print what we find */ | 546 | /* stat the file and print what we find */ |
| 557 | #if !ENABLE_FEATURE_STAT_FORMAT | 547 | #if !ENABLE_FEATURE_STAT_FORMAT |
| @@ -736,15 +726,12 @@ int stat_main(int argc UNUSED_PARAM, char **argv) | |||
| 736 | statfunc_ptr statfunc = do_stat; | 726 | statfunc_ptr statfunc = do_stat; |
| 737 | 727 | ||
| 738 | opt_complementary = "-1"; /* min one arg */ | 728 | opt_complementary = "-1"; /* min one arg */ |
| 739 | opts = getopt32(argv, "tL" | 729 | opts = getopt32(argv, "ftL" |
| 740 | IF_FEATURE_STAT_FILESYSTEM("f") | ||
| 741 | IF_SELINUX("Z") | 730 | IF_SELINUX("Z") |
| 742 | IF_FEATURE_STAT_FORMAT("c:", &format) | 731 | IF_FEATURE_STAT_FORMAT("c:", &format) |
| 743 | ); | 732 | ); |
| 744 | #if ENABLE_FEATURE_STAT_FILESYSTEM | ||
| 745 | if (opts & OPT_FILESYS) /* -f */ | 733 | if (opts & OPT_FILESYS) /* -f */ |
| 746 | statfunc = do_statfs; | 734 | statfunc = do_statfs; |
| 747 | #endif | ||
| 748 | #if ENABLE_SELINUX | 735 | #if ENABLE_SELINUX |
| 749 | if (opts & OPT_SELINUX) { | 736 | if (opts & OPT_SELINUX) { |
| 750 | selinux_or_die(); | 737 | selinux_or_die(); |
