diff --git a/lib/activate/activate.c b/lib/activate/activate.c index aa7f65308..887cfd71c 100644 --- a/lib/activate/activate.c +++ b/lib/activate/activate.c @@ -62,6 +62,11 @@ static int _query(struct logical_volume *lv, int (*fn)(const char *)) return fn(buffer); } + +/* + * These three functions return the number of LVs in the state, + * or -1 on error. + */ int lv_active(struct logical_volume *lv) { return _query(lv, device_active); @@ -77,6 +82,10 @@ int lv_open_count(struct logical_volume *lv) return _query(lv, device_open_count); } + +/* + * Returns 1 if info structure populated, else 0 on failure. + */ int lv_info(struct logical_volume *lv, struct dm_info *info) { char buffer[128]; @@ -84,7 +93,7 @@ int lv_info(struct logical_volume *lv, struct dm_info *info) if (!build_dm_name(buffer, sizeof(buffer), "", lv->vg->name, lv->name)) { stack; - return -1; + return 0; } return device_info(buffer, info); diff --git a/lib/activate/activate.h b/lib/activate/activate.h index 95a30aab8..91bb1725f 100644 --- a/lib/activate/activate.h +++ b/lib/activate/activate.h @@ -13,11 +13,15 @@ int driver_version(char *version, size_t size); int library_version(char *version, size_t size); /* - * Status functions. + * Status functions. Return count (0 upwards) or else -1 on error. */ int lv_active(struct logical_volume *lv); int lv_suspended(struct logical_volume *lv); int lv_open_count(struct logical_volume *lv); + +/* + * Returns 1 if info structure has been populated, else 0. + */ int lv_info(struct logical_volume *lv, struct dm_info *info); /* @@ -42,12 +46,12 @@ int lv_update_write_access(struct logical_volume *lv); /* * Activate all LVs in the VG. Ignore any that are already - * active. Return number activated. + * active. Return number actually activated. */ int activate_lvs_in_vg(struct volume_group *vg); /* - * Deactivate all LVs in the VG + * Deactivate all LVs in the VG. Return number actually deactivated. */ int deactivate_lvs_in_vg(struct volume_group *vg);