Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /* SPDX-License-Identifier: MIT */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * VirtualBox Guest Shared Folders support: module header.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * Copyright (C) 2006-2018 Oracle Corporation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) #ifndef VFSMOD_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) #define VFSMOD_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) #include <linux/backing-dev.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #include <linux/idr.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #include "shfl_hostintf.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) #define DIR_BUFFER_SIZE SZ_16K
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) /* The cast is to prevent assignment of void * to pointers of arbitrary type */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) #define VBOXSF_SBI(sb)	((struct vboxsf_sbi *)(sb)->s_fs_info)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) #define VBOXSF_I(i)	container_of(i, struct vboxsf_inode, vfs_inode)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) struct vboxsf_handle;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) struct vboxsf_options {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 	unsigned long ttl;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 	kuid_t uid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 	kgid_t gid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) 	bool dmode_set;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 	bool fmode_set;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) 	umode_t dmode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 	umode_t fmode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 	umode_t dmask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 	umode_t fmask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) struct vboxsf_fs_context {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 	struct vboxsf_options o;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 	char *nls_name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) /* per-shared folder information */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) struct vboxsf_sbi {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 	struct vboxsf_options o;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 	struct shfl_fsobjinfo root_info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 	struct idr ino_idr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 	spinlock_t ino_idr_lock; /* This protects ino_idr */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 	struct nls_table *nls;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 	u32 next_generation;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 	u32 root;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 	int bdi_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) /* per-inode information */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) struct vboxsf_inode {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	/* some information was changed, update data on next revalidate */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	int force_restat;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 	/* list of open handles for this inode + lock protecting it */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 	struct list_head handle_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	/* This mutex protects handle_list accesses */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	struct mutex handle_list_mutex;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	/* The VFS inode struct */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	struct inode vfs_inode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) struct vboxsf_dir_info {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 	struct list_head info_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) struct vboxsf_dir_buf {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 	size_t entries;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 	size_t free;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 	size_t used;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	void *buf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 	struct list_head head;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) /* globals */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) extern const struct inode_operations vboxsf_dir_iops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) extern const struct inode_operations vboxsf_lnk_iops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) extern const struct inode_operations vboxsf_reg_iops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) extern const struct file_operations vboxsf_dir_fops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) extern const struct file_operations vboxsf_reg_fops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) extern const struct address_space_operations vboxsf_reg_aops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) extern const struct dentry_operations vboxsf_dentry_ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) /* from file.c */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) struct vboxsf_handle *vboxsf_create_sf_handle(struct inode *inode,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 					      u64 handle, u32 access_flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) void vboxsf_release_sf_handle(struct inode *inode, struct vboxsf_handle *sf_handle);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) /* from utils.c */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) struct inode *vboxsf_new_inode(struct super_block *sb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) void vboxsf_init_inode(struct vboxsf_sbi *sbi, struct inode *inode,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 		       const struct shfl_fsobjinfo *info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) int vboxsf_create_at_dentry(struct dentry *dentry,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 			    struct shfl_createparms *params);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) int vboxsf_stat(struct vboxsf_sbi *sbi, struct shfl_string *path,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 		struct shfl_fsobjinfo *info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) int vboxsf_stat_dentry(struct dentry *dentry, struct shfl_fsobjinfo *info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) int vboxsf_inode_revalidate(struct dentry *dentry);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) int vboxsf_getattr(const struct path *path, struct kstat *kstat,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 		   u32 request_mask, unsigned int query_flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) int vboxsf_setattr(struct dentry *dentry, struct iattr *iattr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) struct shfl_string *vboxsf_path_from_dentry(struct vboxsf_sbi *sbi,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 					    struct dentry *dentry);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) int vboxsf_nlscpy(struct vboxsf_sbi *sbi, char *name, size_t name_bound_len,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 		  const unsigned char *utf8_name, size_t utf8_len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) struct vboxsf_dir_info *vboxsf_dir_info_alloc(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) void vboxsf_dir_info_free(struct vboxsf_dir_info *p);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) int vboxsf_dir_read_all(struct vboxsf_sbi *sbi, struct vboxsf_dir_info *sf_d,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 			u64 handle);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) /* from vboxsf_wrappers.c */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) int vboxsf_connect(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) void vboxsf_disconnect(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) int vboxsf_create(u32 root, struct shfl_string *parsed_path,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 		  struct shfl_createparms *create_parms);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) int vboxsf_close(u32 root, u64 handle);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) int vboxsf_remove(u32 root, struct shfl_string *parsed_path, u32 flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) int vboxsf_rename(u32 root, struct shfl_string *src_path,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 		  struct shfl_string *dest_path, u32 flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) int vboxsf_read(u32 root, u64 handle, u64 offset, u32 *buf_len, u8 *buf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) int vboxsf_write(u32 root, u64 handle, u64 offset, u32 *buf_len, u8 *buf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) int vboxsf_dirinfo(u32 root, u64 handle,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 		   struct shfl_string *parsed_path, u32 flags, u32 index,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 		   u32 *buf_len, struct shfl_dirinfo *buf, u32 *file_count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) int vboxsf_fsinfo(u32 root, u64 handle, u32 flags,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 		  u32 *buf_len, void *buf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) int vboxsf_map_folder(struct shfl_string *folder_name, u32 *root);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) int vboxsf_unmap_folder(u32 root);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) int vboxsf_readlink(u32 root, struct shfl_string *parsed_path,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 		    u32 buf_len, u8 *buf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) int vboxsf_symlink(u32 root, struct shfl_string *new_path,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 		   struct shfl_string *old_path, struct shfl_fsobjinfo *buf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) int vboxsf_set_utf8(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) int vboxsf_set_symlinks(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) #endif