maint: cleanup up various uses of __attribute__
[coreutils.git] / src / fiemap.h
blob15ddff9a0b524b4fa0f5b8ac7f26d921fe838b5e
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
12 # include <stdint.h>
14 struct fiemap_extent
16 /* Logical offset in bytes for the start of the extent
17 from the beginning of the file. */
18 uint64_t fe_logical;
20 /* Physical offset in bytes for the start of the extent
21 from the beginning of the disk. */
22 uint64_t fe_physical;
24 /* Length in bytes for this extent. */
25 uint64_t fe_length;
27 uint64_t fe_reserved64[2];
29 /* FIEMAP_EXTENT_* flags for this extent. */
30 uint32_t fe_flags;
32 uint32_t fe_reserved[3];
35 struct fiemap
37 /* Logical offset(inclusive) at which to start mapping(in). */
38 uint64_t fm_start;
40 /* Logical length of mapping which userspace wants(in). */
41 uint64_t fm_length;
43 /* FIEMAP_FLAG_* flags for request(in/out). */
44 uint32_t fm_flags;
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;
52 uint32_t fm_reserved;
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. */
58 # ifdef __linux__
59 struct fiemap_extent fm_extents[0];
60 # endif
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
107 #endif