Linux Audio

Check our new training course

Loading...
v6.2
  1/* SPDX-License-Identifier: GPL-2.0-only */
  2/*
 
  3 * ocfs2_ioctl.h
  4 *
  5 * Defines OCFS2 ioctls.
  6 *
  7 * Copyright (C) 2010 Oracle.  All rights reserved.
 
 
 
 
 
 
 
 
 
  8 */
  9
 10#ifndef OCFS2_IOCTL_H
 11#define OCFS2_IOCTL_H
 
 
 
 
 
 
 
 
 12
 13/*
 14 * Space reservation / allocation / free ioctls and argument structure
 15 * are designed to be compatible with XFS.
 16 *
 17 * ALLOCSP* and FREESP* are not and will never be supported, but are
 18 * included here for completeness.
 19 */
 20struct ocfs2_space_resv {
 21	__s16		l_type;
 22	__s16		l_whence;
 23	__s64		l_start;
 24	__s64		l_len;		/* len == 0 means until end of file */
 25	__s32		l_sysid;
 26	__u32		l_pid;
 27	__s32		l_pad[4];	/* reserve area			    */
 28};
 29
 30#define OCFS2_IOC_ALLOCSP		_IOW ('X', 10, struct ocfs2_space_resv)
 31#define OCFS2_IOC_FREESP		_IOW ('X', 11, struct ocfs2_space_resv)
 32#define OCFS2_IOC_RESVSP		_IOW ('X', 40, struct ocfs2_space_resv)
 33#define OCFS2_IOC_UNRESVSP	_IOW ('X', 41, struct ocfs2_space_resv)
 34#define OCFS2_IOC_ALLOCSP64	_IOW ('X', 36, struct ocfs2_space_resv)
 35#define OCFS2_IOC_FREESP64	_IOW ('X', 37, struct ocfs2_space_resv)
 36#define OCFS2_IOC_RESVSP64	_IOW ('X', 42, struct ocfs2_space_resv)
 37#define OCFS2_IOC_UNRESVSP64	_IOW ('X', 43, struct ocfs2_space_resv)
 38
 39/* Used to pass group descriptor data when online resize is done */
 40struct ocfs2_new_group_input {
 41	__u64 group;		/* Group descriptor's blkno. */
 42	__u32 clusters;		/* Total number of clusters in this group */
 43	__u32 frees;		/* Total free clusters in this group */
 44	__u16 chain;		/* Chain for this group */
 45	__u16 reserved1;
 46	__u32 reserved2;
 47};
 48
 49#define OCFS2_IOC_GROUP_EXTEND	_IOW('o', 1, int)
 50#define OCFS2_IOC_GROUP_ADD	_IOW('o', 2,struct ocfs2_new_group_input)
 51#define OCFS2_IOC_GROUP_ADD64	_IOW('o', 3,struct ocfs2_new_group_input)
 52
 53/* Used to pass 2 file names to reflink. */
 54struct reflink_arguments {
 55	__u64 old_path;
 56	__u64 new_path;
 57	__u64 preserve;
 58};
 59#define OCFS2_IOC_REFLINK	_IOW('o', 4, struct reflink_arguments)
 60
 61/* Following definitions dedicated for ocfs2_info_request ioctls. */
 62#define OCFS2_INFO_MAX_REQUEST		(50)
 63#define OCFS2_TEXT_UUID_LEN		(OCFS2_VOL_UUID_LEN * 2)
 64
 65/* Magic number of all requests */
 66#define OCFS2_INFO_MAGIC		(0x4F32494E)
 67
 68/*
 69 * Always try to separate info request into small pieces to
 70 * guarantee the backward&forward compatibility.
 71 */
 72struct ocfs2_info {
 73	__u64 oi_requests;	/* Array of __u64 pointers to requests */
 74	__u32 oi_count;		/* Number of requests in info_requests */
 75	__u32 oi_pad;
 76};
 77
 78struct ocfs2_info_request {
 79/*00*/	__u32 ir_magic;	/* Magic number */
 80	__u32 ir_code;	/* Info request code */
 81	__u32 ir_size;	/* Size of request */
 82	__u32 ir_flags;	/* Request flags */
 83/*10*/			/* Request specific fields */
 84};
 85
 86struct ocfs2_info_clustersize {
 87	struct ocfs2_info_request ic_req;
 88	__u32 ic_clustersize;
 89	__u32 ic_pad;
 90};
 91
 92struct ocfs2_info_blocksize {
 93	struct ocfs2_info_request ib_req;
 94	__u32 ib_blocksize;
 95	__u32 ib_pad;
 96};
 97
 98struct ocfs2_info_maxslots {
 99	struct ocfs2_info_request im_req;
100	__u32 im_max_slots;
101	__u32 im_pad;
102};
103
104struct ocfs2_info_label {
105	struct ocfs2_info_request il_req;
106	__u8	il_label[OCFS2_MAX_VOL_LABEL_LEN];
107} __attribute__ ((packed));
108
109struct ocfs2_info_uuid {
110	struct ocfs2_info_request iu_req;
111	__u8	iu_uuid_str[OCFS2_TEXT_UUID_LEN + 1];
112} __attribute__ ((packed));
113
114struct ocfs2_info_fs_features {
115	struct ocfs2_info_request if_req;
116	__u32 if_compat_features;
117	__u32 if_incompat_features;
118	__u32 if_ro_compat_features;
119	__u32 if_pad;
120};
121
122struct ocfs2_info_journal_size {
123	struct ocfs2_info_request ij_req;
124	__u64 ij_journal_size;
125};
126
127struct ocfs2_info_freeinode {
128	struct ocfs2_info_request ifi_req;
129	struct ocfs2_info_local_freeinode {
130		__u64 lfi_total;
131		__u64 lfi_free;
132	} ifi_stat[OCFS2_MAX_SLOTS];
133	__u32 ifi_slotnum; /* out */
134	__u32 ifi_pad;
135};
136
137#define OCFS2_INFO_MAX_HIST     (32)
138
139struct ocfs2_info_freefrag {
140	struct ocfs2_info_request iff_req;
141	struct ocfs2_info_freefrag_stats { /* (out) */
142		struct ocfs2_info_free_chunk_list {
143			__u32 fc_chunks[OCFS2_INFO_MAX_HIST];
144			__u32 fc_clusters[OCFS2_INFO_MAX_HIST];
145		} ffs_fc_hist;
146		__u32 ffs_clusters;
147		__u32 ffs_free_clusters;
148		__u32 ffs_free_chunks;
149		__u32 ffs_free_chunks_real;
150		__u32 ffs_min; /* Minimum free chunksize in clusters */
151		__u32 ffs_max;
152		__u32 ffs_avg;
153		__u32 ffs_pad;
154	} iff_ffs;
155	__u32 iff_chunksize; /* chunksize in clusters(in) */
156	__u32 iff_pad;
157};
158
159/* Codes for ocfs2_info_request */
160enum ocfs2_info_type {
161	OCFS2_INFO_CLUSTERSIZE = 1,
162	OCFS2_INFO_BLOCKSIZE,
163	OCFS2_INFO_MAXSLOTS,
164	OCFS2_INFO_LABEL,
165	OCFS2_INFO_UUID,
166	OCFS2_INFO_FS_FEATURES,
167	OCFS2_INFO_JOURNAL_SIZE,
168	OCFS2_INFO_FREEINODE,
169	OCFS2_INFO_FREEFRAG,
170	OCFS2_INFO_NUM_TYPES
171};
172
173/* Flags for struct ocfs2_info_request */
174/* Filled by the caller */
175#define OCFS2_INFO_FL_NON_COHERENT	(0x00000001)	/* Cluster coherency not
176							   required. This is a hint.
177							   It is up to ocfs2 whether
178							   the request can be fulfilled
179							   without locking. */
180/* Filled by ocfs2 */
181#define OCFS2_INFO_FL_FILLED		(0x40000000)	/* Filesystem understood
182							   this request and
183							   filled in the answer */
184
185#define OCFS2_INFO_FL_ERROR		(0x80000000)	/* Error happened during
186							   request handling. */
187
188#define OCFS2_IOC_INFO		_IOR('o', 5, struct ocfs2_info)
189
190struct ocfs2_move_extents {
191/* All values are in bytes */
192	/* in */
193	__u64 me_start;		/* Virtual start in the file to move */
194	__u64 me_len;		/* Length of the extents to be moved */
195	__u64 me_goal;		/* Physical offset of the goal,
196				   it's in block unit */
197	__u64 me_threshold;	/* Maximum distance from goal or threshold
198				   for auto defragmentation */
199	__u64 me_flags;		/* Flags for the operation:
200				 * - auto defragmentation.
201				 * - refcount,xattr cases.
202				 */
203	/* out */
204	__u64 me_moved_len;	/* Moved/defraged length */
205	__u64 me_new_offset;	/* Resulting physical location */
206	__u32 me_reserved[2];	/* Reserved for futhure */
207};
208
209#define OCFS2_MOVE_EXT_FL_AUTO_DEFRAG	(0x00000001)	/* Kernel manages to
210							   claim new clusters
211							   as the goal place
212							   for extents moving */
213#define OCFS2_MOVE_EXT_FL_PART_DEFRAG	(0x00000002)	/* Allow partial extent
214							   moving, is to make
215							   movement less likely
216							   to fail, may make fs
217							   even more fragmented */
218#define OCFS2_MOVE_EXT_FL_COMPLETE	(0x00000004)	/* Move or defragmenation
219							   completely gets done.
220							 */
221
222#define OCFS2_IOC_MOVE_EXT	_IOW('o', 6, struct ocfs2_move_extents)
223
224#endif /* OCFS2_IOCTL_H */
v3.5.6
  1/* -*- mode: c; c-basic-offset: 8; -*-
  2 * vim: noexpandtab sw=8 ts=8 sts=0:
  3 *
  4 * ocfs2_ioctl.h
  5 *
  6 * Defines OCFS2 ioctls.
  7 *
  8 * Copyright (C) 2010 Oracle.  All rights reserved.
  9 *
 10 * This program is free software; you can redistribute it and/or
 11 * modify it under the terms of the GNU General Public
 12 * License, version 2, as published by the Free Software Foundation.
 13 *
 14 * This program is distributed in the hope that it will be useful,
 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 17 * General Public License for more details.
 18 */
 19
 20#ifndef OCFS2_IOCTL_H
 21#define OCFS2_IOCTL_H
 22
 23/*
 24 * ioctl commands
 25 */
 26#define OCFS2_IOC_GETFLAGS	FS_IOC_GETFLAGS
 27#define OCFS2_IOC_SETFLAGS	FS_IOC_SETFLAGS
 28#define OCFS2_IOC32_GETFLAGS	FS_IOC32_GETFLAGS
 29#define OCFS2_IOC32_SETFLAGS	FS_IOC32_SETFLAGS
 30
 31/*
 32 * Space reservation / allocation / free ioctls and argument structure
 33 * are designed to be compatible with XFS.
 34 *
 35 * ALLOCSP* and FREESP* are not and will never be supported, but are
 36 * included here for completeness.
 37 */
 38struct ocfs2_space_resv {
 39	__s16		l_type;
 40	__s16		l_whence;
 41	__s64		l_start;
 42	__s64		l_len;		/* len == 0 means until end of file */
 43	__s32		l_sysid;
 44	__u32		l_pid;
 45	__s32		l_pad[4];	/* reserve area			    */
 46};
 47
 48#define OCFS2_IOC_ALLOCSP		_IOW ('X', 10, struct ocfs2_space_resv)
 49#define OCFS2_IOC_FREESP		_IOW ('X', 11, struct ocfs2_space_resv)
 50#define OCFS2_IOC_RESVSP		_IOW ('X', 40, struct ocfs2_space_resv)
 51#define OCFS2_IOC_UNRESVSP	_IOW ('X', 41, struct ocfs2_space_resv)
 52#define OCFS2_IOC_ALLOCSP64	_IOW ('X', 36, struct ocfs2_space_resv)
 53#define OCFS2_IOC_FREESP64	_IOW ('X', 37, struct ocfs2_space_resv)
 54#define OCFS2_IOC_RESVSP64	_IOW ('X', 42, struct ocfs2_space_resv)
 55#define OCFS2_IOC_UNRESVSP64	_IOW ('X', 43, struct ocfs2_space_resv)
 56
 57/* Used to pass group descriptor data when online resize is done */
 58struct ocfs2_new_group_input {
 59	__u64 group;		/* Group descriptor's blkno. */
 60	__u32 clusters;		/* Total number of clusters in this group */
 61	__u32 frees;		/* Total free clusters in this group */
 62	__u16 chain;		/* Chain for this group */
 63	__u16 reserved1;
 64	__u32 reserved2;
 65};
 66
 67#define OCFS2_IOC_GROUP_EXTEND	_IOW('o', 1, int)
 68#define OCFS2_IOC_GROUP_ADD	_IOW('o', 2,struct ocfs2_new_group_input)
 69#define OCFS2_IOC_GROUP_ADD64	_IOW('o', 3,struct ocfs2_new_group_input)
 70
 71/* Used to pass 2 file names to reflink. */
 72struct reflink_arguments {
 73	__u64 old_path;
 74	__u64 new_path;
 75	__u64 preserve;
 76};
 77#define OCFS2_IOC_REFLINK	_IOW('o', 4, struct reflink_arguments)
 78
 79/* Following definitions dedicated for ocfs2_info_request ioctls. */
 80#define OCFS2_INFO_MAX_REQUEST		(50)
 81#define OCFS2_TEXT_UUID_LEN		(OCFS2_VOL_UUID_LEN * 2)
 82
 83/* Magic number of all requests */
 84#define OCFS2_INFO_MAGIC		(0x4F32494E)
 85
 86/*
 87 * Always try to separate info request into small pieces to
 88 * guarantee the backward&forward compatibility.
 89 */
 90struct ocfs2_info {
 91	__u64 oi_requests;	/* Array of __u64 pointers to requests */
 92	__u32 oi_count;		/* Number of requests in info_requests */
 93	__u32 oi_pad;
 94};
 95
 96struct ocfs2_info_request {
 97/*00*/	__u32 ir_magic;	/* Magic number */
 98	__u32 ir_code;	/* Info request code */
 99	__u32 ir_size;	/* Size of request */
100	__u32 ir_flags;	/* Request flags */
101/*10*/			/* Request specific fields */
102};
103
104struct ocfs2_info_clustersize {
105	struct ocfs2_info_request ic_req;
106	__u32 ic_clustersize;
107	__u32 ic_pad;
108};
109
110struct ocfs2_info_blocksize {
111	struct ocfs2_info_request ib_req;
112	__u32 ib_blocksize;
113	__u32 ib_pad;
114};
115
116struct ocfs2_info_maxslots {
117	struct ocfs2_info_request im_req;
118	__u32 im_max_slots;
119	__u32 im_pad;
120};
121
122struct ocfs2_info_label {
123	struct ocfs2_info_request il_req;
124	__u8	il_label[OCFS2_MAX_VOL_LABEL_LEN];
125} __attribute__ ((packed));
126
127struct ocfs2_info_uuid {
128	struct ocfs2_info_request iu_req;
129	__u8	iu_uuid_str[OCFS2_TEXT_UUID_LEN + 1];
130} __attribute__ ((packed));
131
132struct ocfs2_info_fs_features {
133	struct ocfs2_info_request if_req;
134	__u32 if_compat_features;
135	__u32 if_incompat_features;
136	__u32 if_ro_compat_features;
137	__u32 if_pad;
138};
139
140struct ocfs2_info_journal_size {
141	struct ocfs2_info_request ij_req;
142	__u64 ij_journal_size;
143};
144
145struct ocfs2_info_freeinode {
146	struct ocfs2_info_request ifi_req;
147	struct ocfs2_info_local_freeinode {
148		__u64 lfi_total;
149		__u64 lfi_free;
150	} ifi_stat[OCFS2_MAX_SLOTS];
151	__u32 ifi_slotnum; /* out */
152	__u32 ifi_pad;
153};
154
155#define OCFS2_INFO_MAX_HIST     (32)
156
157struct ocfs2_info_freefrag {
158	struct ocfs2_info_request iff_req;
159	struct ocfs2_info_freefrag_stats { /* (out) */
160		struct ocfs2_info_free_chunk_list {
161			__u32 fc_chunks[OCFS2_INFO_MAX_HIST];
162			__u32 fc_clusters[OCFS2_INFO_MAX_HIST];
163		} ffs_fc_hist;
164		__u32 ffs_clusters;
165		__u32 ffs_free_clusters;
166		__u32 ffs_free_chunks;
167		__u32 ffs_free_chunks_real;
168		__u32 ffs_min; /* Minimum free chunksize in clusters */
169		__u32 ffs_max;
170		__u32 ffs_avg;
171		__u32 ffs_pad;
172	} iff_ffs;
173	__u32 iff_chunksize; /* chunksize in clusters(in) */
174	__u32 iff_pad;
175};
176
177/* Codes for ocfs2_info_request */
178enum ocfs2_info_type {
179	OCFS2_INFO_CLUSTERSIZE = 1,
180	OCFS2_INFO_BLOCKSIZE,
181	OCFS2_INFO_MAXSLOTS,
182	OCFS2_INFO_LABEL,
183	OCFS2_INFO_UUID,
184	OCFS2_INFO_FS_FEATURES,
185	OCFS2_INFO_JOURNAL_SIZE,
186	OCFS2_INFO_FREEINODE,
187	OCFS2_INFO_FREEFRAG,
188	OCFS2_INFO_NUM_TYPES
189};
190
191/* Flags for struct ocfs2_info_request */
192/* Filled by the caller */
193#define OCFS2_INFO_FL_NON_COHERENT	(0x00000001)	/* Cluster coherency not
194							   required. This is a hint.
195							   It is up to ocfs2 whether
196							   the request can be fulfilled
197							   without locking. */
198/* Filled by ocfs2 */
199#define OCFS2_INFO_FL_FILLED		(0x40000000)	/* Filesystem understood
200							   this request and
201							   filled in the answer */
202
203#define OCFS2_INFO_FL_ERROR		(0x80000000)	/* Error happened during
204							   request handling. */
205
206#define OCFS2_IOC_INFO		_IOR('o', 5, struct ocfs2_info)
207
208struct ocfs2_move_extents {
209/* All values are in bytes */
210	/* in */
211	__u64 me_start;		/* Virtual start in the file to move */
212	__u64 me_len;		/* Length of the extents to be moved */
213	__u64 me_goal;		/* Physical offset of the goal,
214				   it's in block unit */
215	__u64 me_threshold;	/* Maximum distance from goal or threshold
216				   for auto defragmentation */
217	__u64 me_flags;		/* Flags for the operation:
218				 * - auto defragmentation.
219				 * - refcount,xattr cases.
220				 */
221	/* out */
222	__u64 me_moved_len;	/* Moved/defraged length */
223	__u64 me_new_offset;	/* Resulting physical location */
224	__u32 me_reserved[2];	/* Reserved for futhure */
225};
226
227#define OCFS2_MOVE_EXT_FL_AUTO_DEFRAG	(0x00000001)	/* Kernel manages to
228							   claim new clusters
229							   as the goal place
230							   for extents moving */
231#define OCFS2_MOVE_EXT_FL_PART_DEFRAG	(0x00000002)	/* Allow partial extent
232							   moving, is to make
233							   movement less likely
234							   to fail, may make fs
235							   even more fragmented */
236#define OCFS2_MOVE_EXT_FL_COMPLETE	(0x00000004)	/* Move or defragmenation
237							   completely gets done.
238							 */
239
240#define OCFS2_IOC_MOVE_EXT	_IOW('o', 6, struct ocfs2_move_extents)
241
242#endif /* OCFS2_IOCTL_H */