1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-02 01:18:26 +03:00
lvm2/lib
David Teigland 49f1b15a03 cov: clean up pvid and vgid usage
pvid and vgid are sometimes a null-terminated string, and
other times a 'struct id', and the two types were often
cast between each other.  When a struct id was cast to a char
pointer, the resulting string would not necessarily be null
terminated.  Casting a null-terminated string id to a
struct id is fine, but is still avoided when possible.

A struct id is:  int8_t uuid[ID_LEN]
A string id is:  char pvid[ID_LEN + 1]

A convention is introduced to help distinguish them:

- variables and struct fields named "pvid" or "vgid"
  should be null-terminated strings.

- variables and struct fields named "pv_id" or "vg_id"
  should generally be struct id's.

e.g.
  char pvid[ID_LEN + 1];
  char vgid[ID_LEN + 1];
  struct id pv_id;
  struct id vg_id;

Function names also attempt to follow this convention.

Avoid casting between the two types as much as possible,
with limited exceptions when known to be safe and clearly
commented.

Avoid using variations of strcpy and strcmp, and instead
use memcpy/memcmp with ID_LEN (with similar limited
exceptions possible.)
2021-08-11 14:26:41 -05:00
..
activate cov: clean up pvid and vgid usage 2021-08-11 14:26:41 -05:00
cache cov: clean up pvid and vgid usage 2021-08-11 14:26:41 -05:00
cache_segtype cachevol: move flag setting after taking archive 2019-10-17 13:03:50 +02:00
commands devices: rework libudev usage 2021-07-13 11:11:23 -05:00
config devices: rework libudev usage 2021-07-13 11:11:23 -05:00
datastruct cleanup: eliminate unused assign 2021-03-11 00:18:01 +01:00
device cov: clean up pvid and vgid usage 2021-08-11 14:26:41 -05:00
display lib: locking: Add new type "idm" 2021-05-20 16:01:05 -05:00
error device_mapper: remove dbg_malloc. 2018-06-08 13:40:53 +01:00
filters cov: remove unneeded includes 2021-07-28 00:49:28 +02:00
format_text cov: clean up pvid and vgid usage 2021-08-11 14:26:41 -05:00
freeseg device_mapper: remove dbg_malloc. 2018-06-08 13:40:53 +01:00
integrity cleanup: no backtraces needed after log_error 2021-03-10 01:11:52 +01:00
label cov: clean up pvid and vgid usage 2021-08-11 14:26:41 -05:00
locking backup: automatically store data on vg_unlock 2021-06-09 14:56:13 +02:00
log debug: keep microseconds aligned 2021-03-15 11:13:24 +01:00
lvmpolld device usage based on devices file 2021-02-23 16:43:32 -06:00
metadata cov: clean up pvid and vgid usage 2021-08-11 14:26:41 -05:00
mirror lv_info: missing check for info.exists 2021-03-14 16:34:38 +01:00
misc devices: rework libudev usage 2021-07-13 11:11:23 -05:00
mm cov: initialize value 2021-03-11 00:18:01 +01:00
notify build: Don't generate symlinks in include/ dir 2018-05-14 10:30:20 +01:00
properties build: Don't generate symlinks in include/ dir 2018-05-14 10:30:20 +01:00
raid cleanup: reduce code dupliction 2021-03-19 23:21:18 +01:00
report Add metadata-based autoactivation property for VG and LV 2021-04-07 15:32:49 -05:00
snapshot typo: fixes 2021-02-08 23:53:41 +01:00
striped device_mapper: remove dbg_malloc. 2018-06-08 13:40:53 +01:00
thin targets: use target_present_version 2021-02-08 23:43:38 +01:00
unknown device_mapper: remove dbg_malloc. 2018-06-08 13:40:53 +01:00
uuid build: Don't generate symlinks in include/ dir 2018-05-14 10:30:20 +01:00
vdo vdo: just one probe is enough 2021-02-17 11:21:35 +01:00
writecache typo: fixes 2021-02-08 23:53:41 +01:00
zero device_mapper: remove dbg_malloc. 2018-06-08 13:40:53 +01:00
Makefile.in devices: rework libudev usage 2021-07-13 11:11:23 -05:00