summaryrefslogtreecommitdiff
path: root/lib/btrfs/btrfsitem/items_gen.go
blob: 31d2a76a3f750f318a83d7799bd0963ea8c374a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
// Code generated by Make.  DO NOT EDIT.

package btrfsitem

import (
	"reflect"

	"git.lukeshu.com/go/typedsync"

	"git.lukeshu.com/btrfs-progs-ng/lib/btrfs/btrfsprim"
)

const (
	BLOCK_GROUP_ITEM_KEY     = btrfsprim.BLOCK_GROUP_ITEM_KEY
	CHUNK_ITEM_KEY           = btrfsprim.CHUNK_ITEM_KEY
	DEV_EXTENT_KEY           = btrfsprim.DEV_EXTENT_KEY
	DEV_ITEM_KEY             = btrfsprim.DEV_ITEM_KEY
	DIR_INDEX_KEY            = btrfsprim.DIR_INDEX_KEY
	DIR_ITEM_KEY             = btrfsprim.DIR_ITEM_KEY
	EXTENT_CSUM_KEY          = btrfsprim.EXTENT_CSUM_KEY
	EXTENT_DATA_KEY          = btrfsprim.EXTENT_DATA_KEY
	EXTENT_DATA_REF_KEY      = btrfsprim.EXTENT_DATA_REF_KEY
	EXTENT_ITEM_KEY          = btrfsprim.EXTENT_ITEM_KEY
	FREE_SPACE_BITMAP_KEY    = btrfsprim.FREE_SPACE_BITMAP_KEY
	FREE_SPACE_EXTENT_KEY    = btrfsprim.FREE_SPACE_EXTENT_KEY
	FREE_SPACE_INFO_KEY      = btrfsprim.FREE_SPACE_INFO_KEY
	INODE_ITEM_KEY           = btrfsprim.INODE_ITEM_KEY
	INODE_REF_KEY            = btrfsprim.INODE_REF_KEY
	METADATA_ITEM_KEY        = btrfsprim.METADATA_ITEM_KEY
	ORPHAN_ITEM_KEY          = btrfsprim.ORPHAN_ITEM_KEY
	PERSISTENT_ITEM_KEY      = btrfsprim.PERSISTENT_ITEM_KEY
	QGROUP_INFO_KEY          = btrfsprim.QGROUP_INFO_KEY
	QGROUP_LIMIT_KEY         = btrfsprim.QGROUP_LIMIT_KEY
	QGROUP_RELATION_KEY      = btrfsprim.QGROUP_RELATION_KEY
	QGROUP_STATUS_KEY        = btrfsprim.QGROUP_STATUS_KEY
	ROOT_BACKREF_KEY         = btrfsprim.ROOT_BACKREF_KEY
	ROOT_ITEM_KEY            = btrfsprim.ROOT_ITEM_KEY
	ROOT_REF_KEY             = btrfsprim.ROOT_REF_KEY
	SHARED_BLOCK_REF_KEY     = btrfsprim.SHARED_BLOCK_REF_KEY
	SHARED_DATA_REF_KEY      = btrfsprim.SHARED_DATA_REF_KEY
	TREE_BLOCK_REF_KEY       = btrfsprim.TREE_BLOCK_REF_KEY
	UNTYPED_KEY              = btrfsprim.UNTYPED_KEY
	UUID_RECEIVED_SUBVOL_KEY = btrfsprim.UUID_RECEIVED_SUBVOL_KEY
	UUID_SUBVOL_KEY          = btrfsprim.UUID_SUBVOL_KEY
	XATTR_ITEM_KEY           = btrfsprim.XATTR_ITEM_KEY
)

var (
	blockGroupType      = reflect.TypeOf(BlockGroup{})
	chunkType           = reflect.TypeOf(Chunk{})
	devType             = reflect.TypeOf(Dev{})
	devExtentType       = reflect.TypeOf(DevExtent{})
	devStatsType        = reflect.TypeOf(DevStats{})
	dirEntryType        = reflect.TypeOf(DirEntry{})
	emptyType           = reflect.TypeOf(Empty{})
	extentType          = reflect.TypeOf(Extent{})
	extentCSumType      = reflect.TypeOf(ExtentCSum{})
	extentDataRefType   = reflect.TypeOf(ExtentDataRef{})
	fileExtentType      = reflect.TypeOf(FileExtent{})
	freeSpaceBitmapType = reflect.TypeOf(FreeSpaceBitmap{})
	freeSpaceHeaderType = reflect.TypeOf(FreeSpaceHeader{})
	freeSpaceInfoType   = reflect.TypeOf(FreeSpaceInfo{})
	inodeType           = reflect.TypeOf(Inode{})
	inodeRefsType       = reflect.TypeOf(InodeRefs{})
	metadataType        = reflect.TypeOf(Metadata{})
	qGroupInfoType      = reflect.TypeOf(QGroupInfo{})
	qGroupLimitType     = reflect.TypeOf(QGroupLimit{})
	qGroupStatusType    = reflect.TypeOf(QGroupStatus{})
	rootType            = reflect.TypeOf(Root{})
	rootRefType         = reflect.TypeOf(RootRef{})
	sharedDataRefType   = reflect.TypeOf(SharedDataRef{})
	uuidMapType         = reflect.TypeOf(UUIDMap{})
)

// keytype2gotype is used by UnmarshalItem.
var keytype2gotype = map[Type]reflect.Type{
	BLOCK_GROUP_ITEM_KEY:     blockGroupType,
	CHUNK_ITEM_KEY:           chunkType,
	DEV_EXTENT_KEY:           devExtentType,
	DEV_ITEM_KEY:             devType,
	DIR_INDEX_KEY:            dirEntryType,
	DIR_ITEM_KEY:             dirEntryType,
	EXTENT_CSUM_KEY:          extentCSumType,
	EXTENT_DATA_KEY:          fileExtentType,
	EXTENT_DATA_REF_KEY:      extentDataRefType,
	EXTENT_ITEM_KEY:          extentType,
	FREE_SPACE_BITMAP_KEY:    freeSpaceBitmapType,
	FREE_SPACE_EXTENT_KEY:    emptyType,
	FREE_SPACE_INFO_KEY:      freeSpaceInfoType,
	INODE_ITEM_KEY:           inodeType,
	INODE_REF_KEY:            inodeRefsType,
	METADATA_ITEM_KEY:        metadataType,
	ORPHAN_ITEM_KEY:          emptyType,
	PERSISTENT_ITEM_KEY:      devStatsType,
	QGROUP_INFO_KEY:          qGroupInfoType,
	QGROUP_LIMIT_KEY:         qGroupLimitType,
	QGROUP_RELATION_KEY:      emptyType,
	QGROUP_STATUS_KEY:        qGroupStatusType,
	ROOT_BACKREF_KEY:         rootRefType,
	ROOT_ITEM_KEY:            rootType,
	ROOT_REF_KEY:             rootRefType,
	SHARED_BLOCK_REF_KEY:     emptyType,
	SHARED_DATA_REF_KEY:      sharedDataRefType,
	TREE_BLOCK_REF_KEY:       emptyType,
	UUID_RECEIVED_SUBVOL_KEY: uuidMapType,
	UUID_SUBVOL_KEY:          uuidMapType,
	XATTR_ITEM_KEY:           dirEntryType,
}

// untypedObjID2gotype is used by UnmarshalItem.
var untypedObjID2gotype = map[btrfsprim.ObjID]reflect.Type{
	btrfsprim.FREE_SPACE_OBJECTID: freeSpaceHeaderType,
}

// Pools.
var (
	blockGroupPool      = typedsync.Pool[Item]{New: func() Item { return new(BlockGroup) }}
	chunkPool           = typedsync.Pool[Item]{New: func() Item { return new(Chunk) }}
	devPool             = typedsync.Pool[Item]{New: func() Item { return new(Dev) }}
	devExtentPool       = typedsync.Pool[Item]{New: func() Item { return new(DevExtent) }}
	devStatsPool        = typedsync.Pool[Item]{New: func() Item { return new(DevStats) }}
	dirEntryPool        = typedsync.Pool[Item]{New: func() Item { return new(DirEntry) }}
	emptyPool           = typedsync.Pool[Item]{New: func() Item { return new(Empty) }}
	extentPool          = typedsync.Pool[Item]{New: func() Item { return new(Extent) }}
	extentCSumPool      = typedsync.Pool[Item]{New: func() Item { return new(ExtentCSum) }}
	extentDataRefPool   = typedsync.Pool[Item]{New: func() Item { return new(ExtentDataRef) }}
	fileExtentPool      = typedsync.Pool[Item]{New: func() Item { return new(FileExtent) }}
	freeSpaceBitmapPool = typedsync.Pool[Item]{New: func() Item { return new(FreeSpaceBitmap) }}
	freeSpaceHeaderPool = typedsync.Pool[Item]{New: func() Item { return new(FreeSpaceHeader) }}
	freeSpaceInfoPool   = typedsync.Pool[Item]{New: func() Item { return new(FreeSpaceInfo) }}
	inodePool           = typedsync.Pool[Item]{New: func() Item { return new(Inode) }}
	inodeRefsPool       = typedsync.Pool[Item]{New: func() Item { return new(InodeRefs) }}
	metadataPool        = typedsync.Pool[Item]{New: func() Item { return new(Metadata) }}
	qGroupInfoPool      = typedsync.Pool[Item]{New: func() Item { return new(QGroupInfo) }}
	qGroupLimitPool     = typedsync.Pool[Item]{New: func() Item { return new(QGroupLimit) }}
	qGroupStatusPool    = typedsync.Pool[Item]{New: func() Item { return new(QGroupStatus) }}
	rootPool            = typedsync.Pool[Item]{New: func() Item { return new(Root) }}
	rootRefPool         = typedsync.Pool[Item]{New: func() Item { return new(RootRef) }}
	sharedDataRefPool   = typedsync.Pool[Item]{New: func() Item { return new(SharedDataRef) }}
	uuidMapPool         = typedsync.Pool[Item]{New: func() Item { return new(UUIDMap) }}
)

// gotype2pool is used by UnmarshalItem.
var gotype2pool = map[reflect.Type]*typedsync.Pool[Item]{
	blockGroupType:      &blockGroupPool,
	chunkType:           &chunkPool,
	devType:             &devPool,
	devExtentType:       &devExtentPool,
	devStatsType:        &devStatsPool,
	dirEntryType:        &dirEntryPool,
	emptyType:           &emptyPool,
	extentType:          &extentPool,
	extentCSumType:      &extentCSumPool,
	extentDataRefType:   &extentDataRefPool,
	fileExtentType:      &fileExtentPool,
	freeSpaceBitmapType: &freeSpaceBitmapPool,
	freeSpaceHeaderType: &freeSpaceHeaderPool,
	freeSpaceInfoType:   &freeSpaceInfoPool,
	inodeType:           &inodePool,
	inodeRefsType:       &inodeRefsPool,
	metadataType:        &metadataPool,
	qGroupInfoType:      &qGroupInfoPool,
	qGroupLimitType:     &qGroupLimitPool,
	qGroupStatusType:    &qGroupStatusPool,
	rootType:            &rootPool,
	rootRefType:         &rootRefPool,
	sharedDataRefType:   &sharedDataRefPool,
	uuidMapType:         &uuidMapPool,
}

// isItem implements Item.
func (*BlockGroup) isItem()      {}
func (*Chunk) isItem()           {}
func (*Dev) isItem()             {}
func (*DevExtent) isItem()       {}
func (*DevStats) isItem()        {}
func (*DirEntry) isItem()        {}
func (*Empty) isItem()           {}
func (*Extent) isItem()          {}
func (*ExtentCSum) isItem()      {}
func (*ExtentDataRef) isItem()   {}
func (*FileExtent) isItem()      {}
func (*FreeSpaceBitmap) isItem() {}
func (*FreeSpaceHeader) isItem() {}
func (*FreeSpaceInfo) isItem()   {}
func (*Inode) isItem()           {}
func (*InodeRefs) isItem()       {}
func (*Metadata) isItem()        {}
func (*QGroupInfo) isItem()      {}
func (*QGroupLimit) isItem()     {}
func (*QGroupStatus) isItem()    {}
func (*Root) isItem()            {}
func (*RootRef) isItem()         {}
func (*SharedDataRef) isItem()   {}
func (*UUIDMap) isItem()         {}

// Free implements Item.
func (o *BlockGroup) Free()      { *o = BlockGroup{}; blockGroupPool.Put(o) }
func (o *Dev) Free()             { *o = Dev{}; devPool.Put(o) }
func (o *DevExtent) Free()       { *o = DevExtent{}; devExtentPool.Put(o) }
func (o *DevStats) Free()        { *o = DevStats{}; devStatsPool.Put(o) }
func (o *Empty) Free()           { *o = Empty{}; emptyPool.Put(o) }
func (o *ExtentCSum) Free()      { *o = ExtentCSum{}; extentCSumPool.Put(o) }
func (o *ExtentDataRef) Free()   { *o = ExtentDataRef{}; extentDataRefPool.Put(o) }
func (o *FreeSpaceHeader) Free() { *o = FreeSpaceHeader{}; freeSpaceHeaderPool.Put(o) }
func (o *FreeSpaceInfo) Free()   { *o = FreeSpaceInfo{}; freeSpaceInfoPool.Put(o) }
func (o *Inode) Free()           { *o = Inode{}; inodePool.Put(o) }
func (o *QGroupInfo) Free()      { *o = QGroupInfo{}; qGroupInfoPool.Put(o) }
func (o *QGroupLimit) Free()     { *o = QGroupLimit{}; qGroupLimitPool.Put(o) }
func (o *QGroupStatus) Free()    { *o = QGroupStatus{}; qGroupStatusPool.Put(o) }
func (o *Root) Free()            { *o = Root{}; rootPool.Put(o) }
func (o *SharedDataRef) Free()   { *o = SharedDataRef{}; sharedDataRefPool.Put(o) }
func (o *UUIDMap) Free()         { *o = UUIDMap{}; uuidMapPool.Put(o) }

// Clone is a handy method.
func (o BlockGroup) Clone() BlockGroup           { return o }
func (o Dev) Clone() Dev                         { return o }
func (o DevExtent) Clone() DevExtent             { return o }
func (o DevStats) Clone() DevStats               { return o }
func (o Empty) Clone() Empty                     { return o }
func (o ExtentCSum) Clone() ExtentCSum           { return o }
func (o ExtentDataRef) Clone() ExtentDataRef     { return o }
func (o FreeSpaceHeader) Clone() FreeSpaceHeader { return o }
func (o FreeSpaceInfo) Clone() FreeSpaceInfo     { return o }
func (o Inode) Clone() Inode                     { return o }
func (o QGroupInfo) Clone() QGroupInfo           { return o }
func (o QGroupLimit) Clone() QGroupLimit         { return o }
func (o QGroupStatus) Clone() QGroupStatus       { return o }
func (o Root) Clone() Root                       { return o }
func (o SharedDataRef) Clone() SharedDataRef     { return o }
func (o UUIDMap) Clone() UUIDMap                 { return o }

// CloneItem implements Item.
func (o *BlockGroup) CloneItem() Item {
	ret, _ := blockGroupPool.Get()
	*(ret.(*BlockGroup)) = o.Clone()
	return ret
}
func (o *Chunk) CloneItem() Item { ret, _ := chunkPool.Get(); *(ret.(*Chunk)) = o.Clone(); return ret }
func (o *Dev) CloneItem() Item   { ret, _ := devPool.Get(); *(ret.(*Dev)) = o.Clone(); return ret }
func (o *DevExtent) CloneItem() Item {
	ret, _ := devExtentPool.Get()
	*(ret.(*DevExtent)) = o.Clone()
	return ret
}
func (o *DevStats) CloneItem() Item {
	ret, _ := devStatsPool.Get()
	*(ret.(*DevStats)) = o.Clone()
	return ret
}
func (o *DirEntry) CloneItem() Item {
	ret, _ := dirEntryPool.Get()
	*(ret.(*DirEntry)) = o.Clone()
	return ret
}
func (o *Empty) CloneItem() Item { ret, _ := emptyPool.Get(); *(ret.(*Empty)) = o.Clone(); return ret }
func (o *Extent) CloneItem() Item {
	ret, _ := extentPool.Get()
	*(ret.(*Extent)) = o.Clone()
	return ret
}
func (o *ExtentCSum) CloneItem() Item {
	ret, _ := extentCSumPool.Get()
	*(ret.(*ExtentCSum)) = o.Clone()
	return ret
}
func (o *ExtentDataRef) CloneItem() Item {
	ret, _ := extentDataRefPool.Get()
	*(ret.(*ExtentDataRef)) = o.Clone()
	return ret
}
func (o *FileExtent) CloneItem() Item {
	ret, _ := fileExtentPool.Get()
	*(ret.(*FileExtent)) = o.Clone()
	return ret
}
func (o *FreeSpaceBitmap) CloneItem() Item {
	ret, _ := freeSpaceBitmapPool.Get()
	*(ret.(*FreeSpaceBitmap)) = o.Clone()
	return ret
}
func (o *FreeSpaceHeader) CloneItem() Item {
	ret, _ := freeSpaceHeaderPool.Get()
	*(ret.(*FreeSpaceHeader)) = o.Clone()
	return ret
}
func (o *FreeSpaceInfo) CloneItem() Item {
	ret, _ := freeSpaceInfoPool.Get()
	*(ret.(*FreeSpaceInfo)) = o.Clone()
	return ret
}
func (o *Inode) CloneItem() Item { ret, _ := inodePool.Get(); *(ret.(*Inode)) = o.Clone(); return ret }
func (o *InodeRefs) CloneItem() Item {
	ret, _ := inodeRefsPool.Get()
	*(ret.(*InodeRefs)) = o.Clone()
	return ret
}
func (o *Metadata) CloneItem() Item {
	ret, _ := metadataPool.Get()
	*(ret.(*Metadata)) = o.Clone()
	return ret
}
func (o *QGroupInfo) CloneItem() Item {
	ret, _ := qGroupInfoPool.Get()
	*(ret.(*QGroupInfo)) = o.Clone()
	return ret
}
func (o *QGroupLimit) CloneItem() Item {
	ret, _ := qGroupLimitPool.Get()
	*(ret.(*QGroupLimit)) = o.Clone()
	return ret
}
func (o *QGroupStatus) CloneItem() Item {
	ret, _ := qGroupStatusPool.Get()
	*(ret.(*QGroupStatus)) = o.Clone()
	return ret
}
func (o *Root) CloneItem() Item { ret, _ := rootPool.Get(); *(ret.(*Root)) = o.Clone(); return ret }
func (o *RootRef) CloneItem() Item {
	ret, _ := rootRefPool.Get()
	*(ret.(*RootRef)) = o.Clone()
	return ret
}
func (o *SharedDataRef) CloneItem() Item {
	ret, _ := sharedDataRefPool.Get()
	*(ret.(*SharedDataRef)) = o.Clone()
	return ret
}
func (o *UUIDMap) CloneItem() Item {
	ret, _ := uuidMapPool.Get()
	*(ret.(*UUIDMap)) = o.Clone()
	return ret
}

// Item type assertions.
var (
	_ Item = (*BlockGroup)(nil)
	_ Item = (*Chunk)(nil)
	_ Item = (*Dev)(nil)
	_ Item = (*DevExtent)(nil)
	_ Item = (*DevStats)(nil)
	_ Item = (*DirEntry)(nil)
	_ Item = (*Empty)(nil)
	_ Item = (*Extent)(nil)
	_ Item = (*ExtentCSum)(nil)
	_ Item = (*ExtentDataRef)(nil)
	_ Item = (*FileExtent)(nil)
	_ Item = (*FreeSpaceBitmap)(nil)
	_ Item = (*FreeSpaceHeader)(nil)
	_ Item = (*FreeSpaceInfo)(nil)
	_ Item = (*Inode)(nil)
	_ Item = (*InodeRefs)(nil)
	_ Item = (*Metadata)(nil)
	_ Item = (*QGroupInfo)(nil)
	_ Item = (*QGroupLimit)(nil)
	_ Item = (*QGroupStatus)(nil)
	_ Item = (*Root)(nil)
	_ Item = (*RootRef)(nil)
	_ Item = (*SharedDataRef)(nil)
	_ Item = (*UUIDMap)(nil)
)

// Clone type assertions.
var (
	_ interface{ Clone() BlockGroup }      = BlockGroup{}
	_ interface{ Clone() Chunk }           = Chunk{}
	_ interface{ Clone() Dev }             = Dev{}
	_ interface{ Clone() DevExtent }       = DevExtent{}
	_ interface{ Clone() DevStats }        = DevStats{}
	_ interface{ Clone() DirEntry }        = DirEntry{}
	_ interface{ Clone() Empty }           = Empty{}
	_ interface{ Clone() Extent }          = Extent{}
	_ interface{ Clone() ExtentCSum }      = ExtentCSum{}
	_ interface{ Clone() ExtentDataRef }   = ExtentDataRef{}
	_ interface{ Clone() FileExtent }      = FileExtent{}
	_ interface{ Clone() FreeSpaceBitmap } = FreeSpaceBitmap{}
	_ interface{ Clone() FreeSpaceHeader } = FreeSpaceHeader{}
	_ interface{ Clone() FreeSpaceInfo }   = FreeSpaceInfo{}
	_ interface{ Clone() Inode }           = Inode{}
	_ interface{ Clone() InodeRefs }       = InodeRefs{}
	_ interface{ Clone() Metadata }        = Metadata{}
	_ interface{ Clone() QGroupInfo }      = QGroupInfo{}
	_ interface{ Clone() QGroupLimit }     = QGroupLimit{}
	_ interface{ Clone() QGroupStatus }    = QGroupStatus{}
	_ interface{ Clone() Root }            = Root{}
	_ interface{ Clone() RootRef }         = RootRef{}
	_ interface{ Clone() SharedDataRef }   = SharedDataRef{}
	_ interface{ Clone() UUIDMap }         = UUIDMap{}
)