~ubuntu-branches/ubuntu/breezy/lvm2/breezy

« back to all changes in this revision

Viewing changes to lib/metadata/segtype.h

  • Committer: Bazaar Package Importer
  • Author(s): Patrick Caulfield
  • Date: 2004-11-03 09:37:56 UTC
  • Revision ID: james.westby@ubuntu.com-20041103093756-jt0nj8z0v8k1lyiv
Tags: upstream-2.00.25
ImportĀ upstreamĀ versionĀ 2.00.25

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.  
 
3
 * Copyright (C) 2004 Red Hat, Inc. All rights reserved.
 
4
 *
 
5
 * This file is part of LVM2.
 
6
 *
 
7
 * This copyrighted material is made available to anyone wishing to use,
 
8
 * modify, copy, or redistribute it subject to the terms and conditions
 
9
 * of the GNU General Public License v.2.
 
10
 *
 
11
 * You should have received a copy of the GNU General Public License
 
12
 * along with this program; if not, write to the Free Software Foundation,
 
13
 * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
14
 */
 
15
 
 
16
#ifndef _SEGTYPES_H
 
17
#define _SEGTYPES_H
 
18
 
 
19
struct segtype_handler;
 
20
struct cmd_context;
 
21
struct config_tree;
 
22
struct lv_segment;
 
23
struct formatter;
 
24
struct config_node;
 
25
struct hash_table;
 
26
struct dev_manager;
 
27
 
 
28
/* Feature flags */
 
29
#define SEG_CAN_SPLIT           0x00000001
 
30
#define SEG_AREAS_STRIPED       0x00000002
 
31
#define SEG_AREAS_MIRRORED      0x00000004
 
32
#define SEG_SNAPSHOT            0x00000008
 
33
#define SEG_FORMAT1_SUPPORT     0x00000010
 
34
#define SEG_VIRTUAL             0x00000020
 
35
 
 
36
struct segment_type {
 
37
        struct list list;
 
38
        struct cmd_context *cmd;
 
39
        uint32_t flags;
 
40
        struct segtype_handler *ops;
 
41
        const char *name;
 
42
        void *library;
 
43
        void *private;
 
44
};
 
45
 
 
46
struct segtype_handler {
 
47
        const char *(*name) (const struct lv_segment * seg);
 
48
        void (*display) (const struct lv_segment * seg);
 
49
        int (*text_export) (const struct lv_segment * seg,
 
50
                            struct formatter * f);
 
51
        int (*text_import_area_count) (struct config_node * sn,
 
52
                                       uint32_t *area_count);
 
53
        int (*text_import) (struct lv_segment * seg,
 
54
                            const struct config_node * sn,
 
55
                            struct hash_table * pv_hash);
 
56
        int (*merge_segments) (struct lv_segment * seg1,
 
57
                               struct lv_segment * seg2);
 
58
        int (*compose_target_line) (struct dev_manager * dm, struct pool * mem,
 
59
                                    struct config_tree * cft,
 
60
                                    void **target_state,
 
61
                                    struct lv_segment * seg, char *params,
 
62
                                    size_t paramsize, const char **target,
 
63
                                    int *pos, uint32_t *pvmove_mirror_count);
 
64
        int (*target_percent) (void **target_state, struct pool * mem,
 
65
                               struct config_tree * cft,
 
66
                               struct lv_segment * seg, char *params,
 
67
                               uint64_t *total_numerator,
 
68
                               uint64_t *total_denominator, float *percent);
 
69
        int (*target_present) (void);
 
70
        void (*destroy) (const struct segment_type * segtype);
 
71
};
 
72
 
 
73
struct segment_type *get_segtype_from_string(struct cmd_context *cmd,
 
74
                                             const char *str);
 
75
 
 
76
struct segment_type *init_striped_segtype(struct cmd_context *cmd);
 
77
struct segment_type *init_zero_segtype(struct cmd_context *cmd);
 
78
struct segment_type *init_error_segtype(struct cmd_context *cmd);
 
79
 
 
80
#ifdef SNAPSHOT_INTERNAL
 
81
struct segment_type *init_snapshot_segtype(struct cmd_context *cmd);
 
82
#endif
 
83
 
 
84
#ifdef MIRRORED_INTERNAL
 
85
struct segment_type *init_mirrored_segtype(struct cmd_context *cmd);
 
86
#endif
 
87
 
 
88
#ifdef CRYPT_INTERNAL
 
89
struct segment_type *init_crypt_segtype(struct cmd_context *cmd);
 
90
#endif
 
91
 
 
92
#endif