]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blame - copy/xfs_copy.h
Merge branch 'master' of git://oss.sgi.com/xfs/cmds/xfsprogs
[thirdparty/xfsprogs-dev.git] / copy / xfs_copy.h
CommitLineData
6404bb81 1/*
da23017d
NS
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
6404bb81 7 * published by the Free Software Foundation.
da23017d
NS
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
6404bb81
NS
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 */
32typedef struct ag_header {
5e656dbb 33 xfs_dsb_t *xfs_sb; /* superblock for filesystem or AG */
6404bb81
NS
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
989b74bc 43 * exist because of alignment constraints for direct I/O and dealing
6404bb81
NS
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
989b74bc 47 * alignment problems resulting from things like AG's starting on
6404bb81
NS
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 */
989b74bc 52struct t_args;
6404bb81
NS
53typedef struct {
54 int id; /* buffer ID */
55 size_t size; /* size of buffer -- fixed */
56 size_t min_io_size; /* for direct I/O */
989b74bc
NS
57 xfs_off_t position; /* requested position (bytes) */
58 size_t length; /* requested length (bytes) */
6404bb81 59 char *data; /* pointer to data buffer */
989b74bc 60 struct t_args *owner; /* for non-parallel writes */
6404bb81
NS
61} wbuf;
62
989b74bc 63typedef struct t_args {
6404bb81 64 int id;
989b74bc 65 uuid_t uuid;
6404bb81
NS
66 pthread_mutex_t wait;
67 int fd;
68} thread_args;
69
70typedef struct {
71 pthread_mutex_t mutex;
72 int num_working;
73 wbuf *buffer;
74} thread_control;
75
76typedef int thread_id;
77typedef int tm_index; /* index into thread mask array */
78typedef __uint32_t thread_mask; /* a thread mask */
79
80typedef struct {
81 char *name;
82 int fd;
83 xfs_off_t position;
84 pthread_t pid;
85 int state;
86 int error;
87 int err_type;
88} target_control;
89