1 /*
2 * This header was generated from the Linux kernel headers by update_headers.py,
3 * to provide necessary information from kernel to userspace, such as constants,
4 * structures, and macros, and thus, contains no copyrightable information.
5 */
6 #ifndef _LINUX_FSMAP_H
7 #define _LINUX_FSMAP_H
8 #include <linux/types.h>
9 struct fsmap {
10 __u32 fmr_device;
11 __u32 fmr_flags;
12 __u64 fmr_physical;
13 __u64 fmr_owner;
14 __u64 fmr_offset;
15 __u64 fmr_length;
16 __u64 fmr_reserved[3];
17 };
18 struct fsmap_head {
19 __u32 fmh_iflags;
20 __u32 fmh_oflags;
21 __u32 fmh_count;
22 __u32 fmh_entries;
23 __u64 fmh_reserved[6];
24 struct fsmap fmh_keys[2];
25 struct fsmap fmh_recs[];
26 };
27 static inline size_t
fsmap_sizeof(unsigned int nr)28 fsmap_sizeof(
29 unsigned int nr)
30 {
31 return sizeof(struct fsmap_head) + nr * sizeof(struct fsmap);
32 }
33 static inline void
fsmap_advance(struct fsmap_head * head)34 fsmap_advance(
35 struct fsmap_head *head)
36 {
37 head->fmh_keys[0] = head->fmh_recs[head->fmh_entries - 1];
38 }
39 #define FMH_IF_VALID 0
40 #define FMH_OF_DEV_T 0x1
41 #define FMR_OF_PREALLOC 0x1
42 #define FMR_OF_ATTR_FORK 0x2
43 #define FMR_OF_EXTENT_MAP 0x4
44 #define FMR_OF_SHARED 0x8
45 #define FMR_OF_SPECIAL_OWNER 0x10
46 #define FMR_OF_LAST 0x20
47 #define FMR_OWNER(type, code) (((__u64)type << 32) | \
48 ((__u64)code & 0xFFFFFFFFULL))
49 #define FMR_OWNER_TYPE(owner) ((__u32)((__u64)owner >> 32))
50 #define FMR_OWNER_CODE(owner) ((__u32)(((__u64)owner & 0xFFFFFFFFULL)))
51 #define FMR_OWN_FREE FMR_OWNER(0, 1)
52 #define FMR_OWN_UNKNOWN FMR_OWNER(0, 2)
53 #define FMR_OWN_METADATA FMR_OWNER(0, 3)
54 #define FS_IOC_GETFSMAP _IOWR('X', 59, struct fsmap_head)
55 #endif
56