Update for proper binject ioctls
authorJens Axboe <jaxboe@fusionio.com>
Wed, 27 Oct 2010 15:24:54 +0000 (09:24 -0600)
committerJens Axboe <jaxboe@fusionio.com>
Wed, 27 Oct 2010 15:24:54 +0000 (09:24 -0600)
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
engines/binject.c
os/binject.h

index 7f5d629..7109c7a 100644 (file)
@@ -260,7 +260,7 @@ static void binject_unmap_dev(struct thread_data *td, struct binject_file *bf)
 
        bic.minor = bf->minor;
 
-       if (ioctl(fdb, 1, &bic) < 0)
+       if (ioctl(fdb, B_IOCTL_DEL, &bic) < 0)
                td_verror(td, errno, "binject dev unmap");
 
        close(fdb);
@@ -280,7 +280,7 @@ static int binject_map_dev(struct thread_data *td, struct binject_file *bf,
 
        bic.fd = fd;
 
-       if (ioctl(fdb, 0, &bic) < 0) {
+       if (ioctl(fdb, B_IOCTL_ADD, &bic) < 0) {
                td_verror(td, errno, "binject dev map");
                close(fdb);
                return 1;
index 24eee0d..1d862c8 100644 (file)
@@ -25,6 +25,10 @@ struct b_ioctl_cmd {
        int minor;
 };
 
+#define BINJECT_IOCTL_CHR      'J'
+#define B_IOCTL_ADD            _IOWR(BINJECT_IOCTL_CHR, 1, struct b_ioctl_cmd)
+#define B_IOCTL_DEL            _IOWR(BINJECT_IOCTL_CHR, 2, struct b_ioctl_cmd)
+
 enum {
        B_TYPE_READ             = 0,
        B_TYPE_WRITE,