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