]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
include/blkdev: share BLKDISCARD macros
authorKarel Zak <kzak@redhat.com>
Mon, 16 Sep 2024 12:27:15 +0000 (14:27 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 17 Sep 2024 11:19:09 +0000 (13:19 +0200)
Move BLKDISCARD* ioctl identifiers to the include/blkdev.h file to
prevent duplicate definitions.

Signed-off-by: Karel Zak <kzak@redhat.com>
disk-utils/fdisk.c
include/blkdev.h
sys-utils/blkdiscard.c

index 2500c142dc2a8638003f27e76c4851f65e1b18a0..962eb5ae7f13df357ec21df110760374003bbca5 100644 (file)
@@ -59,9 +59,6 @@
 # ifdef HAVE_LINUX_FS_H
 #  include <linux/fs.h>
 # endif
-# ifndef BLKDISCARD
-#   define BLKDISCARD     _IO(0x12,119)
-# endif
 #endif
 
 int pwipemode = WIPEMODE_AUTO;
index efa33af11fada6f761f5b0fd71f6199b70754034..3f3c5e2ab6ab17ed9cc3361ea58cc847c3cb4258 100644 (file)
 #  define BLKPBSZGET _IO(0x12,123)
 # endif
 
+/* discard area on a device */
+#ifndef BLKDISCARD
+# define BLKDISCARD    _IO(0x12,119)
+#endif
+#ifndef BLKSECDISCARD
+# define BLKSECDISCARD _IO(0x12,125)
+#endif
+#ifndef BLKZEROOUT
+# define BLKZEROOUT    _IO(0x12,127)
+#endif
+
 /* discard zeroes support, introduced in 2.6.33 (commit 98262f27) */
 # ifndef BLKDISCARDZEROES
 #  define BLKDISCARDZEROES _IO(0x12,124)
@@ -79,7 +90,6 @@
 # ifndef CDROM_GET_CAPABILITY
 #  define CDROM_GET_CAPABILITY 0x5331
 # endif
-
 #endif /* __linux */
 
 
index 16c32e6e5770c77d359b0a9607385aeab07eb4d8..fc57aeb73bd7f7c74688d572a512171f3f2d4bdc 100644 (file)
 #include "closestream.h"
 #include "monotonic.h"
 #include "exitcodes.h"
-
-#ifndef BLKDISCARD
-# define BLKDISCARD    _IO(0x12,119)
-#endif
-
-#ifndef BLKSECDISCARD
-# define BLKSECDISCARD _IO(0x12,125)
-#endif
-
-#ifndef BLKZEROOUT
-# define BLKZEROOUT    _IO(0x12,127)
-#endif
+#include "blkdev.h"
 
 enum {
        ACT_DISCARD = 0,        /* default */