/linux/tools/testing/selftests/memfd/ |
H A D | memfd_test.c | 48 static ssize_t fd2name(int fd, char *buf, size_t bufsize) in fd2name() argument 54 size = snprintf(buf1, PATH_MAX, "/proc/self/fd/%d", fd); in fd2name() 56 printf("snprintf(%d) failed on %m\n", fd); in fd2name() 74 int r, fd; in mfd_assert_new() local 76 fd = sys_memfd_create(name, flags); in mfd_assert_new() 77 if (fd < 0) { in mfd_assert_new() 83 r = ftruncate(fd, sz); in mfd_assert_new() 89 return fd; in mfd_assert_new() 94 int fd in sysctl_assert_write() local 109 int fd = open("/proc/sys/vm/memfd_noexec", O_WRONLY | O_CLOEXEC); sysctl_fail_write() local 126 int fd = open("/proc/sys/vm/memfd_noexec", O_RDONLY | O_CLOEXEC); sysctl_assert_equal() local 152 int fd; mfd_assert_reopen_fd() local 179 mfd_assert_get_seals(int fd) mfd_assert_get_seals() argument 192 mfd_assert_has_seals(int fd,unsigned int seals) mfd_assert_has_seals() argument 205 mfd_assert_add_seals(int fd,unsigned int seals) mfd_assert_add_seals() argument 218 mfd_fail_add_seals(int fd,unsigned int seals) mfd_fail_add_seals() argument 237 mfd_assert_size(int fd,size_t size) mfd_assert_size() argument 253 mfd_assert_dup(int fd) mfd_assert_dup() argument 266 mfd_assert_mmap_shared(int fd) mfd_assert_mmap_shared() argument 284 mfd_assert_mmap_private(int fd) mfd_assert_mmap_private() argument 302 mfd_assert_open(int fd,int flags,mode_t mode) mfd_assert_open() argument 317 mfd_fail_open(int fd,int flags,mode_t mode) mfd_fail_open() argument 330 mfd_assert_read(int fd) mfd_assert_read() argument 370 mfd_assert_read_shared(int fd) mfd_assert_read_shared() argument 388 mfd_assert_fork_private_write(int fd) mfd_assert_fork_private_write() argument 422 mfd_assert_write(int fd) mfd_assert_write() argument 502 mfd_fail_write(int fd) mfd_fail_write() argument 567 mfd_assert_shrink(int fd) mfd_assert_shrink() argument 587 mfd_fail_shrink(int fd) mfd_fail_shrink() argument 602 mfd_assert_grow(int fd) mfd_assert_grow() argument 626 mfd_fail_grow(int fd) mfd_fail_grow() argument 646 mfd_assert_grow_write(int fd) mfd_assert_grow_write() argument 670 mfd_fail_grow_write(int fd) mfd_fail_grow_write() argument 692 mfd_assert_mode(int fd,int mode) mfd_assert_mode() argument 711 mfd_assert_chmod(int fd,int mode) mfd_assert_chmod() argument 725 mfd_fail_chmod(int fd,int mode) mfd_fail_chmod() argument 821 int fd; test_create() local 870 int fd; test_basic() local 922 int fd; test_seal_write() local 948 int fd, fd2; test_seal_future_write() local 988 int fd; test_seal_shrink() local 1014 int fd; test_seal_grow() local 1040 int fd; test_seal_resize() local 1067 int fd; test_exec_seal() local 1117 int fd; test_exec_no_seal() local 1136 int fd; test_noexec_seal() local 1161 int fd; test_sysctl_sysctl0() local 1182 int fd; test_sysctl_sysctl1() local 1219 int fd; test_sysctl_sysctl2() local 1417 int fd, fd2; test_share_dup() local 1458 int fd; test_share_mmap() local 1493 int fd, fd2; test_share_open() local 1535 int fd; test_share_fork() local [all...] |
/linux/drivers/clk/ |
H A D | clk-fractional-divider.c | 53 static inline u32 clk_fd_readl(struct clk_fractional_divider *fd) in clk_fd_readl() argument 55 if (fd->flags & CLK_FRAC_DIVIDER_BIG_ENDIAN) in clk_fd_readl() 56 return ioread32be(fd->reg); in clk_fd_readl() 58 return readl(fd->reg); in clk_fd_readl() 61 static inline void clk_fd_writel(struct clk_fractional_divider *fd, u32 val) in clk_fd_writel() argument 63 if (fd->flags & CLK_FRAC_DIVIDER_BIG_ENDIAN) in clk_fd_writel() 64 iowrite32be(val, fd->reg); in clk_fd_writel() 66 writel(val, fd->reg); in clk_fd_writel() 71 struct clk_fractional_divider *fd = to_clk_fd(hw); in clk_fd_get_div() local 77 if (fd->lock) in clk_fd_get_div() [all …]
|
H A D | clk-fractional-divider_test.c | 11 * Test the maximum denominator case for fd clock without flags. 18 struct clk_fractional_divider *fd; in clk_fd_test_approximation_max_denominator() local 21 fd = kunit_kzalloc(test, sizeof(*fd), GFP_KERNEL); in clk_fd_test_approximation_max_denominator() 22 KUNIT_ASSERT_NOT_NULL(test, fd); in clk_fd_test_approximation_max_denominator() 24 fd->mwidth = 3; in clk_fd_test_approximation_max_denominator() 25 fd->nwidth = 3; in clk_fd_test_approximation_max_denominator() 32 clk_fractional_divider_general_approximation(&fd->hw, rate, &parent_rate, &m, &n); in clk_fd_test_approximation_max_denominator() 40 * Test the maximum numerator case for fd clock without flags. 47 struct clk_fractional_divider *fd; in clk_fd_test_approximation_max_numerator() local 50 fd = kunit_kzalloc(test, sizeof(*fd), GFP_KERNEL); in clk_fd_test_approximation_max_numerator() [all …]
|
/linux/fs/hfsplus/ |
H A D | bfind.c | 15 int hfs_find_init(struct hfs_btree *tree, struct hfs_find_data *fd) in hfs_find_init() argument 19 fd->tree = tree; in hfs_find_init() 20 fd->bnode = NULL; in hfs_find_init() 24 fd->search_key = ptr; in hfs_find_init() 25 fd->key = ptr + tree->max_key_len + 2; in hfs_find_init() 33 void hfs_find_exit(struct hfs_find_data *fd) in hfs_find_exit() argument 35 hfs_bnode_put(fd->bnode); in hfs_find_exit() 36 kfree(fd->search_key); in hfs_find_exit() 38 fd->tree->cnid, __builtin_return_address(0)); in hfs_find_exit() 39 mutex_unlock(&fd->tree->tree_lock); in hfs_find_exit() [all …]
|
/linux/fs/hfs/ |
H A D | bfind.c | 15 int hfs_find_init(struct hfs_btree *tree, struct hfs_find_data *fd) in hfs_find_init() argument 19 fd->tree = tree; in hfs_find_init() 20 fd->bnode = NULL; in hfs_find_init() 24 fd->search_key = ptr; in hfs_find_init() 25 fd->key = ptr + tree->max_key_len + 2; in hfs_find_init() 44 void hfs_find_exit(struct hfs_find_data *fd) in hfs_find_exit() argument 46 hfs_bnode_put(fd->bnode); in hfs_find_exit() 47 kfree(fd->search_key); in hfs_find_exit() 49 fd->tree->cnid, __builtin_return_address(0)); in hfs_find_exit() 50 mutex_unlock(&fd->tree->tree_lock); in hfs_find_exit() [all …]
|
H A D | brec.c | 14 static struct hfs_bnode *hfs_bnode_split(struct hfs_find_data *fd); 15 static int hfs_brec_update_parent(struct hfs_find_data *fd); 65 int hfs_brec_insert(struct hfs_find_data *fd, void *entry, int entry_len) in hfs_brec_insert() argument 74 tree = fd->tree; in hfs_brec_insert() 75 if (!fd->bnode) { in hfs_brec_insert() 81 fd->bnode = node; in hfs_brec_insert() 82 fd->record = -1; in hfs_brec_insert() 85 key_len = (fd->search_key->key_len | 1) + 1; in hfs_brec_insert() 88 rec = fd->record + 1; in hfs_brec_insert() 91 node = fd->bnode; in hfs_brec_insert() [all …]
|
/linux/include/linux/ |
H A D | file.h | 3 * Wrapper functions for accessing the file_struct fd array. 44 struct fd { struct 51 static inline bool fd_empty(struct fd f) in fd_empty() argument 56 #define EMPTY_FD (struct fd){0} 57 static inline struct fd BORROWED_FD(struct file *f) in BORROWED_FD() 59 return (struct fd){(unsigned long)f}; in BORROWED_FD() 61 static inline struct fd CLONED_FD(struct file *f) in CLONED_FD() 63 return (struct fd){(unsigned long)f | FDPUT_FPUT}; in CLONED_FD() 66 static inline void fdput(struct fd fd) in fdput() argument 68 if (fd.word & FDPUT_FPUT) in fdput() [all …]
|
/linux/tools/testing/selftests/filesystems/eventfd/ |
H A D | eventfd_test.c | 47 int fd, flags; in TEST() local 49 fd = sys_eventfd2(0, 0); in TEST() 50 ASSERT_GE(fd, 0); in TEST() 52 flags = fcntl(fd, F_GETFL); in TEST() 56 close(fd); in TEST() 61 int fd, flags; in TEST() local 63 fd = sys_eventfd2(0, EFD_CLOEXEC); in TEST() 64 ASSERT_GE(fd, 0); in TEST() 66 flags = fcntl(fd, F_GETFD); in TEST() 70 close(fd); in TEST() [all …]
|
/linux/tools/testing/vsock/ |
H A D | vsock_test.c | 44 int fd; in test_stream_connection_reset() local 46 fd = socket(AF_VSOCK, SOCK_STREAM, 0); in test_stream_connection_reset() 50 ret = connect(fd, &addr.sa, sizeof(addr.svm)); in test_stream_connection_reset() 64 close(fd); in test_stream_connection_reset() 80 int fd; in test_stream_bind_only_client() local 85 fd = socket(AF_VSOCK, SOCK_STREAM, 0); in test_stream_bind_only_client() 89 ret = connect(fd, &addr.sa, sizeof(addr.svm)); in test_stream_bind_only_client() 106 close(fd); in test_stream_bind_only_client() 121 int fd; in test_stream_bind_only_server() local 123 fd = socket(AF_VSOCK, SOCK_STREAM, 0); in test_stream_bind_only_server() [all …]
|
/linux/fs/ |
H A D | file.c | 7 * Manage the dynamic fd arrays in the process files_struct. 36 kvfree(fdt->fd); in __free_fdtable() 51 * Copy 'count' fd bits from the old table to the new table and clear the extra 80 memcpy(nfdt->fd, ofdt->fd, cpy); in copy_fdtable() 81 memset((char *)nfdt->fd + cpy, 0, set); in copy_fdtable() 135 fdt->fd = data; in alloc_fdtable() 151 kvfree(fdt->fd); in alloc_fdtable() 160 * This function will allocate a new fdtable and both fd array and fdset, of 245 static inline void __set_close_on_exec(unsigned int fd, struct fdtable *fdt) in __set_close_on_exec() argument 247 __set_bit(fd, fdt->close_on_exec); in __set_close_on_exec() [all …]
|
/linux/tools/perf/tests/ |
H A D | wp.c | 16 #define WP_TEST_ASSERT_VAL(fd, text, val) \ argument 19 wp_read(fd, &count, sizeof(long long)); \ 32 static int wp_read(int fd, long long *count, int size) in wp_read() 34 int ret = read(fd, count, size); in wp_read() 61 int fd; in __event() 65 fd = sys_perf_event_open(&attr, 0, -1, -1, in __event() 67 if (fd < 0) { in __event() 68 fd = -errno; in __event() 72 return fd; in test__wp_ro() 82 int fd; in test__wp_ro() 27 wp_read(int fd,long long * count,int size) wp_read() argument 56 int fd; __event() local [all...] |
/linux/drivers/clk/ti/ |
H A D | fapll.c | 71 struct fapll_data *fd; member 79 static bool ti_fapll_clock_is_bypass(struct fapll_data *fd) in ti_fapll_clock_is_bypass() argument 81 u32 v = readl_relaxed(fd->base); in ti_fapll_clock_is_bypass() 83 if (fd->bypass_bit_inverted) in ti_fapll_clock_is_bypass() 89 static void ti_fapll_set_bypass(struct fapll_data *fd) in ti_fapll_set_bypass() argument 91 u32 v = readl_relaxed(fd->base); in ti_fapll_set_bypass() 93 if (fd->bypass_bit_inverted) in ti_fapll_set_bypass() 97 writel_relaxed(v, fd->base); in ti_fapll_set_bypass() 100 static void ti_fapll_clear_bypass(struct fapll_data *fd) in ti_fapll_clear_bypass() argument 102 u32 v = readl_relaxed(fd->base); in ti_fapll_clear_bypass() [all …]
|
/linux/scripts/ipe/polgen/ |
H A D | polgen.c | 24 FILE *fd; in policy_to_buffer() local 26 fd = fopen(pathname, "r"); in policy_to_buffer() 27 if (!fd) { in policy_to_buffer() 32 fseek(fd, 0, SEEK_END); in policy_to_buffer() 33 fsize = ftell(fd); in policy_to_buffer() 34 rewind(fd); in policy_to_buffer() 42 read = fread((void *)lbuf, sizeof(*lbuf), fsize, fd); in policy_to_buffer() 50 fclose(fd); in policy_to_buffer() 57 fclose(fd); in policy_to_buffer() 65 FILE *fd; in write_boot_policy() local [all …]
|
/linux/tools/testing/selftests/iommu/ |
H A D | iommufd_utils.h | 63 ioctl(self->fd, \ 68 static int _test_cmd_mock_domain(int fd, unsigned int ioas_id, __u32 *stdev_id, in _test_cmd_mock_domain() argument 79 ret = ioctl(fd, IOMMU_TEST_CMD, &cmd); in _test_cmd_mock_domain() 92 ASSERT_EQ(0, _test_cmd_mock_domain(self->fd, ioas_id, stdev_id, \ 95 EXPECT_ERRNO(_errno, _test_cmd_mock_domain(self->fd, ioas_id, \ 98 static int _test_cmd_mock_domain_flags(int fd, unsigned int ioas_id, in _test_cmd_mock_domain_flags() argument 110 ret = ioctl(fd, IOMMU_TEST_CMD, &cmd); in _test_cmd_mock_domain_flags() 123 ASSERT_EQ(0, _test_cmd_mock_domain_flags(self->fd, ioas_id, flags, \ 127 _test_cmd_mock_domain_flags(self->fd, ioas_id, flags, \ 130 static int _test_cmd_mock_domain_replace(int fd, __u32 stdev_id, __u32 pt_id, in _test_cmd_mock_domain_replace() argument [all …]
|
H A D | iommufd_fail_nth.c | 31 int fd; in writeat() local 33 fd = openat(dfd, fn, O_WRONLY); in writeat() 34 if (fd == -1) in writeat() 36 res = write(fd, val, val_len); in writeat() 38 close(fd); in writeat() 207 int fd; in FIXTURE() local 213 self->fd = -1; in FIXTURE_SETUP() 222 /* The access FD holds the iommufd open until it closes */ in FIXTURE_TEARDOWN() 226 teardown_iommufd(self->fd, _metadata); in FIXTURE_TEARDOWN() 238 self->fd = open("/dev/iommu", O_RDWR); in TEST_FAIL_NTH() [all …]
|
/linux/tools/testing/selftests/bpf/ |
H A D | test_maps.c | 40 int fd; in test_hashmap() local 42 fd = bpf_map_create(BPF_MAP_TYPE_HASH, NULL, sizeof(key), sizeof(value), 2, &map_opts); in test_hashmap() 43 if (fd < 0) { in test_hashmap() 51 assert(bpf_map_update_elem(fd, &key, &value, BPF_ANY) == 0); in test_hashmap() 55 assert(bpf_map_update_elem(fd, &key, &value, BPF_NOEXIST) < 0 && in test_hashmap() 60 assert(bpf_map_update_elem(fd, &key, &value, -1) < 0 && in test_hashmap() 64 assert(bpf_map_lookup_elem(fd, &key, &value) == 0 && value == 1234); in test_hashmap() 69 assert(bpf_map_update_elem(fd, &key, &value, BPF_ANY) == 0); in test_hashmap() 72 assert(bpf_map_lookup_and_delete_elem(fd, &key, &value) == 0 && value == 1234); in test_hashmap() 75 assert(bpf_map_lookup_elem(fd, in test_hashmap() 135 int fd, i, j; test_hashmap_sizes() local 158 int fd, i; test_hashmap_percpu() local 270 int i, fd, ret; helper_fill_hashmap() local 292 int fd, i, max_entries = 10000; test_hashmap_walk() local 363 int key, next_key, fd; test_arraymap() local 419 int key, next_key, fd, i; test_arraymap_percpu() local 482 int key, fd, i; test_arraymap_percpu_many_keys() local 513 int fd; test_devmap() local 527 int fd; test_devmap_hash() local 543 int fd, i; test_queuemap() local 599 int fd, i; test_stackmap() local 664 int err, i, fd, udp, sfd[6] = {0xdeadbeef}; test_sockmap() local 1156 int mim_fd, fd, err; test_map_in_map() local 1316 int fd, i, value; test_map_large() local 1448 int fd = ((int *)data)[0]; test_update_delete() local 1478 int i, fd, key = 0, value = 0, j = 0; test_map_parallel() local 1536 int fd, key = 0, value = 0; test_map_rdonly() local 1565 int fd, key = 0, value = 0; test_map_wronly_hash() local 1593 int fd, value = 0; test_map_wronly_stack_or_queue() local 1729 int fd; test_reuseport_array() local [all...] |
/linux/tools/lib/perf/ |
H A D | evsel.c | 46 #define FD(_evsel, _cpu_map_idx, _thread) \ macro 47 ((int *)xyarray__entry(_evsel->fd, _cpu_map_idx, _thread)) 54 evsel->fd = xyarray__new(ncpus, nthreads, sizeof(int)); in perf_evsel__alloc_fd() 56 if (evsel->fd) { in perf_evsel__alloc_fd() 61 int *fd = FD(evsel, idx, thread); in perf_evsel__alloc_fd() local 63 if (fd) in perf_evsel__alloc_fd() 64 *fd = -1; in perf_evsel__alloc_fd() 69 return evsel->fd != NULL ? 0 : -ENOMEM; in perf_evsel__alloc_fd() 90 int *fd; in get_group_fd() local 101 if (!leader->fd) in get_group_fd() [all …]
|
/linux/drivers/scsi/ |
H A D | fdomain.c | 123 static inline void fdomain_make_bus_idle(struct fdomain *fd) in fdomain_make_bus_idle() argument 125 outb(0, fd->base + REG_BCTL); in fdomain_make_bus_idle() 126 outb(0, fd->base + REG_MCTL); in fdomain_make_bus_idle() 127 if (fd->chip == tmc18c50 || fd->chip == tmc18c30) in fdomain_make_bus_idle() 130 fd->base + REG_ACTL); in fdomain_make_bus_idle() 132 outb(ACTL_RESET | PARITY_MASK, fd->base + REG_ACTL); in fdomain_make_bus_idle() 186 struct fdomain *fd = shost_priv(sh); in fdomain_select() local 188 outb(BCTL_BUSEN | BCTL_SEL, fd->base + REG_BCTL); in fdomain_select() 189 outb(BIT(sh->this_id) | BIT(target), fd->base + REG_SCSI_DATA_NOACK); in fdomain_select() 192 outb(PARITY_MASK, fd->base + REG_ACTL); in fdomain_select() [all …]
|
/linux/Documentation/usb/ |
H A D | gadget_printer.rst | 208 struct pollfd fd[1]; 211 fd[0].fd = open(PRINTER_FILE, O_RDWR); 212 if (fd[0].fd < 0) { 213 printf("Error %d opening %s\n", fd[0].fd, PRINTER_FILE); 214 close(fd[0].fd); 218 fd[0].events = POLLIN | POLLRDNORM; 226 retval = poll(fd, 1, 1000); 228 if (retval && (fd[0].revents & POLLRDNORM)) { 231 bytes_read = read(fd[0].fd, buf, BUF_SIZE); 235 fd[0].fd, PRINTER_FILE); [all …]
|
/linux/tools/perf/tests/attr/ |
H A D | test-stat-detailed-2 | 9 fd=1 15 fd=2 21 fd=3 27 fd=4 33 fd=5 40 fd=6 47 fd=7 54 fd=8 61 fd=9 68 fd=10 [all …]
|
H A D | test-stat-detailed-3 | 9 fd=1 15 fd=2 21 fd=3 27 fd=4 33 fd=5 40 fd=6 47 fd=7 54 fd=8 61 fd=9 68 fd=10 [all …]
|
/linux/tools/testing/selftests/kvm/ |
H A D | guest_memfd_test.c | 23 static void test_file_read_write(int fd) in test_file_read_write() argument 27 TEST_ASSERT(read(fd, buf, sizeof(buf)) < 0, in test_file_read_write() 28 "read on a guest_mem fd should fail"); in test_file_read_write() 29 TEST_ASSERT(write(fd, buf, sizeof(buf)) < 0, in test_file_read_write() 30 "write on a guest_mem fd should fail"); in test_file_read_write() 31 TEST_ASSERT(pread(fd, buf, sizeof(buf), 0) < 0, in test_file_read_write() 32 "pread on a guest_mem fd should fail"); in test_file_read_write() 33 TEST_ASSERT(pwrite(fd, buf, sizeof(buf), 0) < 0, in test_file_read_write() 34 "pwrite on a guest_mem fd should fail"); in test_file_read_write() 37 static void test_mmap(int fd, size_t page_size) in test_mmap() argument [all …]
|
/linux/tools/testing/selftests/rtc/ |
H A D | rtctest.c | 29 int fd; in FIXTURE() local 33 self->fd = open(rtc_file, O_RDONLY); in FIXTURE_SETUP() 37 close(self->fd); in FIXTURE_TEARDOWN() 44 if (self->fd == -1 && errno == ENOENT) in TEST_F() 46 ASSERT_NE(-1, self->fd); in TEST_F() 49 rc = ioctl(self->fd, RTC_RD_TIME, &rtc_tm); in TEST_F() 91 if (self->fd == -1 && errno == ENOENT) 93 ASSERT_NE(-1, self->fd); 98 rc = ioctl(self->fd, RTC_RD_TIME, &rtc_tm); 106 rc = ioctl(self->fd, RTC_RD_TIM [all...] |
/linux/tools/testing/selftests/net/ |
H A D | ip_local_port_range.c | 34 static int get_so_domain(int fd) in get_so_domain() argument 40 err = getsockopt(fd, SOL_SOCKET, SO_DOMAIN, &domain, &len); in get_so_domain() 47 static int bind_to_loopback_any_port(int fd) in bind_to_loopback_any_port() argument 57 switch (get_so_domain(fd)) { in bind_to_loopback_any_port() 74 return bind(fd, &addr.sa, addr_len); in bind_to_loopback_any_port() 77 static int get_sock_port(int fd) in get_sock_port() argument 89 err = getsockname(fd, &addr.sa, &addr_len); in get_sock_port() 104 static int get_ip_local_port_range(int fd, __u32 *range) in get_ip_local_port_range() argument 111 err = getsockopt(fd, SOL_IP, IP_LOCAL_PORT_RANGE, &val, &len); in get_ip_local_port_range() 188 int fd, err; in TEST_F() local [all …]
|
/linux/drivers/media/platform/samsung/exynos4-is/ |
H A D | fimc-is-param.c | 139 __hw_param_copy(&par->fd.control, &cfg->fd.control); in __fimc_is_hw_update_param() 143 __hw_param_copy(&par->fd.otf_input, &cfg->fd.otf_input); in __fimc_is_hw_update_param() 147 __hw_param_copy(&par->fd.dma_input, &cfg->fd.dma_input); in __fimc_is_hw_update_param() 151 __hw_param_copy(&par->fd.config, &cfg->fd.config); in __fimc_is_hw_update_param() 221 struct fd_param *fd; in __is_set_frame_size() local 225 fd = &is->config[index].fd; in __is_set_frame_size() 237 /* Update fd size info (OTF only) */ in __is_set_frame_size() 238 fd->otf_input.width = mf->width; in __is_set_frame_size() 239 fd->otf_input.height = mf->height; in __is_set_frame_size() 472 struct fd_param *fd; in __is_set_fd_control() local [all …]
|