summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/quota-common-utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'libglusterfs/src/quota-common-utils.c')
-rw-r--r--libglusterfs/src/quota-common-utils.c29
1 files changed, 22 insertions, 7 deletions
diff --git a/libglusterfs/src/quota-common-utils.c b/libglusterfs/src/quota-common-utils.c
index 8cc09e8fff7..ab153209d0d 100644
--- a/libglusterfs/src/quota-common-utils.c
+++ b/libglusterfs/src/quota-common-utils.c
@@ -15,18 +15,13 @@
#include "quota-common-utils.h"
int32_t
-quota_dict_get_meta (dict_t *dict, char *key, quota_meta_t *meta)
+quota_data_to_meta (data_t *data, char *key, quota_meta_t *meta)
{
int32_t ret = -1;
- data_t *data = NULL;
quota_meta_t *value = NULL;
int64_t *size = NULL;
- if (!dict || !key || !meta)
- goto out;
-
- data = dict_get (dict, key);
- if (!data || !data->data)
+ if (!data || !key || !meta)
goto out;
if (data->len > sizeof (int64_t)) {
@@ -59,6 +54,26 @@ out:
}
int32_t
+quota_dict_get_meta (dict_t *dict, char *key, quota_meta_t *meta)
+{
+ int32_t ret = -1;
+ data_t *data = NULL;
+
+ if (!dict || !key || !meta)
+ goto out;
+
+ data = dict_get (dict, key);
+ if (!data || !data->data)
+ goto out;
+
+ ret = quota_data_to_meta (data, key, meta);
+
+out:
+
+ return ret;
+}
+
+int32_t
quota_dict_set_meta (dict_t *dict, char *key, const quota_meta_t *meta,
ia_type_t ia_type)
{