1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00
lvm2/lib/metadata
David Teigland 96b777167c 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 be struct id's.

- examples:
  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-16 11:31:15 -05:00
..
cache_manip.c cache: use interruptible_usleep 2021-03-14 16:34:38 +01:00
integrity_manip.c blkid: simplify fs block size check 2021-05-05 16:15:10 -05:00
lv_alloc.h build: Don't generate symlinks in include/ dir 2018-05-14 10:30:20 +01:00
lv_manip.c cov: remove unneeded includes 2021-07-28 00:49:28 +02:00
lv.c cache: activation cache_check on cachevol 2020-12-09 17:36:09 -06:00
lv.h lvremove: support faster removal of thin-pools 2021-03-11 00:18:01 +01:00
merge.c cov: raid: no more checks with missing areas 2021-07-28 00:49:28 +02:00
metadata-exported.h vdo: support vdo_pool_header_size 2021-06-28 20:41:07 +02:00
metadata.c cov: clean up pvid and vgid usage 2021-08-16 11:31:15 -05:00
metadata.h cov: clean up pvid and vgid usage 2021-08-16 11:31:15 -05:00
mirror.c wipe: convert zero_value to uint8_t 2020-09-15 22:52:25 +02:00
pool_manip.c vgsplit: add support for option --poolmetadataspare 2021-07-21 15:56:33 +02:00
pv_alloc.h doc: change fsf address 2016-01-21 12:11:37 +01:00
pv_list.c cleanup: no backtraces needed after log_error 2021-03-10 01:11:52 +01:00
pv_manip.c cov: remove unneeded includes 2021-07-28 00:49:28 +02:00
pv_map.c build: Don't generate symlinks in include/ dir 2018-05-14 10:30:20 +01:00
pv_map.h build: Don't generate symlinks in include/ dir 2018-05-14 10:30:20 +01:00
pv.c cov: clean up pvid and vgid usage 2021-08-16 11:31:15 -05:00
pv.h cov: clean up pvid and vgid usage 2021-08-16 11:31:15 -05:00
raid_manip.c backup: automatically store data on vg_unlock 2021-06-09 14:56:13 +02:00
segtype.c segtype: add linear 2018-06-05 16:23:18 +02:00
segtype.h segtypes: macros for error and zero segtypes 2021-03-18 18:34:57 +01:00
snapshot_manip.c lvremove: use to_remove for snapshot removal 2021-03-15 11:11:35 +01:00
takeover_matrix.h lvconvert: add infrastructure for RaidLV reshaping support 2017-02-24 05:20:58 +01:00
thin_manip.c lvremove: fix removing thin pool with writecache on data 2021-05-24 16:09:35 -05:00
vdo_manip.c vdo: support vdo_pool_header_size 2021-06-28 20:41:07 +02:00
vg.c backup: automatically store data on vg_unlock 2021-06-09 14:56:13 +02:00
vg.h backup: automatically store data on vg_unlock 2021-06-09 14:56:13 +02:00
writecache_manip.c writecache: use cleaner message instead of table reload 2021-01-28 15:14:25 -06:00