summaryrefslogtreecommitdiff
path: root/lib/device/online.h
blob: 488129e3f57d987a65497406259e76745368a499 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*
 * Copyright (C) 2021 Red Hat, Inc. All rights reserved.
 *
 * This file is part of LVM2.
 *
 * This copyrighted material is made available to anyone wishing to use,
 * modify, copy, or redistribute it subject to the terms and conditions
 * of the GNU Lesser General Public License v.2.1.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 */

#ifndef _ONLINE_H
#define _ONLINE_H

struct pv_online {
	struct dm_list list;
	struct device *dev;
	dev_t devno;
	char pvid[ID_LEN + 1];
	char vgname[NAME_LEN];
	char devname[NAME_LEN];
};

/*
 * Avoid a duplicate pvscan[%d] prefix when logging to the journal.
 * FIXME: this should probably replace if (udevoutput) with
 * if (log_journal & LOG_JOURNAL_OUTPUT)
 */
#define log_print_pvscan(cmd, fmt, args...) \
do \
	if (cmd->udevoutput) \
		log_print(fmt, ##args); \
	else \
		log_print("pvscan[%d] " fmt, getpid(), ##args); \
while (0)

#define log_error_pvscan(cmd, fmt, args...) \
do \
	if (cmd->udevoutput) \
		log_error(fmt, ##args); \
	else \
		log_error("pvscan[%d] " fmt, getpid(), ##args); \
while (0)

int online_pvid_file_read(char *path, int *major, int *minor, char *vgname, char *devname);
int online_vg_file_create(struct cmd_context *cmd, const char *vgname);
void online_vg_file_remove(const char *vgname);
int online_pvid_file_create(struct cmd_context *cmd, struct device *dev, const char *vgname);
int online_pvid_file_exists(const char *pvid);
void online_dir_setup(struct cmd_context *cmd);
int get_pvs_online(struct dm_list *pvs_online, const char *vgname);
int get_pvs_lookup(struct dm_list *pvs_online, const char *vgname);
void free_po_list(struct dm_list *list);
void online_lookup_file_remove(const char *vgname);
void online_vgremove(struct volume_group *vg);

#endif