mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-11 09:18:25 +03:00
1dde89db69
Various tools need to check for existence of a VG before doing something (vgsplit, vgrename, vgcreate). Currently we don't have an interface to check for existence, but the existence check is part of the vg_read* call(s). This patch is an attempt to pull out some of that functionality into a separate function, and hopefully simplify our vg_read interface, and move those patches along. vg_lock_newname() is only concerned about checking whether a vg exists in the system. Unfortunately, we cannot just scan the system, but we must first obtain a lock. Since we are reserving a vgname, we take a WRITE lock on the vgname. Once obtained, we scan the system to ensure the name does not exist. The return codes and behavior is in the function header. You might think of this function as similar to an open() call with O_CREAT and O_EXCL flags (returns failure with -EEXIST if file already exists). NOTE: I think including the word "lock" in the function name is important, as it clearly states the function obtains a lock and makes the code more readable, especially when it comes to cleanup / unlocking. The ultimate function name is somewhat open for debate though so later we may rename. |
||
---|---|---|
.. | ||
activate | ||
cache | ||
commands | ||
config | ||
datastruct | ||
device | ||
display | ||
error | ||
filters | ||
format1 | ||
format_pool | ||
format_text | ||
freeseg | ||
label | ||
locking | ||
log | ||
metadata | ||
mirror | ||
misc | ||
mm | ||
report | ||
snapshot | ||
striped | ||
uuid | ||
zero | ||
Makefile.in |