/samples/uhid/ |
D | uhid-example.c | 161 ssize_t ret; in uhid_write() local 163 ret = write(fd, ev, sizeof(*ev)); in uhid_write() 164 if (ret < 0) { in uhid_write() 167 } else if (ret != sizeof(*ev)) { in uhid_write() 169 ret, sizeof(ev)); in uhid_write() 228 ssize_t ret; in event() local 231 ret = read(fd, &ev, sizeof(ev)); in event() 232 if (ret == 0) { in event() 235 } else if (ret < 0) { in event() 238 } else if (ret != sizeof(ev)) { in event() [all …]
|
/samples/bpf/ |
D | xdp_monitor_user.c | 48 int ret = EXIT_FAIL_OPTION; in main() local 72 return ret; in main() 80 ret = EXIT_FAIL_BPF; in main() 84 ret = sample_init_pre_load(skel); in main() 85 if (ret < 0) { in main() 86 fprintf(stderr, "Failed to sample_init_pre_load: %s\n", strerror(-ret)); in main() 87 ret = EXIT_FAIL_BPF; in main() 91 ret = xdp_monitor__load(skel); in main() 92 if (ret < 0) { in main() 94 ret = EXIT_FAIL_BPF; in main() [all …]
|
D | xdp_redirect_map_multi_user.c | 55 int i, ret = -1; in update_mac_map() local 60 ret = get_mac_addr(ifindex, mac_addr); in update_mac_map() 61 if (ret < 0) { in update_mac_map() 64 return ret; in update_mac_map() 67 ret = bpf_map_update_elem(mac_map_fd, &ifindex, mac_addr, 0); in update_mac_map() 68 if (ret < 0) { in update_mac_map() 71 return ret; in update_mac_map() 85 int ret = EXIT_FAIL_OPTION; in main() local 123 return ret; in main() 129 return ret; in main() [all …]
|
D | xdp_redirect_map_user.c | 54 int ret = EXIT_FAIL_OPTION; in main() local 90 return ret; in main() 117 ret = EXIT_FAIL_BPF; in main() 121 ret = sample_init_pre_load(skel); in main() 122 if (ret < 0) { in main() 123 fprintf(stderr, "Failed to sample_init_pre_load: %s\n", strerror(-ret)); in main() 124 ret = EXIT_FAIL_BPF; in main() 130 ret = get_mac_addr(ifindex_out, skel->rodata->tx_mac_addr); in main() 131 if (ret < 0) { in main() 133 ifindex_out, strerror(-ret)); in main() [all …]
|
D | xdp_redirect_user.c | 49 int ret = EXIT_FAIL_OPTION; in main() local 80 return ret; in main() 86 return ret; in main() 106 ret = EXIT_FAIL_BPF; in main() 110 ret = sample_init_pre_load(skel); in main() 111 if (ret < 0) { in main() 112 fprintf(stderr, "Failed to sample_init_pre_load: %s\n", strerror(-ret)); in main() 113 ret = EXIT_FAIL_BPF; in main() 121 ret = xdp_redirect__load(skel); in main() 122 if (ret < 0) { in main() [all …]
|
D | test_map_in_map_user.c | 38 int ret, id; in check_map_id() local 40 ret = bpf_obj_get_info_by_fd(inner_map_fd, &info, &info_len); in check_map_id() 41 assert(!ret); in check_map_id() 43 ret = bpf_map_lookup_elem(map_in_map_fd, &key, &id); in check_map_id() 44 assert(!ret); in check_map_id() 50 int ret; in populate_map() local 52 ret = bpf_map_update_elem(PORT_A, &port_key, &magic_result, BPF_ANY); in populate_map() 53 assert(!ret); in populate_map() 55 ret = bpf_map_update_elem(PORT_H, &port_key, &magic_result, in populate_map() 57 assert(!ret); in populate_map() [all …]
|
D | test_lwt_bpf.c | 95 int ret, off = 0, flags = IS_PSEUDO; in rewrite() local 98 ret = bpf_skb_load_bytes(skb, IP_PROTO_OFF, &proto, 1); in rewrite() 99 if (ret < 0) { in rewrite() 100 printk("bpf_l4_csum_replace failed: %d\n", ret); in rewrite() 120 ret = bpf_l4_csum_replace(skb, off, old_ip, new_ip, in rewrite() 122 if (ret < 0) { in rewrite() 128 ret = bpf_l3_csum_replace(skb, IP_CSUM_OFF, old_ip, new_ip, sizeof(new_ip)); in rewrite() 129 if (ret < 0) { in rewrite() 130 printk("bpf_l3_csum_replace failed: %d\n", ret); in rewrite() 135 ret = bpf_skb_store_bytes(skb, IP_DST_OFF, &new_ip, sizeof(new_ip), 0); in rewrite() [all …]
|
D | xdp_redirect_cpu_user.c | 93 int ret; in create_cpu_entry() local 98 ret = bpf_map_update_elem(map_fd, &cpu, value, 0); in create_cpu_entry() 99 if (ret < 0) { in create_cpu_entry() 101 return ret; in create_cpu_entry() 107 ret = bpf_map_update_elem(avail_fd, &avail_idx, &cpu, 0); in create_cpu_entry() 108 if (ret < 0) { in create_cpu_entry() 110 return ret; in create_cpu_entry() 114 ret = bpf_map_lookup_elem(count_fd, &key, &curr_cpus_count); in create_cpu_entry() 115 if (ret < 0) { in create_cpu_entry() 118 return ret; in create_cpu_entry() [all …]
|
D | fds_example.c | 79 int fd, ret; in bpf_do_map() local 86 ret = bpf_obj_pin(fd, file); in bpf_do_map() 87 printf("bpf: pin ret:(%d,%s)\n", ret, strerror(errno)); in bpf_do_map() 88 assert(ret == 0); in bpf_do_map() 96 ret = bpf_map_update_elem(fd, &key, &value, 0); in bpf_do_map() 98 ret, strerror(errno)); in bpf_do_map() 99 assert(ret == 0); in bpf_do_map() 101 ret = bpf_map_lookup_elem(fd, &key, &value); in bpf_do_map() 103 ret, strerror(errno)); in bpf_do_map() 104 assert(ret == 0); in bpf_do_map() [all …]
|
D | test_map_in_map_kern.c | 111 int addrlen, ret, inline_ret, ret_key = 0; in trace_sys_connect() local 122 ret = bpf_probe_read_user(dst6, sizeof(dst6), &in6->sin6_addr); in trace_sys_connect() 123 if (ret) { in trace_sys_connect() 124 inline_ret = ret; in trace_sys_connect() 133 ret = bpf_probe_read_user(&port, sizeof(port), &in6->sin6_port); in trace_sys_connect() 134 if (ret) { in trace_sys_connect() 135 inline_ret = ret; in trace_sys_connect() 141 ret = -ENOENT; in trace_sys_connect() 149 ret = __LINE__; in trace_sys_connect() 150 inline_ret = ret; in trace_sys_connect() [all …]
|
D | test_cgrp2_array_pin.c | 32 int ret = -1; in main() local 85 ret = bpf_map_update_elem(array_fd, &array_key, &cg2_fd, 0); in main() 86 if (ret) { in main() 92 ret = bpf_obj_pin(array_fd, pinned_file); in main() 93 if (ret) { in main() 105 return ret; in main()
|
/samples/kfifo/ |
D | record-example.c | 73 unsigned int ret; in testfunc() local 96 ret = kfifo_out_peek(&test, buf, sizeof(buf)); in testfunc() 97 if (ret) 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() 123 int ret; in fifo_write() local 129 ret = kfifo_from_user(&test, buf, count, &copied); in fifo_write() 132 if (ret) in fifo_write() [all …]
|
D | inttype-example.c | 56 unsigned int ret; in testfunc() local 68 ret = kfifo_out(&test, buf, 2); in testfunc() 69 printk(KERN_INFO "ret: %d\n", ret); in testfunc() 71 ret = kfifo_in(&test, buf, ret); in testfunc() 72 printk(KERN_INFO "ret: %d\n", ret); in testfunc() 109 int ret; in fifo_write() local 115 ret = kfifo_from_user(&test, buf, count, &copied); in fifo_write() 118 if (ret) in fifo_write() 119 return ret; in fifo_write() 127 int ret; in fifo_read() local [all …]
|
D | bytestream-example.c | 56 unsigned int ret; in testfunc() local 75 ret = kfifo_out(&test, buf, 2); in testfunc() 76 printk(KERN_INFO "ret: %d\n", ret); in testfunc() 78 ret = kfifo_in(&test, buf, ret); in testfunc() 79 printk(KERN_INFO "ret: %d\n", ret); in testfunc() 116 int ret; in fifo_write() local 122 ret = kfifo_from_user(&test, buf, count, &copied); in fifo_write() 125 if (ret) in fifo_write() 126 return ret; in fifo_write() 134 int ret; in fifo_read() local [all …]
|
D | dma-example.c | 24 unsigned int ret; in example_init() local 87 ret = 0; in example_init() 90 kfifo_dma_in_finish(&fifo, ret); in example_init() 116 ret = 5; in example_init() 119 kfifo_dma_out_finish(&fifo, ret); in example_init() 121 ret = kfifo_len(&fifo); in example_init() 124 if (ret != 7) { in example_init()
|
/samples/binderfs/ |
D | binderfs_example.c | 20 int fd, ret, saved_errno; in main() local 23 ret = unshare(CLONE_NEWNS); in main() 24 if (ret < 0) { in main() 30 ret = mount(NULL, "/", NULL, MS_REC | MS_PRIVATE, 0); in main() 31 if (ret < 0) { in main() 37 ret = mkdir("/dev/binderfs", 0755); in main() 38 if (ret < 0 && errno != EEXIST) { in main() 44 ret = mount(NULL, "/dev/binderfs", "binder", 0, 0); in main() 45 if (ret < 0) { in main() 60 ret = ioctl(fd, BINDER_CTL_ADD, &device); in main() [all …]
|
/samples/ftrace/ |
D | ftrace-direct-modify.c | 56 int ret = 0; in simple_thread() local 62 if (ret) in simple_thread() 65 ret = modify_ftrace_direct(my_ip, my_tramp, tramps[t]); in simple_thread() 66 if (!ret) in simple_thread() 68 WARN_ON_ONCE(ret); in simple_thread() 78 int ret; in ftrace_direct_init() local 80 ret = register_ftrace_direct(my_ip, my_tramp); in ftrace_direct_init() 81 if (!ret) in ftrace_direct_init() 83 return ret; in ftrace_direct_init()
|
/samples/watchdog/ |
D | watchdog-simple.c | 10 int ret = 0; in main() local 16 ret = write(fd, "\0", 1); in main() 17 if (ret != 1) { in main() 18 ret = -1; in main() 24 return ret; in main()
|
/samples/qmi/ |
D | qmi_sample_client.c | 307 int ret; in ping_write() local 311 ret = qmi_txn_init(qmi, &txn, NULL, NULL); in ping_write() 312 if (ret < 0) in ping_write() 313 return ret; in ping_write() 315 ret = qmi_send_request(qmi, NULL, &txn, in ping_write() 319 if (ret < 0) { in ping_write() 321 return ret; in ping_write() 324 ret = qmi_txn_wait(&txn, 5 * HZ); in ping_write() 325 if (ret < 0) in ping_write() 326 count = ret; in ping_write() [all …]
|
/samples/rpmsg/ |
D | rpmsg_client_sample.c | 28 int ret; in rpmsg_sample_cb() local 44 ret = rpmsg_send(rpdev->ept, MSG, strlen(MSG)); in rpmsg_sample_cb() 45 if (ret) in rpmsg_sample_cb() 46 dev_err(&rpdev->dev, "rpmsg_send failed: %d\n", ret); in rpmsg_sample_cb() 53 int ret; in rpmsg_sample_probe() local 66 ret = rpmsg_send(rpdev->ept, MSG, strlen(MSG)); in rpmsg_sample_probe() 67 if (ret) { in rpmsg_sample_probe() 68 dev_err(&rpdev->dev, "rpmsg_send failed: %d\n", ret); in rpmsg_sample_probe() 69 return ret; in rpmsg_sample_probe()
|
/samples/acrn/ |
D | vm-sample.c | 49 int vcpu_id, ret; in main() local 68 ret = ioctl(hsm_fd, ACRN_IOCTL_CREATE_VM, &create_vm); in main() 69 printf("Created VM! [%d]\n", ret); in main() 79 ret = ioctl(hsm_fd, ACRN_IOCTL_SET_MEMSEG, &ram_map); in main() 80 printf("Set up VM memory! [%d]\n", ret); in main() 97 ret = ioctl(hsm_fd, ACRN_IOCTL_SET_VCPU_REGS, ®s); in main() 98 printf("Set up VM BSP registers! [%d]\n", ret); in main() 101 ret = ioctl(hsm_fd, ACRN_IOCTL_CREATE_IOREQ_CLIENT, 0); in main() 102 printf("Created IO request client! [%d]\n", ret); in main() 105 ret = ioctl(hsm_fd, ACRN_IOCTL_START_VM, vmid); in main() [all …]
|
/samples/vfio-mdev/ |
D | mdpy-fb.c | 104 int ret; in mdpy_fb_probe() local 106 ret = pci_enable_device(pdev); in mdpy_fb_probe() 107 if (ret < 0) in mdpy_fb_probe() 108 return ret; in mdpy_fb_probe() 110 ret = pci_request_regions(pdev, "mdpy-fb"); in mdpy_fb_probe() 111 if (ret < 0) in mdpy_fb_probe() 120 ret = -EINVAL; in mdpy_fb_probe() 125 ret = -EINVAL; in mdpy_fb_probe() 130 ret = -EINVAL; in mdpy_fb_probe() 138 ret = -ENOMEM; in mdpy_fb_probe() [all …]
|
D | mdpy.c | 170 int ret = 0; in mdev_access() local 193 ret = -1; in mdev_access() 197 ret = count; in mdev_access() 203 return ret; in mdev_access() 226 int ret; in mdpy_probe() local 238 ret = -ENOMEM; in mdpy_probe() 246 ret = -ENOMEM; in mdpy_probe() 261 ret = vfio_register_group_dev(&mdev_state->vdev); in mdpy_probe() 262 if (ret) in mdpy_probe() 273 return ret; in mdpy_probe() [all …]
|
/samples/kobject/ |
D | kobject-example.c | 37 int ret; in foo_store() local 39 ret = kstrtoint(buf, 10, &foo); in foo_store() 40 if (ret < 0) in foo_store() 41 return ret; in foo_store() 69 int var, ret; in b_store() local 71 ret = kstrtoint(buf, 10, &var); in b_store() 72 if (ret < 0) in b_store() 73 return ret; in b_store()
|
/samples/pidfd/ |
D | pidfd-metadata.c | 54 int procfd, ret; in pidfd_metadata_fd() local 68 ret = sys_pidfd_send_signal(pidfd, 0, NULL, 0); in pidfd_metadata_fd() 69 if (ret < 0) { in pidfd_metadata_fd() 86 int pidfd = -1, ret = EXIT_FAILURE; in main() local 94 err(ret, "CLONE_PIDFD"); in main() 114 ret = EXIT_SUCCESS; in main() 119 exit(ret); in main()
|