summaryrefslogtreecommitdiffstats
path: root/disk-utils/blockdev.c
diff options
context:
space:
mode:
authorKarel Zak2009-10-15 00:06:07 +0200
committerKarel Zak2009-10-15 00:06:07 +0200
commit726fa24e73661855ad772ca7365c15fc38cb2084 (patch)
tree330505d118948e1e869501a7284ab1611694093c /disk-utils/blockdev.c
parentblockdev: refactoring (better commands definition) (diff)
downloadkernel-qcow2-util-linux-726fa24e73661855ad772ca7365c15fc38cb2084.tar.gz
kernel-qcow2-util-linux-726fa24e73661855ad772ca7365c15fc38cb2084.tar.xz
kernel-qcow2-util-linux-726fa24e73661855ad772ca7365c15fc38cb2084.zip
blockdev: add support for uint and ushort ioctls
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'disk-utils/blockdev.c')
-rw-r--r--disk-utils/blockdev.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/disk-utils/blockdev.c b/disk-utils/blockdev.c
index 8bc045655..b6c6415fd 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;