xref: /dragonfly/sys/sys/journal.h (revision 86d7f5d3)
1*86d7f5d3SJohn Marino /*
2*86d7f5d3SJohn Marino  * Copyright (c) 2004 The DragonFly Project.  All rights reserved.
3*86d7f5d3SJohn Marino  *
4*86d7f5d3SJohn Marino  * This code is derived from software contributed to The DragonFly Project
5*86d7f5d3SJohn Marino  * by Matthew Dillon <dillon@backplane.com>
6*86d7f5d3SJohn Marino  *
7*86d7f5d3SJohn Marino  * Redistribution and use in source and binary forms, with or without
8*86d7f5d3SJohn Marino  * modification, are permitted provided that the following conditions
9*86d7f5d3SJohn Marino  * are met:
10*86d7f5d3SJohn Marino  *
11*86d7f5d3SJohn Marino  * 1. Redistributions of source code must retain the above copyright
12*86d7f5d3SJohn Marino  *    notice, this list of conditions and the following disclaimer.
13*86d7f5d3SJohn Marino  * 2. Redistributions in binary form must reproduce the above copyright
14*86d7f5d3SJohn Marino  *    notice, this list of conditions and the following disclaimer in
15*86d7f5d3SJohn Marino  *    the documentation and/or other materials provided with the
16*86d7f5d3SJohn Marino  *    distribution.
17*86d7f5d3SJohn Marino  * 3. Neither the name of The DragonFly Project nor the names of its
18*86d7f5d3SJohn Marino  *    contributors may be used to endorse or promote products derived
19*86d7f5d3SJohn Marino  *    from this software without specific, prior written permission.
20*86d7f5d3SJohn Marino  *
21*86d7f5d3SJohn Marino  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22*86d7f5d3SJohn Marino  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23*86d7f5d3SJohn Marino  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24*86d7f5d3SJohn Marino  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
25*86d7f5d3SJohn Marino  * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26*86d7f5d3SJohn Marino  * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
27*86d7f5d3SJohn Marino  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28*86d7f5d3SJohn Marino  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
29*86d7f5d3SJohn Marino  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30*86d7f5d3SJohn Marino  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
31*86d7f5d3SJohn Marino  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32*86d7f5d3SJohn Marino  * SUCH DAMAGE.
33*86d7f5d3SJohn Marino  *
34*86d7f5d3SJohn Marino  * $DragonFly: src/sys/sys/journal.h,v 1.13 2007/05/09 00:53:35 dillon Exp $
35*86d7f5d3SJohn Marino  */
36*86d7f5d3SJohn Marino 
37*86d7f5d3SJohn Marino #ifndef _SYS_JOURNAL_H_
38*86d7f5d3SJohn Marino #define _SYS_JOURNAL_H_
39*86d7f5d3SJohn Marino 
40*86d7f5d3SJohn Marino #ifndef _SYS_TYPES_H_
41*86d7f5d3SJohn Marino #include <sys/types.h>
42*86d7f5d3SJohn Marino #endif
43*86d7f5d3SJohn Marino #ifndef _SYS_TIME_H_
44*86d7f5d3SJohn Marino #include <sys/time.h>
45*86d7f5d3SJohn Marino #endif
46*86d7f5d3SJohn Marino 
47*86d7f5d3SJohn Marino /*
48*86d7f5d3SJohn Marino  * Physical file format (binary)
49*86d7f5d3SJohn Marino  *
50*86d7f5d3SJohn Marino  * All raw records are 128-bit aligned, but all record sizes are actual.
51*86d7f5d3SJohn Marino  * This means that any scanning code must 16-byte-align the recsize field
52*86d7f5d3SJohn Marino  * when calculating skips.  The top level raw record has a header and a
53*86d7f5d3SJohn Marino  * trailer to allow both forwards and backwards scanning of the journal.
54*86d7f5d3SJohn Marino  * The alignment requirement allows the worker thread FIFO reservation
55*86d7f5d3SJohn Marino  * API to operate efficiently, amoung other things.
56*86d7f5d3SJohn Marino  *
57*86d7f5d3SJohn Marino  * Logical data stream records are usually no larger then the journal's
58*86d7f5d3SJohn Marino  * in-memory FIFO, since the journal's transactional APIs return contiguous
59*86d7f5d3SJohn Marino  * blocks of buffer space and since logical stream records are used to avoid
60*86d7f5d3SJohn Marino  * stalls when concurrent blocking operations are being written to the journal.
61*86d7f5d3SJohn Marino  * Programs can depend on a logical stream record being a 'reasonable' size.
62*86d7f5d3SJohn Marino  *
63*86d7f5d3SJohn Marino  * Multiple logical data streams may operate concurrently in the journal,
64*86d7f5d3SJohn Marino  * reflecting the fact that the system may be executing multiple blocking
65*86d7f5d3SJohn Marino  * operations on the filesystem all at the same time.  These logical data
66*86d7f5d3SJohn Marino  * streams are short-lived transactional entities which use a 13 bit id
67*86d7f5d3SJohn Marino  * plus a transaction start bit, end bit, and abort bit.
68*86d7f5d3SJohn Marino  *
69*86d7f5d3SJohn Marino  * Stream identifiers in the 0x00-0xFF range are special and not used for
70*86d7f5d3SJohn Marino  * normal transactional commands.
71*86d7f5d3SJohn Marino  *
72*86d7f5d3SJohn Marino  * Stream id 0x00 indicates that no other streams should be active at that
73*86d7f5d3SJohn Marino  * point in the journal, which helps the journaling code detect corruption.
74*86d7f5d3SJohn Marino  *
75*86d7f5d3SJohn Marino  * Stream id 0x01 is used for pad.  Pads are used to align data on convenient
76*86d7f5d3SJohn Marino  * boundaries and to deal with dead space.
77*86d7f5d3SJohn Marino  *
78*86d7f5d3SJohn Marino  * Stream id 0x02 indicates a discontinuity in the streamed data and typically
79*86d7f5d3SJohn Marino  * contains information relating to the reason for the discontinuity.
80*86d7f5d3SJohn Marino  * JTYPE_ASSOCIATE and JTYPE_DISASSOCIATE are usually emplaced in stream 0x02.
81*86d7f5d3SJohn Marino  *
82*86d7f5d3SJohn Marino  * Stream id 0x03 may be used to annotate the journal with text comments
83*86d7f5d3SJohn Marino  * via mountctl commands.  This can be extremely useful to note situations
84*86d7f5d3SJohn Marino  * that may help with later recovery or audit operations.
85*86d7f5d3SJohn Marino  *
86*86d7f5d3SJohn Marino  * Stream id 0x04-0x7F are reserved by DragonFly for future protocol expansion.
87*86d7f5d3SJohn Marino  *
88*86d7f5d3SJohn Marino  * Stream id 0x80-0xFF may be used for third-party protocol expansion.
89*86d7f5d3SJohn Marino  *
90*86d7f5d3SJohn Marino  * Stream id's 0x0100-0x1FFF typically represent short-lived transactions
91*86d7f5d3SJohn Marino  * (i.e. an id may be reused once the previous use has completed).  The
92*86d7f5d3SJohn Marino  * journaling system runs through these id's sequentially which means that
93*86d7f5d3SJohn Marino  * the journaling code can handle up to 8192-256 = 7936 simultanious
94*86d7f5d3SJohn Marino  * transactions at any given moment.
95*86d7f5d3SJohn Marino  *
96*86d7f5d3SJohn Marino  * The sequence number field is context-sensitive.  It is typically used by
97*86d7f5d3SJohn Marino  * a journaling stream to provide an incrementing counter and/or timestamp
98*86d7f5d3SJohn Marino  * so recovery utilities can determine if any data is missing.
99*86d7f5d3SJohn Marino  *
100*86d7f5d3SJohn Marino  * The check word in the trailer may be used to provide an integrity check
101*86d7f5d3SJohn Marino  * on the journaled data.  A value of 0 always means that no check word
102*86d7f5d3SJohn Marino  * has been calculated.
103*86d7f5d3SJohn Marino  *
104*86d7f5d3SJohn Marino  * The journal_rawrecbeg structure MUST be a multiple of 16 bytes.
105*86d7f5d3SJohn Marino  * The journal_rawrecend structure MUST be a multiple of 8 bytes.
106*86d7f5d3SJohn Marino  *
107*86d7f5d3SJohn Marino  * NOTE: PAD RECORD SPECIAL CASE.  Pad records can be 16 bytes and have the
108*86d7f5d3SJohn Marino  * rawrecend structure overlayed on the sequence number field of the
109*86d7f5d3SJohn Marino  * rawrecbeg structure.  This is necessary because stream records are
110*86d7f5d3SJohn Marino  * 16 byte aligned, not 24 byte aligned, and dead space is not allowed.
111*86d7f5d3SJohn Marino  * So the pad record must fit into any dead space.  THEREFORE, THE TRANSID
112*86d7f5d3SJohn Marino  * FIELD FOR A PAD RECORD MUST BE IGNORED.
113*86d7f5d3SJohn Marino  *
114*86d7f5d3SJohn Marino  * NOTE: ENDIAN HANDLING.  Data records can be in little or big endian form.
115*86d7f5d3SJohn Marino  * The receiver detects the state by observing the 'begmagic' field.  Each
116*86d7f5d3SJohn Marino  * direction in a full-duplex connection can be operating with different
117*86d7f5d3SJohn Marino  * endianess.  Checksum data is always calculated on the raw record (including
118*86d7f5d3SJohn Marino  * dead space) in a byte-stream fashion, and then converted to the transmit
119*86d7f5d3SJohn Marino  * endianess like everything else.  If the receiver's endianess is different
120*86d7f5d3SJohn Marino  * it must convert it back to host normal form to compare it against the
121*86d7f5d3SJohn Marino  * calculated checksum.
122*86d7f5d3SJohn Marino  */
123*86d7f5d3SJohn Marino struct journal_rawrecbeg {
124*86d7f5d3SJohn Marino 	u_int16_t begmagic;	/* recovery scan, endianess detection */
125*86d7f5d3SJohn Marino 	u_int16_t streamid;	/* start/stop bits and stream identifier */
126*86d7f5d3SJohn Marino 	int32_t recsize;	/* stream data block (incls beg & end) */
127*86d7f5d3SJohn Marino 	int64_t transid;	/* sequence number or transaction id */
128*86d7f5d3SJohn Marino 	/* ADDITIONAL DATA */
129*86d7f5d3SJohn Marino };
130*86d7f5d3SJohn Marino 
131*86d7f5d3SJohn Marino struct journal_rawrecend {
132*86d7f5d3SJohn Marino 	u_int16_t endmagic;	/* recovery scan, endianess detection */
133*86d7f5d3SJohn Marino 	u_int16_t check;	/* check word or 0 */
134*86d7f5d3SJohn Marino 	int32_t recsize;	/* same as rawrecbeg->recsize, for rev scan */
135*86d7f5d3SJohn Marino };
136*86d7f5d3SJohn Marino 
137*86d7f5d3SJohn Marino struct journal_ackrecord {
138*86d7f5d3SJohn Marino 	struct journal_rawrecbeg	rbeg;
139*86d7f5d3SJohn Marino 	int32_t				filler0;
140*86d7f5d3SJohn Marino 	int32_t				filler1;
141*86d7f5d3SJohn Marino 	struct journal_rawrecend	rend;
142*86d7f5d3SJohn Marino };
143*86d7f5d3SJohn Marino 
144*86d7f5d3SJohn Marino /*
145*86d7f5d3SJohn Marino  * Constants for stream record magic numbers.    The incomplete magic
146*86d7f5d3SJohn Marino  * number code is used internally by the memory FIFO reservation API
147*86d7f5d3SJohn Marino  * and worker thread, allowing a block of space in the journaling
148*86d7f5d3SJohn Marino  * stream (aka a stream block) to be reserved and then populated without
149*86d7f5d3SJohn Marino  * stalling other threads doing their own reservation and population.
150*86d7f5d3SJohn Marino  */
151*86d7f5d3SJohn Marino #define JREC_BEGMAGIC		0x1234
152*86d7f5d3SJohn Marino #define JREC_ENDMAGIC		0xCDEF
153*86d7f5d3SJohn Marino #define JREC_INCOMPLETEMAGIC	0xFFFF
154*86d7f5d3SJohn Marino 
155*86d7f5d3SJohn Marino /*
156*86d7f5d3SJohn Marino  * Stream ids are 14 bits.  The top 2 bits specify when a new logical
157*86d7f5d3SJohn Marino  * stream is being created or an existing logical stream is being terminated.
158*86d7f5d3SJohn Marino  * A single raw stream record will set both the BEGIN and END bits if the
159*86d7f5d3SJohn Marino  * entire transaction is encapsulated in a single stream record.
160*86d7f5d3SJohn Marino  */
161*86d7f5d3SJohn Marino #define JREC_STREAMCTL_MASK	0xE000
162*86d7f5d3SJohn Marino #define JREC_STREAMCTL_BEGIN	0x8000	/* start a new logical stream */
163*86d7f5d3SJohn Marino #define JREC_STREAMCTL_END	0x4000	/* terminate a logical stream */
164*86d7f5d3SJohn Marino #define JREC_STREAMCTL_ABORTED	0x2000
165*86d7f5d3SJohn Marino 
166*86d7f5d3SJohn Marino #define JREC_STREAMID_MASK	0x1FFF
167*86d7f5d3SJohn Marino #define JREC_STREAMID_SYNCPT	(JREC_STREAMCTL_BEGIN|JREC_STREAMCTL_END|0x0000)
168*86d7f5d3SJohn Marino #define JREC_STREAMID_PAD	(JREC_STREAMCTL_BEGIN|JREC_STREAMCTL_END|0x0001)
169*86d7f5d3SJohn Marino #define JREC_STREAMID_DISCONT	0x0002	/* discontinuity */
170*86d7f5d3SJohn Marino #define JREC_STREAMID_ANNOTATE	0x0003	/* annotation */
171*86d7f5d3SJohn Marino #define JREC_STREAMID_ACK	0x0004	/* acknowledgement */
172*86d7f5d3SJohn Marino #define JREC_STREAMID_RESTART	0x0005	/* disctoninuity - journal restart */
173*86d7f5d3SJohn Marino 				/* 0x0006-0x007F reserved by DragonFly */
174*86d7f5d3SJohn Marino 				/* 0x0080-0x00FF for third party use */
175*86d7f5d3SJohn Marino #define JREC_STREAMID_JMIN	0x0100	/* lowest allowed general id */
176*86d7f5d3SJohn Marino #define JREC_STREAMID_JMAX	0x2000	/* (one past the highest allowed id) */
177*86d7f5d3SJohn Marino 
178*86d7f5d3SJohn Marino #define JREC_DEFAULTSIZE	64	/* reasonable initial reservation */
179*86d7f5d3SJohn Marino #define JREC_MINRECSIZE		16	/* (after alignment) */
180*86d7f5d3SJohn Marino #define	JREC_MAXRECSIZE		(128*1024*1024)
181*86d7f5d3SJohn Marino 
182*86d7f5d3SJohn Marino /*
183*86d7f5d3SJohn Marino  * Each logical journaling stream typically represents a transaction...
184*86d7f5d3SJohn Marino  * that is, a VFS operation.  The VFS operation is written out using
185*86d7f5d3SJohn Marino  * sub-records and may contain multiple, possibly nested sub-transactions.
186*86d7f5d3SJohn Marino  * multiple sub-transactions occur when a VFS operation cannot be represented
187*86d7f5d3SJohn Marino  * by a single command.  This is typically the case when a journal is
188*86d7f5d3SJohn Marino  * configured to be reversable because UNDO sequences almost always have to
189*86d7f5d3SJohn Marino  * be specified in such cases.  For example, if you ftruncate() a file the
190*86d7f5d3SJohn Marino  * journal might have to write out a sequence of WRITE records representing
191*86d7f5d3SJohn Marino  * the lost data, otherwise the journal would not be reversable.
192*86d7f5d3SJohn Marino  * Sub-transactions within a particular stream do not have their own sequence
193*86d7f5d3SJohn Marino  * number field and thus may not be parallelized (the protocol is already
194*86d7f5d3SJohn Marino  * complex enough!).
195*86d7f5d3SJohn Marino  *
196*86d7f5d3SJohn Marino  * In order to support streaming operation with a limited buffer the recsize
197*86d7f5d3SJohn Marino  * field is allowed to be 0 for subrecords with the JMASK_NESTED bit set.
198*86d7f5d3SJohn Marino  * If this case occurs a scanner can determine that the recursion has ended
199*86d7f5d3SJohn Marino  * by detecting a nested subrecord with the JMASK_LAST bit set.  A scanner
200*86d7f5d3SJohn Marino  * may also set the field to the proper value after the fact to make later
201*86d7f5d3SJohn Marino  * operations more efficient.
202*86d7f5d3SJohn Marino  *
203*86d7f5d3SJohn Marino  * Note that this bit must be properly set even if the recsize field is
204*86d7f5d3SJohn Marino  * non-zero.  The recsize must always be properly specified for 'leaf'
205*86d7f5d3SJohn Marino  * subrecords, however in order to allow subsystems to potentially allocate
206*86d7f5d3SJohn Marino  * more data space then they use the protocol allows any 'dead' space to be
207*86d7f5d3SJohn Marino  * filled with JLEAF_PAD records.
208*86d7f5d3SJohn Marino  *
209*86d7f5d3SJohn Marino  * The recsize field may indicate data well past the size of the current
210*86d7f5d3SJohn Marino  * raw stream record.  That is, the scanner may have to glue together
211*86d7f5d3SJohn Marino  * multiple stream records with the same stream id to fully decode the
212*86d7f5d3SJohn Marino  * embedded subrecords.  In particular, a subrecord could very well represent
213*86d7f5d3SJohn Marino  * hundreds of megabytes of data (e.g. if a program were to do a
214*86d7f5d3SJohn Marino  * multi-megabyte write()) and be split up across thousands of raw streaming
215*86d7f5d3SJohn Marino  * records, possibly interlaced with other unrelated streams from other
216*86d7f5d3SJohn Marino  * unrelated processes.
217*86d7f5d3SJohn Marino  *
218*86d7f5d3SJohn Marino  * If a large sub-transaction is aborted the logical stream may be
219*86d7f5d3SJohn Marino  * terminated without writing out all the expected data.  When this occurs
220*86d7f5d3SJohn Marino  * the stream's ending record must also have the JREC_STREAMCTL_ABORTED bit
221*86d7f5d3SJohn Marino  * set.  However, scanners should still be robust enough to detect such
222*86d7f5d3SJohn Marino  * overflows even if the aborted bit is not set and consider them data
223*86d7f5d3SJohn Marino  * corruption.
224*86d7f5d3SJohn Marino  *
225*86d7f5d3SJohn Marino  * Aborts may also occur in the normal course of operations, especially once
226*86d7f5d3SJohn Marino  * the journaling API is integrated into the cache coherency API.  A normal
227*86d7f5d3SJohn Marino  * abort is issued by emplacing a JLEAF_ABORT record within the transaction
228*86d7f5d3SJohn Marino  * being aborted.  Such records must be the last record in the sub-transaction,
229*86d7f5d3SJohn Marino  * so JLEAF_LAST is also usually set.  In a transaction with many
230*86d7f5d3SJohn Marino  * sub-transactions only those sub-transactions with an abort record are
231*86d7f5d3SJohn Marino  * aborted, the rest remain valid.  Abort records are considered S.O.P. for
232*86d7f5d3SJohn Marino  * two reasons:  First, limited memory buffer space may make it impossible
233*86d7f5d3SJohn Marino  * to delete the portion of the stream being aborted (the data may have
234*86d7f5d3SJohn Marino  * already been sent to the target).  Second, the journaling code will
235*86d7f5d3SJohn Marino  * eventually be used to support a cache coherency layer which may have to
236*86d7f5d3SJohn Marino  * abort operations as part of the cache coherency protocol.  Note that
237*86d7f5d3SJohn Marino  * subrecord aborts are different from stream record aborts.  Stream record
238*86d7f5d3SJohn Marino  * aborts are considered to be extrodinary situations while subrecord aborts
239*86d7f5d3SJohn Marino  * are S.O.P.
240*86d7f5d3SJohn Marino  */
241*86d7f5d3SJohn Marino 
242*86d7f5d3SJohn Marino struct journal_subrecord {
243*86d7f5d3SJohn Marino 	u_int16_t rectype;	/* 2 control bits, 14 record type bits */
244*86d7f5d3SJohn Marino 	int16_t reserved;	/* future use */
245*86d7f5d3SJohn Marino 	int32_t recsize;	/* record size (mandatory if not NESTED) */
246*86d7f5d3SJohn Marino 	/* ADDITIONAL DATA */
247*86d7f5d3SJohn Marino };
248*86d7f5d3SJohn Marino 
249*86d7f5d3SJohn Marino #define	JDATA_KERN		0x0001
250*86d7f5d3SJohn Marino #define	JDATA_USER		0x0002
251*86d7f5d3SJohn Marino #define	JDATA_XIO		0x0003
252*86d7f5d3SJohn Marino 
253*86d7f5d3SJohn Marino #define JMASK_NESTED		0x8000	/* data is a nested recursion */
254*86d7f5d3SJohn Marino #define JMASK_LAST		0x4000
255*86d7f5d3SJohn Marino #define JMASK_SUBRECORD		0x0400
256*86d7f5d3SJohn Marino #define JTYPE_MASK		(~JMASK_LAST)
257*86d7f5d3SJohn Marino 
258*86d7f5d3SJohn Marino #define JLEAF_PAD		0x0000
259*86d7f5d3SJohn Marino #define JLEAF_ABORT		0x0001
260*86d7f5d3SJohn Marino #define JTYPE_ASSOCIATE		0x0002
261*86d7f5d3SJohn Marino #define JTYPE_DISASSOCIATE	0x0003
262*86d7f5d3SJohn Marino #define JTYPE_UNDO		(JMASK_NESTED|0x0004)
263*86d7f5d3SJohn Marino #define JTYPE_AUDIT		(JMASK_NESTED|0x0005)
264*86d7f5d3SJohn Marino #define JTYPE_REDO		(JMASK_NESTED|0x0006)
265*86d7f5d3SJohn Marino 
266*86d7f5d3SJohn Marino #define JTYPE_SETATTR		(JMASK_NESTED|0x0010)
267*86d7f5d3SJohn Marino #define JTYPE_WRITE		(JMASK_NESTED|0x0011)
268*86d7f5d3SJohn Marino #define JTYPE_PUTPAGES		(JMASK_NESTED|0x0012)
269*86d7f5d3SJohn Marino #define JTYPE_SETACL		(JMASK_NESTED|0x0013)
270*86d7f5d3SJohn Marino #define JTYPE_SETEXTATTR	(JMASK_NESTED|0x0014)
271*86d7f5d3SJohn Marino #define JTYPE_CREATE		(JMASK_NESTED|0x0015)
272*86d7f5d3SJohn Marino #define JTYPE_MKNOD		(JMASK_NESTED|0x0016)
273*86d7f5d3SJohn Marino #define JTYPE_LINK		(JMASK_NESTED|0x0017)
274*86d7f5d3SJohn Marino #define JTYPE_SYMLINK		(JMASK_NESTED|0x0018)
275*86d7f5d3SJohn Marino #define JTYPE_WHITEOUT		(JMASK_NESTED|0x0019)
276*86d7f5d3SJohn Marino #define JTYPE_REMOVE		(JMASK_NESTED|0x001A)
277*86d7f5d3SJohn Marino #define JTYPE_MKDIR		(JMASK_NESTED|0x001B)
278*86d7f5d3SJohn Marino #define JTYPE_RMDIR		(JMASK_NESTED|0x001C)
279*86d7f5d3SJohn Marino #define JTYPE_RENAME		(JMASK_NESTED|0x001D)
280*86d7f5d3SJohn Marino 
281*86d7f5d3SJohn Marino #define JTYPE_VATTR		(JMASK_NESTED|0x0100)
282*86d7f5d3SJohn Marino #define JTYPE_CRED		(JMASK_NESTED|0x0101)
283*86d7f5d3SJohn Marino 
284*86d7f5d3SJohn Marino /*
285*86d7f5d3SJohn Marino  * Low level record types
286*86d7f5d3SJohn Marino  */
287*86d7f5d3SJohn Marino #define JLEAF_FILEDATA		0x0401
288*86d7f5d3SJohn Marino #define JLEAF_PATH1		0x0402
289*86d7f5d3SJohn Marino #define JLEAF_PATH2		0x0403
290*86d7f5d3SJohn Marino #define JLEAF_PATH3		0x0404
291*86d7f5d3SJohn Marino #define JLEAF_PATH4		0x0405
292*86d7f5d3SJohn Marino #define JLEAF_UID		0x0406
293*86d7f5d3SJohn Marino #define JLEAF_GID		0x0407
294*86d7f5d3SJohn Marino #define JLEAF_MODES		0x0408
295*86d7f5d3SJohn Marino #define JLEAF_FFLAGS		0x0409
296*86d7f5d3SJohn Marino #define JLEAF_PID		0x040A
297*86d7f5d3SJohn Marino #define JLEAF_PPID		0x040B
298*86d7f5d3SJohn Marino #define JLEAF_COMM		0x040C
299*86d7f5d3SJohn Marino #define JLEAF_ATTRNAME		0x040D
300*86d7f5d3SJohn Marino #define JLEAF_PATH_REF		0x040E
301*86d7f5d3SJohn Marino #define JLEAF_RESERVED_0F	0x040F
302*86d7f5d3SJohn Marino #define JLEAF_SYMLINKDATA	0x0410
303*86d7f5d3SJohn Marino #define JLEAF_SEEKPOS		0x0411
304*86d7f5d3SJohn Marino #define JLEAF_INUM		0x0412
305*86d7f5d3SJohn Marino #define JLEAF_NLINK		0x0413
306*86d7f5d3SJohn Marino #define JLEAF_FSID		0x0414
307*86d7f5d3SJohn Marino #define JLEAF_SIZE		0x0415
308*86d7f5d3SJohn Marino #define JLEAF_ATIME		0x0416
309*86d7f5d3SJohn Marino #define JLEAF_MTIME		0x0417
310*86d7f5d3SJohn Marino #define JLEAF_CTIME		0x0418
311*86d7f5d3SJohn Marino #define JLEAF_GEN		0x0419
312*86d7f5d3SJohn Marino #define JLEAF_FLAGS		0x041A
313*86d7f5d3SJohn Marino #define JLEAF_UDEV		0x041B
314*86d7f5d3SJohn Marino #define JLEAF_FILEREV		0x041C
315*86d7f5d3SJohn Marino #define JLEAF_VTYPE		0x041D
316*86d7f5d3SJohn Marino #define JLEAF_ERROR		0x041E
317*86d7f5d3SJohn Marino #define JLEAF_UMAJOR		0x041F
318*86d7f5d3SJohn Marino #define JLEAF_UMINOR		0x0420
319*86d7f5d3SJohn Marino 
320*86d7f5d3SJohn Marino /*
321*86d7f5d3SJohn Marino  * Low level journal data file structures
322*86d7f5d3SJohn Marino  *
323*86d7f5d3SJohn Marino  * NOTE: embedded strings may use the full width of the field and thus
324*86d7f5d3SJohn Marino  * may not be 0-terminated.
325*86d7f5d3SJohn Marino  */
326*86d7f5d3SJohn Marino struct jleaf_path {
327*86d7f5d3SJohn Marino 	char	path[4];	/* path from base of mount point */
328*86d7f5d3SJohn Marino 	/* path is variable length and 0-terminated */
329*86d7f5d3SJohn Marino };
330*86d7f5d3SJohn Marino 
331*86d7f5d3SJohn Marino struct jleaf_vattr {
332*86d7f5d3SJohn Marino 	int32_t	modes;
333*86d7f5d3SJohn Marino 	int32_t fflags;
334*86d7f5d3SJohn Marino 	struct timespec atime;
335*86d7f5d3SJohn Marino 	struct timespec mtime;
336*86d7f5d3SJohn Marino 	struct timespec ctime;
337*86d7f5d3SJohn Marino 	int64_t inum;
338*86d7f5d3SJohn Marino };
339*86d7f5d3SJohn Marino 
340*86d7f5d3SJohn Marino struct jleaf_cred {
341*86d7f5d3SJohn Marino 	int32_t	uid;
342*86d7f5d3SJohn Marino 	int32_t gid;
343*86d7f5d3SJohn Marino 	int32_t pid;
344*86d7f5d3SJohn Marino 	int32_t flags;		/* suid/sgid and other flags */
345*86d7f5d3SJohn Marino 	char	line[8];	/* ttyname or other session identification */
346*86d7f5d3SJohn Marino 	char	comm[8];	/* simplified command name for reference */
347*86d7f5d3SJohn Marino };
348*86d7f5d3SJohn Marino 
349*86d7f5d3SJohn Marino struct jleaf_ioinfo {
350*86d7f5d3SJohn Marino 	int64_t offset;
351*86d7f5d3SJohn Marino };
352*86d7f5d3SJohn Marino 
353*86d7f5d3SJohn Marino #endif
354