~ubuntu-branches/ubuntu/edgy/xfsprogs/edgy

« back to all changes in this revision

Viewing changes to copy/xfs_copy.h

  • Committer: Bazaar Package Importer
  • Author(s): Nathan Scott
  • Date: 2004-07-28 21:11:38 UTC
  • Revision ID: james.westby@ubuntu.com-20040728211138-0v4pdnunnp7na5lm
Tags: 2.6.20-1
* New upstream release.
* Fix xfs_io segfault on non-XFS files.  (closes: #260470)
* Fix packaging botch, deleted files included.  (closes: #260491)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (c) 2000-2003 Silicon Graphics, Inc.  All Rights Reserved.
 
3
 * 
 
4
 * This program is free software; you can redistribute it and/or modify it
 
5
 * under the terms of version 2 of the GNU General Public License as
 
6
 * published by the Free Software Foundation.
 
7
 * 
 
8
 * This program is distributed in the hope that it would be useful, but
 
9
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
11
 * 
 
12
 * Further, this software is distributed without any warranty that it is
 
13
 * free of the rightful claim of any third person regarding infringement
 
14
 * or the like.  Any license provided herein, whether implied or
 
15
 * otherwise, applies only to this software file.  Patent licenses, if
 
16
 * any, provided herein do not apply to combinations of this program with
 
17
 * other software, or any other product whatsoever.
 
18
 * 
 
19
 * You should have received a copy of the GNU General Public License along
 
20
 * with this program; if not, write the Free Software Foundation, Inc., 59
 
21
 * Temple Place - Suite 330, Boston MA 02111-1307, USA.
 
22
 * 
 
23
 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
 
24
 * Mountain View, CA  94043, or:
 
25
 * 
 
26
 * http://www.sgi.com 
 
27
 * 
 
28
 * For further information regarding this notice, see: 
 
29
 * 
 
30
 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
 
31
 */
 
32
 
 
33
/*
 
34
 * An on-disk allocation group header is composed of 4 structures,
 
35
 * each of which is 1 disk sector long where the sector size is at
 
36
 * least 512 bytes long (BBSIZE).
 
37
 *
 
38
 * There's one ag_header per ag and the superblock in the first ag
 
39
 * is the contains the real data for the entire filesystem (although
 
40
 * most of the relevant data won't change anyway even on a growfs).
 
41
 *
 
42
 * The filesystem superblock specifies the number of AG's and
 
43
 * the AG size.  That splits the filesystem up into N pieces,
 
44
 * each of which is an AG and has an ag_header at the beginning.
 
45
 */
 
46
typedef struct ag_header  {
 
47
        xfs_sb_t        *xfs_sb;        /* superblock for filesystem or AG */
 
48
        xfs_agf_t       *xfs_agf;       /* free space info */
 
49
        xfs_agi_t       *xfs_agi;       /* free inode info */
 
50
        xfs_agfl_t      *xfs_agfl;      /* AG freelist */
 
51
        char            *residue;
 
52
        int             residue_length;
 
53
} ag_header_t;
 
54
 
 
55
/*
 
56
 * The position/buf_position, length/buf_length, data/buffer pairs
 
57
 * exist because of alignment constraints for direct I/O and dealing
 
58
 * with scenarios where either the source or target or both is a file
 
59
 * and the blocksize of the filesystem where file resides is different
 
60
 * from that of the filesystem image being duplicated.  You can get
 
61
 * alignment problems resulting from things like AG's starting on
 
62
 * non-aligned points in the filesystem.  So you have to be able
 
63
 * to read from points "before" the requested starting point and
 
64
 * read in more data than requested.
 
65
 */
 
66
struct t_args;
 
67
typedef struct {
 
68
        int             id;             /* buffer ID */
 
69
        size_t          size;           /* size of buffer -- fixed */
 
70
        size_t          min_io_size;    /* for direct I/O */
 
71
        xfs_off_t       position;       /* requested position (bytes) */
 
72
        size_t          length;         /* requested length (bytes) */
 
73
        char            *data;          /* pointer to data buffer */
 
74
        struct t_args   *owner;         /* for non-parallel writes */
 
75
} wbuf;
 
76
 
 
77
typedef struct t_args {
 
78
        int             id;
 
79
        uuid_t          uuid;
 
80
        pthread_mutex_t wait;
 
81
        int             fd;
 
82
} thread_args;
 
83
 
 
84
typedef struct {
 
85
        pthread_mutex_t mutex;
 
86
        int             num_working;
 
87
        wbuf            *buffer;
 
88
} thread_control;
 
89
 
 
90
typedef int thread_id;
 
91
typedef int tm_index;                   /* index into thread mask array */
 
92
typedef __uint32_t thread_mask;         /* a thread mask */
 
93
 
 
94
typedef struct {
 
95
        char            *name;
 
96
        int             fd;
 
97
        xfs_off_t       position;
 
98
        pthread_t       pid;
 
99
        int             state;
 
100
        int             error;
 
101
        int             err_type;
 
102
} target_control;
 
103