From: Karel Zak Date: Mon, 16 Sep 2024 12:27:15 +0000 (+0200) Subject: include/blkdev: share BLKDISCARD macros X-Git-Tag: v2.42-start~206^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=123d4de40dd96c1e720b1e87a6b17d362cc244ce;p=thirdparty%2Futil-linux.git include/blkdev: share BLKDISCARD macros Move BLKDISCARD* ioctl identifiers to the include/blkdev.h file to prevent duplicate definitions. Signed-off-by: Karel Zak --- diff --git a/disk-utils/fdisk.c b/disk-utils/fdisk.c index 2500c142d..962eb5ae7 100644 --- a/disk-utils/fdisk.c +++ b/disk-utils/fdisk.c @@ -59,9 +59,6 @@ # ifdef HAVE_LINUX_FS_H # include # endif -# ifndef BLKDISCARD -# define BLKDISCARD _IO(0x12,119) -# endif #endif int pwipemode = WIPEMODE_AUTO; diff --git a/include/blkdev.h b/include/blkdev.h index efa33af11..3f3c5e2ab 100644 --- a/include/blkdev.h +++ b/include/blkdev.h @@ -59,6 +59,17 @@ # 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 */ diff --git a/sys-utils/blkdiscard.c b/sys-utils/blkdiscard.c index 16c32e6e5..fc57aeb73 100644 --- a/sys-utils/blkdiscard.c +++ b/sys-utils/blkdiscard.c @@ -48,18 +48,7 @@ #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 */