lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Wed, 23 Sep 2020 21:30:25 +0000
From:   David Laight <David.Laight@...LAB.COM>
To:     'Arnd Bergmann' <>, Al Viro <>
CC:     Christoph Hellwig <>,
        Andrew Morton <>,
        Jens Axboe <>,
        David Howells <>,
        Linux ARM <>,
        "" <>,
        "open list:BROADCOM NVRAM DRIVER" <>,
        Parisc List <>,
        linuxppc-dev <>,
        linux-s390 <>,
        sparclinux <>,
        linux-block <>,
        linux-scsi <>,
        Linux FS-devel Mailing List <>,
        linux-aio <>,
        "" <>,
        linux-arch <>,
        Linux-MM <>,
        Networking <>,
        "" <>,
        LSM List <>
Subject: RE: [PATCH 5/9] fs: remove various compat readv/writev helpers

From: Arnd Bergmann
> Sent: 23 September 2020 19:46
> Regardless of that, another advantage of having the SYSCALL_DECLAREx()
> would be the ability to include that header file from elsewhere with a different
> macro definition to create a machine-readable version of the interface when
> combined with the syscall.tbl files. This could be used to create a user
> space stub for calling into the low-level syscall regardless of the
> libc interfaces,
> or for synchronizing the interfaces with strace, qemu-user, or anything that
> needs to deal with the low-level interface.

A similar 'trick' (that probably won't work here) is to pass
the name of a #define function as a parameter to another define.
Useful for defining constants and error strings together. eg:
#define TRAFFIC_LIGHTS(x) \
	x(RED, 0, "Red") \
	x(YELLOW, 1, "Yellow) \
	x(GREEN, 2, "GREEN)

You can then do thing like:
#define x(token, value, string) token = value,
#undef x
#define x(token, value, string) [value] = string,
const char *colours[] = {TRAFFIC_LIGHTS(x)};
#undef x
to initialise constants and a name table that are always in sync.

It is also a good way to generate source lines that are over 1MB.


Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

Powered by blists - more mailing lists