1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00
LVM2 mirror repository https://sourceware.org/lvm2/
Go to file
Tony Asleson 91f737383c lvm2app: Add signed numerical property values
Currently lvm2app properties have the following structure:

typedef struct lvm_property_value {
        uint32_t is_settable:1;
        uint32_t is_string:1;
        uint32_t is_integer:1;
        uint32_t is_valid:1;
        uint32_t padding:28;
        union {
                const char *string;
                uint64_t integer;
        } value;
} lvm_property_value_t;

which assumes that numerical values were in the range of 0 to 2**64-1.  However,
some of the properties were 'signed', like LV major/minor numbers and some
reserved values for properties that represent percentages.  Thus when the
values were retrieved they were in two's complement notation.  So for a -1
major number the API user would get a value of 18446744073709551615.  The
API user could cast the returned value to an int64_t to handle this, but that
requires the API developer to look at the source code and determine when it
should be done.

This change modifies the return property structure to:

typedef struct lvm_property_value {
        uint32_t is_settable:1;
        uint32_t is_string:1;
        uint32_t is_integer:1;
        uint32_t is_valid:1;
        uint32_t is_signed:1;
        uint32_t padding:27;
        union {
                const char *string;
                uint64_t integer;
                int64_t signed_integer;
        } value;
} lvm_property_value_t;

With this addition the API user can interrogate that the value is numerical,
(is_integer = 1) and subsequently check if it's signed (is_signed = 1) too.
If signed, then the API developer should use the union's signed_integer to
avoid casting.

This change maintains backwards compatibility as the structure size remains
unchanged and integer value remains unchanged.  Only the additional bit
taken from the pad is utilized.

Bugzilla reference:
https://bugzilla.redhat.com/show_bug.cgi?id=838257

Signed-off-by: Tony Asleson <tasleson@redhat.com>
2015-05-06 08:51:04 -05:00
autoconf autoconf: Update config.guess/sub to 2014-01-01. 2014-01-21 22:00:15 +00:00
conf config: Remove newly-exposed default settings. 2015-05-02 00:07:12 +01:00
daemons clvmd: missed newline in help text 2015-05-03 00:41:20 +02:00
doc doc: Update dm kernel files. 2015-04-22 15:34:25 +01:00
include cleanup: add dev-ext-udev-constants.h with constants/names of the properties/values used from udev db 2015-01-30 13:17:12 +01:00
lib lvm2app: Add signed numerical property values 2015-05-06 08:51:04 -05:00
libdaemon libdaemon: introduce support for exit on idle 2015-04-29 17:10:44 +02:00
libdm select: fix matching reserved values while <,<=,>,>= is used in selection criteria 2015-04-24 09:48:57 +02:00
liblvm lvm2app: Add signed numerical property values 2015-05-06 08:51:04 -05:00
man man: expanded explanation of lvmetad 2015-05-01 15:23:43 -05:00
nix nix: install also mdadm 2015-04-22 09:09:26 +02:00
old-tests report: select: refactor: move str_list to libdm 2014-06-17 16:27:20 +02:00
po make: Fix pofile and .d file generation. 2014-07-02 00:48:50 +01:00
python python: python 3 compat patch for lvm2 2015-04-29 15:09:56 +02:00
report-generators add copyright notices to new files 2010-07-28 12:20:38 +00:00
reports [REPORT-GENERATORS] cut down stylsheet.css to what we actually use 2010-07-21 10:00:38 +00:00
scripts config: Introduce lvmconfig. 2015-04-28 17:00:37 +01:00
spec spec: Pull in lvmconfig and associated manpages. 2015-04-30 06:35:05 +02:00
test tests: do not restart lvmetad when not necessary 2015-05-06 15:20:11 +02:00
tools polldaemon: make wait_for_single_lv public 2015-05-05 20:52:24 +02:00
udev makefiles: compile files on make 2014-04-18 16:38:49 +02:00
unit-tests cleanup: use DM_ARRAY_SIZE 2014-04-08 11:00:15 +02:00
.gitignore gitignore: Ignore files ending in ~ 2012-06-11 16:13:02 +01:00
acinclude.m4 configure: detect st_ctim 2015-03-18 13:42:24 +01:00
aclocal.m4 configure: typo in configure --with-default-raid10-segtype causing it to be unrecognized 2015-02-19 16:19:15 +01:00
configure configure: detect /run dir 2015-05-03 00:42:07 +02:00
configure.in configure: detect /run dir 2015-05-03 00:42:07 +02:00
COPYING Outline docs 2001-12-31 16:12:40 +00:00
COPYING.LIB Fix inconsistent licence notices: executables are GPLv2; libraries LGPLv2.1. 2007-08-20 20:55:30 +00:00
INSTALL quick review of docs 2008-11-04 17:49:22 +00:00
make.tmpl.in makefiles: avoid // in datadir usage 2015-04-22 10:59:03 +02:00
Makefile.in config: remove duplication of settings 2015-04-21 14:55:03 -05:00
README README: fix link to lvm-devel mailing list 2015-03-31 15:44:00 +02:00
VERSION post-release 2015-05-02 01:52:05 +01:00
VERSION_DM post-release 2015-05-02 01:52:05 +01:00
WHATS_NEW WHATS_NEW: update for recent changes 2015-05-05 20:52:49 +02:00
WHATS_NEW_DM post-release 2015-05-02 01:52:05 +01:00

This tree contains the LVM2 and device-mapper tools and libraries.

For more information about LVM2 read the changelog in the WHATS_NEW file.
Installation instructions are in INSTALL.

There is no warranty - see COPYING and COPYING.LIB.

Tarballs are available from:
  ftp://sources.redhat.com/pub/lvm2/

The source code is stored in git:
  http://git.fedorahosted.org/git/lvm2.git
  git clone git://git.fedorahosted.org/git/lvm2.git

Mailing list for general discussion related to LVM2:
  linux-lvm@redhat.com
  Subscribe from https://www.redhat.com/mailman/listinfo/linux-lvm

Mailing lists for LVM2 development, patches and commits:
  lvm-devel@redhat.com
  Subscribe from https://www.redhat.com/mailman/listinfo/lvm-devel

  lvm2-commits@lists.fedorahosted.org (Read-only archive of commits)
  Subscribe from https://fedorahosted.org/mailman/listinfo/lvm2-commits

Mailing list for device-mapper development, including kernel patches
and multipath-tools:
  dm-devel@redhat.com
  Subscribe from https://www.redhat.com/mailman/listinfo/dm-devel

The source code repository used until 7th June 2012 is accessible here:
  http://sources.redhat.com/cgi-bin/cvsweb.cgi/LVM2/?cvsroot=lvm2.