v4l2-compliance: fix 32-bit compilation for v4l_fd_init()
authorHans Verkuil <hans.verkuil@cisco.com>
Tue, 1 Apr 2014 15:30:22 +0000 (17:30 +0200)
committerHans Verkuil <hans.verkuil@cisco.com>
Tue, 1 Apr 2014 15:30:22 +0000 (17:30 +0200)
Since mmap and v4l2_mmap have different prototypes (why?!) we have
to make a small wrapper to ensure that it compiles for both 32 and 64
bit systems.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
utils/v4l2-compliance/v4l-helpers.h

index 48ea602..e718a24 100644 (file)
@@ -14,11 +14,21 @@ struct v4l_fd {
        int (*munmap)(void *addr, size_t length);
 };
 
+/*
+ * mmap has a different prototype compared to v4l2_mmap. Because of
+ * this we have to make a wrapper for it.
+ */
+static inline void *v4l_fd_mmap(void *addr, size_t length, int prot, int flags,
+                                     int fd, int64_t offset)
+{
+       return mmap(addr, length, prot, flags, fd, offset);
+}
+
 static inline void v4l_fd_init(struct v4l_fd *f, int fd)
 {
        f->fd = fd;
        f->ioctl = ioctl;
-       f->mmap = mmap;
+       f->mmap = v4l_fd_mmap;
        f->munmap = munmap;
 }