1
0
Fork 0
mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git synced 2025-01-22 07:53:11 -05:00

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>
This commit is contained in:
Christian Brauner 2025-01-20 12:56:10 +01:00
parent f9d94f78a8
commit 68e6b7d98b
No known key found for this signature in database
GPG key ID: 91C61BC06578DCA2

View file

@ -5,6 +5,7 @@
#include <errno.h> #include <errno.h>
#include <limits.h> #include <limits.h>
#include <linux/types.h> #include <linux/types.h>
#include <inttypes.h>
#include <stdio.h> #include <stdio.h>
#include "../../tools/testing/selftests/pidfd/pidfd.h" #include "../../tools/testing/selftests/pidfd/pidfd.h"
@ -86,8 +87,8 @@ int main(int argc, char *argv[])
if (ret < 0) if (ret < 0)
die_errno("ioctl(NS_GET_MNTNS_ID) failed"); die_errno("ioctl(NS_GET_MNTNS_ID) failed");
printf("Listing %u mounts for mount namespace %llu\n", printf("Listing %u mounts for mount namespace %" PRIu64 "\n",
info.nr_mounts, info.mnt_ns_id); info.nr_mounts, (uint64_t)info.mnt_ns_id);
for (;;) { for (;;) {
ssize_t nr_mounts; ssize_t nr_mounts;
next: next:
@ -97,8 +98,8 @@ int main(int argc, char *argv[])
if (nr_mounts <= 0) { if (nr_mounts <= 0) {
int fd_mntns_next; int fd_mntns_next;
printf("Finished listing %u mounts for mount namespace %llu\n\n", printf("Finished listing %u mounts for mount namespace %" PRIu64 "\n\n",
info.nr_mounts, info.mnt_ns_id); info.nr_mounts, (uint64_t)info.mnt_ns_id);
fd_mntns_next = ioctl(fd_mntns, NS_MNT_GET_NEXT, &info); fd_mntns_next = ioctl(fd_mntns, NS_MNT_GET_NEXT, &info);
if (fd_mntns_next < 0) { if (fd_mntns_next < 0) {
if (errno == ENOENT) { if (errno == ENOENT) {
@ -110,8 +111,8 @@ int main(int argc, char *argv[])
close(fd_mntns); close(fd_mntns);
fd_mntns = fd_mntns_next; fd_mntns = fd_mntns_next;
last_mnt_id = 0; last_mnt_id = 0;
printf("Listing %u mounts for mount namespace %llu\n", printf("Listing %u mounts for mount namespace %" PRIu64 "\n",
info.nr_mounts, info.mnt_ns_id); info.nr_mounts, (uint64_t)info.mnt_ns_id);
goto next; goto next;
} }
@ -129,14 +130,14 @@ int main(int argc, char *argv[])
STATMOUNT_MNT_OPTS | STATMOUNT_MNT_OPTS |
STATMOUNT_FS_TYPE, 0); STATMOUNT_FS_TYPE, 0);
if (!stmnt) { if (!stmnt) {
printf("Failed to statmount(%llu) in mount namespace(%llu)\n", printf("Failed to statmount(%" PRIu64 ") in mount namespace(%" PRIu64 ")\n",
last_mnt_id, info.mnt_ns_id); (uint64_t)last_mnt_id, (uint64_t)info.mnt_ns_id);
continue; continue;
} }
printf("mnt_id:\t\t%llu\nmnt_parent_id:\t%llu\nfs_type:\t%s\nmnt_root:\t%s\nmnt_point:\t%s\nmnt_opts:\t%s\n\n", printf("mnt_id:\t\t%" PRIu64 "\nmnt_parent_id:\t%" PRIu64 "\nfs_type:\t%s\nmnt_root:\t%s\nmnt_point:\t%s\nmnt_opts:\t%s\n\n",
stmnt->mnt_id, (uint64_t)stmnt->mnt_id,
stmnt->mnt_parent_id, (uint64_t)stmnt->mnt_parent_id,
stmnt->str + stmnt->fs_type, stmnt->str + stmnt->fs_type,
stmnt->str + stmnt->mnt_root, stmnt->str + stmnt->mnt_root,
stmnt->str + stmnt->mnt_point, stmnt->str + stmnt->mnt_point,