From 6fcdc552ffdca93334ffe2d044745c83de0722fa Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Sun, 28 Feb 2021 13:50:57 +0100 Subject: Cleanup handling of optional dependencies Don't use super pedantic parsing of the argument and work with the generated variable instead of assigning it to our own and set it to "check" if not value is assigned. Then search for a dependency if the with variable is anything other than "no" and fail if it was set to "yes". In addition, the WITHOUT_xxx defines are replaced with WITH_xxx defines. Signed-off-by: David Oberhollenzer --- jffsX-utils/compr.c | 4 ++-- jffsX-utils/compr.h | 3 +-- jffsX-utils/compr_lzo.c | 2 +- jffsX-utils/mkfs.jffs2.c | 12 ++++++------ 4 files changed, 10 insertions(+), 11 deletions(-) (limited to 'jffsX-utils') diff --git a/jffsX-utils/compr.c b/jffsX-utils/compr.c index cb4432e..42d8a70 100644 --- a/jffsX-utils/compr.c +++ b/jffsX-utils/compr.c @@ -517,7 +517,7 @@ int jffs2_compressors_init(void) #ifdef CONFIG_JFFS2_RTIME jffs2_rtime_init(); #endif -#ifdef CONFIG_JFFS2_LZO +#ifdef WITH_LZO jffs2_lzo_init(); #endif return 0; @@ -531,7 +531,7 @@ int jffs2_compressors_exit(void) #ifdef CONFIG_JFFS2_ZLIB jffs2_zlib_exit(); #endif -#ifdef CONFIG_JFFS2_LZO +#ifdef WITH_LZO jffs2_lzo_exit(); #endif return 0; diff --git a/jffsX-utils/compr.h b/jffsX-utils/compr.h index a21e935..0806f4d 100644 --- a/jffsX-utils/compr.h +++ b/jffsX-utils/compr.h @@ -18,7 +18,6 @@ #define CONFIG_JFFS2_ZLIB #define CONFIG_JFFS2_RTIME -#define CONFIG_JFFS2_LZO #define JFFS2_RUBINMIPS_PRIORITY 10 #define JFFS2_DYNRUBIN_PRIORITY 20 @@ -111,7 +110,7 @@ void jffs2_zlib_exit(void); int jffs2_rtime_init(void); void jffs2_rtime_exit(void); #endif -#ifdef CONFIG_JFFS2_LZO +#ifdef WITH_LZO int jffs2_lzo_init(void); void jffs2_lzo_exit(void); #endif diff --git a/jffsX-utils/compr_lzo.c b/jffsX-utils/compr_lzo.c index 56aa1b4..337ebe9 100644 --- a/jffsX-utils/compr_lzo.c +++ b/jffsX-utils/compr_lzo.c @@ -25,7 +25,7 @@ #include #include -#ifndef WITHOUT_LZO +#ifdef WITH_LZO #include #include #include diff --git a/jffsX-utils/mkfs.jffs2.c b/jffsX-utils/mkfs.jffs2.c index bd67634..b9dd96b 100644 --- a/jffsX-utils/mkfs.jffs2.c +++ b/jffsX-utils/mkfs.jffs2.c @@ -65,7 +65,7 @@ #include #include #include -#ifndef WITHOUT_XATTR +#ifdef WITH_XATTR #include #include #endif @@ -978,7 +978,7 @@ static void write_special_file(struct filesystem_entry *e) padword(); } -#ifndef WITHOUT_XATTR +#ifdef WITH_XATTR typedef struct xattr_entry { struct xattr_entry *next; uint32_t xid; @@ -1209,7 +1209,7 @@ static void write_xattr_entry(struct filesystem_entry *e) } } -#else /* WITHOUT_XATTR */ +#else /* WITH_XATTR */ #define write_xattr_entry(x) #endif @@ -1380,7 +1380,7 @@ static struct option long_options[] = { {"test-compression", 0, NULL, 't'}, {"compressor-priority", 1, NULL, 'y'}, {"incremental", 1, NULL, 'i'}, -#ifndef WITHOUT_XATTR +#ifdef WITH_XATTR {"with-xattr", 0, NULL, 1000 }, {"with-selinux", 0, NULL, 1001 }, {"with-posix-acl", 0, NULL, 1002 }, @@ -1420,7 +1420,7 @@ static const char helptext[] = " -q, --squash Squash permissions and owners making all files be owned by root\n" " -U, --squash-uids Squash owners making all files be owned by root\n" " -P, --squash-perms Squash permissions on all files\n" -#ifndef WITHOUT_XATTR +#ifdef WITH_XATTR " --with-xattr stuff all xattr entries into image\n" " --with-selinux stuff only SELinux Labels into jffs2 image\n" " --with-posix-acl stuff only POSIX ACL entries into jffs2 image\n" @@ -1745,7 +1745,7 @@ int main(int argc, char **argv) sys_errmsg_die("cannot open (incremental) file"); } break; -#ifndef WITHOUT_XATTR +#ifdef WITH_XATTR case 1000: /* --with-xattr */ enable_xattr |= (1 << JFFS2_XPREFIX_USER) | (1 << JFFS2_XPREFIX_SECURITY) -- cgit v1.2.3