1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00
lvm2/libdm
Peter Rajnoha 35c4e4489c report: select: add support for reserved value recognition in report selection string - add struct dm_report_reserved_value
Make dm_report_init_with_selection to accept an argument with an
array of reserved values where each element contains a triple:

  {dm report field type, reserved value, array of strings representing this value}

When the selection is parsed, we always check whether a string
representation of some reserved value is not hit and if it is,
we use the reserved value assigned for this string instead of
trying to parse it as a value of certain field type.

This makes it possible to define selections like:

   ... --select lv_major=undefined (or -1 or unknown or undef or whatever string representations are registered for this reserved value in the future)
   ... --select lv_read_ahead=auto
   ... --select vg_mda_copies=unmanaged

With this, each time the field value of certain type is hit
and when we compare it with the selection, we use the proper
value for comparison.

For now, register these reserved values that are used at the moment
(also more descriptive names are used for the values):

  const uint64_t _reserved_number_undef_64 = UINT64_MAX;
  const uint64_t _reserved_number_unmanaged_64 = UINT64_MAX - 1;
  const uint64_t _reserved_size_auto_64 = UINT64_MAX;

 {
  {DM_REPORT_FIELD_TYPE_NUMBER, _reserved_number_undef_64, {"-1", "undefined", "undef", "unknown", NULL}},
  {DM_REPORT_FIELD_TYPE_NUMBER, _reserved_number_unmanaged_64, {"unmanaged", NULL}},
  {DM_REPORT_FIELD_TYPE_SIZE, _reserved_size_auto_64, {"auto", NULL}},
  NULL
 }

Same reserved value of different field types do not collide.
All arrays are null-terminated.

The list of reserved values is automatically displayed within
selection help output:

  Selection operands
  ------------------
  ...

  Reserved values
  ---------------
    -1, undefined, undef, unknown   - Reserved value for undefined numeric value. [number]
    unmanaged                       - Reserved value for unmanaged number of metadata copies in VG. [number]
    auto                            - Reserved value for size that is automatically calculated. [size]

  Selection operators
  -------------------
  ...
2014-06-17 16:27:21 +02:00
..
datastruct Use void pointer instead of char for binary key 2011-03-10 12:48:40 +00:00
ioctl libdm: cleanup complation without DM_IOCTLS 2014-04-30 10:26:29 +02:00
misc cleanup: self compilable headers 2013-12-12 13:28:19 +01:00
mm debug: avoid warning when compiled with valgrind 2014-03-27 13:13:08 +01:00
regex cleanup: stack usage 2013-07-01 23:11:14 +02:00
.exported_symbols Generate liblvm2app and libdevmapper exported symbols from header files. 2010-06-25 18:17:38 +00:00
libdevmapper.h report: select: add support for reserved value recognition in report selection string - add struct dm_report_reserved_value 2014-06-17 16:27:21 +02:00
libdevmapper.pc.in Switch to use Requires.private for devmapper.pc and lvm2app.pc 2010-05-11 08:54:11 +00:00
libdm-common.c udev: also print subsystem udev flags in debug message about udev flags + fix typo DM_SUBSSYTEM_UDEV_FLAG7 -> DM_SUBSYSTEM_UDEV_FLAG7 2014-05-27 14:44:11 +02:00
libdm-common.h libdm: introduce and use DEV_UUID macro 2012-10-10 17:16:15 +02:00
libdm-config.c cleanup: include stdarg.h where needed. 2014-04-18 16:38:50 +02:00
libdm-deptree.c activation: Remove empty DM device when table fails to load. 2014-05-28 10:17:15 -05:00
libdm-file.c Drop unreachable code 2012-02-08 12:59:45 +00:00
libdm-report.c report: select: add support for reserved value recognition in report selection string - add struct dm_report_reserved_value 2014-06-17 16:27:21 +02:00
libdm-string.c cleanup: use const for endptr in dm_units_to_factor 2014-05-26 12:09:01 +02:00
Makefile.in libdm: Add missing UDEV_CFLAGS. 2014-04-01 15:26:26 +02:00