]> granicus.if.org Git - strace/blobdiff - ubi.c
mmap_cache: add function to enable mmap_cache
[strace] / ubi.c
diff --git a/ubi.c b/ubi.c
index 9fa41e1c08b94cd4605dc43687e2104f5dbd1563..9f611ff58177d980d09f3fe4dad6a418f306a278 100644 (file)
--- a/ubi.c
+++ b/ubi.c
 
 #include "defs.h"
 
-#include <linux/ioctl.h>
+#ifdef HAVE_STRUCT_UBI_ATTACH_REQ_MAX_BEB_PER1024
 
-/* The UBI api changes, so we have to keep a local copy */
-#include <linux/version.h>
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 7, 0)
-# include "ubi-user.h"
-#else
+# include <linux/ioctl.h>
 # include <mtd/ubi-user.h>
-#endif
 
-#include "xlat/ubi_volume_types.h"
-#include "xlat/ubi_volume_props.h"
+# include "xlat/ubi_volume_types.h"
+# include "xlat/ubi_volume_props.h"
 
 int
 ubi_ioctl(struct tcb *const tcp, const unsigned int code,
@@ -67,7 +62,7 @@ ubi_ioctl(struct tcb *const tcp, const unsigned int code,
                                        CLAMP(mkvol.name_len, 0,
                                              UBI_MAX_VOLUME_NAME));
                        tprints("}");
-                       return 1;
+                       return 0;
                }
                if (!syserror(tcp)) {
                        tprints(" => ");
@@ -135,7 +130,7 @@ ubi_ioctl(struct tcb *const tcp, const unsigned int code,
                                ", max_beb_per1024=%" PRIi16 "}",
                                attach.ubi_num, attach.mtd_num,
                                attach.vid_hdr_offset, attach.max_beb_per1024);
-                       return 1;
+                       return 0;
                }
                if (!syserror(tcp)) {
                        tprints(" => ");
@@ -183,12 +178,12 @@ ubi_ioctl(struct tcb *const tcp, const unsigned int code,
                printnum_int(tcp, arg, "%d");
                break;
 
-#ifdef UBI_IOCVOLCRBLK
+# ifdef UBI_IOCVOLCRBLK
        case UBI_IOCVOLCRBLK:
-#endif
-#ifdef UBI_IOCVOLRMBLK
+# endif
+# ifdef UBI_IOCVOLRMBLK
        case UBI_IOCVOLRMBLK:
-#endif
+# endif
                /* no arguments */
                break;
 
@@ -196,5 +191,7 @@ ubi_ioctl(struct tcb *const tcp, const unsigned int code,
                return RVAL_DECODED;
        }
 
-       return RVAL_DECODED | 1;
+       return RVAL_IOCTL_DECODED;
 }
+
+#endif /* HAVE_STRUCT_UBI_ATTACH_REQ_MAX_BEB_PER1024 */