diff options
| author | vapier <vapier@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2005-07-26 22:39:56 +0000 |
|---|---|---|
| committer | vapier <vapier@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2005-07-26 22:39:56 +0000 |
| commit | c559e28b405abfcd6629ecba9018e88279dc82f5 (patch) | |
| tree | 20e684d294d8ee21e4c48cf1ad596d127e6dd472 /coreutils | |
| parent | 481fcb27b45816c4e7d2be8c0fe6a764b81296b3 (diff) | |
| download | busybox-w32-c559e28b405abfcd6629ecba9018e88279dc82f5.tar.gz busybox-w32-c559e28b405abfcd6629ecba9018e88279dc82f5.tar.bz2 busybox-w32-c559e28b405abfcd6629ecba9018e88279dc82f5.zip | |
just punt all the f_frsize crap since not all linux headers support it Bug 346
git-svn-id: svn://busybox.net/trunk/busybox@10917 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'coreutils')
| -rw-r--r-- | coreutils/stat.c | 27 |
1 files changed, 5 insertions, 22 deletions
diff --git a/coreutils/stat.c b/coreutils/stat.c index b41e1d3be..4afe249c0 100644 --- a/coreutils/stat.c +++ b/coreutils/stat.c | |||
| @@ -37,10 +37,6 @@ | |||
| 37 | #include <string.h> | 37 | #include <string.h> |
| 38 | #include "busybox.h" | 38 | #include "busybox.h" |
| 39 | 39 | ||
| 40 | #ifdef __linux__ | ||
| 41 | # include <linux/version.h> | ||
| 42 | #endif | ||
| 43 | |||
| 44 | /* vars to control behavior */ | 40 | /* vars to control behavior */ |
| 45 | #define OPT_TERSE 2 | 41 | #define OPT_TERSE 2 |
| 46 | #define OPT_DEREFERNCE 4 | 42 | #define OPT_DEREFERNCE 4 |
| @@ -173,23 +169,11 @@ static void print_statfs(char *pformat, size_t buf_len, char m, | |||
| 173 | strncat(pformat, "ld", buf_len); | 169 | strncat(pformat, "ld", buf_len); |
| 174 | printf(pformat, (intmax_t) (statfsbuf->f_bavail)); | 170 | printf(pformat, (intmax_t) (statfsbuf->f_bavail)); |
| 175 | break; | 171 | break; |
| 172 | case 'S': | ||
| 176 | case 's': | 173 | case 's': |
| 177 | strncat(pformat, "lu", buf_len); | 174 | strncat(pformat, "lu", buf_len); |
| 178 | printf(pformat, (unsigned long int) (statfsbuf->f_bsize)); | 175 | printf(pformat, (unsigned long int) (statfsbuf->f_bsize)); |
| 179 | break; | 176 | break; |
| 180 | case 'S': { | ||
| 181 | unsigned long int frsize; | ||
| 182 | #if defined(__linux__) && LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) | ||
| 183 | frsize = statfsbuf->f_frsize; | ||
| 184 | if (!frsize) | ||
| 185 | frsize = statfsbuf->f_bsize; | ||
| 186 | #else | ||
| 187 | frsize = statfsbuf->f_bsize; | ||
| 188 | #endif | ||
| 189 | strncat(pformat, "lu", buf_len); | ||
| 190 | printf(pformat, frsize); | ||
| 191 | break; | ||
| 192 | } | ||
| 193 | case 'c': | 177 | case 'c': |
| 194 | strncat(pformat, "ld", buf_len); | 178 | strncat(pformat, "ld", buf_len); |
| 195 | printf(pformat, (intmax_t) (statfsbuf->f_files)); | 179 | printf(pformat, (intmax_t) (statfsbuf->f_files)); |
| @@ -407,10 +391,10 @@ static int do_statfs(char const *filename, char const *format) | |||
| 407 | #ifdef CONFIG_FEATURE_STAT_FORMAT | 391 | #ifdef CONFIG_FEATURE_STAT_FORMAT |
| 408 | if (format == NULL) | 392 | if (format == NULL) |
| 409 | format = (flags & OPT_TERSE | 393 | format = (flags & OPT_TERSE |
| 410 | ? "%n %i %l %t %s %S %b %f %a %c %d\n" | 394 | ? "%n %i %l %t %s %b %f %a %c %d\n" |
| 411 | : " File: \"%n\"\n" | 395 | : " File: \"%n\"\n" |
| 412 | " ID: %-8i Namelen: %-7l Type: %T\n" | 396 | " ID: %-8i Namelen: %-7l Type: %T\n" |
| 413 | "Block size: %-10s Fundamental block size: %S\n" | 397 | "Block size: %-10s\n" |
| 414 | "Blocks: Total: %-10b Free: %-10f Available: %a\n" | 398 | "Blocks: Total: %-10b Free: %-10f Available: %a\n" |
| 415 | "Inodes: Total: %-10c Free: %d\n"); | 399 | "Inodes: Total: %-10c Free: %d\n"); |
| 416 | print_it(format, filename, print_statfs, &statfsbuf); | 400 | print_it(format, filename, print_statfs, &statfsbuf); |
| @@ -431,13 +415,12 @@ static int do_statfs(char const *filename, char const *format) | |||
| 431 | printf("Type: %s\n", human_fstype(statfsbuf.f_type)); | 415 | printf("Type: %s\n", human_fstype(statfsbuf.f_type)); |
| 432 | 416 | ||
| 433 | format = (flags & OPT_TERSE | 417 | format = (flags & OPT_TERSE |
| 434 | ? "%lu %lu %ld %ld %ld %ld %ld\n" | 418 | ? "%lu %ld %ld %ld %ld %ld\n" |
| 435 | : "Block size: %-10lu Fundamental block size: %lu\n" | 419 | : "Block size: %-10lu\n" |
| 436 | "Blocks: Total: %-10ld Free: %-10ld Available: %ld\n" | 420 | "Blocks: Total: %-10ld Free: %-10ld Available: %ld\n" |
| 437 | "Inodes: Total: %-10ld Free: %ld\n"); | 421 | "Inodes: Total: %-10ld Free: %ld\n"); |
| 438 | printf(format, | 422 | printf(format, |
| 439 | (unsigned long int) (statfsbuf.f_bsize), | 423 | (unsigned long int) (statfsbuf.f_bsize), |
| 440 | statfsbuf.f_frsize ? statfsbuf.f_frsize : statfsbuf.f_bsize, | ||
| 441 | (intmax_t) (statfsbuf.f_blocks), | 424 | (intmax_t) (statfsbuf.f_blocks), |
| 442 | (intmax_t) (statfsbuf.f_bfree), | 425 | (intmax_t) (statfsbuf.f_bfree), |
| 443 | (intmax_t) (statfsbuf.f_bavail), | 426 | (intmax_t) (statfsbuf.f_bavail), |
