Home
last modified time | relevance | path

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

12345678910>>...78

/linux/tools/testing/selftests/memfd/
H A Dmemfd_test.c49 static ssize_t fd2name(int fd, char *buf, size_t bufsize) in fd2name() argument
55 size = snprintf(buf1, PATH_MAX, "/proc/self/fd/%d", fd); in fd2name()
57 printf("snprintf(%d) failed on %m\n", fd); in fd2name()
75 int r, fd; in mfd_assert_new() local
77 fd = sys_memfd_create(name, flags); in mfd_assert_new()
78 if (fd < 0) { in mfd_assert_new()
84 r = ftruncate(fd, sz); in mfd_assert_new()
90 return fd; in mfd_assert_new()
95 int fd = open("/proc/sys/vm/memfd_noexec", O_WRONLY | O_CLOEXEC); in sysctl_assert_write() local
97 if (fd < 0) { in sysctl_assert_write()
[all …]
/linux/drivers/clk/
H A Dclk-fractional-divider.c53 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 Dclk-fractional-divider_test.c18 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()
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()
51 KUNIT_ASSERT_NOT_NULL(test, fd); in clk_fd_test_approximation_max_numerator()
53 fd->mwidth = 3; in clk_fd_test_approximation_max_numerator()
[all …]
/linux/include/linux/
H A Dfile.h38 struct fd { struct
45 static inline bool fd_empty(struct fd f) in fd_empty() argument
50 #define EMPTY_FD (struct fd){0}
51 static inline struct fd BORROWED_FD(struct file *f) in BORROWED_FD()
53 return (struct fd){(unsigned long)f}; in BORROWED_FD()
55 static inline struct fd CLONED_FD(struct file *f) in CLONED_FD()
57 return (struct fd){(unsigned long)f | FDPUT_FPUT}; in CLONED_FD()
60 static inline void fdput(struct fd fd) in fdput() argument
62 if (unlikely(fd.word & FDPUT_FPUT)) in fdput()
63 fput(fd_file(fd)); in fdput()
[all …]
/linux/fs/hfsplus/
H A Dbfind.c15 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/tools/testing/vsock/
H A Dvsock_test.c51 int fd; in test_stream_connection_reset() local
53 fd = socket(AF_VSOCK, SOCK_STREAM, 0); in test_stream_connection_reset()
57 ret = connect(fd, &addr.sa, sizeof(addr.svm)); in test_stream_connection_reset()
71 close(fd); in test_stream_connection_reset()
87 int fd; in test_stream_bind_only_client() local
92 fd = socket(AF_VSOCK, SOCK_STREAM, 0); in test_stream_bind_only_client()
96 ret = connect(fd, &addr.sa, sizeof(addr.svm)); in test_stream_bind_only_client()
113 close(fd); in test_stream_bind_only_client()
118 int fd; in test_stream_bind_only_server() local
120 fd = vsock_bind(VMADDR_CID_ANY, opts->peer_port, SOCK_STREAM); in test_stream_bind_only_server()
[all …]
/linux/fs/hfs/
H A Dbfind.c15 int hfs_find_init(struct hfs_btree *tree, struct hfs_find_data *fd) in hfs_find_init() argument
19 if (!tree || !fd) in hfs_find_init()
22 fd->tree = tree; in hfs_find_init()
23 fd->bnode = NULL; in hfs_find_init()
27 fd->search_key = ptr; in hfs_find_init()
28 fd->key = ptr + tree->max_key_len + 2; in hfs_find_init()
47 void hfs_find_exit(struct hfs_find_data *fd) in hfs_find_exit() argument
49 hfs_bnode_put(fd->bnode); in hfs_find_exit()
50 kfree(fd->search_key); in hfs_find_exit()
52 fd->tree->cnid, __builtin_return_address(0)); in hfs_find_exit()
[all …]
/linux/tools/testing/selftests/filesystems/eventfd/
H A Deventfd_test.c47 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/perf/tests/
H A Dwp.c16 #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() argument
34 int ret = read(fd, count, size); in wp_read()
61 int fd; in __event() local
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 __event()
82 int fd; in test__wp_ro()
[all …]
/linux/drivers/scsi/
H A Dfdomain.c123 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/tools/testing/selftests/wireguard/qemu/
H A Dinit.c61 int bits = 256, fd; in seed_rng() local
66 fd = open("/dev/random", O_WRONLY); in seed_rng()
67 if (fd < 0) in seed_rng()
69 if (ioctl(fd, RNDADDTOENTCNT, &bits) < 0) in seed_rng()
71 close(fd); in seed_rng()
112 int fd; in enable_logging() local
114 fd = open("/proc/sys/kernel/printk", O_WRONLY); in enable_logging()
115 if (fd >= 0) { in enable_logging()
116 if (write(fd, "9\n", 2) != 2) in enable_logging()
118 close(fd); in enable_logging()
[all …]
/linux/tools/testing/selftests/iommu/
H A Diommufd_fail_nth.c31 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()
210 int fd; in FIXTURE() local
218 self->fd = -1; in FIXTURE_SETUP()
234 _test_cmd_pasid_detach(self->fd, self->stdev_id, self->pasid); in FIXTURE_TEARDOWN()
235 teardown_iommufd(self->fd, _metadata); in FIXTURE_TEARDOWN()
247 self->fd = open("/dev/iommu", O_RDWR); in TEST_FAIL_NTH()
[all …]
/linux/scripts/ipe/polgen/
H A Dpolgen.c24 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()
64 FILE *fd; in write_boot_policy() local
[all …]
/linux/tools/testing/selftests/bpf/
H A Dtest_maps.c36 int fd; in test_hashmap() local
38 fd = bpf_map_create(BPF_MAP_TYPE_HASH, NULL, sizeof(key), sizeof(value), 2, &map_opts); in test_hashmap()
39 if (fd < 0) { in test_hashmap()
47 assert(bpf_map_update_elem(fd, &key, &value, BPF_ANY) == 0); in test_hashmap()
51 assert(bpf_map_update_elem(fd, &key, &value, BPF_NOEXIST) < 0 && in test_hashmap()
56 assert(bpf_map_update_elem(fd, &key, &value, -1) < 0 && in test_hashmap()
60 assert(bpf_map_lookup_elem(fd, &key, &value) == 0 && value == 1234); in test_hashmap()
65 assert(bpf_map_update_elem(fd, &key, &value, BPF_ANY) == 0); in test_hashmap()
68 assert(bpf_map_lookup_and_delete_elem(fd, &key, &value) == 0 && value == 1234); in test_hashmap()
71 assert(bpf_map_lookup_elem(fd, &key, &value) < 0 && errno == ENOENT); in test_hashmap()
[all …]
/linux/fs/
H A Dfile.c105 kvfree(fdt->fd); in __free_fdtable()
149 memcpy(nfdt->fd, ofdt->fd, cpy); in copy_fdtable()
150 memset((char *)nfdt->fd + cpy, 0, set); in copy_fdtable()
222 fdt->fd = data; in alloc_fdtable()
238 kvfree(fdt->fd); in alloc_fdtable()
322 static inline void __set_close_on_exec(unsigned int fd, struct fdtable *fdt, in __set_close_on_exec() argument
326 __set_bit(fd, fdt->close_on_exec); in __set_close_on_exec()
328 if (test_bit(fd, fdt->close_on_exec)) in __set_close_on_exec()
329 __clear_bit(fd, fdt->close_on_exec); in __set_close_on_exec()
333 static inline void __set_open_fd(unsigned int fd, struct fdtable *fdt, bool set) in __set_open_fd() argument
[all …]
/linux/tools/testing/selftests/net/
H A Dipv6_flowlabel_mgr.c48 static int flowlabel_get(int fd, uint32_t label, uint8_t share, uint16_t flags) in flowlabel_get() argument
61 return setsockopt(fd, SOL_IPV6, IPV6_FLOWLABEL_MGR, &req, sizeof(req)); in flowlabel_get()
64 static int flowlabel_put(int fd, uint32_t label) in flowlabel_put() argument
71 return setsockopt(fd, SOL_IPV6, IPV6_FLOWLABEL_MGR, &req, sizeof(req)); in flowlabel_put()
74 static void run_tests(int fd) in run_tests() argument
80 expect_fail(flowlabel_get(fd, 1, IPV6_FL_S_ANY, 0)); in run_tests()
83 expect_fail(flowlabel_put(fd, 1)); in run_tests()
86 expect_fail(flowlabel_get(fd, 0x1FFFFF, IPV6_FL_S_ANY, in run_tests()
90 expect_pass(flowlabel_get(fd, 1, IPV6_FL_S_ANY, IPV6_FL_F_CREATE)); in run_tests()
92 expect_pass(flowlabel_get(fd, 1, IPV6_FL_S_ANY, 0)); in run_tests()
[all …]
H A Dreuseaddr_ports_exhausted.c58 int fd, ret; in bind_port() local
60 fd = socket(AF_INET, SOCK_STREAM, 0); in bind_port()
61 ASSERT_NE(-1, fd) TH_LOG("failed to open socket."); in bind_port()
63 ret = setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &reuseaddr, sizeof(int)); in bind_port()
66 ret = setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &reuseport, sizeof(int)); in bind_port()
73 if (bind(fd, (struct sockaddr *)&local_addr, len) == -1) { in bind_port()
74 close(fd); in bind_port()
78 return fd; in bind_port()
84 int i, j, fd[2]; in TEST() local
90 fd[j] = bind_port(_metadata, opts->reuseaddr[j], opts->reuseport[j]); in TEST()
[all …]
/linux/fs/jffs2/
H A Dbuild.c56 struct jffs2_full_dirent *fd; in jffs2_build_inode_pass1() local
61 for(fd = ic->scan_dents; fd; fd = fd->next) { in jffs2_build_inode_pass1()
63 if (!fd->ino) in jffs2_build_inode_pass1()
68 child_ic = jffs2_get_ino_cache(c, fd->ino); in jffs2_build_inode_pass1()
71 fd->name, fd->ino, ic->ino); in jffs2_build_inode_pass1()
72 jffs2_mark_node_obsolete(c, fd->raw); in jffs2_build_inode_pass1()
74 fd->ic = NULL; in jffs2_build_inode_pass1()
79 fd->ic = child_ic; in jffs2_build_inode_pass1()
83 if (fd->type == DT_DIR) { in jffs2_build_inode_pass1()
89 dbg_fsbuild("increased nlink for child \"%s\" (ino #%u)\n", fd->name, fd->ino); in jffs2_build_inode_pass1()
[all …]
/linux/arch/um/os-Linux/
H A Dfile.c44 int os_stat_fd(const int fd, struct uml_stat *ubuf) in os_stat_fd() argument
49 CATCH_EINTR(err = fstat64(fd, &sbuf)); in os_stat_fd()
89 int os_ioctl_generic(int fd, unsigned int cmd, unsigned long arg) in os_ioctl_generic() argument
93 err = ioctl(fd, cmd, arg); in os_ioctl_generic()
101 int os_get_ifname(int fd, char* namebuf) in os_get_ifname() argument
103 if (ioctl(fd, SIOCGIFNAME, namebuf) < 0) in os_get_ifname()
109 int os_mode_fd(int fd, int mode) in os_mode_fd() argument
113 CATCH_EINTR(err = fchmod(fd, mode)); in os_mode_fd()
167 int fd, err, f = 0; in os_open_file() local
188 fd = open64(file, f, mode); in os_open_file()
[all …]
/linux/tools/testing/selftests/mm/
H A Dgup_longterm.c38 static __fsword_t get_fs_type(int fd) in get_fs_type() argument
44 ret = fstatfs(fd, &fs); in get_fs_type()
91 static void do_test(int fd, size_t size, enum test_type type, bool shared) in do_test() argument
93 __fsword_t fs_type = get_fs_type(fd); in do_test()
99 if (fd < 0) { in do_test()
104 if (ftruncate(fd, size)) { in do_test()
116 if (fallocate(fd, 0, 0, size)) { in do_test()
136 shared ? MAP_SHARED : MAP_PRIVATE, fd, 0); in do_test()
300 typedef void (*test_fn)(int fd, size_t size);
304 int fd; in run_with_memfd() local
[all …]
/linux/drivers/clk/ti/
H A Dfapll.c71 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/drivers/infiniband/hw/hfi1/
H A Duser_exp_rcv.c15 struct hfi1_filedata *fd);
17 static int set_rcvarray_entry(struct hfi1_filedata *fd,
29 static int program_rcvarray(struct hfi1_filedata *fd, struct tid_user_buf *,
33 static int unprogram_rcvarray(struct hfi1_filedata *fd, u32 tidinfo);
34 static void __clear_tid_node(struct hfi1_filedata *fd,
36 static void clear_tid_node(struct hfi1_filedata *fd, struct tid_rb_node *node);
50 int hfi1_user_exp_rcv_init(struct hfi1_filedata *fd, in hfi1_user_exp_rcv_init() argument
55 fd->entry_to_rb = kcalloc(uctxt->expected_count, in hfi1_user_exp_rcv_init()
56 sizeof(*fd->entry_to_rb), in hfi1_user_exp_rcv_init()
58 if (!fd->entry_to_rb) in hfi1_user_exp_rcv_init()
[all …]
/linux/tools/testing/selftests/rtc/
H A Drtctest.c36 int fd; in FIXTURE() local
40 self->fd = open(rtc_file, O_RDONLY); in FIXTURE_SETUP()
44 close(self->fd); in FIXTURE_TEARDOWN()
51 if (self->fd == -1 && errno == ENOENT) in TEST_F()
53 ASSERT_NE(-1, self->fd); in TEST_F()
56 rc = ioctl(self->fd, RTC_RD_TIME, &rtc_tm); in TEST_F()
92 static enum rtc_alarm_state get_rtc_alarm_state(int fd, int need_seconds) in get_rtc_alarm_state() argument
100 rc = ioctl(fd, RTC_PARAM_GET, &param); in get_rtc_alarm_state()
120 if (self->fd == -1 && errno == ENOENT)
122 ASSERT_NE(-1, self->fd);
[all …]
/linux/tools/testing/selftests/efivarfs/
H A Dopen-unlink.c16 int fd; in set_immutable() local
20 fd = open(path, O_RDONLY); in set_immutable()
21 if (fd < 0) in set_immutable()
22 return fd; in set_immutable()
24 rc = ioctl(fd, FS_IOC_GETFLAGS, &flags); in set_immutable()
27 close(fd); in set_immutable()
37 rc = ioctl(fd, FS_IOC_SETFLAGS, &flags); in set_immutable()
39 close(fd); in set_immutable()
47 int fd; in get_immutable() local
51 fd = open(path, O_RDONLY); in get_immutable()
[all …]
/linux/tools/perf/tests/shell/attr/
H A Dtest-stat-detailed-39 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 …]

12345678910>>...78