From: Andre Noll Date: Sun, 4 Jan 2015 00:33:35 +0000 (+0000) Subject: Mention that OSL_RBTREE implies OSL_UNIQUE. X-Git-Tag: v0.1.3~16 X-Git-Url: http://git.tuebingen.mpg.de/?p=osl.git;a=commitdiff_plain;h=20a76169066eaf33b279e0f322415ea4b4c2899e Mention that OSL_RBTREE implies OSL_UNIQUE. 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. --- diff --git a/osl.c b/osl.c index 4569b1b..c6959ac 100644 --- 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; + 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; diff --git a/osl.h.in b/osl.h.in index 1e1ec96..5491a2c 100644 --- 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, - /** 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