]> granicus.if.org Git - strace/blob - fs_x_ioctl.c
Update debian/watch
[strace] / fs_x_ioctl.c
1 /*
2  * Copyright (c) 2014 Mike Frysinger <vapier@gentoo.org>
3  * Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org>
4  * Copyright (c) 2016-2018 The strace developers.
5  * All rights reserved.
6  *
7  * SPDX-License-Identifier: LGPL-2.1-or-later
8  */
9
10 #include "defs.h"
11 #include <linux/fs.h>
12
13 int
14 fs_x_ioctl(struct tcb *const tcp, const unsigned int code,
15            const kernel_ulong_t arg)
16 {
17         switch (code) {
18 #ifdef FITRIM
19         /* First seen in linux-2.6.37 */
20         case FITRIM: {
21                 struct fstrim_range fstrim;
22
23                 tprints(", ");
24                 if (!umove_or_printaddr(tcp, arg, &fstrim))
25                         tprintf("{start=%#" PRIx64
26                                 ", len=%#" PRIx64
27                                 ", minlen=%#" PRIx64 "}",
28                                 (uint64_t) fstrim.start,
29                                 (uint64_t) fstrim.len,
30                                 (uint64_t) fstrim.minlen);
31                 break;
32         }
33 #endif
34
35         /* No arguments */
36 #ifdef FIFREEZE
37         case FIFREEZE:
38         case FITHAW:
39                 break;
40 #endif
41
42         default:
43                 return RVAL_DECODED;
44         }
45
46         return RVAL_IOCTL_DECODED;
47 }