This is a squash of these changes cherry-picked from common-android13-5.10
ANDROID: fuse-bpf: Make compile and pass test
ANDROID: fuse-bpf: set error_in to ENOENT in negative lookup
ANDROID: fuse-bpf: Add ability to run ranges of tests to fuse_test
ANDROID: fuse-bpf: Add test for lookup postfilter
ANDROID: fuse-bpf: readddir postfilter fixes
ANDROID: fix kernelci error in fs/fuse/dir.c
ANDROID: fuse-bpf: Fix RCU/reference issue
ANDROID: fuse-bpf: Always call revalidate for backing
ANDROID: fuse-bpf: Adjust backing handle funcs
ANDROID: fuse-bpf: Fix revalidate error path and backing handling
ANDROID: fuse-bpf: Fix use of get_fuse_inode
ANDROID: fuse: Don't use readdirplus w/ nodeid 0
ANDROID: fuse-bpf: Introduce readdirplus test case for fuse bpf
ANDROID: fuse-bpf: Make sure force_again flag is false by default
ANDROID: fuse-bpf: Make inodes with backing_fd reachable for regular FUSE fuse_iget
Revert "ANDROID: fuse-bpf: use target instead of parent inode to execute backing revalidate"
ANDROID: fuse-bpf: use target instead of parent inode to execute backing revalidate
ANDROID: fuse-bpf: Fix misuse of args.out_args
ANDROID: fuse-bpf: Fix non-fusebpf build
ANDROID: fuse-bpf: Use fuse_bpf_args in uapi
ANDROID: fuse-bpf: Fix read_iter
ANDROID: fuse-bpf: Use cache and refcount
ANDROID: fuse-bpf: Rename iocb_fuse to iocb_orig
ANDROID: fuse-bpf: Fix fixattr in rename
ANDROID: fuse-bpf: Fix readdir
ANDROID: fuse-bpf: Fix lseek return value for offset 0
ANDROID: fuse-bpf: fix read_iter and write_iter
ANDROID: fuse-bpf: fix special devices
ANDROID: fuse-bpf: support FUSE_LSEEK
ANDROID: fuse-bpf: Add support for FUSE_COPY_FILE_RANGE
ANDROID: fuse-bpf: Report errors to finalize
ANDROID: fuse-bpf: Avoid reusing uint64_t for file
ANDROID: fuse-bpf: Fix CONFIG_FUSE_BPF typo in FUSE_FSYNCDIR
ANDROID: fuse-bpf: Move fd operations to be synchronous
ANDROID: fuse-bpf: Invalidate if lower is unhashed
ANDROID: fuse-bpf: Move bpf earlier in fuse_permission
ANDROID: fuse-bpf: Update attributes on file write
ANDROID: fuse: allow mounting with no userspace daemon
ANDROID: fuse-bpf: Support FUSE_STATFS
ANDROID: fuse-bpf: Fix filldir
ANDROID: fuse-bpf: fix fuse_create_open_finalize
ANDROID: fuse: add bpf support for removexattr
ANDROID: fuse-bpf: Fix truncate
ANDROID: fuse-bpf: Support inotify
ANDROID: fuse-bpf: Make compile with CONFIG_FUSE but no CONFIG_FUSE_BPF
ANDROID: fuse-bpf: Fix perms on readdir
ANDROID: fuse: Fix umasking in backing
ANDROID: fs/fuse: Backing move returns EXDEV if TO not backed
ANDROID: bpf-fuse: Fix Setattr
ANDROID: fuse-bpf: Check if mkdir dentry setup
ANDROID: fuse-bpf: Close backing fds in fuse_dentry_revalidate
ANDROID: fuse-bpf: Close backing-fd on both paths
ANDROID: fuse-bpf: Partial fix for mmap'd files
ANDROID: fuse-bpf: Restore a missing const
ANDROID: Add fuse-bpf self tests
ANDROID: Add FUSE_BPF to gki_defconfig
ANDROID: fuse-bpf v1
ANDROID: fuse: Move functions in preparation for fuse-bpf
Bug: 202785178
Bug: 265206112
Test: test_fuse passes on linux.
On cuttlefish,
atest android.scopedstorage.cts.host.ScopedStorageHostTest
passes with fuse-bpf enabled and disabled
Change-Id: Idb099c281f9b39ff2c46fa3ebc63e508758416ee
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Signed-off-by: Daniel Rosenberg <drosen@google.com>
95 lines
1.9 KiB
C
95 lines
1.9 KiB
C
/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause WITH Linux-syscall-note */
|
|
/* Copyright (c) 2022 Google LLC */
|
|
|
|
#ifndef _LINUX_ANDROID_FUSE_H
|
|
#define _LINUX_ANDROID_FUSE_H
|
|
|
|
#ifdef __KERNEL__
|
|
#include <linux/types.h>
|
|
#else
|
|
#include <stdint.h>
|
|
#endif
|
|
|
|
#define FUSE_ACTION_KEEP 0
|
|
#define FUSE_ACTION_REMOVE 1
|
|
#define FUSE_ACTION_REPLACE 2
|
|
|
|
struct fuse_entry_bpf_out {
|
|
uint64_t backing_action;
|
|
uint64_t backing_fd;
|
|
uint64_t bpf_action;
|
|
uint64_t bpf_fd;
|
|
};
|
|
|
|
struct fuse_entry_bpf {
|
|
struct fuse_entry_bpf_out out;
|
|
struct file *backing_file;
|
|
struct file *bpf_file;
|
|
};
|
|
|
|
struct fuse_read_out {
|
|
uint64_t offset;
|
|
uint32_t again;
|
|
uint32_t padding;
|
|
};
|
|
|
|
struct fuse_in_postfilter_header {
|
|
uint32_t len;
|
|
uint32_t opcode;
|
|
uint64_t unique;
|
|
uint64_t nodeid;
|
|
uint32_t uid;
|
|
uint32_t gid;
|
|
uint32_t pid;
|
|
uint32_t error_in;
|
|
};
|
|
|
|
/*
|
|
* Fuse BPF Args
|
|
*
|
|
* Used to communicate with bpf programs to allow checking or altering certain values.
|
|
* The end_offset allows the bpf verifier to check boundaries statically. This reflects
|
|
* the ends of the buffer. size shows the length that was actually used.
|
|
*
|
|
*/
|
|
|
|
/** One input argument of a request */
|
|
struct fuse_bpf_in_arg {
|
|
uint32_t size;
|
|
const void *value;
|
|
const void *end_offset;
|
|
};
|
|
|
|
/** One output argument of a request */
|
|
struct fuse_bpf_arg {
|
|
uint32_t size;
|
|
void *value;
|
|
void *end_offset;
|
|
};
|
|
|
|
#define FUSE_MAX_IN_ARGS 5
|
|
#define FUSE_MAX_OUT_ARGS 3
|
|
|
|
#define FUSE_BPF_FORCE (1 << 0)
|
|
#define FUSE_BPF_OUT_ARGVAR (1 << 6)
|
|
|
|
struct fuse_bpf_args {
|
|
uint64_t nodeid;
|
|
uint32_t opcode;
|
|
uint32_t error_in;
|
|
uint32_t in_numargs;
|
|
uint32_t out_numargs;
|
|
uint32_t flags;
|
|
struct fuse_bpf_in_arg in_args[FUSE_MAX_IN_ARGS];
|
|
struct fuse_bpf_arg out_args[FUSE_MAX_OUT_ARGS];
|
|
};
|
|
|
|
#define FUSE_BPF_USER_FILTER 1
|
|
#define FUSE_BPF_BACKING 2
|
|
#define FUSE_BPF_POST_FILTER 4
|
|
|
|
#define FUSE_OPCODE_FILTER 0x0ffff
|
|
#define FUSE_PREFILTER 0x10000
|
|
#define FUSE_POSTFILTER 0x20000
|
|
|
|
#endif // _LINUX_ANDROID_FUSE_H
|