]> git.tuebingen.mpg.de Git - osl.git/commitdiff
Mention that OSL_RBTREE implies OSL_UNIQUE.
authorAndre Noll <maan@tuebingen.mpg.de>
Sun, 4 Jan 2015 00:33:35 +0000 (00:33 +0000)
committerAndre Noll <maan@tuebingen.mpg.de>
Wed, 18 Feb 2015 14:11:29 +0000 (15:11 +0100)
Also print a warning when a table is opened or created which contains
a column description with OSL_RBTREE set but OSL_UNIQUE unset. Future
versions of osl might reject such table descriptions. But in order
to not break existing applications, we can not make such a change
without a deprecation period. So a warning has to suffice for now.

osl.c
osl.h.in

diff --git a/osl.c b/osl.c
index 4569b1bcf4810e1533c8283f1e72ae06d6f858e8..c6959acc0780144715f5a201c599380fcb9f4108 100644 (file)
--- a/osl.c
+++ b/osl.c
@@ -277,6 +277,9 @@ int init_table_structure(const struct osl_table_description *desc,
                ret = -E_OSL_BAD_STORAGE_FLAGS;
                if (st == OSL_DISK_STORAGE && sf & OSL_RBTREE)
                        goto err;
                ret = -E_OSL_BAD_STORAGE_FLAGS;
                if (st == OSL_DISK_STORAGE && sf & OSL_RBTREE)
                        goto err;
+               if ((sf & OSL_RBTREE) && !(sf & OSL_UNIQUE))
+                       WARNING_LOG("invalid storage flags for column %s: "
+                               "OSL_RBTREE && !OSL_UNIQUE\n", cd->name);
                ret = -E_OSL_BAD_STORAGE_SIZE;
                if (sf & OSL_FIXED_SIZE && !cd->data_size)
                        goto err;
                ret = -E_OSL_BAD_STORAGE_SIZE;
                if (sf & OSL_FIXED_SIZE && !cd->data_size)
                        goto err;
index 1e1ec965a719c73fc9d2e88e484fed47b19404c8..5491a2c82411eb20a735185f6dd3b144cd00e881 100644 (file)
--- a/osl.h.in
+++ b/osl.h.in
@@ -62,7 +62,7 @@ enum osl_storage_flags {
        OSL_RBTREE = 1,
        /** The data for this column will have constant size. */
        OSL_FIXED_SIZE = 2,
        OSL_RBTREE = 1,
        /** The data for this column will have constant size. */
        OSL_FIXED_SIZE = 2,
-       /** All values of this column will be different. */
+       /** All values are different. Must be set if \p OSL_RBTREE is set. */
        OSL_UNIQUE = 4,
        /** Do not free the data for this column (\p OSL_NO_STORAGE). */
        OSL_DONT_FREE = 8
        OSL_UNIQUE = 4,
        /** Do not free the data for this column (\p OSL_NO_STORAGE). */
        OSL_DONT_FREE = 8