Lines Matching defs:file

16 #include <linux/file.h>
169 return bpf_fd_array_map_update_elem(map, f.file, key, value, flags);
181 err = bpf_fd_array_map_update_elem(map, f.file, key, value, flags);
185 err = bpf_fd_htab_map_update_elem(map, f.file, key, value, flags);
319 * map object inspection since multiple file descriptors with
506 static int bpf_map_release(struct inode *inode, struct file *filp)
520 fmode_t mode = f.file->f_mode;
522 /* Our file permissions may have been overridden by global
532 static void bpf_map_show_fdinfo(struct seq_file *m, struct file *filp)
564 static ssize_t bpf_dummy_read(struct file *filp, char __user *buf, size_t siz, loff_t *ppos)
572 static ssize_t bpf_dummy_write(struct file *filp, const char __user *buf, size_t siz, loff_t *ppos)
609 static int bpf_map_mmap(struct file *filp, struct vm_area_struct *vma)
662 static __poll_t bpf_map_poll(struct file *filp, struct poll_table_struct *pts)
910 if (!f.file) {
913 if (f.file->f_op != &bpf_map_fops) {
918 return f.file->private_data;
1815 static int bpf_prog_release(struct inode *inode, struct file *filp)
1848 static void bpf_prog_show_fdinfo(struct seq_file *m, struct file *filp)
1892 if (!f.file) {
1895 if (f.file->f_op != &bpf_prog_fops) {
1900 return f.file->private_data;
2358 /* Clean up bpf_link and corresponding anon_inode file and FD. After
2361 * defunct, releases anon_inode file and puts reserved FD. bpf_prog's refcnt
2369 fput(primer->file);
2415 static int bpf_link_release(struct inode *inode, struct file *filp)
2435 static void bpf_link_show_fdinfo(struct seq_file *m, struct file *filp)
2476 /* Prepare bpf_link to be exposed to user-space by allocating anon_inode file,
2487 * that file, FD, or ID can't be allocated.
2491 struct file *file;
2505 file = anon_inode_getfile("bpf_link", &bpf_link_fops, link, O_CLOEXEC);
2506 if (IS_ERR(file)) {
2509 return PTR_ERR(file);
2513 primer->file = file;
2526 fd_install(primer->fd, primer->file);
2541 if (!f.file) {
2544 if (f.file->f_op != &bpf_link_fops) {
2549 link = f.file->private_data;
3459 static int bpf_prog_get_info_by_fd(struct file *file, struct bpf_prog *prog, const union bpf_attr *attr,
3533 if (prog->blinded && !bpf_dump_raw_ok(file->f_cred)) {
3537 insns_sanitized = bpf_insn_prepare_dump(prog, file->f_cred);
3575 if (bpf_dump_raw_ok(file->f_cred)) {
3613 if (bpf_dump_raw_ok(file->f_cred)) {
3644 if (bpf_dump_raw_ok(file->f_cred)) {
3704 if (bpf_dump_raw_ok(file->f_cred)) {
3749 static int bpf_map_get_info_by_fd(struct file *file, struct bpf_map *map, const union bpf_attr *attr,
3793 static int bpf_btf_get_info_by_fd(struct file *file, struct btf *btf, const union bpf_attr *attr,
3808 static int bpf_link_get_info_by_fd(struct file *file, struct bpf_link *link, const union bpf_attr *attr,
3858 if (!f.file) {
3862 if (f.file->f_op == &bpf_prog_fops) {
3863 err = bpf_prog_get_info_by_fd(f.file, f.file->private_data, attr, uattr);
3864 } else if (f.file->f_op == &bpf_map_fops) {
3865 err = bpf_map_get_info_by_fd(f.file, f.file->private_data, attr, uattr);
3866 } else if (f.file->f_op == &btf_fops) {
3867 err = bpf_btf_get_info_by_fd(f.file, f.file->private_data, attr, uattr);
3868 } else if (f.file->f_op == &bpf_link_fops) {
3869 err = bpf_link_get_info_by_fd(f.file, f.file->private_data, attr, uattr);
3966 struct file *file;
3994 file = fcheck_files(files, fd);
3995 if (!file) {
3998 get_file(file);
4007 if (file->f_op == &bpf_link_fops) {
4008 struct bpf_link *link = file->private_data;
4021 event = perf_get_event(file);
4037 fput(file);
4320 static int bpf_stats_release(struct inode *inode, struct file *file)