fiemap.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. #ifndef _LINUX_FIEMAP_H
  12. #define _LINUX_FIEMAP_H
  13. #include <linux/types.h>
  14. struct fiemap_extent {
  15. __u64 fe_logical; /* logical offset in bytes for the start of
  16. * the extent from the beginning of the file */
  17. __u64 fe_physical; /* physical offset in bytes for the start
  18. * of the extent from the beginning of the disk */
  19. __u64 fe_length; /* length in bytes for this extent */
  20. __u64 fe_reserved64[2];
  21. __u32 fe_flags; /* FIEMAP_EXTENT_* flags for this extent */
  22. __u32 fe_reserved[3];
  23. };
  24. struct fiemap {
  25. __u64 fm_start; /* logical offset (inclusive) at
  26. * which to start mapping (in) */
  27. __u64 fm_length; /* logical length of mapping which
  28. * userspace wants (in) */
  29. __u32 fm_flags; /* FIEMAP_FLAG_* flags for request (in/out) */
  30. __u32 fm_mapped_extents;/* number of extents that were mapped (out) */
  31. __u32 fm_extent_count; /* size of fm_extents array (in) */
  32. __u32 fm_reserved;
  33. struct fiemap_extent fm_extents[0]; /* array of mapped extents (out) */
  34. };
  35. #define FIEMAP_MAX_OFFSET (~0ULL)
  36. #define FIEMAP_FLAG_SYNC 0x00000001 /* sync file data before map */
  37. #define FIEMAP_FLAG_XATTR 0x00000002 /* map extended attribute tree */
  38. #define FIEMAP_FLAG_CACHE 0x00000004 /* request caching of the extents */
  39. #define FIEMAP_FLAGS_COMPAT (FIEMAP_FLAG_SYNC | FIEMAP_FLAG_XATTR)
  40. #define FIEMAP_EXTENT_LAST 0x00000001 /* Last extent in file. */
  41. #define FIEMAP_EXTENT_UNKNOWN 0x00000002 /* Data location unknown. */
  42. #define FIEMAP_EXTENT_DELALLOC 0x00000004 /* Location still pending.
  43. * Sets EXTENT_UNKNOWN. */
  44. #define FIEMAP_EXTENT_ENCODED 0x00000008 /* Data can not be read
  45. * while fs is unmounted */
  46. #define FIEMAP_EXTENT_DATA_ENCRYPTED 0x00000080 /* Data is encrypted by fs.
  47. * Sets EXTENT_NO_BYPASS. */
  48. #define FIEMAP_EXTENT_NOT_ALIGNED 0x00000100 /* Extent offsets may not be
  49. * block aligned. */
  50. #define FIEMAP_EXTENT_DATA_INLINE 0x00000200 /* Data mixed with metadata.
  51. * Sets EXTENT_NOT_ALIGNED.*/
  52. #define FIEMAP_EXTENT_DATA_TAIL 0x00000400 /* Multiple files in block.
  53. * Sets EXTENT_NOT_ALIGNED.*/
  54. #define FIEMAP_EXTENT_UNWRITTEN 0x00000800 /* Space allocated, but
  55. * no data (i.e. zero). */
  56. #define FIEMAP_EXTENT_MERGED 0x00001000 /* File does not natively
  57. * support extents. Result
  58. * merged for efficiency. */
  59. #define FIEMAP_EXTENT_SHARED 0x00002000 /* Space shared with other
  60. * files. */
  61. #endif /* _LINUX_FIEMAP_H */