Lines Matching refs:fd
38 static __fsword_t get_fs_type(int fd) in get_fs_type() argument
44 ret = fstatfs(fd, &fs); in get_fs_type()
91 static void do_test(int fd, size_t size, enum test_type type, bool shared) in do_test() argument
93 __fsword_t fs_type = get_fs_type(fd); in do_test()
98 if (ftruncate(fd, size)) { in do_test()
103 if (fallocate(fd, 0, 0, size)) { in do_test()
112 shared ? MAP_SHARED : MAP_PRIVATE, fd, 0); in do_test()
234 typedef void (*test_fn)(int fd, size_t size);
238 int fd; in run_with_memfd() local
242 fd = memfd_create("test", 0); in run_with_memfd()
243 if (fd < 0) { in run_with_memfd()
248 fn(fd, pagesize); in run_with_memfd()
249 close(fd); in run_with_memfd()
255 int fd; in run_with_tmpfile() local
265 fd = fileno(file); in run_with_tmpfile()
266 if (fd < 0) { in run_with_tmpfile()
271 fn(fd, pagesize); in run_with_tmpfile()
278 int fd; in run_with_local_tmpfile() local
282 fd = mkstemp(filename); in run_with_local_tmpfile()
283 if (fd < 0) { in run_with_local_tmpfile()
293 fn(fd, pagesize); in run_with_local_tmpfile()
295 close(fd); in run_with_local_tmpfile()
302 int fd; in run_with_memfd_hugetlb() local
309 fd = memfd_create("test", flags); in run_with_memfd_hugetlb()
310 if (fd < 0) { in run_with_memfd_hugetlb()
315 fn(fd, hugetlbsize); in run_with_memfd_hugetlb()
316 close(fd); in run_with_memfd_hugetlb()
324 static void test_shared_rw_pin(int fd, size_t size) in test_shared_rw_pin() argument
326 do_test(fd, size, TEST_TYPE_RW, true); in test_shared_rw_pin()
329 static void test_shared_rw_fast_pin(int fd, size_t size) in test_shared_rw_fast_pin() argument
331 do_test(fd, size, TEST_TYPE_RW_FAST, true); in test_shared_rw_fast_pin()
334 static void test_shared_ro_pin(int fd, size_t size) in test_shared_ro_pin() argument
336 do_test(fd, size, TEST_TYPE_RO, true); in test_shared_ro_pin()
339 static void test_shared_ro_fast_pin(int fd, size_t size) in test_shared_ro_fast_pin() argument
341 do_test(fd, size, TEST_TYPE_RO_FAST, true); in test_shared_ro_fast_pin()
344 static void test_private_rw_pin(int fd, size_t size) in test_private_rw_pin() argument
346 do_test(fd, size, TEST_TYPE_RW, false); in test_private_rw_pin()
349 static void test_private_rw_fast_pin(int fd, size_t size) in test_private_rw_fast_pin() argument
351 do_test(fd, size, TEST_TYPE_RW_FAST, false); in test_private_rw_fast_pin()
354 static void test_private_ro_pin(int fd, size_t size) in test_private_ro_pin() argument
356 do_test(fd, size, TEST_TYPE_RO, false); in test_private_ro_pin()
359 static void test_private_ro_fast_pin(int fd, size_t size) in test_private_ro_fast_pin() argument
361 do_test(fd, size, TEST_TYPE_RO_FAST, false); in test_private_ro_fast_pin()
365 static void test_shared_iouring(int fd, size_t size) in test_shared_iouring() argument
367 do_test(fd, size, TEST_TYPE_IOURING, true); in test_shared_iouring()
370 static void test_private_iouring(int fd, size_t size) in test_private_iouring() argument
372 do_test(fd, size, TEST_TYPE_IOURING, false); in test_private_iouring()