| 1 | /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ |
| 2 | /* |
| 3 | * FS_IOC_FIEMAP ioctl infrastructure. |
| 4 | * |
| 5 | * Some portions copyright (C) 2007 Cluster File Systems, Inc |
| 6 | * |
| 7 | * Authors: Mark Fasheh <mfasheh@suse.com> |
| 8 | * Kalpak Shah <kalpak.shah@sun.com> |
| 9 | * Andreas Dilger <adilger@sun.com> |
| 10 | */ |
| 11 | |
| 12 | #ifndef _UAPI_LINUX_FIEMAP_H |
| 13 | #define _UAPI_LINUX_FIEMAP_H |
| 14 | |
| 15 | #include <linux/types.h> |
| 16 | |
| 17 | /** |
| 18 | * struct fiemap_extent - description of one fiemap extent |
| 19 | * @fe_logical: byte offset of the extent in the file |
| 20 | * @fe_physical: byte offset of extent on disk |
| 21 | * @fe_length: length in bytes for this extent |
| 22 | * @fe_flags: FIEMAP_EXTENT_* flags for this extent |
| 23 | */ |
| 24 | struct fiemap_extent { |
| 25 | __u64 fe_logical; |
| 26 | __u64 fe_physical; |
| 27 | __u64 fe_length; |
| 28 | /* private: */ |
| 29 | __u64 fe_reserved64[2]; |
| 30 | /* public: */ |
| 31 | __u32 fe_flags; |
| 32 | /* private: */ |
| 33 | __u32 fe_reserved[3]; |
| 34 | }; |
| 35 | |
| 36 | /** |
| 37 | * struct fiemap - file extent mappings |
| 38 | * @fm_start: byte offset (inclusive) at which to start mapping (in) |
| 39 | * @fm_length: logical length of mapping which userspace wants (in) |
| 40 | * @fm_flags: FIEMAP_FLAG_* flags for request (in/out) |
| 41 | * @fm_mapped_extents: number of extents that were mapped (out) |
| 42 | * @fm_extent_count: size of fm_extents array (in) |
| 43 | * @fm_extents: array of mapped extents (out) |
| 44 | */ |
| 45 | struct fiemap { |
| 46 | __u64 fm_start; |
| 47 | __u64 fm_length; |
| 48 | __u32 fm_flags; |
| 49 | __u32 fm_mapped_extents; |
| 50 | __u32 fm_extent_count; |
| 51 | /* private: */ |
| 52 | __u32 fm_reserved; |
| 53 | /* public: */ |
| 54 | struct fiemap_extent fm_extents[]; |
| 55 | }; |
| 56 | |
| 57 | #define FIEMAP_MAX_OFFSET (~0ULL) |
| 58 | |
| 59 | /* flags used in fm_flags: */ |
| 60 | #define FIEMAP_FLAG_SYNC 0x00000001 /* sync file data before map */ |
| 61 | #define FIEMAP_FLAG_XATTR 0x00000002 /* map extended attribute tree */ |
| 62 | #define FIEMAP_FLAG_CACHE 0x00000004 /* request caching of the extents */ |
| 63 | |
| 64 | #define FIEMAP_FLAGS_COMPAT (FIEMAP_FLAG_SYNC | FIEMAP_FLAG_XATTR) |
| 65 | |
| 66 | /* flags used in fe_flags: */ |
| 67 | #define FIEMAP_EXTENT_LAST 0x00000001 /* Last extent in file. */ |
| 68 | #define FIEMAP_EXTENT_UNKNOWN 0x00000002 /* Data location unknown. */ |
| 69 | #define FIEMAP_EXTENT_DELALLOC 0x00000004 /* Location still pending. |
| 70 | * Sets EXTENT_UNKNOWN. */ |
| 71 | #define FIEMAP_EXTENT_ENCODED 0x00000008 /* Data can not be read |
| 72 | * while fs is unmounted */ |
| 73 | #define FIEMAP_EXTENT_DATA_ENCRYPTED 0x00000080 /* Data is encrypted by fs. |
| 74 | * Sets EXTENT_NO_BYPASS. */ |
| 75 | #define FIEMAP_EXTENT_NOT_ALIGNED 0x00000100 /* Extent offsets may not be |
| 76 | * block aligned. */ |
| 77 | #define FIEMAP_EXTENT_DATA_INLINE 0x00000200 /* Data mixed with metadata. |
| 78 | * Sets EXTENT_NOT_ALIGNED.*/ |
| 79 | #define FIEMAP_EXTENT_DATA_TAIL 0x00000400 /* Multiple files in block. |
| 80 | * Sets EXTENT_NOT_ALIGNED.*/ |
| 81 | #define FIEMAP_EXTENT_UNWRITTEN 0x00000800 /* Space allocated, but |
| 82 | * no data (i.e. zero). */ |
| 83 | #define FIEMAP_EXTENT_MERGED 0x00001000 /* File does not natively |
| 84 | * support extents. Result |
| 85 | * merged for efficiency. */ |
| 86 | #define FIEMAP_EXTENT_SHARED 0x00002000 /* Space shared with other |
| 87 | * files. */ |
| 88 | |
| 89 | #endif /* _UAPI_LINUX_FIEMAP_H */ |
| 90 | |