[PATCH v2] decode mtd ioctls
Dmitry V. Levin
ldv at altlinux.org
Thu Apr 5 00:42:24 UTC 2012
On Wed, Apr 04, 2012 at 08:31:34PM -0400, Mike Frysinger wrote:
> On Wednesday 04 April 2012 14:14:49 Dmitry V. Levin wrote:
> > On Tue, Apr 03, 2012 at 10:22:48PM -0400, Mike Frysinger wrote:
> > > On Tuesday 03 April 2012 19:11:32 Dmitry V. Levin wrote:
> > > > On Tue, Apr 03, 2012 at 02:24:33AM -0400, Mike Frysinger wrote:
> > > > > I got tired of figuring out mtd structures (which show up a lot
> > > > > in the embedded space), so add decoders for those ioctls.
> > > > >
> > > > > * defs.h (mtd_ioctl): New prototype.
> > > > > (print_loff_t): Likewise.
> > > > > * io.c (print_loff_t): Delete static keyword
> > > > > * ioctl.c (ioctl_decode): Call mtd_ioctl when code is 'M'.
> > > > > * Makefile.am (strace_SOURCES): Add mtd.c.
> > > > > * mtd.c: New file.
> > > >
> > > > I've got a system where it doesn't compile because mtd/mtd-user.h
> > > > is not installed there:
> > > >
> > > > mtd.c:30:26: fatal error: mtd/mtd-user.h: No such file or directory
> > > >
> > > > One may argue that the system must provide this file, but I'd rather
> > > > like to have a traditional workaround for such cases. ;)
> > >
> > > should i just copy the header locally ? or add a mtd-user.h header check
> > > and disable the code if it's not found ?
> >
> > I've got another system where this header file is installed but it's quite
> > unusable:
> > mtd.c:33:4: error: 'MTD_OPS_PLACE_OOB' undeclared here (not in a function)
> > mtd.c:34:4: error: 'MTD_OPS_AUTO_OOB' undeclared here (not in a function)
> > mtd.c:35:4: error: 'MTD_OPS_RAW' undeclared here (not in a function)
> > mtd.c:47:4: error: 'MTD_MLCNANDFLASH' undeclared here (not in a function)
>
> yeah, i wrote it to the stuff exported in linux-3.3
>
> > So I suppose it would be safer to provide a local copy.
>
> hrm, i could do:
> #include <linux/version.h>
> #if KERNEL_VERSION(3, 3, 0) < LINUX_VERSION_CODE
> # include "mtd-user.h"
> #else
> # include <mtd/mtd-user.h>
> #endif
>
> this should give us the best of both worlds ?
Yes, at least it looks so.
--
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20120405/ffe48b5d/attachment.bin>
More information about the Strace-devel
mailing list