diff options
author | Peter Rajnoha <prajnoha@redhat.com> | 2014-11-13 11:41:49 +0100 |
---|---|---|
committer | Peter Rajnoha <prajnoha@redhat.com> | 2014-11-13 14:28:51 +0100 |
commit | 83308fdff97e242f6124858b35437ede6ee6a7e8 (patch) | |
tree | 56fe1686e66e450fadb8eb61da60503000cf50c6 /lib/activate/activate.h | |
parent | efe5245e47201e1947ce0bf60990a7de2151e296 (diff) | |
download | lvm2-83308fdff97e242f6124858b35437ede6ee6a7e8.tar.gz |
cleanup: cleanup internal interface to acquire segment status
- Add separate lv_status fn (if we're interested only in seg status,
but not lv info at the same time as it is with existing
lv_info_with_seg_status fn). So we 3 fns:
- lv_info (existing one, runs only info ioctl, fills in struct lvinfo only)
- lv_status (new one, runs status ioctl, fills in struct lv_seg_status only)
- lv_info_with_seg_status (existing one, runs status ioctl, fills
in struct lvinfo as well as lv_seg_status)
- Add more comments in the code explaining the difference between lv_info,
lv_status and lv_info_with_seg_status and their return values.
- Move decision whether lv_info_with_seg_status needs to call only
status ioctl (in case the segment for which we require status is from
the LV for which we require info) or separate status and info ioctl
(in case the segment for which we require status is from different
LV that the one for which we require info) into
lv_info_with_seg_status fn so caller doesn't need to bother about
this at all.
- Cleanup internal interface for this seg status so it's more readable.
Diffstat (limited to 'lib/activate/activate.h')
-rw-r--r-- | lib/activate/activate.h | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/lib/activate/activate.h b/lib/activate/activate.h index 86c53f5f3..ef375bd62 100644 --- a/lib/activate/activate.h +++ b/lib/activate/activate.h @@ -111,16 +111,31 @@ int lv_deactivate(struct cmd_context *cmd, const char *lvid_s, const struct logi int lv_mknodes(struct cmd_context *cmd, const struct logical_volume *lv); /* - * Returns 1 if info structure has been populated, else 0. + * Returns 1 if info structure has been populated, else 0 on failure. + * When lvinfo* is NULL, it returns 1 if the device is locally active, 0 otherwise. */ int lv_info(struct cmd_context *cmd, const struct logical_volume *lv, int use_layer, struct lvinfo *info, int with_open_count, int with_read_ahead); int lv_info_by_lvid(struct cmd_context *cmd, const char *lvid_s, int use_layer, struct lvinfo *info, int with_open_count, int with_read_ahead); +/* + * Returns 1 if lv_seg_status structure has been populated, + * else 0 on failure or if device not active locally. + */ +int lv_status(struct cmd_context *cmd, struct lv_segment *lv_seg, + struct lv_seg_status *lv_seg_status); + +/* + * Returns 1 if lv_info_and_seg_status structure has been populated, + * else 0 on failure or if device not active locally. + * + * lv_info_with_seg_status is the same as calling lv_info and then lv_seg_status, + * but this fn tries to do that with one ioctl if possible. + */ int lv_info_with_seg_status(struct cmd_context *cmd, const struct logical_volume *lv, - const struct lv_segment *lv_seg, int use_layer, - struct lv_with_info_and_seg_status *lvdm, + struct lv_segment *lv_seg, int use_layer, + struct lvinfo *lvinfo, struct lv_seg_status *lv_seg_status, int with_open_count, int with_read_ahead); int lv_check_not_in_use(const struct logical_volume *lv); |