1 #include "tests.h"
2
3 #ifdef HAVE_LINUX_FIEMAP_H
4
5 # include <stdio.h>
6 # include <sys/ioctl.h>
7 # include <linux/fiemap.h>
8 # include <linux/fs.h>
9 # include "xlat.h"
10 # include "xlat/fiemap_flags.h"
11
12 static void
test_fiemap(void)13 test_fiemap(void)
14 {
15 (void) tail_alloc(1);
16 TAIL_ALLOC_OBJECT_CONST_PTR(struct fiemap, args);
17
18 printf("ioctl(-1, FS_IOC_FIEMAP, {fm_start=%" PRI__u64
19 ", fm_length=%" PRI__u64", fm_flags=",
20 args->fm_start, args->fm_length);
21 printflags(fiemap_flags, args->fm_flags, "FIEMAP_FLAG_???");
22 printf(", fm_extent_count=%u})", args->fm_extent_count);
23 ioctl(-1, FS_IOC_FIEMAP, args);
24 printf(" = -1 EBADF (%m)\n");
25
26 /* The live version of this test is in btrfs.c */
27 }
28
29 /* clone and dedupe ioctls are in btrfs.c since they originated there */
30
31 int
main(int argc,char * argv[])32 main(int argc, char *argv[])
33 {
34 test_fiemap();
35
36 puts("+++ exited with 0 +++");
37
38 return 0;
39 }
40
41 #else
42
43 SKIP_MAIN_UNDEFINED("HAVE_LINUX_FIEMAP_H")
44
45 #endif
46