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