diff options
Diffstat (limited to 'testcases/kernel/syscalls/memfd_create/memfd_create04.c')
-rw-r--r-- | testcases/kernel/syscalls/memfd_create/memfd_create04.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/testcases/kernel/syscalls/memfd_create/memfd_create04.c b/testcases/kernel/syscalls/memfd_create/memfd_create04.c index 7b699b218..585f17e16 100644 --- a/testcases/kernel/syscalls/memfd_create/memfd_create04.c +++ b/testcases/kernel/syscalls/memfd_create/memfd_create04.c @@ -1,20 +1,23 @@ // SPDX-License-Identifier: GPL-2.0-or-later /* - * Copyright (c) Zilogic Systems Pvt. Ltd., 2018 - * Email: code@zilogic.com + * Copyright (c) Zilogic Systems Pvt. Ltd. <code@zilogic.com>, 2018 + * Copyright (c) Linux Test Project, 2019-2023 */ -/* - * Test: Validating memfd_create() with MFD_HUGETLB and MFD_HUGE_x flags. +/*\ + * [Description] + * + * Validating memfd_create() with MFD_HUGETLB and MFD_HUGE_x flags. * - * Test cases: Attempt to create files in the hugetlbfs filesystem using - * different huge page sizes. + * Attempt to create files in the hugetlbfs filesystem using different huge page + * sizes. * - * Test logic: memfd_create() should return non-negative value (fd) - * if the system supports that particular huge page size. - * On success, fd is returned. - * On failure, -1 is returned with ENODEV error. + * [Algorithm] + * + * memfd_create() should return non-negative value (fd) if the system supports + * that particular huge page size. + * On success, fd is returned. On failure, -1 is returned with ENODEV error. */ #define _GNU_SOURCE @@ -25,8 +28,6 @@ #include <errno.h> #include <stdio.h> -#define PATH_HUGEPAGES "/sys/kernel/mm/hugepages" - static struct test_flag { int flag; char *h_size; @@ -48,7 +49,7 @@ static void check_hugepage_support(struct test_flag *test_flags) char pattern[64]; sprintf(pattern, PATH_HUGEPAGES); - strcat(pattern, "/hugepages-"); + strcat(pattern, "hugepages-"); strcat(pattern, test_flags->h_size); if (access(pattern, F_OK)) |