int32_t quota_dict_set_meta (dict_t *dict, char *key, const quota_meta_t *meta, ia_type_t ia_type) { int32_t ret = -1; quota_meta_t *value = NULL; value = GF_CALLOC (1, sizeof (quota_meta_t), gf_common_quota_meta_t); if (value == NULL) { gf_log_callingfn ("quota", GF_LOG_ERROR, "Memory allocation failed"); goto out; } value->size = hton64 (meta->size); value->file_count = hton64 (meta->file_count); value->dir_count = hton64 (meta->dir_count); if (ia_type == IA_IFDIR) { ret = dict_set_bin (dict, key, value, sizeof (*value)); } else { /* For a file we don't need to store dir_count in the * quota size xattr, so we set the len of the data in the dict * as 128bits, so when the posix xattrop reads the dict, it only * performs operations on size and file_count */ ret = dict_set_bin (dict, key, value, sizeof (*value) - sizeof (int64_t)); } if (ret < 0) { gf_log_callingfn ("quota", GF_LOG_ERROR, "dict set failed"); GF_FREE (value); } out: return ret; }
gf_posix_mt_char); if (!value) goto out; xattr_size = sys_lgetxattr (filler->real_path, key, value, xattr_size); if (xattr_size <= 0) { gf_log (filler->this->name, GF_LOG_WARNING, "getxattr failed. path: %s, key: %s", filler->real_path, key); GF_FREE (value); goto out; } value[xattr_size] = '\0'; ret = dict_set_bin (filler->xattr, key, value, xattr_size); if (ret < 0) { gf_log (filler->this->name, GF_LOG_DEBUG, "dict set failed. path: %s, key: %s", filler->real_path, key); GF_FREE (value); goto out; } } ret = 0; out: return ret; } static int gf_posix_xattr_enotsup_log;