4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
26 #ifndef _SYS_FS_PC_NODE_H
27 #define _SYS_FS_PC_NODE_H
35 #include <sys/vnode.h>
38 #include <sys/vfs_opreg.h>
42 * This overlays the fid structure (see vfs.h)
48 uint32_t pcfid_block
; /* dblock containing directory entry */
49 uint16_t pcfid_offset
; /* offset within block of entry */
50 uint16_t pcfid_ctime
; /* creation time of entry (~= i_gen) */
54 struct pcnode
*pc_forw
; /* active list ptrs, must be first */
55 struct pcnode
*pc_back
;
56 int pc_flags
; /* see below */
57 struct vnode
*pc_vn
; /* vnode for pcnode */
58 uint_t pc_size
; /* size of file */
59 pc_cluster32_t pc_scluster
; /* starting cluster of file */
60 daddr_t pc_eblkno
; /* disk blkno for entry */
61 int pc_eoffset
; /* offset in disk block of entry */
62 struct pcdir pc_entry
; /* directory entry of file */
63 pc_cluster32_t pc_lcluster
; /* last cluster visited */
64 daddr_t pc_lindex
; /* index of last cluster visited */
70 #define PC_MOD 0x01 /* file data has been modified */
71 #define PC_CHG 0x02 /* node data has been changed */
72 #define PC_INVAL 0x04 /* node is invalid */
73 #define PC_EXTERNAL 0x08 /* vnode ref is held externally */
74 #define PC_ACC 0x10 /* file data has been accessed */
75 #define PC_RELEHOLD 0x80 /* node is being released */
77 #define PCTOV(PCP) ((PCP)->pc_vn)
78 #define VTOPC(VP) ((struct pcnode *)((VP)->v_data))
81 * Make a unique integer for a file
83 #define pc_makenodeid(BN, OFF, ATTR, SCLUSTER, ENTPS) \
84 (ino_t)((ATTR) & PCA_DIR ? \
85 (uint32_t)(-(SCLUSTER) - 1) : \
86 ((BN) * (ENTPS)) + ((OFF) / sizeof (struct pcdir)))
91 #define PCFHASH(FSP, BN, O) 0
92 #define PCDHASH(FSP, SC) 0
94 #define PCFHASH(FSP, BN, O) (((unsigned)FSP + BN + O) % NPCHASH)
95 #define PCDHASH(FSP, SC) (((unsigned)FSP + SC) % NPCHASH)
99 struct pcnode
*pch_forw
;
100 struct pcnode
*pch_back
;
104 * pcnode file and directory operations vectors
106 extern struct vnodeops
*pcfs_fvnodeops
;
107 extern struct vnodeops
*pcfs_dvnodeops
;
110 extern const struct fs_operation_def pcfs_fvnodeops_template
[];
111 extern const struct fs_operation_def pcfs_dvnodeops_template
[];
114 extern struct pchead pcfhead
[];
115 extern struct pchead pcdhead
[];
120 extern void pc_init(void);
121 extern struct pcnode
*pc_getnode(struct pcfs
*, daddr_t
, int, struct pcdir
*);
122 extern void pc_rele(struct pcnode
*);
123 extern void pc_mark_mod(struct pcfs
*, struct pcnode
*);
124 extern void pc_mark_acc(struct pcfs
*, struct pcnode
*);
125 extern int pc_nodesync(struct pcnode
*);
126 extern int pc_nodeupdate(struct pcnode
*);
127 extern int pc_bmap(struct pcnode
*, daddr_t
, daddr_t
*, uint_t
*);
129 extern int pc_balloc(struct pcnode
*, daddr_t
, int, daddr_t
*);
130 extern int pc_bfree(struct pcnode
*, pc_cluster32_t
);
131 extern int pc_verify(struct pcfs
*);
132 extern void pc_diskchanged(struct pcfs
*);
133 extern void pc_mark_irrecov(struct pcfs
*);
135 extern int pc_dirlook(struct pcnode
*, char *, struct pcnode
**);
136 extern int pc_direnter(struct pcnode
*, char *, struct vattr
*,
138 extern int pc_dirremove(struct pcnode
*, char *, struct vnode
*, enum vtype
,
140 extern int pc_rename(struct pcnode
*, struct pcnode
*, char *, char *,
142 extern int pc_blkatoff(struct pcnode
*, offset_t
, struct buf
**,
144 extern int pc_truncate(struct pcnode
*, uint_t
);
145 extern int pc_fileclsize(struct pcfs
*, pc_cluster32_t
, pc_cluster32_t
*);
146 extern int pcfs_putapage(struct vnode
*, page_t
*, u_offset_t
*, size_t *, int,
148 extern void pc_badfs(struct pcfs
*);
154 #endif /* _SYS_FS_PC_NODE_H */