mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
Commit snapshot-related changes preparing for the next beta release.
This commit is contained in:
parent
de3bec7f81
commit
671b6aa602
@ -26,16 +26,16 @@
|
|||||||
#define ALIGNMENT sizeof(int)
|
#define ALIGNMENT sizeof(int)
|
||||||
|
|
||||||
static char *dm_cmd_list[] = {
|
static char *dm_cmd_list[] = {
|
||||||
"create",
|
"create",
|
||||||
"reload",
|
"reload",
|
||||||
"remove",
|
"remove",
|
||||||
"remove_all",
|
"remove_all",
|
||||||
"suspend",
|
"suspend",
|
||||||
"resume",
|
"resume",
|
||||||
"info",
|
"info",
|
||||||
"deps",
|
"deps",
|
||||||
"rename",
|
"rename",
|
||||||
"version"
|
"version"
|
||||||
};
|
};
|
||||||
|
|
||||||
void dm_task_destroy(struct dm_task *dmt)
|
void dm_task_destroy(struct dm_task *dmt)
|
||||||
@ -358,11 +358,10 @@ int dm_task_run(struct dm_task *dmt)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case DM_DEVICE_RENAME:
|
case DM_DEVICE_RENAME:
|
||||||
rename_dev_node(dmt->dev_name, dmt->newname);
|
rename_dev_node(dmt->dev_name, dmt->newname);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
dmt->dmi = dmi;
|
dmt->dmi = dmi;
|
||||||
close(fd);
|
close(fd);
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -204,7 +204,7 @@ int rename_dev_node(const char *old_name, const char *new_name)
|
|||||||
_build_dev_path(oldpath, sizeof(oldpath), old_name);
|
_build_dev_path(oldpath, sizeof(oldpath), old_name);
|
||||||
_build_dev_path(newpath, sizeof(newpath), new_name);
|
_build_dev_path(newpath, sizeof(newpath), new_name);
|
||||||
|
|
||||||
if (stat(newpath, &info) >= 0) {
|
if (stat(newpath, &info) == 0) {
|
||||||
if (!S_ISBLK(info.st_mode)) {
|
if (!S_ISBLK(info.st_mode)) {
|
||||||
log_error("A non-block device file at '%s' "
|
log_error("A non-block device file at '%s' "
|
||||||
"is already present", newpath);
|
"is already present", newpath);
|
||||||
@ -212,8 +212,9 @@ int rename_dev_node(const char *old_name, const char *new_name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (unlink(newpath) < 0) {
|
if (unlink(newpath) < 0) {
|
||||||
if (errno == EPERM) { /* devfs, entry has already been renamed */
|
if (errno == EPERM) {
|
||||||
return 1;
|
/* devfs, entry has already been renamed */
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
log_error("Unable to unlink device node for '%s'",
|
log_error("Unable to unlink device node for '%s'",
|
||||||
new_name);
|
new_name);
|
||||||
@ -222,7 +223,8 @@ int rename_dev_node(const char *old_name, const char *new_name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (rename(oldpath, newpath) < 0) {
|
if (rename(oldpath, newpath) < 0) {
|
||||||
log_error("Unable to rename device node from '%s' to '%s'", old_name, new_name);
|
log_error("Unable to rename device node from '%s' to '%s'",
|
||||||
|
old_name, new_name);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user