~ubuntu-branches/ubuntu/vivid/lvm2/vivid

« back to all changes in this revision

Viewing changes to lib/cache/lvmetad.h

  • Committer: Package Import Robot
  • Author(s): Bastian Blank
  • Date: 2012-05-01 20:27:50 UTC
  • mto: (3.1.23 sid)
  • mto: This revision was merged to the branch mainline in revision 72.
  • Revision ID: package-import@ubuntu.com-20120501202750-gljjjtblowwq9mw8
Tags: upstream-2.02.95
ImportĀ upstreamĀ versionĀ 2.02.95

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2012 Red Hat, Inc.
 
3
 *
 
4
 * This file is part of LVM2.
 
5
 *
 
6
 * This copyrighted material is made available to anyone wishing to use,
 
7
 * modify, copy, or redistribute it subject to the terms and conditions
 
8
 * of the GNU Lesser General Public License v.2.1.
 
9
 *
 
10
 * You should have received a copy of the GNU Lesser General Public License
 
11
 * along with this program; if not, write to the Free Software Foundation,
 
12
 * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
13
 */
 
14
 
 
15
#ifndef _LVM_METAD_H
 
16
#define _LVM_METAD_H
 
17
 
 
18
struct volume_group;
 
19
struct cmd_context;
 
20
struct dm_config_tree;
 
21
 
 
22
#ifdef LVMETAD_SUPPORT
 
23
/*
 
24
 * Initialise the communication with lvmetad. Normally called by
 
25
 * lvmcache_init. Sets up a global handle for our process.
 
26
 */
 
27
void lvmetad_init(void);
 
28
 
 
29
/*
 
30
 * Override the use of lvmetad for retrieving scan results and metadata.
 
31
 */
 
32
void lvmetad_set_active(int);
 
33
 
 
34
/*
 
35
 * Check whether lvmetad is active (where active means both that it is running
 
36
 * and that we have a working connection with it).
 
37
 */
 
38
int lvmetad_active(void);
 
39
 
 
40
/*
 
41
 * Send a new version of VG metadata to lvmetad. This is normally called after
 
42
 * vg_write but before vg_commit. After vg_commit, lvmetad_vg_commit is called
 
43
 * to seal the transaction. The result of lvmetad_vg_update is that the new
 
44
 * metadata is stored tentatively in lvmetad, but it is not used until
 
45
 * lvmetad_vg_commit. The request is validated immediately and lvmetad_vg_commit
 
46
 * only constitutes a pointer update.
 
47
 */
 
48
int lvmetad_vg_update(struct volume_group *vg);
 
49
 
 
50
/*
 
51
 * Inform lvmetad that a VG has been removed. This is not entirely safe, but is
 
52
 * only needed during vgremove, which does not wipe PV labels and therefore
 
53
 * cannot mark the PVs as gone.
 
54
 */
 
55
int lvmetad_vg_remove(struct volume_group *vg);
 
56
 
 
57
/*
 
58
 * Notify lvmetad that a PV has been found. It is not an error if the PV is
 
59
 * already marked as present in lvmetad. If a non-NULL vg pointer is supplied,
 
60
 * it is taken to represent the metadata read from the MDA(s) present on that
 
61
 * PV. It *is* an error if: the VG is already known to lvmetad, the sequence
 
62
 * number on the cached and on the discovered PV match but the metadata content
 
63
 * does not.
 
64
 */
 
65
int lvmetad_pv_found(struct id pvid, struct device *device,
 
66
                     const struct format_type *fmt, uint64_t label_sector,
 
67
                     struct volume_group *vg);
 
68
 
 
69
/*
 
70
 * Inform the daemon that the device no longer exists.
 
71
 */
 
72
int lvmetad_pv_gone(dev_t devno, const char *pv_name);
 
73
int lvmetad_pv_gone_by_dev(struct device *dev);
 
74
 
 
75
/*
 
76
 * Request a list of all PVs available to lvmetad. If requested, this will also
 
77
 * read labels off all the PVs to populate lvmcache.
 
78
 */
 
79
int lvmetad_pv_list_to_lvmcache(struct cmd_context *cmd);
 
80
 
 
81
/*
 
82
 * Lookup an individual PV.
 
83
 * If found is not NULL, it is set according to whether or not the PV is found,
 
84
 * otherwise if the PV is not found an error is returned.
 
85
 */
 
86
int lvmetad_pv_lookup(struct cmd_context *cmd, struct id pvid, int *found);
 
87
int lvmetad_pv_lookup_by_dev(struct cmd_context *cmd, struct device *dev, int *found);
 
88
 
 
89
/*
 
90
 * Request a list of all VGs available to lvmetad and use it to fill in
 
91
 * lvmcache..
 
92
 */
 
93
int lvmetad_vg_list_to_lvmcache(struct cmd_context *cmd);
 
94
 
 
95
/*
 
96
 * Find a VG by its ID or its name in the lvmetad cache. Gives NULL if the VG is
 
97
 * not found.
 
98
 */
 
99
struct volume_group *lvmetad_vg_lookup(struct cmd_context *cmd,
 
100
                                       const char *vgname, const char *vgid);
 
101
 
 
102
/*
 
103
 * Scan a single device and update lvmetad with the result(s).
 
104
 */
 
105
int pvscan_lvmetad_single(struct cmd_context *cmd, struct device *dev);
 
106
 
 
107
#  else         /* LVMETAD_SUPPORT */
 
108
 
 
109
#    define lvmetad_init()      do { } while (0)
 
110
#    define lvmetad_set_active(a)       do { } while (0)
 
111
#    define lvmetad_active()    (0)
 
112
#    define lvmetad_vg_update(vg)       (1)
 
113
#    define lvmetad_vg_remove(vg)       (1)
 
114
#    define lvmetad_pv_found(pvid, device, fmt, label_sector, vg)       (1)
 
115
#    define lvmetad_pv_gone(devno, pv_name)     (1)
 
116
#    define lvmetad_pv_gone_by_dev(dev) (1)
 
117
#    define lvmetad_pv_list_to_lvmcache(cmd)    (1)
 
118
#    define lvmetad_pv_lookup(cmd, pvid, found) (0)
 
119
#    define lvmetad_pv_lookup_by_dev(cmd, dev, found)   (0)
 
120
#    define lvmetad_vg_list_to_lvmcache(cmd)    (1)
 
121
#    define lvmetad_vg_lookup(cmd, vgname, vgid)        (NULL)
 
122
#    define pvscan_lvmetad_single(cmd, dev)     (0)
 
123
 
 
124
#  endif        /* LVMETAD_SUPPORT */
 
125
 
 
126
#endif