Home
last modified time | relevance | path

Searched refs:buf (Results 1 – 25 of 25) sorted by relevance

/samples/bpf/
Dtask_fd_query_user.c50 char buf[256]; in bpf_find_probe_type() local
53 ret = snprintf(buf, sizeof(buf), PMU_TYPE_FILE, event_type); in bpf_find_probe_type()
54 CHECK_PERROR_RET(ret < 0 || ret >= sizeof(buf)); in bpf_find_probe_type()
56 fd = open(buf, O_RDONLY); in bpf_find_probe_type()
59 ret = read(fd, buf, sizeof(buf)); in bpf_find_probe_type()
61 CHECK_PERROR_RET(ret < 0 || ret >= sizeof(buf)); in bpf_find_probe_type()
64 ret = (int)strtol(buf, NULL, 10); in bpf_find_probe_type()
72 char buf[256]; in bpf_get_retprobe_bit() local
75 ret = snprintf(buf, sizeof(buf), PMU_RETPROBE_FILE, event_type); in bpf_get_retprobe_bit()
76 CHECK_PERROR_RET(ret < 0 || ret >= sizeof(buf)); in bpf_get_retprobe_bit()
[all …]
Dtracex6_kern.c60 struct bpf_perf_event_value *val, buf; in BPF_KPROBE() local
68 error = bpf_perf_event_read_value(&counters, key, &buf, sizeof(buf)); in BPF_KPROBE()
74 *val = buf; in BPF_KPROBE()
76 bpf_map_update_elem(&values2, &key, &buf, BPF_NOEXIST); in BPF_KPROBE()
Dtest_overhead_user.c40 char buf[] = "test\n"; in test_task_rename() local
50 if (write(fd, buf, sizeof(buf)) < 0) { in test_task_rename()
64 char buf[4]; in test_urandom_read() local
74 if (read(fd, buf, sizeof(buf)) < 0) { in test_urandom_read()
Dxdp_router_ipv4_user.c32 char buf[8192]; variable
98 buf_ptr = buf; in recv_msg()
100 len = recv(sock, buf_ptr, sizeof(buf) - nll, 0); in recv_msg()
325 char buf[8192]; in get_route_table() member
360 memset(buf, 0, sizeof(buf)); in get_route_table()
367 nh = (struct nlmsghdr *)buf; in get_route_table()
464 char buf[8192]; in get_arp_table() member
498 memset(buf, 0, sizeof(buf)); in get_arp_table()
505 nh = (struct nlmsghdr *)buf; in get_arp_table()
584 memset(buf, 0, sizeof(buf)); in monitor_route()
[all …]
Dhbm.c97 static char buf[4097]; in read_trace_pipe2() local
100 sz = read(trace_fd, buf, sizeof(buf) - 1); in read_trace_pipe2()
102 buf[sz] = 0; in read_trace_pipe2()
103 puts(buf); in read_trace_pipe2()
105 fprintf(outf, "%s\n", buf); in read_trace_pipe2()
Dcookie_uid_helper_example.c220 char buf; in udp_client() local
251 recv_len = recvfrom(s_rcv, &buf, sizeof(buf), 0, in udp_client()
259 printf("Message received: %c\n", buf); in udp_client()
Dxdpsock_user.c535 char buf[32]; in hex_dump() local
541 sprintf(buf, "addr=%llu", addr); in hex_dump()
543 printf("%s | ", buf); in hex_dump()
558 printf("%s | ", buf); in hex_dump()
/samples/hidraw/
Dhid-example.c47 char buf[256]; in main() local
66 memset(buf, 0x0, sizeof(buf)); in main()
88 res = ioctl(fd, HIDIOCGRAWNAME(256), buf); in main()
92 printf("Raw Name: %s\n", buf); in main()
95 res = ioctl(fd, HIDIOCGRAWPHYS(256), buf); in main()
99 printf("Raw Phys: %s\n", buf); in main()
114 buf[0] = 0x9; /* Report Number */ in main()
115 buf[1] = 0xff; in main()
116 buf[2] = 0xff; in main()
117 buf[3] = 0xff; in main()
[all …]
/samples/kfifo/
Drecord-example.c71 char buf[100]; in testfunc() local
74 struct { unsigned char buf[6]; } hello = { "hello" }; in testfunc() member
85 memset(buf, 'a' + i, i + 1); in testfunc()
86 kfifo_in(&test, buf, i + 1); in testfunc()
96 ret = kfifo_out_peek(&test, buf, sizeof(buf)); in testfunc()
98 printk(KERN_INFO "%.*s\n", ret, buf); in testfunc()
103 ret = kfifo_out(&test, buf, sizeof(buf)); in testfunc()
104 buf[ret] = '\0'; in testfunc()
105 printk(KERN_INFO "item = %.*s\n", ret, buf); in testfunc()
106 if (strcmp(buf, expected_result[i++])) { in testfunc()
[all …]
Dbytestream-example.c54 unsigned char buf[6]; in testfunc() local
71 i = kfifo_out(&test, buf, 5); in testfunc()
72 printk(KERN_INFO "buf: %.*s\n", i, buf); in testfunc()
75 ret = kfifo_out(&test, buf, 2); in testfunc()
78 ret = kfifo_in(&test, buf, ret); in testfunc()
113 static ssize_t fifo_write(struct file *file, const char __user *buf, in fifo_write() argument
122 ret = kfifo_from_user(&test, buf, count, &copied); in fifo_write()
131 static ssize_t fifo_read(struct file *file, char __user *buf, in fifo_read() argument
140 ret = kfifo_to_user(&test, buf, count, &copied); in fifo_read()
Dinttype-example.c54 int buf[6]; in testfunc() local
68 ret = kfifo_out(&test, buf, 2); in testfunc()
71 ret = kfifo_in(&test, buf, ret); in testfunc()
106 static ssize_t fifo_write(struct file *file, const char __user *buf, in fifo_write() argument
115 ret = kfifo_from_user(&test, buf, count, &copied); in fifo_write()
124 static ssize_t fifo_read(struct file *file, char __user *buf, in fifo_read() argument
133 ret = kfifo_to_user(&test, buf, count, &copied); in fifo_read()
/samples/kobject/
Dkobject-example.c29 char *buf) in foo_show() argument
31 return sprintf(buf, "%d\n", foo); in foo_show()
35 const char *buf, size_t count) in foo_store() argument
39 ret = kstrtoint(buf, 10, &foo); in foo_store()
55 char *buf) in b_show() argument
63 return sprintf(buf, "%d\n", var); in b_show()
67 const char *buf, size_t count) in b_store() argument
71 ret = kstrtoint(buf, 10, &var); in b_store()
Dkset-example.c40 ssize_t (*show)(struct foo_obj *foo, struct foo_attribute *attr, char *buf);
41 ssize_t (*store)(struct foo_obj *foo, struct foo_attribute *attr, const char *buf, size_t count);
54 char *buf) in foo_attr_show() argument
65 return attribute->show(foo, attribute, buf); in foo_attr_show()
74 const char *buf, size_t len) in foo_attr_store() argument
85 return attribute->store(foo, attribute, buf, len); in foo_attr_store()
113 char *buf) in foo_show() argument
115 return sprintf(buf, "%d\n", foo_obj->foo); in foo_show()
119 const char *buf, size_t count) in foo_store() argument
123 ret = kstrtoint(buf, 10, &foo_obj->foo); in foo_store()
[all …]
/samples/connector/
Ducon.c51 char buf[128]; in netlink_send() local
56 nlh = (struct nlmsghdr *)buf; in netlink_send()
100 char buf[1024]; in main() local
137 memset(buf, 0, sizeof(buf)); in main()
166 memset(buf, 0, sizeof(buf)); in main()
168 data = (struct cn_msg *)buf; in main()
207 memset(buf, 0, sizeof(buf)); in main()
208 len = recv(s, buf, sizeof(buf), 0); in main()
214 reply = (struct nlmsghdr *)buf; in main()
/samples/seccomp/
Dbpf-fancy.c34 char buf[256]; in main() local
48 JNE((unsigned long)buf, DENY), in main()
50 JGE(sizeof(buf), DENY), in main()
63 JEQ((unsigned long)buf, JUMP(&l, buf_len)), in main()
78 JLT(sizeof(buf), ALLOW), in main()
98 bytes = syscall(__NR_read, STDIN_FILENO, buf, sizeof(buf)-1); in main()
101 syscall(__NR_write, STDERR_FILENO, buf, bytes); in main()
Dbpf-direct.c66 char *buf; in emulator() local
74 buf = (char *) ctx->uc_mcontext.gregs[REG_ARG1]; in emulator()
84 bytes = write(STDOUT_FILENO, buf, len); in emulator()
166 char buf[4096]; in main() local
174 bytes = syscall(__NR_read, STDIN_FILENO, buf, sizeof(buf)); in main()
176 syscall(__NR_write, STDOUT_FILENO, buf, bytes); in main()
Duser-trap.c36 char buf[CMSG_SPACE(sizeof(int))] = {0}, c = 'c'; in send_fd() local
44 msg.msg_control = buf; in send_fd()
45 msg.msg_controllen = sizeof(buf); in send_fd()
65 char buf[CMSG_SPACE(sizeof(int))] = {0}, c = 'c'; in recv_fd() local
73 msg.msg_control = buf; in recv_fd()
74 msg.msg_controllen = sizeof(buf); in recv_fd()
/samples/vfs/
Dtest-fsmount.c22 char buf[4096]; in check_messages() local
28 n = read(fd, buf, sizeof(buf)); in check_messages()
33 switch (buf[0]) { in check_messages()
35 fprintf(stderr, "Error: %*.*s\n", n, n, buf + 2); in check_messages()
38 fprintf(stderr, "Warning: %*.*s\n", n, n, buf + 2); in check_messages()
41 fprintf(stderr, "Info: %*.*s\n", n, n, buf + 2); in check_messages()
/samples/vfio-mdev/
Dmtty.c161 static void dump_buffer(u8 *buf, uint32_t count) in dump_buffer() argument
168 pr_info("%2x ", *(buf + i)); in dump_buffer()
240 u8 *buf, u32 count) in handle_pci_cfg_write() argument
250 mdev_state->vconfig[0x3c] = buf[0]; in handle_pci_cfg_write()
270 cfg_addr = *(u32 *)buf; in handle_pci_cfg_write()
294 u16 offset, u8 *buf, u32 count) in handle_bar_write() argument
296 u8 data = *buf; in handle_bar_write()
462 u16 offset, u8 *buf, u32 count) in handle_bar_read() argument
469 *buf = (u8)mdev_state->s[index].divisor; in handle_bar_read()
477 *buf = mdev_state->s[index].rxtx.fifo[ in handle_bar_read()
[all …]
Dmbochs.c156 struct dma_buf *buf; member
298 char *buf, u32 count) in handle_pci_cfg_write() argument
307 cfg_addr = *(u32 *)buf; in handle_pci_cfg_write()
326 char *buf, u32 count) in handle_mmio_write() argument
339 reg16 = *(u16 *)buf; in handle_mmio_write()
356 char *buf, u32 count) in handle_mmio_read() argument
368 memset(buf, 0, count); in handle_mmio_read()
371 memcpy(buf, mdev_state->edid_blob + offset, count); in handle_mmio_read()
381 *(u16 *)buf = reg16; in handle_mmio_read()
387 memset(buf, 0, count); in handle_mmio_read()
[all …]
Dmdpy.c143 char *buf, u32 count) in handle_pci_cfg_write() argument
150 cfg_addr = *(u32 *)buf; in handle_pci_cfg_write()
167 static ssize_t mdev_access(struct mdev_state *mdev_state, char *buf, in mdev_access() argument
176 handle_pci_cfg_write(mdev_state, pos, buf, count); in mdev_access()
178 memcpy(buf, (mdev_state->vconfig + pos), count); in mdev_access()
185 memcpy(mdev_state->memblk, buf, count); in mdev_access()
187 memcpy(buf, mdev_state->memblk, count); in mdev_access()
291 static ssize_t mdpy_read(struct vfio_device *vdev, char __user *buf, in mdpy_read() argument
310 if (copy_to_user(buf, &val, sizeof(val))) in mdpy_read()
322 if (copy_to_user(buf, &val, sizeof(val))) in mdpy_read()
[all …]
/samples/pidfd/
Dpidfd-metadata.c87 char buf[4096] = { 0 }; in main() local
110 bytes = read(statusfd, buf, sizeof(buf)); in main()
112 bytes = write(STDOUT_FILENO, buf, bytes); in main()
/samples/crypto/
Dfips140_lab_util.c115 static void full_write(int fd, const void *buf, size_t count) in full_write() argument
118 ssize_t ret = write(fd, buf, count); in full_write()
122 buf += ret; in full_write()
201 static char buf[256]; in fips140_module_version() local
204 memset(buf, 0, sizeof(buf)); in fips140_module_version()
205 ret = fips140_ioctl(FIPS140_IOCTL_MODULE_VERSION, buf); in fips140_module_version()
211 return buf; in fips140_module_version()
255 uint8_t buf[AF_ALG_MAX_RNG_REQUEST_SIZE]; in dump_from_jent_fd() local
260 memset(buf, 0, sizeof(buf)); in dump_from_jent_fd()
261 ret = read(fd, buf, MIN(count, sizeof(buf))); in dump_from_jent_fd()
[all …]
/samples/uhid/
Duhid-example.c303 char buf[128]; in keyboard() local
306 ret = read(STDIN_FILENO, buf, sizeof(buf)); in keyboard()
316 switch (buf[i]) { in keyboard()
380 fprintf(stderr, "Invalid input: %c\n", buf[i]); in keyboard()
/samples/v4l/
Dv4l2-pci-skeleton.c218 struct skel_buffer *buf = to_skel_buffer(vbuf); in buffer_queue() local
222 list_add_tail(&buf->list, &skel->buf_list); in buffer_queue()
232 struct skel_buffer *buf, *node; in return_all_buffers() local
236 list_for_each_entry_safe(buf, node, &skel->buf_list, list) { in return_all_buffers()
237 vb2_buffer_done(&buf->vb.vb2_buf, state); in return_all_buffers()
238 list_del(&buf->list); in return_all_buffers()