From 1519ab5ffca4ec4be5ae36556e2e608c188d8f60 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Tue, 24 Aug 2010 11:43:21 +0200 Subject: [PATCH] blockdev: add BLKDISCARDZEROES Signed-off-by: Karel Zak --- disk-utils/blockdev.c | 6 ++++++ include/blkdev.h | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/disk-utils/blockdev.c b/disk-utils/blockdev.c index cf594d12..089405e9 100644 --- a/disk-utils/blockdev.c +++ b/disk-utils/blockdev.c @@ -74,6 +74,12 @@ struct bdc bdcms[] = .argtype = ARG_INT, .argval = -1, .help = N_("get read-only") + },{ + IOCTL_ENTRY(BLKDISCARDZEROES), + .name = "--getdiscardzeroes", + .argtype = ARG_UINT, + .argval = -1, + .help = N_("get discard zeroes support status") },{ IOCTL_ENTRY(BLKSSZGET), .name = "--getss", diff --git a/include/blkdev.h b/include/blkdev.h index 0eea01cd..2179c6ed 100644 --- a/include/blkdev.h +++ b/include/blkdev.h @@ -33,6 +33,7 @@ #endif /* BLKROSET && __linux__ */ + #ifdef APPLE_DARWIN #define BLKGETSIZE DKIOCGETBLOCKCOUNT32 #endif @@ -45,6 +46,11 @@ #define BLKPBSZGET _IO(0x12,123) #endif +/* discard zeroes support, introduced in 2.6.33 (commait 98262f27) */ +#ifndef BLKDISCARDZEROES +#define BLKDISCARDZEROES _IO(0x12,124) +#endif + #ifndef FIFREEZE #define FIFREEZE _IOWR('X', 119, int) /* Freeze */ #define FITHAW _IOWR('X', 120, int) /* Thaw */ -- 2.39.5