From: Karel Zak Date: Wed, 14 Oct 2009 22:06:07 +0000 (+0200) Subject: blockdev: add support for uint and ushort ioctls X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=726fa24e73661855ad772ca7365c15fc38cb2084;p=util-linux blockdev: add support for uint and ushort ioctls Signed-off-by: Karel Zak --- diff --git a/disk-utils/blockdev.c b/disk-utils/blockdev.c index 8bc04565..b6c6415f 100644 --- a/disk-utils/blockdev.c +++ b/disk-utils/blockdev.c @@ -40,7 +40,9 @@ enum { /* ioctl argument types */ enum { ARG_NONE, + ARG_USHRT, ARG_INT, + ARG_UINT, ARG_LONG, ARG_ULONG, ARG_LLONG, @@ -258,6 +260,8 @@ void do_commands(int fd, char **argv, int d) { int res, i, j; int iarg; + unsigned int uarg; + unsigned short huarg; long larg; long long llarg; unsigned long lu; @@ -295,6 +299,10 @@ do_commands(int fd, char **argv, int d) { case ARG_NONE: res = ioctl(fd, bdcms[j].ioc, 0); break; + case ARG_USHRT: + huarg = bdcms[j].argval; + res = ioctl(fd, bdcms[j].ioc, &huarg); + break; case ARG_INT: if (bdcms[j].argname) { if (i == d-1) { @@ -310,6 +318,10 @@ do_commands(int fd, char **argv, int d) { ioctl(fd, bdcms[j].ioc, iarg) : ioctl(fd, bdcms[j].ioc, &iarg); break; + case ARG_UINT: + uarg = bdcms[j].argval; + res = ioctl(fd, bdcms[j].ioc, &uarg); + break; case ARG_LONG: larg = bdcms[j].argval; res = ioctl(fd, bdcms[j].ioc, &larg); @@ -346,9 +358,15 @@ do_commands(int fd, char **argv, int d) { printf("%s: ", _(bdcms[j].help)); switch(bdcms[j].argtype) { + case ARG_USHRT: + printf("%hu\n", huarg); + break; case ARG_INT: printf("%d\n", iarg); break; + case ARG_UINT: + printf("%u\n", uarg); + break; case ARG_LONG: printf("%ld\n", larg); break;