]> granicus.if.org Git - strace/commitdiff
Decode FIFREEZE/FITHAW/FITRIM ioctls
authorMike Frysinger <vapier@gentoo.org>
Fri, 21 Nov 2014 21:13:16 +0000 (16:13 -0500)
committerDmitry V. Levin <ldv@altlinux.org>
Fri, 21 Nov 2014 21:41:32 +0000 (21:41 +0000)
The freeze/thaw ones are simple, but the trim is an interesting struct.

* block.c (block_ioctl): Handle FIFREEZE/FITHAW/FITRIM.
* ioctl.c (ioctl_decode): Pass 'X' ioctls to block_ioctl.

block.c
ioctl.c

diff --git a/block.c b/block.c
index b281b1afe2fe08179db05cec54504cfb08742d79..b62e43636c1eb6ca71598d2fe1da638b6df242ff 100644 (file)
--- a/block.c
+++ b/block.c
@@ -116,6 +116,11 @@ block_ioctl(struct tcb *tcp, long code, long arg)
        /* take a signed int */
        case BLKROSET:
        case BLKBSZSET:
+#ifdef FIFREEZE
+       /* First seen in linux-2.6.29 */
+       case FIFREEZE:
+       case FITHAW:
+#endif
                if (entering(tcp)) {
                        int val;
                        if (umove(tcp, arg, &val) < 0)
@@ -263,6 +268,21 @@ block_ioctl(struct tcb *tcp, long code, long arg)
                }
                break;
 
+#ifdef FITRIM
+       /* First seen in linux-2.6.37 */
+       case FITRIM:
+               if (entering(tcp)) {
+                       struct fstrim_range fstrim;
+                       if (umove(tcp, arg, &fstrim))
+                               tprintf(", %#lx", arg);
+                       else
+                               tprintf(", {start=%#" PRIx64 ", len=%#" PRIx64 ", "
+                                       "minlen=%#" PRIx64 "}", (uint64_t) fstrim.start,
+                                       (uint64_t) fstrim.len, (uint64_t) fstrim.minlen);
+               }
+               break;
+#endif
+
        /* No arguments or unhandled */
        case BLKTRACESTART:
        case BLKTRACESTOP:
diff --git a/ioctl.c b/ioctl.c
index 9c743ce5f1885a175921ae140ba35ed223972825..cfd5a245f21da6d5477c432202b7f675e9e1bf4b 100644 (file)
--- a/ioctl.c
+++ b/ioctl.c
@@ -85,6 +85,7 @@ ioctl_decode(struct tcb *tcp, long code, long arg)
                return rtc_ioctl(tcp, code, arg);
        case 0x03:
        case 0x12:
+       case 'X':
                return block_ioctl(tcp, code, arg);
 #ifdef HAVE_SCSI_SG_H
        case 0x22: