]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - copy/xfs_copy.h
Merge branch 'libxfs-4.17-sync' into for-next
[thirdparty/xfsprogs-dev.git] / copy / xfs_copy.h
1 /*
2 * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc.
3 * All Rights Reserved.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it would be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19 /*
20 * An on-disk allocation group header is composed of 4 structures,
21 * each of which is 1 disk sector long where the sector size is at
22 * least 512 bytes long (BBSIZE).
23 *
24 * There's one ag_header per ag and the superblock in the first ag
25 * is the contains the real data for the entire filesystem (although
26 * most of the relevant data won't change anyway even on a growfs).
27 *
28 * The filesystem superblock specifies the number of AG's and
29 * the AG size. That splits the filesystem up into N pieces,
30 * each of which is an AG and has an ag_header at the beginning.
31 */
32 typedef struct ag_header {
33 xfs_dsb_t *xfs_sb; /* superblock for filesystem or AG */
34 xfs_agf_t *xfs_agf; /* free space info */
35 xfs_agi_t *xfs_agi; /* free inode info */
36 xfs_agfl_t *xfs_agfl; /* AG freelist */
37 char *residue;
38 int residue_length;
39 } ag_header_t;
40
41 /*
42 * The position/buf_position, length/buf_length, data/buffer pairs
43 * exist because of alignment constraints for direct I/O and dealing
44 * with scenarios where either the source or target or both is a file
45 * and the blocksize of the filesystem where file resides is different
46 * from that of the filesystem image being duplicated. You can get
47 * alignment problems resulting from things like AG's starting on
48 * non-aligned points in the filesystem. So you have to be able
49 * to read from points "before" the requested starting point and
50 * read in more data than requested.
51 */
52 struct t_args;
53 typedef struct {
54 int id; /* buffer ID */
55 size_t size; /* size of buffer -- fixed */
56 size_t min_io_size; /* for direct I/O */
57 int data_align; /* data buffer alignment */
58 xfs_off_t position; /* requested position (bytes) */
59 size_t length; /* requested length (bytes) */
60 char *data; /* pointer to data buffer */
61 struct t_args *owner; /* for non-parallel writes */
62 } wbuf;
63
64 typedef struct t_args {
65 int id;
66 uuid_t uuid;
67 pthread_mutex_t wait;
68 int fd;
69 } thread_args;
70
71 typedef struct {
72 pthread_mutex_t mutex;
73 int num_working;
74 wbuf *buffer;
75 } thread_control;
76
77 typedef int thread_id;
78 typedef int tm_index; /* index into thread mask array */
79 typedef uint32_t thread_mask; /* a thread mask */
80
81 typedef struct {
82 char *name;
83 int fd;
84 xfs_off_t position;
85 pthread_t pid;
86 int state;
87 int error;
88 int err_type;
89 } target_control;