1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-03 05:18:29 +03:00

vgmknodes also creates necessary nodes in /dev/mapper

This commit is contained in:
Alasdair Kergon 2003-11-13 14:11:41 +00:00
parent 2864846d91
commit 8c0388e487
3 changed files with 23 additions and 14 deletions

View File

@ -152,7 +152,8 @@ int driver_version(char *version, size_t size)
/* /*
* Returns 1 if info structure populated, else 0 on failure. * Returns 1 if info structure populated, else 0 on failure.
*/ */
int lv_info(const struct logical_volume *lv, struct lvinfo *info) static int _lv_info(const struct logical_volume *lv, int mknodes,
struct lvinfo *info)
{ {
int r; int r;
struct dev_manager *dm; struct dev_manager *dm;
@ -166,7 +167,7 @@ int lv_info(const struct logical_volume *lv, struct lvinfo *info)
return 0; return 0;
} }
if (!(r = dev_manager_info(dm, lv, &dminfo))) if (!(r = dev_manager_info(dm, lv, mknodes, &dminfo)))
stack; stack;
info->exists = dminfo.exists; info->exists = dminfo.exists;
@ -180,6 +181,11 @@ int lv_info(const struct logical_volume *lv, struct lvinfo *info)
return r; return r;
} }
int lv_info(const struct logical_volume *lv, struct lvinfo *info)
{
return _lv_info(lv, 0, info);
}
/* /*
* Returns 1 if percent set, else 0 on failure. * Returns 1 if percent set, else 0 on failure.
*/ */
@ -486,7 +492,7 @@ int lv_mknodes(struct cmd_context *cmd, const struct logical_volume *lv)
struct lvinfo info; struct lvinfo info;
int r = 1; int r = 1;
if (!lv_info(lv, &info)) { if (!_lv_info(lv, 1, &info)) {
stack; stack;
return 0; return 0;
} }

View File

@ -285,13 +285,16 @@ static struct dm_task *_setup_task(const char *name, const char *uuid,
} }
static int _info_run(const char *name, const char *uuid, struct dm_info *info, static int _info_run(const char *name, const char *uuid, struct dm_info *info,
struct pool *mem, char **uuid_out) int mknodes, struct pool *mem, char **uuid_out)
{ {
int r = 0; int r = 0;
struct dm_task *dmt; struct dm_task *dmt;
const char *u; const char *u;
int dmtask;
if (!(dmt = _setup_task(name, uuid, 0, DM_DEVICE_INFO))) { dmtask = mknodes ? DM_DEVICE_MKNODES : DM_DEVICE_INFO;
if (!(dmt = _setup_task(name, uuid, 0, dmtask))) {
stack; stack;
return 0; return 0;
} }
@ -320,15 +323,15 @@ static int _info_run(const char *name, const char *uuid, struct dm_info *info,
return r; return r;
} }
static int _info(const char *name, const char *uuid, struct dm_info *info, static int _info(const char *name, const char *uuid, int mknodes,
struct pool *mem, char **uuid_out) struct dm_info *info, struct pool *mem, char **uuid_out)
{ {
if (uuid && *uuid && _info_run(NULL, uuid, info, mem, uuid_out) if (!mknodes && uuid && *uuid &&
&& info->exists) _info_run(NULL, uuid, info, 0, mem, uuid_out) && info->exists)
return 1; return 1;
if (name) if (name)
return _info_run(name, NULL, info, mem, uuid_out); return _info_run(name, NULL, info, mknodes, mem, uuid_out);
return 0; return 0;
} }
@ -1072,7 +1075,7 @@ void dev_manager_destroy(struct dev_manager *dm)
} }
int dev_manager_info(struct dev_manager *dm, const struct logical_volume *lv, int dev_manager_info(struct dev_manager *dm, const struct logical_volume *lv,
struct dm_info *info) int mknodes, struct dm_info *info)
{ {
char *name; char *name;
@ -1088,7 +1091,7 @@ int dev_manager_info(struct dev_manager *dm, const struct logical_volume *lv,
* Try and get some info on this device. * Try and get some info on this device.
*/ */
log_debug("Getting device info for %s", name); log_debug("Getting device info for %s", name);
if (!_info(name, lv->lvid.s, info, NULL, NULL)) { if (!_info(name, lv->lvid.s, mknodes, info, NULL, NULL)) {
stack; stack;
return 0; return 0;
} }
@ -1167,7 +1170,7 @@ static struct dev_layer *_create_dev(struct dev_manager *dm, char *name,
dl->name = name; dl->name = name;
log_debug("Getting device info for %s", dl->name); log_debug("Getting device info for %s", dl->name);
if (!_info(dl->name, dlid, &dl->info, dm->mem, &uuid)) { if (!_info(dl->name, dlid, 0, &dl->info, dm->mem, &uuid)) {
stack; stack;
return NULL; return NULL;
} }

View File

@ -28,7 +28,7 @@ void dev_manager_exit(void);
* unsuspended until the snapshot is also created.) * unsuspended until the snapshot is also created.)
*/ */
int dev_manager_info(struct dev_manager *dm, const struct logical_volume *lv, int dev_manager_info(struct dev_manager *dm, const struct logical_volume *lv,
struct dm_info *info); int mknodes, struct dm_info *info);
int dev_manager_snapshot_percent(struct dev_manager *dm, int dev_manager_snapshot_percent(struct dev_manager *dm,
struct logical_volume *lv, float *percent); struct logical_volume *lv, float *percent);
int dev_manager_mirror_percent(struct dev_manager *dm, int dev_manager_mirror_percent(struct dev_manager *dm,