1 /****************************************************************************
2  ****************************************************************************
3  ***
4  ***   This header was automatically generated from a Linux kernel header
5  ***   of the same name, to make information necessary for userspace to
6  ***   call into the kernel available to libc.  It contains only constants,
7  ***   structures, and macros generated from the original header, and thus,
8  ***   contains no copyrightable information.
9  ***
10  ***   To edit the content of this header, modify the corresponding
11  ***   source file (e.g. under external/kernel-headers/original/) then
12  ***   run bionic/libc/kernel/tools/update_all.py
13  ***
14  ***   Any manual change here will be lost the next time this script will
15  ***   be run. You've been warned!
16  ***
17  ****************************************************************************
18  ****************************************************************************/
19 #ifndef _LINUX_NILFS2_API_H
20 #define _LINUX_NILFS2_API_H
21 #include <linux/types.h>
22 #include <linux/ioctl.h>
23 struct nilfs_cpinfo {
24   __u32 ci_flags;
25   __u32 ci_pad;
26   __u64 ci_cno;
27   __u64 ci_create;
28   __u64 ci_nblk_inc;
29   __u64 ci_inodes_count;
30   __u64 ci_blocks_count;
31   __u64 ci_next;
32 };
33 enum {
34   NILFS_CPINFO_SNAPSHOT,
35   NILFS_CPINFO_INVALID,
36   NILFS_CPINFO_SKETCH,
37   NILFS_CPINFO_MINOR,
38 };
39 #define NILFS_CPINFO_FNS(flag,name) static inline int nilfs_cpinfo_ ##name(const struct nilfs_cpinfo * cpinfo) \
40 { return ! ! (cpinfo->ci_flags & (1UL << NILFS_CPINFO_ ##flag)); \
41 }
42 struct nilfs_suinfo {
43   __u64 sui_lastmod;
44   __u32 sui_nblocks;
45   __u32 sui_flags;
46 };
47 enum {
48   NILFS_SUINFO_ACTIVE,
49   NILFS_SUINFO_DIRTY,
50   NILFS_SUINFO_ERROR,
51 };
52 #define NILFS_SUINFO_FNS(flag,name) static inline int nilfs_suinfo_ ##name(const struct nilfs_suinfo * si) \
53 { return si->sui_flags & (1UL << NILFS_SUINFO_ ##flag); \
54 }
55 struct nilfs_suinfo_update {
56   __u64 sup_segnum;
57   __u32 sup_flags;
58   __u32 sup_reserved;
59   struct nilfs_suinfo sup_sui;
60 };
61 enum {
62   NILFS_SUINFO_UPDATE_LASTMOD,
63   NILFS_SUINFO_UPDATE_NBLOCKS,
64   NILFS_SUINFO_UPDATE_FLAGS,
65   __NR_NILFS_SUINFO_UPDATE_FIELDS,
66 };
67 #define NILFS_SUINFO_UPDATE_FNS(flag,name) static inline void nilfs_suinfo_update_set_ ##name(struct nilfs_suinfo_update * sup) \
68 { sup->sup_flags |= 1UL << NILFS_SUINFO_UPDATE_ ##flag; \
69 } static inline void nilfs_suinfo_update_clear_ ##name(struct nilfs_suinfo_update * sup) \
70 { sup->sup_flags &= ~(1UL << NILFS_SUINFO_UPDATE_ ##flag); \
71 } static inline int nilfs_suinfo_update_ ##name(const struct nilfs_suinfo_update * sup) \
72 { return ! ! (sup->sup_flags & (1UL << NILFS_SUINFO_UPDATE_ ##flag)); \
73 }
74 enum {
75   NILFS_CHECKPOINT,
76   NILFS_SNAPSHOT,
77 };
78 struct nilfs_cpmode {
79   __u64 cm_cno;
80   __u32 cm_mode;
81   __u32 cm_pad;
82 };
83 struct nilfs_argv {
84   __u64 v_base;
85   __u32 v_nmembs;
86   __u16 v_size;
87   __u16 v_flags;
88   __u64 v_index;
89 };
90 struct nilfs_period {
91   __u64 p_start;
92   __u64 p_end;
93 };
94 struct nilfs_cpstat {
95   __u64 cs_cno;
96   __u64 cs_ncps;
97   __u64 cs_nsss;
98 };
99 struct nilfs_sustat {
100   __u64 ss_nsegs;
101   __u64 ss_ncleansegs;
102   __u64 ss_ndirtysegs;
103   __u64 ss_ctime;
104   __u64 ss_nongc_ctime;
105   __u64 ss_prot_seq;
106 };
107 struct nilfs_vinfo {
108   __u64 vi_vblocknr;
109   __u64 vi_start;
110   __u64 vi_end;
111   __u64 vi_blocknr;
112 };
113 struct nilfs_vdesc {
114   __u64 vd_ino;
115   __u64 vd_cno;
116   __u64 vd_vblocknr;
117   struct nilfs_period vd_period;
118   __u64 vd_blocknr;
119   __u64 vd_offset;
120   __u32 vd_flags;
121   __u32 vd_pad;
122 };
123 struct nilfs_bdesc {
124   __u64 bd_ino;
125   __u64 bd_oblocknr;
126   __u64 bd_blocknr;
127   __u64 bd_offset;
128   __u32 bd_level;
129   __u32 bd_pad;
130 };
131 #define NILFS_IOCTL_IDENT 'n'
132 #define NILFS_IOCTL_CHANGE_CPMODE _IOW(NILFS_IOCTL_IDENT, 0x80, struct nilfs_cpmode)
133 #define NILFS_IOCTL_DELETE_CHECKPOINT _IOW(NILFS_IOCTL_IDENT, 0x81, __u64)
134 #define NILFS_IOCTL_GET_CPINFO _IOR(NILFS_IOCTL_IDENT, 0x82, struct nilfs_argv)
135 #define NILFS_IOCTL_GET_CPSTAT _IOR(NILFS_IOCTL_IDENT, 0x83, struct nilfs_cpstat)
136 #define NILFS_IOCTL_GET_SUINFO _IOR(NILFS_IOCTL_IDENT, 0x84, struct nilfs_argv)
137 #define NILFS_IOCTL_GET_SUSTAT _IOR(NILFS_IOCTL_IDENT, 0x85, struct nilfs_sustat)
138 #define NILFS_IOCTL_GET_VINFO _IOWR(NILFS_IOCTL_IDENT, 0x86, struct nilfs_argv)
139 #define NILFS_IOCTL_GET_BDESCS _IOWR(NILFS_IOCTL_IDENT, 0x87, struct nilfs_argv)
140 #define NILFS_IOCTL_CLEAN_SEGMENTS _IOW(NILFS_IOCTL_IDENT, 0x88, struct nilfs_argv[5])
141 #define NILFS_IOCTL_SYNC _IOR(NILFS_IOCTL_IDENT, 0x8A, __u64)
142 #define NILFS_IOCTL_RESIZE _IOW(NILFS_IOCTL_IDENT, 0x8B, __u64)
143 #define NILFS_IOCTL_SET_ALLOC_RANGE _IOW(NILFS_IOCTL_IDENT, 0x8C, __u64[2])
144 #define NILFS_IOCTL_SET_SUINFO _IOW(NILFS_IOCTL_IDENT, 0x8D, struct nilfs_argv)
145 #endif
146