xlat.in

Dmitry V. Levin ldv at altlinux.org
Sat Sep 20 11:52:58 UTC 2014


Hi,

On Fri, Sep 19, 2014 at 06:30:09PM -0700, enh wrote:
> how do i regenerate an xlat .in file from a uapi header file? i notice
> that fsmagic.in is very out of date.

fsmagic.in differs from most of other xlat files: it doesn't rely on
macros provided by linux kernel headers because there was no
<linux/magic.h> before linux 2.6.19.  We can either continue or end this
practice.

In the former case, the script to regenerate fsmagic.in is likely to be this:
$ sed -rn 's/^#define[[:space:]]+([^[:space:]]+)[[:space:]]+(0x[^[:space:]]+).*/\t{\2,\t"\1"\t},/p' include/uapi/linux/magic.h |sort -u -k2,2

In the latter case, a bit shorter script would do:
$ sed -rn 's/^#define[[:space:]]+([^[:space:]]+)[[:space:]]+(0x[^[:space:]]+).*/\2\t\1/p' include/uapi/linux/magic.h |sort -u -k1,1 |cut -f2
(preceded by #include <linux/magic.h>)

The "sort -u -k" is required to get rid of EXT2/3/4 duplications.

I'm slightly more inclined to choose a conservative approach.


-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20140920/58dae06c/attachment.bin>


More information about the Strace-devel mailing list