mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-23 02:05:07 +03:00
Dave Wysochanski
07b0c948ee
Add vg_lock_newname() library function.
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.
This tree contains the LVM2 and device-mapper tools and libraries. For more information about LVM2 read the changelog in the WHATS_NEW file. Installation instructions are in INSTALL. There is no warranty - see COPYING and COPYING.LIB. Tarballs are available from: ftp://sources.redhat.com/pub/lvm2/ To access the CVS tree use: cvs -d :pserver:cvs@sources.redhat.com:/cvs/lvm2 login CVS password: cvs cvs -d :pserver:cvs@sources.redhat.com:/cvs/lvm2 co LVM2 Mailing list for general discussion related to LVM2: linux-lvm@redhat.com Subscribe from https://www.redhat.com/mailman/listinfo/linux-lvm Mailing list for LVM2 development, patches and commits: lvm-devel@redhat.com Subscribe from https://www.redhat.com/mailman/listinfo/linux-lvm Mailing list for device-mapper development, including kernel patches and multipath-tools: dm-devel@redhat.com Subscribe from https://www.redhat.com/mailman/listinfo/dm-devel
Description
Languages
C
75.5%
Shell
18.7%
Python
2.9%
M4
1%
Makefile
0.8%
Other
1%