Skip to contentSkip to conversation

kpartx/devmapper.c: fix unused variable error

PATCH Superseded Sergei Trofimovich 1 participant 1 message Jan 5, 2022 Device mapper

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kpartx/devmapper.c: fix unused variable error

Without the change the build fails as:

devmapper.c:58:69: error: unused parameter 'udev_flags' [-Werror=unused-parameter]
58 | int dm_simplecmd(int task, const char *name, int no_flush, uint16_t udev_flags)
| ~~~~~~~~~^~~~~~~~~~

The change adds __attribute__((used)) annotation to unused function parameter.
CC: Martin Wilck <[email protected]>
CC: Benjamin Marzinski <[email protected]>

---
 kpartx/devmapper.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
kpartx/devmapper.c +7 -1
index 511c090f..49ffd310 100644
@@ -18,6 +18,12 @@
 #define MAX_PREFIX_LEN (_UUID_PREFIX_LEN + 4)
 #define PARAMS_SIZE 1024
 
+#ifdef LIBDM_API_COOKIE
+#    define __DM_API_COOKIE_UNUSED__ /* empty */
+#else
+#    define __DM_API_COOKIE_UNUSED__ __attribute__((unused))
+#endif
+
 int dm_prereq(char * str, uint32_t x, uint32_t y, uint32_t z)
 {
 	int r = 1;
@@ -55,7 +61,7 @@ out:
 	return r;
 }
 
-int dm_simplecmd(int task, const char *name, int no_flush, uint16_t udev_flags)
+int dm_simplecmd(int task, const char *name, int no_flush, __DM_API_COOKIE_UNUSED__ uint16_t udev_flags)
 {
 	int r = 0;
 #ifdef LIBDM_API_COOKIE
Signature · 6 lines
2.34.1

--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel