1 /* $OpenBSD: fusefs.h,v 1.14 2020/01/20 23:21:56 claudio Exp $ */ 2 /* 3 * Copyright (c) 2012-2013 Sylvestre Gallon <ccna.syl@gmail.com> 4 * 5 * Permission to use, copy, modify, and distribute this software for any 6 * purpose with or without fee is hereby granted, provided that the above 7 * copyright notice and this permission notice appear in all copies. 8 * 9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 */ 17 18 #ifndef __FUSEFS_H__ 19 #define __FUSEFS_H__ 20 21 /* sysctl defines */ 22 #define FUSEFS_OPENDEVS 1 /* # of fuse devices opened */ 23 #define FUSEFS_INFBUFS 2 /* # of in fbufs */ 24 #define FUSEFS_WAITFBUFS 3 /* # of fbufs waiting for a response */ 25 #define FUSEFS_POOL_NBPAGES 4 /* # total fusefs size */ 26 #define FUSEFS_MAXID 5 /* number of valid fusefs ids */ 27 28 #define FUSEFS_NAMES { \ 29 { 0, 0}, \ 30 { "fusefs_open_devices", CTLTYPE_INT }, \ 31 { "fusefs_fbufs_in", CTLTYPE_INT }, \ 32 { "fusefs_fbufs_wait", CTLTYPE_INT }, \ 33 { "fusefs_pool_pages", CTLTYPE_INT }, \ 34 } 35 36 struct fb_ioctl_xch { 37 uint64_t fbxch_uuid; 38 size_t fbxch_len; 39 uint8_t *fbxch_data; 40 }; 41 42 /* FUSE Device ioctls */ 43 #define FIOCGETFBDAT _IOW('F', 0, struct fb_ioctl_xch) 44 #define FIOCSETFBDAT _IOW('F', 1, struct fb_ioctl_xch) 45 46 #ifdef _KERNEL 47 48 struct fuse_msg; 49 50 struct fusefs_mnt { 51 struct mount *mp; 52 uint32_t undef_op; 53 int max_read; 54 int sess_init; 55 int allow_other; 56 dev_t dev; 57 }; 58 59 #define UNDEF_ACCESS 1<<0 60 #define UNDEF_MKDIR 1<<1 61 #define UNDEF_CREATE 1<<2 62 #define UNDEF_LINK 1<<3 63 #define UNDEF_READLINK 1<<4 64 #define UNDEF_RMDIR 1<<5 65 #define UNDEF_REMOVE 1<<6 66 #define UNDEF_SETATTR 1<<7 67 #define UNDEF_RENAME 1<<8 68 #define UNDEF_SYMLINK 1<<9 69 #define UNDEF_MKNOD 1<<10 70 #define UNDEF_FLUSH 1<<11 71 #define UNDEF_FSYNC 1<<12 72 73 extern const struct vops fusefs_vops; 74 extern struct pool fusefs_fbuf_pool; 75 76 /* files helpers. */ 77 int fusefs_file_open(struct fusefs_mnt *, struct fusefs_node *, enum fufh_type, 78 int, int, struct proc *); 79 int fusefs_file_close(struct fusefs_mnt *, struct fusefs_node *, 80 enum fufh_type, int, int, struct proc *); 81 82 /* device helpers. */ 83 void fuse_device_cleanup(dev_t); 84 void fuse_device_queue_fbuf(dev_t, struct fusebuf *); 85 void fuse_device_set_fmp(struct fusefs_mnt *, int); 86 87 /* 88 * The root inode is the root of the file system. Inode 0 can't be used for 89 * normal purposes. 90 */ 91 #define FUSE_ROOTINO ((ino_t)1) 92 #define VFSTOFUSEFS(mp) ((struct fusefs_mnt *)((mp)->mnt_data)) 93 94 #endif /* _KERNEL */ 95 #endif /* __FUSEFS_H__ */ 96