[systemd-devel] [PATCH 1/5] udev-builtin-input_id: identify trackpoints and accelerometers

Lennart Poettering lennart at poettering.net
Thu Apr 2 03:57:46 PDT 2015


On Thu, 02.04.15 12:39, Hans de Goede (hdegoede at redhat.com) wrote:

> >>  /* we must use this kernel-compatible implementation */
> >>  #define BITS_PER_LONG (sizeof(unsigned long) * 8)
> >>  #define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1)
> >>@@ -131,6 +139,7 @@ static void test_pointers (struct udev_device *dev,
> >>                             const unsigned long* bitmask_abs,
> >>                             const unsigned long* bitmask_key,
> >>                             const unsigned long* bitmask_rel,
> >>+                           unsigned long prop,
> >
> >"unsigned long"? Is this really necessary? Shouldn't we just use
> >uint64_t? here?
> 
> unsigned long matches what is used in the kernel, it is a bit field,
> I do not know what type is preferred for bit fields in systemd /
> udev.

Oh god, the kernel is stupid. Using variable size types for
kernel/userspace APIs is just stupid...

Anyway, if that's how it is, use unsigned long, and also use strtoul
then, as before...

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list