diff options
Diffstat (limited to 'tools/testing/selftests/memfd/memfd_test.c')
-rw-r--r-- | tools/testing/selftests/memfd/memfd_test.c | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/tools/testing/selftests/memfd/memfd_test.c b/tools/testing/selftests/memfd/memfd_test.c index 3634c909b1b0..0b9eafb7ab7b 100644 --- a/tools/testing/selftests/memfd/memfd_test.c +++ b/tools/testing/selftests/memfd/memfd_test.c @@ -59,9 +59,9 @@ static void mfd_fail_new(const char *name, unsigned int flags) } } -static __u64 mfd_assert_get_seals(int fd) +static unsigned int mfd_assert_get_seals(int fd) { - long r; + int r; r = fcntl(fd, F_GET_SEALS); if (r < 0) { @@ -69,50 +69,48 @@ static __u64 mfd_assert_get_seals(int fd) abort(); } - return r; + return (unsigned int)r; } -static void mfd_assert_has_seals(int fd, __u64 seals) +static void mfd_assert_has_seals(int fd, unsigned int seals) { - __u64 s; + unsigned int s; s = mfd_assert_get_seals(fd); if (s != seals) { - printf("%llu != %llu = GET_SEALS(%d)\n", - (unsigned long long)seals, (unsigned long long)s, fd); + printf("%u != %u = GET_SEALS(%d)\n", seals, s, fd); abort(); } } -static void mfd_assert_add_seals(int fd, __u64 seals) +static void mfd_assert_add_seals(int fd, unsigned int seals) { - long r; - __u64 s; + int r; + unsigned int s; s = mfd_assert_get_seals(fd); r = fcntl(fd, F_ADD_SEALS, seals); if (r < 0) { - printf("ADD_SEALS(%d, %llu -> %llu) failed: %m\n", - fd, (unsigned long long)s, (unsigned long long)seals); + printf("ADD_SEALS(%d, %u -> %u) failed: %m\n", fd, s, seals); abort(); } } -static void mfd_fail_add_seals(int fd, __u64 seals) +static void mfd_fail_add_seals(int fd, unsigned int seals) { - long r; - __u64 s; + int r; + unsigned int s; r = fcntl(fd, F_GET_SEALS); if (r < 0) s = 0; else - s = r; + s = (unsigned int)r; r = fcntl(fd, F_ADD_SEALS, seals); if (r >= 0) { - printf("ADD_SEALS(%d, %llu -> %llu) didn't fail as expected\n", - fd, (unsigned long long)s, (unsigned long long)seals); + printf("ADD_SEALS(%d, %u -> %u) didn't fail as expected\n", + fd, s, seals); abort(); } } @@ -205,7 +203,7 @@ static void mfd_fail_open(int fd, int flags, mode_t mode) sprintf(buf, "/proc/self/fd/%d", fd); r = open(buf, flags, mode); if (r >= 0) { - printf("open(%s) didn't fail as expected\n"); + printf("open(%s) didn't fail as expected\n", buf); abort(); } } |