1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00
lvm2/lib/format_text
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
..
archive.c Merge branch 'master' into 2018-05-11-fork-libdm 2018-06-01 13:04:12 +01:00
archiver.c cov: clean up pvid and vgid usage 2021-08-16 11:31:15 -05:00
archiver.h build: Don't generate symlinks in include/ dir 2018-05-14 10:30:20 +01:00
export.c cleanup: easier print of historical lv 2021-03-10 01:11:52 +01:00
flags.c Add metadata-based autoactivation property for VG and LV 2021-04-07 15:32:49 -05:00
format-text.c cov: clean up pvid and vgid usage 2021-08-16 11:31:15 -05:00
format-text.h vgck: fix updatemetadata writing different descriptions 2019-10-11 12:57:32 -05:00
import_vsn1.c cov: clean up pvid and vgid usage 2021-08-16 11:31:15 -05:00
import-export.h metadata: add vg_from_config_tree 2019-11-27 11:13:47 -06:00
import.c vg_read: reuse already parsed config tree 2021-03-08 15:30:18 +01:00
layout.h gcc: zero-sized array to fexlible array C99 2020-09-01 17:57:50 +02:00
text_export.h cleanup: easier print of historical lv 2021-03-10 01:11:52 +01:00
text_import.h doc: change fsf address 2016-01-21 12:11:37 +01:00
text_label.c cov: clean up pvid and vgid usage 2021-08-16 11:31:15 -05:00