aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2022-02-10 13:18:18 +0000
committerRon Yorston <rmy@pobox.com>2022-02-10 13:43:54 +0000
commite6238530e486d3c4bfe5cab7df5545869ab139ad (patch)
tree685297ca4d627d96f025f01491f162cdb392e54a
parent104fd2e186db21df3e93ed5a4db9a7623b70d46f (diff)
downloadbusybox-w32-e6238530e486d3c4bfe5cab7df5545869ab139ad.tar.gz
busybox-w32-e6238530e486d3c4bfe5cab7df5545869ab139ad.tar.bz2
busybox-w32-e6238530e486d3c4bfe5cab7df5545869ab139ad.zip
cpio: code shrink with !FEATURE_EXTRA_FILE_DATA
The new --renumber-inodes option won't work if FEATURE_EXTRA_FILE_DATA is disabled. Don't allow it to be selected in that case. In fact, if FEATURE_EXTRA_FILE_DATA is disabled all the code to handle hardlinks can be #ifdef'ed out. The new --ignore-devno option need do nothing if FEATURE_EXTRA_FILE_DATA is disabled, as in that case the device ids will already be zero. It can still be selected, cpio will just always behave as though the option was provided on the command line. This doesn't affect the size of the default build.
-rw-r--r--Config.in2
-rw-r--r--archival/cpio.c6
2 files changed, 6 insertions, 2 deletions
diff --git a/Config.in b/Config.in
index da8a72a8e..2a2672f29 100644
--- a/Config.in
+++ b/Config.in
@@ -481,7 +481,7 @@ config FEATURE_IMPROVED_COLOUR_MAPPING
481 Windows console colours. 481 Windows console colours.
482 482
483config FEATURE_EXTRA_FILE_DATA 483config FEATURE_EXTRA_FILE_DATA
484 bool "Read additional file metadata (2.1 kb)" 484 bool "Read additional file metadata (2.7 kb)"
485 default y 485 default y
486 depends on PLATFORM_MINGW32 486 depends on PLATFORM_MINGW32
487 help 487 help
diff --git a/archival/cpio.c b/archival/cpio.c
index 7149782d7..d6564de59 100644
--- a/archival/cpio.c
+++ b/archival/cpio.c
@@ -49,7 +49,7 @@
49//config:config FEATURE_CPIO_RENUMBER_INODES 49//config:config FEATURE_CPIO_RENUMBER_INODES
50//config: bool "Support --renumber-inodes like GNU cpio" 50//config: bool "Support --renumber-inodes like GNU cpio"
51//config: default y 51//config: default y
52//config: depends on FEATURE_CPIO_O && LONG_OPTS 52//config: depends on FEATURE_CPIO_O && LONG_OPTS && (PLATFORM_POSIX || FEATURE_EXTRA_FILE_DATA)
53//config: help 53//config: help
54//config: Optionally renumber inodes when creating archives. 54//config: Optionally renumber inodes when creating archives.
55 55
@@ -275,6 +275,7 @@ static NOINLINE int cpio_o(void)
275 if (!(S_ISLNK(st.st_mode) || S_ISREG(st.st_mode))) 275 if (!(S_ISLNK(st.st_mode) || S_ISREG(st.st_mode)))
276 st.st_size = 0; /* paranoia */ 276 st.st_size = 0; /* paranoia */
277 277
278#if ENABLE_FEATURE_EXTRA_FILE_DATA
278 /* Store hardlinks for later processing, dont output them */ 279 /* Store hardlinks for later processing, dont output them */
279 if (!S_ISDIR(st.st_mode) && st.st_nlink > 1) { 280 if (!S_ISDIR(st.st_mode) && st.st_nlink > 1) {
280 struct name_s *n; 281 struct name_s *n;
@@ -310,6 +311,7 @@ static NOINLINE int cpio_o(void)
310 free(line); 311 free(line);
311 continue; 312 continue;
312 } 313 }
314#endif
313#if ENABLE_FEATURE_CPIO_RENUMBER_INODES 315#if ENABLE_FEATURE_CPIO_RENUMBER_INODES
314 else if (option_mask32 & OPT_RENUMBER_INODES) { 316 else if (option_mask32 & OPT_RENUMBER_INODES) {
315 st.st_ino = ++G.next_inode; 317 st.st_ino = ++G.next_inode;
@@ -345,10 +347,12 @@ static NOINLINE int cpio_o(void)
345 } 347 }
346 } 348 }
347 349
350#if ENABLE_FEATURE_EXTRA_FILE_DATA
348#if ENABLE_FEATURE_CPIO_IGNORE_DEVNO 351#if ENABLE_FEATURE_CPIO_IGNORE_DEVNO
349 if (option_mask32 & OPT_IGNORE_DEVNO) 352 if (option_mask32 & OPT_IGNORE_DEVNO)
350 st.st_dev = st.st_rdev = 0; 353 st.st_dev = st.st_rdev = 0;
351#endif 354#endif
355#endif
352 356
353 bytes += printf("070701" 357 bytes += printf("070701"
354 "%08X%08X%08X%08X%08X%08X%08X" 358 "%08X%08X%08X%08X%08X%08X%08X"