From e6238530e486d3c4bfe5cab7df5545869ab139ad Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Thu, 10 Feb 2022 13:18:18 +0000 Subject: 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. --- Config.in | 2 +- archival/cpio.c | 6 +++++- 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 Windows console colours. config FEATURE_EXTRA_FILE_DATA - bool "Read additional file metadata (2.1 kb)" + bool "Read additional file metadata (2.7 kb)" default y depends on PLATFORM_MINGW32 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 @@ //config:config FEATURE_CPIO_RENUMBER_INODES //config: bool "Support --renumber-inodes like GNU cpio" //config: default y -//config: depends on FEATURE_CPIO_O && LONG_OPTS +//config: depends on FEATURE_CPIO_O && LONG_OPTS && (PLATFORM_POSIX || FEATURE_EXTRA_FILE_DATA) //config: help //config: Optionally renumber inodes when creating archives. @@ -275,6 +275,7 @@ static NOINLINE int cpio_o(void) if (!(S_ISLNK(st.st_mode) || S_ISREG(st.st_mode))) st.st_size = 0; /* paranoia */ +#if ENABLE_FEATURE_EXTRA_FILE_DATA /* Store hardlinks for later processing, dont output them */ if (!S_ISDIR(st.st_mode) && st.st_nlink > 1) { struct name_s *n; @@ -310,6 +311,7 @@ static NOINLINE int cpio_o(void) free(line); continue; } +#endif #if ENABLE_FEATURE_CPIO_RENUMBER_INODES else if (option_mask32 & OPT_RENUMBER_INODES) { st.st_ino = ++G.next_inode; @@ -345,9 +347,11 @@ static NOINLINE int cpio_o(void) } } +#if ENABLE_FEATURE_EXTRA_FILE_DATA #if ENABLE_FEATURE_CPIO_IGNORE_DEVNO if (option_mask32 & OPT_IGNORE_DEVNO) st.st_dev = st.st_rdev = 0; +#endif #endif bytes += printf("070701" -- cgit v1.2.3-55-g6feb