From: Tobias Stoeckmann Date: Fri, 3 Apr 2026 08:16:48 +0000 (+0200) Subject: debug: Turn mask unsigned X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d49f4cc97dfb244d43a948b24e609af22bc3363c;p=thirdparty%2Futil-linux.git debug: Turn mask unsigned The debug mask is a bitmask, so use an unsigned type. This also matches the string formatters, since x/X expect an unsigned data type. Signed-off-by: Tobias Stoeckmann --- diff --git a/include/debug.h b/include/debug.h index fd53b676a..552f09759 100644 --- a/include/debug.h +++ b/include/debug.h @@ -41,7 +41,7 @@ struct ul_debug_maskname { const char *name; - int mask; + unsigned mask; const char *help; }; #define UL_DEBUG_EMPTY_MASKNAMES {{ NULL, 0, NULL }} @@ -49,7 +49,7 @@ struct ul_debug_maskname { #define UL_DEBUG_MASKNAMES(m) m ## _masknames #define UL_DEBUG_MASK(m) m ## _debug_mask -#define UL_DEBUG_DEFINE_MASK(m) int UL_DEBUG_MASK(m) +#define UL_DEBUG_DEFINE_MASK(m) unsigned UL_DEBUG_MASK(m) #define UL_DEBUG_DECLARE_MASK(m) extern UL_DEBUG_DEFINE_MASK(m) #define UL_DEBUG_ALL 0xFFFFFF @@ -114,9 +114,9 @@ struct ul_debug_maskname { extern void ul_debug(const char *mesg, ...) __attribute__ ((__format__ (__printf__, 1, 2))); extern void ul_debug_prefix(const char *lib, const char *flag, - const void *handler, int mask); -extern int ul_debug_parse_mask(const struct ul_debug_maskname flagnames[], - const char *mask); + const void *handler, unsigned mask); +extern unsigned ul_debug_parse_mask(const struct ul_debug_maskname flagnames[], + const char *mask); extern void ul_debug_print_masks(const char *env, const struct ul_debug_maskname flagnames[]); diff --git a/lib/debug.c b/lib/debug.c index 21829d75f..c76c51c4e 100644 --- a/lib/debug.c +++ b/lib/debug.c @@ -21,17 +21,17 @@ void ul_debug(const char *mesg, ...) } void ul_debug_prefix(const char *lib, const char *flag, - const void *handler, int mask) + const void *handler, unsigned mask) { fprintf(stderr, "%d: %s: %8s: ", getpid(), lib, flag); if (handler && !(mask & __UL_DEBUG_FL_NOADDR)) fprintf(stderr, "[%p]: ", handler); } -int ul_debug_parse_mask(const struct ul_debug_maskname flagnames[], - const char *mask) +unsigned ul_debug_parse_mask(const struct ul_debug_maskname flagnames[], + const char *mask) { - int res; + unsigned res; char *ptr; /* let's check for a numeric mask first */ diff --git a/libmount/python/pylibmount.c b/libmount/python/pylibmount.c index 5aac526ca..ff5b95829 100644 --- a/libmount/python/pylibmount.c +++ b/libmount/python/pylibmount.c @@ -21,7 +21,7 @@ /* Libmount-specific Exception class */ PyObject *LibmountError; -int pylibmount_debug_mask; +unsigned pylibmount_debug_mask; PyObject *UL_IncRef(void *killme) { diff --git a/libmount/python/pylibmount.h b/libmount/python/pylibmount.h index bf3278def..9d1daff83 100644 --- a/libmount/python/pylibmount.h +++ b/libmount/python/pylibmount.h @@ -25,7 +25,7 @@ } \ } while (0) -extern int pylibmount_debug_mask; +extern unsigned pylibmount_debug_mask; static inline void __attribute__ ((__format__ (__printf__, 1, 2))) pymnt_debug(const char *mesg, ...)