1 /* FS_IOC_FIEMAP ioctl infrastructure.
2 Some portions copyright (C) 2007 Cluster File Systems, Inc
3 Authors: Mark Fasheh <mfasheh@suse.com>
4 Kalpak Shah <kalpak.shah@sun.com>
5 Andreas Dilger <adilger@sun.com>. */
7 /* Copy from kernel, modified to respect GNU code style by Jie Liu. */
9 #ifndef _LINUX_FIEMAP_H
10 # define _LINUX_FIEMAP_H
16 /* Logical offset in bytes for the start of the extent
17 from the beginning of the file. */
20 /* Physical offset in bytes for the start of the extent
21 from the beginning of the disk. */
24 /* Length in bytes for this extent. */
27 uint64_t fe_reserved64
[2];
29 /* FIEMAP_EXTENT_* flags for this extent. */
32 uint32_t fe_reserved
[3];
37 /* Logical offset(inclusive) at which to start mapping(in). */
40 /* Logical length of mapping which userspace wants(in). */
43 /* FIEMAP_FLAG_* flags for request(in/out). */
46 /* Number of extents that were mapped(out). */
47 uint32_t fm_mapped_extents
;
49 /* Size of fm_extents array(in). */
50 uint32_t fm_extent_count
;
54 /* Array of mapped extents(out).
55 This is protected by the ifdef because it uses non standard
56 zero length arrays. Note C99 has the equivalent flexible arrays,
57 but we don't use those for maximum portability to older systems. */
59 struct fiemap_extent fm_extents
[0];
63 /* The maximum offset can be mapped for a file. */
64 # define FIEMAP_MAX_OFFSET (~0ULL)
66 /* Sync file data before map. */
67 # define FIEMAP_FLAG_SYNC 0x00000001
69 /* Map extented attribute tree. */
70 # define FIEMAP_FLAG_XATTR 0x00000002
72 # define FIEMAP_FLAGS_COMPAT (FIEMAP_FLAG_SYNC | FIEMAP_FLAG_XATTR)
74 /* Last extent in file. */
75 # define FIEMAP_EXTENT_LAST 0x00000001
77 /* Data location unknown. */
78 # define FIEMAP_EXTENT_UNKNOWN 0x00000002
80 /* Location still pending, Sets EXTENT_UNKNOWN. */
81 # define FIEMAP_EXTENT_DELALLOC 0x00000004
83 /* Data cannot be read while fs is unmounted. */
84 # define FIEMAP_EXTENT_ENCODED 0x00000008
86 /* Data is encrypted by fs. Sets EXTENT_NO_BYPASS. */
87 # define FIEMAP_EXTENT_DATA_ENCRYPTED 0x00000080
89 /* Extent offsets may not be block aligned. */
90 # define FIEMAP_EXTENT_NOT_ALIGNED 0x00000100
92 /* Data mixed with metadata. Sets EXTENT_NOT_ALIGNED. */
93 # define FIEMAP_EXTENT_DATA_INLINE 0x00000200
95 /* Multiple files in block. Set EXTENT_NOT_ALIGNED. */
96 # define FIEMAP_EXTENT_DATA_TAIL 0x00000400
98 /* Space allocated, but not data (i.e. zero). */
99 # define FIEMAP_EXTENT_UNWRITTEN 0x00000800
101 /* File does not natively support extents. Result merged for efficiency. */
102 # define FIEMAP_EXTENT_MERGED 0x00001000
104 /* Space shared with other files. */
105 # define FIEMAP_EXTENT_SHARED 0x00002000