Lines Matching +full:x +full:- +full:size
1 // SPDX-License-Identifier: LGPL-2.1
17 * in 'perf trace', see tools/perf/trace/beauty/Build and builtin-trace.c
19 #include <uapi/asm-generic/ioctls.h>
21 static size_t ioctl__scnprintf_tty_cmd(int nr, int dir, char *bf, size_t size) in ioctl__scnprintf_tty_cmd() argument
42 return scnprintf(bf, size, "%s", strarray__ioctl_tty_cmd.entries[nr]); in ioctl__scnprintf_tty_cmd()
44 return scnprintf(bf, size, "(%#x, %#x, %#x)", 'T', nr, dir); in ioctl__scnprintf_tty_cmd()
47 static size_t ioctl__scnprintf_drm_cmd(int nr, int dir, char *bf, size_t size) in ioctl__scnprintf_drm_cmd() argument
53 return scnprintf(bf, size, "DRM_%s", strarray__drm_ioctl_cmds.entries[nr]); in ioctl__scnprintf_drm_cmd()
55 return scnprintf(bf, size, "(%#x, %#x, %#x)", 'd', nr, dir); in ioctl__scnprintf_drm_cmd()
58 static size_t ioctl__scnprintf_sndrv_pcm_cmd(int nr, int dir, char *bf, size_t size) in ioctl__scnprintf_sndrv_pcm_cmd() argument
64 return scnprintf(bf, size, "SNDRV_PCM_%s", strarray__sndrv_pcm_ioctl_cmds.entries[nr]); in ioctl__scnprintf_sndrv_pcm_cmd()
66 return scnprintf(bf, size, "(%#x, %#x, %#x)", 'A', nr, dir); in ioctl__scnprintf_sndrv_pcm_cmd()
69 static size_t ioctl__scnprintf_sndrv_ctl_cmd(int nr, int dir, char *bf, size_t size) in ioctl__scnprintf_sndrv_ctl_cmd() argument
75 return scnprintf(bf, size, "SNDRV_CTL_%s", strarray__sndrv_ctl_ioctl_cmds.entries[nr]); in ioctl__scnprintf_sndrv_ctl_cmd()
77 return scnprintf(bf, size, "(%#x, %#x, %#x)", 'U', nr, dir); in ioctl__scnprintf_sndrv_ctl_cmd()
80 static size_t ioctl__scnprintf_kvm_cmd(int nr, int dir, char *bf, size_t size) in ioctl__scnprintf_kvm_cmd() argument
86 return scnprintf(bf, size, "KVM_%s", strarray__kvm_ioctl_cmds.entries[nr]); in ioctl__scnprintf_kvm_cmd()
88 return scnprintf(bf, size, "(%#x, %#x, %#x)", 0xAE, nr, dir); in ioctl__scnprintf_kvm_cmd()
91 static size_t ioctl__scnprintf_vhost_virtio_cmd(int nr, int dir, char *bf, size_t size) in ioctl__scnprintf_vhost_virtio_cmd() argument
98 if (nr < s->nr_entries && s->entries[nr] != NULL) in ioctl__scnprintf_vhost_virtio_cmd()
99 return scnprintf(bf, size, "VHOST_%s", s->entries[nr]); in ioctl__scnprintf_vhost_virtio_cmd()
101 return scnprintf(bf, size, "(%#x, %#x, %#x)", 0xAF, nr, dir); in ioctl__scnprintf_vhost_virtio_cmd()
104 static size_t ioctl__scnprintf_perf_cmd(int nr, int dir, char *bf, size_t size) in ioctl__scnprintf_perf_cmd() argument
110 return scnprintf(bf, size, "PERF_%s", strarray__perf_ioctl_cmds.entries[nr]); in ioctl__scnprintf_perf_cmd()
112 return scnprintf(bf, size, "(%#x, %#x, %#x)", 0xAE, nr, dir); in ioctl__scnprintf_perf_cmd()
115 static size_t ioctl__scnprintf_usbdevfs_cmd(int nr, int dir, char *bf, size_t size) in ioctl__scnprintf_usbdevfs_cmd() argument
121 return scnprintf(bf, size, "USBDEVFS_%s", strarray__usbdevfs_ioctl_cmds.entries[nr]); in ioctl__scnprintf_usbdevfs_cmd()
123 return scnprintf(bf, size, "(%c, %#x, %#x)", 'U', nr, dir); in ioctl__scnprintf_usbdevfs_cmd()
126 static size_t ioctl__scnprintf_cmd(unsigned long cmd, char *bf, size_t size, bool show_prefix) in ioctl__scnprintf_cmd() argument
136 size_t (*scnprintf)(int nr, int dir, char *bf, size_t size); in ioctl__scnprintf_cmd()
139 ['A' - '$'] = { .type = 'A', .scnprintf = ioctl__scnprintf_sndrv_pcm_cmd, }, in ioctl__scnprintf_cmd()
140 ['T' - '$'] = { .type = 'T', .scnprintf = ioctl__scnprintf_tty_cmd, }, in ioctl__scnprintf_cmd()
141 ['U' - '$'] = { .type = 'U', .scnprintf = ioctl__scnprintf_sndrv_ctl_cmd, }, in ioctl__scnprintf_cmd()
142 ['d' - '$'] = { .type = 'd', .scnprintf = ioctl__scnprintf_drm_cmd, }, in ioctl__scnprintf_cmd()
143 [0xAE - '$'] = { .type = 0xAE, .scnprintf = ioctl__scnprintf_kvm_cmd, }, in ioctl__scnprintf_cmd()
144 [0xAF - '$'] = { .type = 0xAF, .scnprintf = ioctl__scnprintf_vhost_virtio_cmd, }, in ioctl__scnprintf_cmd()
148 if (type >= ioctl_types[0].type && type <= ioctl_types[nr_types - 1].type) { in ioctl__scnprintf_cmd()
149 const int index = type - ioctl_types[0].type; in ioctl__scnprintf_cmd()
152 return ioctl_types[index].scnprintf(nr, dir, bf, size); in ioctl__scnprintf_cmd()
155 printed += scnprintf(bf + printed, size - printed, "%c", '('); in ioctl__scnprintf_cmd()
158 printed += scnprintf(bf + printed, size - printed, "%s%s", show_prefix ? prefix : "", "NONE"); in ioctl__scnprintf_cmd()
161 printed += scnprintf(bf + printed, size - printed, "%s%s", show_prefix ? prefix : "", "READ"); in ioctl__scnprintf_cmd()
163 printed += scnprintf(bf + printed, size - printed, "%s%s%s", dir & _IOC_READ ? "|" : "", in ioctl__scnprintf_cmd()
168 return printed + scnprintf(bf + printed, size - printed, ", %#x, %#x, %#x)", type, nr, sz); in ioctl__scnprintf_cmd()
175 size_t syscall_arg__scnprintf_ioctl_cmd(char *bf, size_t size, struct syscall_arg *arg) in syscall_arg__scnprintf_ioctl_cmd() argument
177 unsigned long cmd = arg->val; in syscall_arg__scnprintf_ioctl_cmd()
179 struct file *file = thread__files_entry(arg->thread, fd); in syscall_arg__scnprintf_ioctl_cmd()
182 if (file->dev_maj == USB_DEVICE_MAJOR) in syscall_arg__scnprintf_ioctl_cmd()
183 return ioctl__scnprintf_usbdevfs_cmd(_IOC_NR(cmd), _IOC_DIR(cmd), bf, size); in syscall_arg__scnprintf_ioctl_cmd()
186 return ioctl__scnprintf_cmd(cmd, bf, size, arg->show_string_prefix); in syscall_arg__scnprintf_ioctl_cmd()