1 1.1 simonb /* $NetBSD: zfs_znode.h,v 1.1 2022/06/19 11:31:19 simonb Exp $ */ 2 1.1 simonb 3 1.1 simonb /* 4 1.1 simonb * XXX From: external/cddl/osnet/dist/uts/common/fs/zfs/sys/zfs_znode.h 5 1.1 simonb * 6 1.1 simonb * Grotty hack to define a "simple" znode_t so we don't need to 7 1.1 simonb * try to include the real zfs_znode.h which isn't easily possible 8 1.1 simonb * from userland due to all sorts of kernel only defines and structs 9 1.1 simonb * being required. 10 1.1 simonb */ 11 1.1 simonb 12 1.1 simonb /* 13 1.1 simonb * CDDL HEADER START 14 1.1 simonb * 15 1.1 simonb * The contents of this file are subject to the terms of the 16 1.1 simonb * Common Development and Distribution License (the "License"). 17 1.1 simonb * You may not use this file except in compliance with the License. 18 1.1 simonb * 19 1.1 simonb * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 20 1.1 simonb * or http://www.opensolaris.org/os/licensing. 21 1.1 simonb * See the License for the specific language governing permissions 22 1.1 simonb * and limitations under the License. 23 1.1 simonb * 24 1.1 simonb * When distributing Covered Code, include this CDDL HEADER in each 25 1.1 simonb * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 26 1.1 simonb * If applicable, add the following below this CDDL HEADER, with the 27 1.1 simonb * fields enclosed by brackets "[]" replaced with your own identifying 28 1.1 simonb * information: Portions Copyright [yyyy] [name of copyright owner] 29 1.1 simonb * 30 1.1 simonb * CDDL HEADER END 31 1.1 simonb */ 32 1.1 simonb /* 33 1.1 simonb * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. 34 1.1 simonb * Copyright (c) 2012, 2015 by Delphix. All rights reserved. 35 1.1 simonb * Copyright (c) 2014 Integros [integros.com] 36 1.1 simonb */ 37 1.1 simonb 38 1.1 simonb 39 1.1 simonb #include <miscfs/genfs/genfs_node.h> 40 1.1 simonb 41 1.1 simonb #define VTOZ(VP) ((znode_t *)(VP)->v_data) 42 1.1 simonb 43 1.1 simonb #define ulong_t unsigned long 44 1.1 simonb #define uint_t unsigned int 45 1.1 simonb #define zfs_acl_t void 46 1.1 simonb 47 1.1 simonb struct avl_node; 48 1.1 simonb typedef struct sa_handle sa_handle_t; 49 1.1 simonb typedef int boolean_t; 50 1.1 simonb 51 1.1 simonb typedef struct avl_tree { 52 1.1 simonb struct avl_node *avl_root; 53 1.1 simonb int (*avl_compar)(const void *, const void *); 54 1.1 simonb size_t avl_offset; 55 1.1 simonb ulong_t avl_numnodes; 56 1.1 simonb size_t avl_size; 57 1.1 simonb } avl_tree_t; 58 1.1 simonb 59 1.1 simonb typedef struct list_node { 60 1.1 simonb struct list_node *list_next; 61 1.1 simonb struct list_node *list_prev; 62 1.1 simonb } list_node_t; 63 1.1 simonb 64 1.1 simonb typedef struct znode { 65 1.1 simonb #ifdef __NetBSD__ 66 1.1 simonb struct genfs_node z_gnode; 67 1.1 simonb #endif 68 1.1 simonb struct zfsvfs *z_zfsvfs; 69 1.1 simonb vnode_t *z_vnode; 70 1.1 simonb uint64_t z_id; /* object ID for this znode */ 71 1.1 simonb #ifdef illumos 72 1.1 simonb kmutex_t z_lock; /* znode modification lock */ 73 1.1 simonb krwlock_t z_parent_lock; /* parent lock for directories */ 74 1.1 simonb krwlock_t z_name_lock; /* "master" lock for dirent locks */ 75 1.1 simonb zfs_dirlock_t *z_dirlocks; /* directory entry lock list */ 76 1.1 simonb #endif 77 1.1 simonb kmutex_t z_range_lock; /* protects changes to z_range_avl */ 78 1.1 simonb avl_tree_t z_range_avl; /* avl tree of file range locks */ 79 1.1 simonb uint8_t z_unlinked; /* file has been unlinked */ 80 1.1 simonb uint8_t z_atime_dirty; /* atime needs to be synced */ 81 1.1 simonb uint8_t z_zn_prefetch; /* Prefetch znodes? */ 82 1.1 simonb uint8_t z_moved; /* Has this znode been moved? */ 83 1.1 simonb uint_t z_blksz; /* block size in bytes */ 84 1.1 simonb uint_t z_seq; /* modification sequence number */ 85 1.1 simonb uint64_t z_mapcnt; /* number of pages mapped to file */ 86 1.1 simonb uint64_t z_gen; /* generation (cached) */ 87 1.1 simonb uint64_t z_size; /* file size (cached) */ 88 1.1 simonb uint64_t z_atime[2]; /* atime (cached) */ 89 1.1 simonb uint64_t z_links; /* file links (cached) */ 90 1.1 simonb uint64_t z_pflags; /* pflags (cached) */ 91 1.1 simonb uint64_t z_uid; /* uid fuid (cached) */ 92 1.1 simonb uint64_t z_gid; /* gid fuid (cached) */ 93 1.1 simonb mode_t z_mode; /* mode (cached) */ 94 1.1 simonb uint32_t z_sync_cnt; /* synchronous open count */ 95 1.1 simonb kmutex_t z_acl_lock; /* acl data lock */ 96 1.1 simonb zfs_acl_t *z_acl_cached; /* cached acl */ 97 1.1 simonb list_node_t z_link_node; /* all znodes in fs link */ 98 1.1 simonb sa_handle_t *z_sa_hdl; /* handle to sa data */ 99 1.1 simonb boolean_t z_is_sa; /* are we native sa? */ 100 1.1 simonb #ifdef __NetBSD__ 101 1.1 simonb struct lockf *z_lockf; /* head of byte-level lock list */ 102 1.1 simonb #endif 103 1.1 simonb } znode_t; 104