/samples/hidraw/ |
D | hid-example.c | 46 char buf[256]; in main() local 61 memset(buf, 0x0, sizeof(buf)); in main() 83 res = ioctl(fd, HIDIOCGRAWNAME(256), buf); in main() 87 printf("Raw Name: %s\n", buf); in main() 90 res = ioctl(fd, HIDIOCGRAWPHYS(256), buf); in main() 94 printf("Raw Phys: %s\n", buf); in main() 109 buf[0] = 0x9; /* Report Number */ in main() 110 buf[1] = 0xff; in main() 111 buf[2] = 0xff; in main() 112 buf[3] = 0xff; in main() [all …]
|
/samples/kfifo/ |
D | record-example.c | 73 char buf[100]; in testfunc() local 76 struct { unsigned char buf[6]; } hello = { "hello" }; in testfunc() member 87 memset(buf, 'a' + i, i + 1); in testfunc() 88 kfifo_in(&test, buf, i + 1); in testfunc() 98 ret = kfifo_out_peek(&test, buf, sizeof(buf)); in testfunc() 100 printk(KERN_INFO "%.*s\n", ret, buf); in testfunc() 105 ret = kfifo_out(&test, buf, sizeof(buf)); in testfunc() 106 buf[ret] = '\0'; in testfunc() 107 printk(KERN_INFO "item = %.*s\n", ret, buf); in testfunc() 108 if (strcmp(buf, expected_result[i++])) { in testfunc() [all …]
|
D | bytestream-example.c | 56 unsigned char buf[6]; in testfunc() local 73 i = kfifo_out(&test, buf, 5); in testfunc() 74 printk(KERN_INFO "buf: %.*s\n", i, buf); in testfunc() 77 ret = kfifo_out(&test, buf, 2); in testfunc() 80 ret = kfifo_in(&test, buf, ret); in testfunc() 115 static ssize_t fifo_write(struct file *file, const char __user *buf, in fifo_write() argument 124 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()
|
D | inttype-example.c | 56 int buf[6]; in testfunc() local 70 ret = kfifo_out(&test, buf, 2); in testfunc() 73 ret = kfifo_in(&test, buf, ret); in testfunc() 108 static ssize_t fifo_write(struct file *file, const char __user *buf, in fifo_write() argument 117 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/ |
D | kobject-example.c | 31 char *buf) in foo_show() argument 33 return sprintf(buf, "%d\n", foo); in foo_show() 37 const char *buf, size_t count) in foo_store() argument 39 sscanf(buf, "%du", &foo); in foo_store() 51 char *buf) in b_show() argument 59 return sprintf(buf, "%d\n", var); in b_show() 63 const char *buf, size_t count) in b_store() argument 67 sscanf(buf, "%du", &var); in b_store()
|
D | kset-example.c | 42 ssize_t (*show)(struct foo_obj *foo, struct foo_attribute *attr, char *buf); 43 ssize_t (*store)(struct foo_obj *foo, struct foo_attribute *attr, const char *buf, size_t count); 56 char *buf) in foo_attr_show() argument 67 return attribute->show(foo, attribute, buf); in foo_attr_show() 76 const char *buf, size_t len) in foo_attr_store() argument 87 return attribute->store(foo, attribute, buf, len); in foo_attr_store() 115 char *buf) in foo_show() argument 117 return sprintf(buf, "%d\n", foo_obj->foo); in foo_show() 121 const char *buf, size_t count) in foo_store() argument 123 sscanf(buf, "%du", &foo_obj->foo); in foo_store() [all …]
|
/samples/seccomp/ |
D | bpf-fancy.c | 31 char buf[256]; in main() local 45 JNE((unsigned long)buf, DENY), in main() 47 JGE(sizeof(buf), DENY), in main() 60 JEQ((unsigned long)buf, JUMP(&l, buf_len)), in main() 75 JLT(sizeof(buf), ALLOW), in main() 95 bytes = syscall(__NR_read, STDIN_FILENO, buf, sizeof(buf)-1); in main() 98 syscall(__NR_write, STDERR_FILENO, buf, bytes); in main()
|
D | bpf-direct.c | 65 char *buf; in emulator() local 73 buf = (char *) ctx->uc_mcontext.gregs[REG_ARG1]; in emulator() 83 bytes = write(STDOUT_FILENO, buf, len); in emulator() 165 char buf[4096]; in main() local 173 bytes = syscall(__NR_read, STDIN_FILENO, buf, sizeof(buf)); in main() 175 syscall(__NR_write, STDOUT_FILENO, buf, bytes); in main()
|
/samples/uhid/ |
D | uhid-example.c | 219 char buf[128]; in keyboard() local 222 ret = read(STDIN_FILENO, buf, sizeof(buf)); in keyboard() 232 switch (buf[i]) { in keyboard() 296 fprintf(stderr, "Invalid input: %c\n", buf[i]); in keyboard()
|