xref: /freebsd/contrib/file/magic/Magdir/zfs (revision b6cee71de37d56e36dbc118e2d9b03e7cece5709)
1*b6cee71dSXin LI#------------------------------------------------------------------------------
2*b6cee71dSXin LI# zfs:	file(1) magic for ZFS dumps
3*b6cee71dSXin LI#
4*b6cee71dSXin LI# From <rea-fbsd@codelabs.ru>
5*b6cee71dSXin LI# ZFS dump header has the following structure (as per zfs_ioctl.h
6*b6cee71dSXin LI# in FreeBSD with drr_type is set to DRR_BEGIN)
7*b6cee71dSXin LI#
8*b6cee71dSXin LI#   enum {
9*b6cee71dSXin LI#	DRR_BEGIN, DRR_OBJECT, DRR_FREEOBJECTS,
10*b6cee71dSXin LI#	DRR_WRITE, DRR_FREE, DRR_END,
11*b6cee71dSXin LI#   } drr_type;
12*b6cee71dSXin LI#   uint32_t drr_pad;
13*b6cee71dSXin LI#   uint64_t drr_magic;
14*b6cee71dSXin LI#   uint64_t drr_version;
15*b6cee71dSXin LI#   uint64_t drr_creation_time;
16*b6cee71dSXin LI#   dmu_objset_type_t drr_type;
17*b6cee71dSXin LI#   uint32_t drr_pad;
18*b6cee71dSXin LI#   uint64_t drr_toguid;
19*b6cee71dSXin LI#   uint64_t drr_fromguid;
20*b6cee71dSXin LI#   char drr_toname[MAXNAMELEN];
21*b6cee71dSXin LI#
22*b6cee71dSXin LI# Backup magic is 0x00000002f5bacbac (quad word)
23*b6cee71dSXin LI# The drr_type is defined as
24*b6cee71dSXin LI#   typedef enum dmu_objset_type {
25*b6cee71dSXin LI#	  DMU_OST_NONE,
26*b6cee71dSXin LI#	  DMU_OST_META,
27*b6cee71dSXin LI#	  DMU_OST_ZFS,
28*b6cee71dSXin LI#	  DMU_OST_ZVOL,
29*b6cee71dSXin LI#	  DMU_OST_OTHER,		  /* For testing only! */
30*b6cee71dSXin LI#	  DMU_OST_ANY,			  /* Be careful! */
31*b6cee71dSXin LI#	  DMU_OST_NUMTYPES
32*b6cee71dSXin LI#  } dmu_objset_type_t;
33*b6cee71dSXin LI#
34*b6cee71dSXin LI# Almost all uint64_t fields are printed as the 32-bit ones (with high
35*b6cee71dSXin LI# 32 bits zeroed), because there is no simple way to print them as the
36*b6cee71dSXin LI# full 64-bit values.
37*b6cee71dSXin LI
38*b6cee71dSXin LI# Big-endian values
39*b6cee71dSXin LI8	string	\000\000\000\002\365\272\313\254 ZFS shapshot (big-endian machine),
40*b6cee71dSXin LI>20	belong	x	version %u,
41*b6cee71dSXin LI>32	belong	0	type: NONE,
42*b6cee71dSXin LI>32	belong	1	type: META,
43*b6cee71dSXin LI>32	belong	2	type: ZFS,
44*b6cee71dSXin LI>32	belong	3	type: ZVOL,
45*b6cee71dSXin LI>32	belong	4	type: OTHER,
46*b6cee71dSXin LI>32	belong	5	type: ANY,
47*b6cee71dSXin LI>32	belong	>5	type: UNKNOWN (%u),
48*b6cee71dSXin LI>40	byte	x	destination GUID: %02X
49*b6cee71dSXin LI>41	byte	x	%02X
50*b6cee71dSXin LI>42	byte	x	%02X
51*b6cee71dSXin LI>43	byte	x	%02X
52*b6cee71dSXin LI>44	byte	x	%02X
53*b6cee71dSXin LI>45	byte	x	%02X
54*b6cee71dSXin LI>46	byte	x	%02X
55*b6cee71dSXin LI>47	byte	x	%02X,
56*b6cee71dSXin LI>48	ulong	>0
57*b6cee71dSXin LI>>52	ulong	>0
58*b6cee71dSXin LI>>>48	byte	x	source GUID: %02X
59*b6cee71dSXin LI>>>49	byte	x	%02X
60*b6cee71dSXin LI>>>50	byte	x	%02X
61*b6cee71dSXin LI>>>51	byte	x	%02X
62*b6cee71dSXin LI>>>52	byte	x	%02X
63*b6cee71dSXin LI>>>53	byte	x	%02X
64*b6cee71dSXin LI>>>54	byte	x	%02X
65*b6cee71dSXin LI>>>55	byte	x	%02X,
66*b6cee71dSXin LI>56	string	>\0	name: '%s'
67*b6cee71dSXin LI
68*b6cee71dSXin LI# Little-endian values
69*b6cee71dSXin LI8	string	\254\313\272\365\002\000\000\000	ZFS shapshot (little-endian machine),
70*b6cee71dSXin LI>16	lelong	x	version %u,
71*b6cee71dSXin LI>32	lelong	0	type: NONE,
72*b6cee71dSXin LI>32	lelong	1	type: META,
73*b6cee71dSXin LI>32	lelong	2	type: ZFS,
74*b6cee71dSXin LI>32	lelong	3	type: ZVOL,
75*b6cee71dSXin LI>32	lelong	4	type: OTHER,
76*b6cee71dSXin LI>32	lelong	5	type: ANY,
77*b6cee71dSXin LI>32	lelong	>5	type: UNKNOWN (%u),
78*b6cee71dSXin LI>47	byte	x	destination GUID: %02X
79*b6cee71dSXin LI>46	byte	x	%02X
80*b6cee71dSXin LI>45	byte	x	%02X
81*b6cee71dSXin LI>44	byte	x	%02X
82*b6cee71dSXin LI>43	byte	x	%02X
83*b6cee71dSXin LI>42	byte	x	%02X
84*b6cee71dSXin LI>41	byte	x	%02X
85*b6cee71dSXin LI>40	byte	x	%02X,
86*b6cee71dSXin LI>48	ulong	>0
87*b6cee71dSXin LI>>52	ulong	>0
88*b6cee71dSXin LI>>>55	byte	x	source GUID: %02X
89*b6cee71dSXin LI>>>54	byte	x	%02X
90*b6cee71dSXin LI>>>53	byte	x	%02X
91*b6cee71dSXin LI>>>52	byte	x	%02X
92*b6cee71dSXin LI>>>51	byte	x	%02X
93*b6cee71dSXin LI>>>50	byte	x	%02X
94*b6cee71dSXin LI>>>49	byte	x	%02X
95*b6cee71dSXin LI>>>48	byte	x	%02X,
96*b6cee71dSXin LI>56	string	>\0	name: '%s'
97