Skip to content

Commit 68e6b7d

Browse files
committed
samples/vfs: fix build warnings
Fix build warnings reported from linux-next. Reported-by: Stephen Rothwell <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Christian Brauner <[email protected]>
1 parent f9d94f7 commit 68e6b7d

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

samples/vfs/test-list-all-mounts.c

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include <errno.h>
66
#include <limits.h>
77
#include <linux/types.h>
8+
#include <inttypes.h>
89
#include <stdio.h>
910

1011
#include "../../tools/testing/selftests/pidfd/pidfd.h"
@@ -86,8 +87,8 @@ int main(int argc, char *argv[])
8687
if (ret < 0)
8788
die_errno("ioctl(NS_GET_MNTNS_ID) failed");
8889

89-
printf("Listing %u mounts for mount namespace %llu\n",
90-
info.nr_mounts, info.mnt_ns_id);
90+
printf("Listing %u mounts for mount namespace %" PRIu64 "\n",
91+
info.nr_mounts, (uint64_t)info.mnt_ns_id);
9192
for (;;) {
9293
ssize_t nr_mounts;
9394
next:
@@ -97,8 +98,8 @@ int main(int argc, char *argv[])
9798
if (nr_mounts <= 0) {
9899
int fd_mntns_next;
99100

100-
printf("Finished listing %u mounts for mount namespace %llu\n\n",
101-
info.nr_mounts, info.mnt_ns_id);
101+
printf("Finished listing %u mounts for mount namespace %" PRIu64 "\n\n",
102+
info.nr_mounts, (uint64_t)info.mnt_ns_id);
102103
fd_mntns_next = ioctl(fd_mntns, NS_MNT_GET_NEXT, &info);
103104
if (fd_mntns_next < 0) {
104105
if (errno == ENOENT) {
@@ -110,8 +111,8 @@ int main(int argc, char *argv[])
110111
close(fd_mntns);
111112
fd_mntns = fd_mntns_next;
112113
last_mnt_id = 0;
113-
printf("Listing %u mounts for mount namespace %llu\n",
114-
info.nr_mounts, info.mnt_ns_id);
114+
printf("Listing %u mounts for mount namespace %" PRIu64 "\n",
115+
info.nr_mounts, (uint64_t)info.mnt_ns_id);
115116
goto next;
116117
}
117118

@@ -129,14 +130,14 @@ int main(int argc, char *argv[])
129130
STATMOUNT_MNT_OPTS |
130131
STATMOUNT_FS_TYPE, 0);
131132
if (!stmnt) {
132-
printf("Failed to statmount(%llu) in mount namespace(%llu)\n",
133-
last_mnt_id, info.mnt_ns_id);
133+
printf("Failed to statmount(%" PRIu64 ") in mount namespace(%" PRIu64 ")\n",
134+
(uint64_t)last_mnt_id, (uint64_t)info.mnt_ns_id);
134135
continue;
135136
}
136137

137-
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",
138-
stmnt->mnt_id,
139-
stmnt->mnt_parent_id,
138+
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",
139+
(uint64_t)stmnt->mnt_id,
140+
(uint64_t)stmnt->mnt_parent_id,
140141
stmnt->str + stmnt->fs_type,
141142
stmnt->str + stmnt->mnt_root,
142143
stmnt->str + stmnt->mnt_point,

0 commit comments

Comments
 (0)