1 /* $OpenBSD: fusefs_node.h,v 1.2 2014/02/01 09:30:38 syl 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_NODE_H_ 19 #define _FUSEFS_NODE_H_ 20 21 #include <ufs/ufs/quota.h> 22 #include <ufs/ufs/inode.h> 23 #include <ufs/ufs/ufs_extern.h> 24 25 enum fufh_type { 26 FUFH_INVALID = -1, 27 FUFH_RDONLY = 0, 28 FUFH_WRONLY = 1, 29 FUFH_RDWR = 2, 30 FUFH_MAXTYPE = 3, 31 }; 32 33 struct fusefs_filehandle { 34 uint64_t fh_id; 35 enum fufh_type fh_type; 36 }; 37 38 struct fusefs_node { 39 struct inode ufs_ino; 40 41 /* fd of fuse session and parent ino_t*/ 42 uint64_t parent; 43 44 /** I/O **/ 45 struct fusefs_filehandle fufh[FUFH_MAXTYPE]; 46 47 /** meta **/ 48 off_t filesize; 49 uint64_t nlookup; 50 enum vtype vtype; 51 }; 52 53 #ifdef ITOV 54 # undef ITOV 55 #endif 56 #define ITOV(ip) ((ip)->ufs_ino.i_vnode) 57 58 #ifdef VTOI 59 # undef VTOI 60 #endif 61 #define VTOI(vp) ((struct fusefs_node *)(vp)->v_data) 62 63 uint64_t fusefs_fd_get(struct fusefs_node *, enum fufh_type); 64 65 #endif /* _FUSEFS_NODE_H_ */ 66