diff options
author | Andreas Gampe <agampe@google.com> | 2015-08-05 17:16:22 -0700 |
---|---|---|
committer | Andreas Gampe <agampe@google.com> | 2015-08-12 12:12:23 -0700 |
commit | a4a6726008ebd46007f98138d907bbe499861b3e (patch) | |
tree | f6705b0900c9a80881bec5fcb48f5c83e964a3a4 /ext4_utils | |
parent | 2aaa82e49e6772074533f0b1ee41925b54db7fe7 (diff) | |
download | extras-a4a6726008ebd46007f98138d907bbe499861b3e.tar.gz |
Ext4utils: Fix unused parameters
Refactor code so that parameters are not unused and the debug code
is always at least checked (and in non-debug cases compiled away).
Bug: 18632512
(cherry picked from commit 7ec740fee7356dd72918c9b9fd0a91276356673b)
Change-Id: I0e1eedae97a6edceb1771e10e6ec82c641ba9c5e
Diffstat (limited to 'ext4_utils')
-rw-r--r-- | ext4_utils/canned_fs_config.c | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/ext4_utils/canned_fs_config.c b/ext4_utils/canned_fs_config.c index 2165feb2..089a8df7 100644 --- a/ext4_utils/canned_fs_config.c +++ b/ext4_utils/canned_fs_config.c @@ -14,6 +14,7 @@ * limitations under the License. */ +#include <inttypes.h> #include <stdio.h> #include <string.h> #include <errno.h> @@ -80,6 +81,8 @@ int load_canned_fs_config(const char* fn) { return 0; } +static const int kDebugCannedFsConfig = 0; + void canned_fs_config(const char* path, int dir, const char* target_out_path, unsigned* uid, unsigned* gid, unsigned* mode, uint64_t* capabilities) { Path key; @@ -94,16 +97,20 @@ void canned_fs_config(const char* path, int dir, const char* target_out_path, *mode = p->mode; *capabilities = p->capabilities; -#if 0 - // for debugging, run the built-in fs_config and compare the results. - - unsigned c_uid, c_gid, c_mode; - uint64_t c_capabilities; - fs_config(path, dir, target_out_path, &c_uid, &c_gid, &c_mode, &c_capabilities); - - if (c_uid != *uid) printf("%s uid %d %d\n", path, *uid, c_uid); - if (c_gid != *gid) printf("%s gid %d %d\n", path, *gid, c_gid); - if (c_mode != *mode) printf("%s mode 0%o 0%o\n", path, *mode, c_mode); - if (c_capabilities != *capabilities) printf("%s capabilities %llx %llx\n", path, *capabilities, c_capabilities); -#endif + if (kDebugCannedFsConfig) { + // for debugging, run the built-in fs_config and compare the results. + + unsigned c_uid, c_gid, c_mode; + uint64_t c_capabilities; + fs_config(path, dir, target_out_path, &c_uid, &c_gid, &c_mode, &c_capabilities); + + if (c_uid != *uid) printf("%s uid %d %d\n", path, *uid, c_uid); + if (c_gid != *gid) printf("%s gid %d %d\n", path, *gid, c_gid); + if (c_mode != *mode) printf("%s mode 0%o 0%o\n", path, *mode, c_mode); + if (c_capabilities != *capabilities) + printf("%s capabilities %" PRIx64 " %" PRIx64 "\n", + path, + *capabilities, + c_capabilities); + } } |