<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux.git/samples/vfs, branch v6.18.21</title>
<subtitle>Clone of https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git</subtitle>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/'/>
<entry>
<title>samples: work around glibc redefining some of our defines wrong</title>
<updated>2025-11-21T17:29:02+00:00</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2025-11-21T17:29:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=a48f822908982353c3256e35a089e9e7d0d61580'/>
<id>a48f822908982353c3256e35a089e9e7d0d61580</id>
<content type='text'>
Apparently as of version 2.42, glibc headers define AT_RENAME_NOREPLACE
and some of the other flags for renameat2() and friends in &lt;stdio.h&gt;.

Which would all be fine, except for inexplicable reasons glibc decided
to define them _differently_ from the kernel definitions, which then
makes some of our sample code that includes both kernel headers and user
space headers unhappy, because the compiler will (correctly) complain
about redefining things.

Now, mixing kernel headers and user space headers is always a somewhat
iffy proposition due to namespacing issues, but it's kind of inevitable
in our sample and selftest code.  And this is just glibc being stupid.

Those defines come from the kernel, glibc is exposing the kernel
interfaces, and glibc shouldn't make up some random new expressions for
these values.

It's not like glibc headers changed the actual result values, but they
arbitrarily just decided to use a different expression to describe those
values.  The kernel just does

    #define AT_RENAME_NOREPLACE  0x0001

while glibc does

    # define RENAME_NOREPLACE (1 &lt;&lt; 0)
    # define AT_RENAME_NOREPLACE RENAME_NOREPLACE

instead.  Same value in the end, but very different macro definition.

For absolutely no reason.

This has since been fixed in the glibc development tree, so eventually
we'll end up with the canonical expressions and no clashes.  But in the
meantime the broken headers are in the glibc-2.42 release and have made
it out into distributions.

Do a minimal work-around to make the samples build cleanly by just
undefining the affected macros in between the user space header include
and the kernel header includes.

Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Apparently as of version 2.42, glibc headers define AT_RENAME_NOREPLACE
and some of the other flags for renameat2() and friends in &lt;stdio.h&gt;.

Which would all be fine, except for inexplicable reasons glibc decided
to define them _differently_ from the kernel definitions, which then
makes some of our sample code that includes both kernel headers and user
space headers unhappy, because the compiler will (correctly) complain
about redefining things.

Now, mixing kernel headers and user space headers is always a somewhat
iffy proposition due to namespacing issues, but it's kind of inevitable
in our sample and selftest code.  And this is just glibc being stupid.

Those defines come from the kernel, glibc is exposing the kernel
interfaces, and glibc shouldn't make up some random new expressions for
these values.

It's not like glibc headers changed the actual result values, but they
arbitrarily just decided to use a different expression to describe those
values.  The kernel just does

    #define AT_RENAME_NOREPLACE  0x0001

while glibc does

    # define RENAME_NOREPLACE (1 &lt;&lt; 0)
    # define AT_RENAME_NOREPLACE RENAME_NOREPLACE

instead.  Same value in the end, but very different macro definition.

For absolutely no reason.

This has since been fixed in the glibc development tree, so eventually
we'll end up with the canonical expressions and no clashes.  But in the
meantime the broken headers are in the glibc-2.42 release and have made
it out into distributions.

Do a minimal work-around to make the samples build cleanly by just
undefining the affected macros in between the user space header include
and the kernel header includes.

Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>samples/vfs: fix printf format string for size_t</title>
<updated>2025-02-25T10:56:26+00:00</updated>
<author>
<name>Arnd Bergmann</name>
<email>arnd@arndb.de</email>
</author>
<published>2025-02-24T14:14:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=33cec19dc022369e02f860150e5dfe32708016dc'/>
<id>33cec19dc022369e02f860150e5dfe32708016dc</id>
<content type='text'>
size_t needs a %z format string modifier instead of %l

samples/vfs/test-list-all-mounts.c:152:39: warning: format specifies type 'unsigned long' but the argument has type 'size_t' (aka 'unsigned int') [-Wformat]
  152 |                                         printf("mnt_uidmap[%lu]:\t%s\n", idx, idmap);
      |                                                            ~~~           ^~~
      |                                                            %zu
samples/vfs/test-list-all-mounts.c:161:39: warning: format specifies type 'unsigned long' but the argument has type 'size_t' (aka 'unsigned int') [-Wformat]
  161 |                                         printf("mnt_gidmap[%lu]:\t%s\n", idx, idmap);
      |                                                            ~~~           ^~~
      |                                                            %zu

Fixes: fa204a65f1b6 ("samples/vfs: add STATMOUNT_MNT_{G,U}IDMAP")
Signed-off-by: Arnd Bergmann &lt;arnd@arndb.de&gt;
Link: https://lore.kernel.org/r/20250224141406.1400864-1-arnd@kernel.org
Signed-off-by: Christian Brauner &lt;brauner@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
size_t needs a %z format string modifier instead of %l

samples/vfs/test-list-all-mounts.c:152:39: warning: format specifies type 'unsigned long' but the argument has type 'size_t' (aka 'unsigned int') [-Wformat]
  152 |                                         printf("mnt_uidmap[%lu]:\t%s\n", idx, idmap);
      |                                                            ~~~           ^~~
      |                                                            %zu
samples/vfs/test-list-all-mounts.c:161:39: warning: format specifies type 'unsigned long' but the argument has type 'size_t' (aka 'unsigned int') [-Wformat]
  161 |                                         printf("mnt_gidmap[%lu]:\t%s\n", idx, idmap);
      |                                                            ~~~           ^~~
      |                                                            %zu

Fixes: fa204a65f1b6 ("samples/vfs: add STATMOUNT_MNT_{G,U}IDMAP")
Signed-off-by: Arnd Bergmann &lt;arnd@arndb.de&gt;
Link: https://lore.kernel.org/r/20250224141406.1400864-1-arnd@kernel.org
Signed-off-by: Christian Brauner &lt;brauner@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>samples/vfs: add STATMOUNT_MNT_{G,U}IDMAP</title>
<updated>2025-02-12T11:12:27+00:00</updated>
<author>
<name>Christian Brauner</name>
<email>brauner@kernel.org</email>
</author>
<published>2025-02-04T11:27:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=fa204a65f1b65664eb938940c73cdfc0dcfd578e'/>
<id>fa204a65f1b65664eb938940c73cdfc0dcfd578e</id>
<content type='text'>
Illustrate how to use STATMOUNT_MNT_{G,U}IDMAP.

Link: https://lore.kernel.org/r/20250204-work-mnt_idmap-statmount-v2-4-007720f39f2e@kernel.org
Reviewed-by: Jeff Layton &lt;jlayton@kernel.org&gt;
Signed-off-by: Christian Brauner &lt;brauner@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Illustrate how to use STATMOUNT_MNT_{G,U}IDMAP.

Link: https://lore.kernel.org/r/20250204-work-mnt_idmap-statmount-v2-4-007720f39f2e@kernel.org
Reviewed-by: Jeff Layton &lt;jlayton@kernel.org&gt;
Signed-off-by: Christian Brauner &lt;brauner@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>samples/vfs: check whether flag was raised</title>
<updated>2025-02-12T11:12:27+00:00</updated>
<author>
<name>Christian Brauner</name>
<email>brauner@kernel.org</email>
</author>
<published>2025-02-04T11:27:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=a496dfecbc47253012f1e10d01110428bb9dc118'/>
<id>a496dfecbc47253012f1e10d01110428bb9dc118</id>
<content type='text'>
For string options the kernel will raise the corresponding flag only if
the string isn't empty. So check for the flag.

Link: https://lore.kernel.org/r/20250204-work-mnt_idmap-statmount-v2-3-007720f39f2e@kernel.org
Reviewed-by: Jeff Layton &lt;jlayton@kernel.org&gt;
Signed-off-by: Christian Brauner &lt;brauner@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
For string options the kernel will raise the corresponding flag only if
the string isn't empty. So check for the flag.

Link: https://lore.kernel.org/r/20250204-work-mnt_idmap-statmount-v2-3-007720f39f2e@kernel.org
Reviewed-by: Jeff Layton &lt;jlayton@kernel.org&gt;
Signed-off-by: Christian Brauner &lt;brauner@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>samples/vfs: fix build warnings</title>
<updated>2025-01-20T12:14:21+00:00</updated>
<author>
<name>Christian Brauner</name>
<email>brauner@kernel.org</email>
</author>
<published>2025-01-20T11:56:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=68e6b7d98bc64bbf1a54d963ca85111432f3a0b4'/>
<id>68e6b7d98bc64bbf1a54d963ca85111432f3a0b4</id>
<content type='text'>
Fix build warnings reported from linux-next.

Reported-by: Stephen Rothwell &lt;sfr@canb.auug.org.au&gt;
Link: https://lore.kernel.org/r/20250120192504.4a1965a0@canb.auug.org.au
Signed-off-by: Christian Brauner &lt;brauner@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fix build warnings reported from linux-next.

Reported-by: Stephen Rothwell &lt;sfr@canb.auug.org.au&gt;
Link: https://lore.kernel.org/r/20250120192504.4a1965a0@canb.auug.org.au
Signed-off-by: Christian Brauner &lt;brauner@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>samples/vfs: use shared header</title>
<updated>2025-01-20T11:50:35+00:00</updated>
<author>
<name>Christian Brauner</name>
<email>brauner@kernel.org</email>
</author>
<published>2025-01-20T11:41:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=f9d94f78a8749e15de8aeb2e281898aa980e62d9'/>
<id>f9d94f78a8749e15de8aeb2e281898aa980e62d9</id>
<content type='text'>
Share some infrastructure between sample programs and fix a build
failure that was reported.

Reported-by: Sasha Levin &lt;sashal@kernel.org&gt;
Link: https://lore.kernel.org/r/Z42UkSXx0MS9qZ9w@lappy
Link: https://qa-reports.linaro.org/lkft/sashal-linus-next/build/v6.13-rc7-511-g109a8e0fa9d6/testrun/26809210/suite/build/test/gcc-8-allyesconfig/log
Signed-off-by: Christian Brauner &lt;brauner@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Share some infrastructure between sample programs and fix a build
failure that was reported.

Reported-by: Sasha Levin &lt;sashal@kernel.org&gt;
Link: https://lore.kernel.org/r/Z42UkSXx0MS9qZ9w@lappy
Link: https://qa-reports.linaro.org/lkft/sashal-linus-next/build/v6.13-rc7-511-g109a8e0fa9d6/testrun/26809210/suite/build/test/gcc-8-allyesconfig/log
Signed-off-by: Christian Brauner &lt;brauner@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>samples/vfs/mountinfo: Use __u64 instead of uint64_t</title>
<updated>2025-01-10T11:08:27+00:00</updated>
<author>
<name>Geert Uytterhoeven</name>
<email>geert+renesas@glider.be</email>
</author>
<published>2025-01-06T13:48:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=f79e6eb84d4d2bff99e3ca6c1f140b2af827e904'/>
<id>f79e6eb84d4d2bff99e3ca6c1f140b2af827e904</id>
<content type='text'>
On 32-bit (e.g. arm32, m68k):

    samples/vfs/mountinfo.c: In function ‘dump_mountinfo’:
    samples/vfs/mountinfo.c:145:29: warning: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 2 has type ‘uint64_t’ {aka ‘long long unsigned int’} [-Wformat=]
      145 |                 printf("0x%lx 0x%lx 0x%llx ", mnt_ns_id, mnt_id, buf-&gt;mnt_parent_id);
	  |                           ~~^                 ~~~~~~~~~
	  |                             |                 |
	  |                             long unsigned int uint64_t {aka long long unsigned int}
	  |                           %llx
    samples/vfs/mountinfo.c:145:35: warning: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘uint64_t’ {aka ‘long long unsigned int’} [-Wformat=]
      145 |                 printf("0x%lx 0x%lx 0x%llx ", mnt_ns_id, mnt_id, buf-&gt;mnt_parent_id);
	  |                                 ~~^                      ~~~~~~
	  |                                   |                      |
	  |                                   long unsigned int      uint64_t {aka long long unsigned int}
	  |                                 %llx

Just using "%llx" instead of "%lx" is not sufficient, as uint64_t is
"long unsigned int" on some 64-bit platforms like arm64.  Hence also
replace "uint64_t" by "__u64", which matches what most other samples
are already using.

Fixes: d95e49bf8bcdc7c1 ("samples: add a mountinfo program to demonstrate statmount()/listmount()")
Signed-off-by: Geert Uytterhoeven &lt;geert+renesas@glider.be&gt;
Link: https://lore.kernel.org/r/20250106134802.1019911-1-geert+renesas@glider.be
Reviewed-by: Jeff Layton &lt;jlayton@kernel.org&gt;
Signed-off-by: Christian Brauner &lt;brauner@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
On 32-bit (e.g. arm32, m68k):

    samples/vfs/mountinfo.c: In function ‘dump_mountinfo’:
    samples/vfs/mountinfo.c:145:29: warning: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 2 has type ‘uint64_t’ {aka ‘long long unsigned int’} [-Wformat=]
      145 |                 printf("0x%lx 0x%lx 0x%llx ", mnt_ns_id, mnt_id, buf-&gt;mnt_parent_id);
	  |                           ~~^                 ~~~~~~~~~
	  |                             |                 |
	  |                             long unsigned int uint64_t {aka long long unsigned int}
	  |                           %llx
    samples/vfs/mountinfo.c:145:35: warning: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘uint64_t’ {aka ‘long long unsigned int’} [-Wformat=]
      145 |                 printf("0x%lx 0x%lx 0x%llx ", mnt_ns_id, mnt_id, buf-&gt;mnt_parent_id);
	  |                                 ~~^                      ~~~~~~
	  |                                   |                      |
	  |                                   long unsigned int      uint64_t {aka long long unsigned int}
	  |                                 %llx

Just using "%llx" instead of "%lx" is not sufficient, as uint64_t is
"long unsigned int" on some 64-bit platforms like arm64.  Hence also
replace "uint64_t" by "__u64", which matches what most other samples
are already using.

Fixes: d95e49bf8bcdc7c1 ("samples: add a mountinfo program to demonstrate statmount()/listmount()")
Signed-off-by: Geert Uytterhoeven &lt;geert+renesas@glider.be&gt;
Link: https://lore.kernel.org/r/20250106134802.1019911-1-geert+renesas@glider.be
Reviewed-by: Jeff Layton &lt;jlayton@kernel.org&gt;
Signed-off-by: Christian Brauner &lt;brauner@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>samples: add test-list-all-mounts</title>
<updated>2025-01-09T15:58:53+00:00</updated>
<author>
<name>Christian Brauner</name>
<email>brauner@kernel.org</email>
</author>
<published>2024-12-12T23:03:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=75d0dd101fbf0173f046bf55a8d583aa8d6a1ce5'/>
<id>75d0dd101fbf0173f046bf55a8d583aa8d6a1ce5</id>
<content type='text'>
Add a sample program illustrating how to list all mounts in all mount
namespaces.

Link: https://lore.kernel.org/r/20241213-work-mount-rbtree-lockless-v3-10-6e3cdaf9b280@kernel.org
Reviewed-by: Jeff Layton &lt;jlayton@kernel.org&gt;
Signed-off-by: Christian Brauner &lt;brauner@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add a sample program illustrating how to list all mounts in all mount
namespaces.

Link: https://lore.kernel.org/r/20241213-work-mount-rbtree-lockless-v3-10-6e3cdaf9b280@kernel.org
Reviewed-by: Jeff Layton &lt;jlayton@kernel.org&gt;
Signed-off-by: Christian Brauner &lt;brauner@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>samples: add a mountinfo program to demonstrate statmount()/listmount()</title>
<updated>2025-01-09T15:58:50+00:00</updated>
<author>
<name>Jeff Layton</name>
<email>jlayton@kernel.org</email>
</author>
<published>2024-11-15T15:35:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=c6640d46dc5a31ee7363545530836c10b9ddb9de'/>
<id>c6640d46dc5a31ee7363545530836c10b9ddb9de</id>
<content type='text'>
Add a new "mountinfo" sample userland program that demonstrates how to
use statmount() and listmount() to get at the same info that
/proc/pid/mountinfo provides.

The output of the program tries to mimic the mountinfo procfile
contents. With the -p flag, it can be pointed at an arbitrary pid to
print out info about its mount namespace. With the -r flag it will
attempt to walk all of the namespaces under the pid's mount namespace
and dump out mount info from all of them.

Signed-off-by: Jeff Layton &lt;jlayton@kernel.org&gt;
Link: https://lore.kernel.org/r/20241115-statmount-v2-1-cd29aeff9cbb@kernel.org
Signed-off-by: Christian Brauner &lt;brauner@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add a new "mountinfo" sample userland program that demonstrates how to
use statmount() and listmount() to get at the same info that
/proc/pid/mountinfo provides.

The output of the program tries to mimic the mountinfo procfile
contents. With the -p flag, it can be pointed at an arbitrary pid to
print out info about its mount namespace. With the -r flag it will
attempt to walk all of the namespaces under the pid's mount namespace
and dump out mount info from all of them.

Signed-off-by: Jeff Layton &lt;jlayton@kernel.org&gt;
Link: https://lore.kernel.org/r/20241115-statmount-v2-1-cd29aeff9cbb@kernel.org
Signed-off-by: Christian Brauner &lt;brauner@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>.gitignore: prefix local generated files with a slash</title>
<updated>2021-05-01T15:43:35+00:00</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2021-04-30T02:03:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=9009b455811b0fa1f6b0adfa94db136984db5a38'/>
<id>9009b455811b0fa1f6b0adfa94db136984db5a38</id>
<content type='text'>
The pattern prefixed with '/' matches files in the same directory,
but not ones in sub-directories.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
Acked-by: Miguel Ojeda &lt;ojeda@kernel.org&gt;
Acked-by: Rob Herring &lt;robh@kernel.org&gt;
Acked-by: Andra Paraschiv &lt;andraprs@amazon.com&gt;
Acked-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Acked-by: Gabriel Krisman Bertazi &lt;krisman@collabora.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The pattern prefixed with '/' matches files in the same directory,
but not ones in sub-directories.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
Acked-by: Miguel Ojeda &lt;ojeda@kernel.org&gt;
Acked-by: Rob Herring &lt;robh@kernel.org&gt;
Acked-by: Andra Paraschiv &lt;andraprs@amazon.com&gt;
Acked-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Acked-by: Gabriel Krisman Bertazi &lt;krisman@collabora.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
