From 817afaad5e6c3d2500e5a6ee14f22408d4d4f228 Mon Sep 17 00:00:00 2001 From: Alasdair Kergon Date: Fri, 15 Jun 2007 20:46:04 +0000 Subject: [PATCH] pre-release --- lib/locking/locking.c | 41 ++++++++++++++++++++++------------------- lib/locking/locking.h | 11 +++++------ man/vgcfgrestore.8 | 8 ++++---- man/vgrename.8 | 17 ++++++++++++++++- 4 files changed, 47 insertions(+), 30 deletions(-) diff --git a/lib/locking/locking.c b/lib/locking/locking.c index 0d6bd4343..81cb992ca 100644 --- a/lib/locking/locking.c +++ b/lib/locking/locking.c @@ -44,46 +44,50 @@ static void _catch_sigint(int unused __attribute__((unused))) _sigint_caught = 1; } -int sigint_caught() { +int sigint_caught(void) { return _sigint_caught; } -void sigint_clear() +void sigint_clear(void) { _sigint_caught = 0; } -/* Temporarily allow keyboard interrupts to be intercepted and noted; - saves interrupt handler state for sigint_restore(). Users should - use the sigint_caught() predicate to check whether interrupt was - requested and act appropriately. Interrupt flags are never - automatically cleared by this code, but lvm_run_command() clears - the flag before running any command. All other places where the - flag needs to be cleared need to call sigint_clear(). */ +/* + * Temporarily allow keyboard interrupts to be intercepted and noted; + * saves interrupt handler state for sigint_restore(). Users should + * use the sigint_caught() predicate to check whether interrupt was + * requested and act appropriately. Interrupt flags are never + * cleared automatically by this code, but the tools clear the flag + * before running each command in lvm_run_command(). All other places + * where the flag needs to be cleared need to call sigint_clear(). + */ -void sigint_allow() +void sigint_allow(void) { struct sigaction handler; sigset_t sigs; - /* do not overwrite the backed up handler data with our - override ones; we just increase nesting count */ + /* + * Do not overwrite the backed-up handler data - + * just increase nesting count. + */ if (_handler_installed) { _handler_installed++; return; } - /* grab old sigaction for SIGINT; shall not fail */ + /* Grab old sigaction for SIGINT: shall not fail. */ sigaction(SIGINT, NULL, &handler); - handler.sa_flags &= ~SA_RESTART; /* clear restart flag */ + handler.sa_flags &= ~SA_RESTART; /* Clear restart flag */ handler.sa_handler = _catch_sigint; _handler_installed = 1; - /* override the signal handler; shall not fail */ + /* Override the signal handler: shall not fail. */ sigaction(SIGINT, &handler, &_oldhandler); - /* unmask SIGINT, remember to mask it again on restore */ + /* Unmask SIGINT. Remember to mask it again on restore. */ sigprocmask(0, NULL, &sigs); if ((_oldmasked = sigismember(&sigs, SIGINT))) { sigdelset(&sigs, SIGINT); @@ -91,9 +95,8 @@ void sigint_allow() } } -void sigint_restore() +void sigint_restore(void) { - /* extra call, ignore */ if (!_handler_installed) return; @@ -102,7 +105,7 @@ void sigint_restore() return; } - /* nesting count went down to 0 */ + /* Nesting count went down to 0. */ _handler_installed = 0; if (_oldmasked) { diff --git a/lib/locking/locking.h b/lib/locking/locking.h index 27ebfc4b0..1687f1bce 100644 --- a/lib/locking/locking.h +++ b/lib/locking/locking.h @@ -115,11 +115,10 @@ int suspend_lvs(struct cmd_context *cmd, struct list *lvs); int resume_lvs(struct cmd_context *cmd, struct list *lvs); int activate_lvs_excl(struct cmd_context *cmd, struct list *lvs); -/* interrupt handling */ - -void sigint_clear(); -void sigint_allow(); -void sigint_restore(); -int sigint_caught(); +/* Interrupt handling */ +void sigint_clear(void); +void sigint_allow(void); +void sigint_restore(void); +int sigint_caught(void); #endif diff --git a/man/vgcfgrestore.8 b/man/vgcfgrestore.8 index 9955cb019..84bd4c231 100644 --- a/man/vgcfgrestore.8 +++ b/man/vgcfgrestore.8 @@ -14,10 +14,10 @@ vgcfgrestore \- restore volume group descriptor area .SH DESCRIPTION .B vgcfgrestore allows you to restore the metadata of \fIVolumeGroupName\fP from a text -backup file produced by \fBvgcfgbackup\fP. You can specify a backup file to -use with the \fP-f\fP option. If no backup file is specified, the latest -backup file is used. A list of backup and archive files of -\fIVolumeGroupName\fP may be listed with the \fB-l\fP option. +backup file produced by \fBvgcfgbackup\fP. You can specify a backup file +with \fP--file\fP. If no backup file is specified, the most recent +one is used. Use \fB--list\fP for a list of the available +backup and archive files of \fIVolumeGroupName\fP. .SH OPTIONS .TP \fB-l | --list\fP \(em List files pertaining to \fIVolumeGroupName\fP diff --git a/man/vgrename.8 b/man/vgrename.8 index a93a35807..c56a9de9e 100644 --- a/man/vgrename.8 +++ b/man/vgrename.8 @@ -25,7 +25,22 @@ volume group "vg02" to "my_volume_group". .TP "vgrename vg02 my_volume_group" does the same. .TP -"vgrename Zvlifi-Ep3t-e0Ng-U42h-o0ye-KHu1-nl7Ns4 VolGroup00_tmp" renames a volume group with UUID Zvlifi-Ep3t-e0Ng-U42h-o0ye-KHu1-nl7Ns4 to the volume group named "VolGroup00_tmp". Using the UUID option to name a volume group may be useful in cases where one machine has two physical volumes, each with the same volume group name, but a separate volume group UUID (this situation will cause error messages with lvm commands). One way duplicate volume group names occur is if an old disk with a root volume is moved to a new machine with its own root volume. In this case, both volume groups may have the same name (for example, "VolGroup00"), but different UUIDs. +"vgrename Zvlifi-Ep3t-e0Ng-U42h-o0ye-KHu1-nl7Ns4 VolGroup00_tmp" +changes the name of the Volume Group with UUID +Zvlifi-Ep3t-e0Ng-U42h-o0ye-KHu1-nl7Ns4 to +"VolGroup00_tmp". + +All the Volume Groups visible to a system need to have different +names. Otherwise many LVM2 commands will refuse to run or give +warning messages. + +This situation could arise when disks are moved between machines. If +a disk is connected and it contains a Volume Group with the same name +as the Volume Group containing your root filesystem the machine might +not even boot correctly. However, the two Volume Groups should have +different UUIDs (unless the disk was cloned) so you can rename +one of the conflicting Volume Groups with +\fBvgrename\fP. .TP .SH SEE ALSO .BR lvm (8), -- 2.43.5