Commit Graph

6 Commits

Author SHA1 Message Date
Arnd Bergmann
33cec19dc0
samples/vfs: fix printf format string for size_t
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: fa204a65f1 ("samples/vfs: add STATMOUNT_MNT_{G,U}IDMAP")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20250224141406.1400864-1-arnd@kernel.org
Signed-off-by: Christian Brauner <brauner@kernel.org>
2025-02-25 11:56:26 +01:00
Christian Brauner
fa204a65f1
samples/vfs: add STATMOUNT_MNT_{G,U}IDMAP
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 <jlayton@kernel.org>
Signed-off-by: Christian Brauner <brauner@kernel.org>
2025-02-12 12:12:27 +01:00
Christian Brauner
a496dfecbc
samples/vfs: check whether flag was raised
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 <jlayton@kernel.org>
Signed-off-by: Christian Brauner <brauner@kernel.org>
2025-02-12 12:12:27 +01:00
Christian Brauner
68e6b7d98b
samples/vfs: fix build warnings
Fix build warnings reported from linux-next.

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Link: https://lore.kernel.org/r/20250120192504.4a1965a0@canb.auug.org.au
Signed-off-by: Christian Brauner <brauner@kernel.org>
2025-01-20 13:14:21 +01:00
Christian Brauner
f9d94f78a8
samples/vfs: use shared header
Share some infrastructure between sample programs and fix a build
failure that was reported.

Reported-by: Sasha Levin <sashal@kernel.org>
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 <brauner@kernel.org>
2025-01-20 12:50:35 +01:00
Christian Brauner
75d0dd101f
samples: add test-list-all-mounts
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 <jlayton@kernel.org>
Signed-off-by: Christian Brauner <brauner@kernel.org>
2025-01-09 16:58:53 +01:00