Re: [PATCH v2 001/110] vfs: introduce kino_t typedef and PRIino format macro
From: Jeff Layton
Date: Tue Mar 03 2026 - 05:56:21 EST
On Mon, 2026-03-02 at 20:25 -0500, Theodore Tso wrote:
> On Mon, Mar 02, 2026 at 03:23:45PM -0500, Jeff Layton wrote:
> > The PRIino macro is a length modifier, not a complete format specifier.
> > It is used as: "%" PRIino "u" for decimal, "%" PRIino "x" for hex, etc.
> > This follows the pattern used by userspace PRIu64/PRIx64 macros.
>
> For the record, I really hate the inttypes.h format specifiers, but I
> agree that we should forward the example of the C99 spec, for better
> or for worse.
>
> That being said, the userspace PRIu64, et. al macros are complete
> format specifiers, not just a length modifier. And I think this
> results in less ugly format specifiers in our kernel code.
>
> ---- cut here ---
> #!/bin/sh
> cat <<EOF > /tmp/blah.c
> #include <inttypes.h>
> #include <stdio.h>
>
> int main(int arg, char **argv)
> {
> printf("PRIu64 is %s\n", PRIu64);
> printf("PRId64 is %s\n", PRId64);
> printf("PRIx64 is %s\n", PRIx64);
> return 0;
> }
> EOF
>
> clang -m32 -o /tmp/blah /tmp/blah.c
> /tmp/blah
> ---- cut here ---
>
> % /tmp/blah.sh
> PRIu64 is llu
> PRId64 is lld
> PRIx64 is llx
>
I originally had them that way, but ended up going with just a single
"PRIino" macro since it was simpler.
If we were going to keep these macros in perpetuity then I'd be
inclined to follow your suggestion, but since they're just temporary
scaffolding to make this change, maybe I can ask you to overlook this
preference for now?
--
Jeff Layton <jlayton@xxxxxxxxxx>