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 struct fiemap_extent fm_extents
[0];
58 /* The maximum offset can be mapped for a file. */
59 # define FIEMAP_MAX_OFFSET (~0ULL)
61 /* Sync file data before map. */
62 # define FIEMAP_FLAG_SYNC 0x00000001
64 /* Map extented attribute tree. */
65 # define FIEMAP_FLAG_XATTR 0x00000002
67 # define FIEMAP_FLAGS_COMPAT (FIEMAP_FLAG_SYNC | FIEMAP_FLAG_XATTR)
69 /* Last extent in file. */
70 # define FIEMAP_EXTENT_LAST 0x00000001
72 /* Data location unknown. */
73 # define FIEMAP_EXTENT_UNKNOWN 0x00000002
75 /* Location still pending, Sets EXTENT_UNKNOWN. */
76 # define FIEMAP_EXTENT_DELALLOC 0x00000004
78 /* Data can not be read while fs is unmounted. */
79 # define FIEMAP_EXTENT_ENCODED 0x00000008
81 /* Data is encrypted by fs. Sets EXTENT_NO_BYPASS. */
82 # define FIEMAP_EXTENT_DATA_ENCRYPTED 0x00000080
84 /* Extent offsets may not be block aligned. */
85 # define FIEMAP_EXTENT_NOT_ALIGNED 0x00000100
87 /* Data mixed with metadata. Sets EXTENT_NOT_ALIGNED. */
88 # define FIEMAP_EXTENT_DATA_INLINE 0x00000200
90 /* Multiple files in block. Set EXTENT_NOT_ALIGNED. */
91 # define FIEMAP_EXTENT_DATA_TAIL 0x00000400
93 /* Space allocated, but not data (i.e. zero). */
94 # define FIEMAP_EXTENT_UNWRITTEN 0x00000800
96 /* File does not natively support extents. Result merged for efficiency. */
97 # define FIEMAP_EXTENT_MERGED 0x00001000
99 /* Space shared with other files. */
100 # define FIEMAP_EXTENT_SHARED 0x00002000