#include "serialize.h"
#include "cache.h"
-static int get_path(uid_t uid, enum layer_attribute_type type,
+#define BXT_DEFAULT_USER tzplatform_getuid(TZ_SYS_DEFAULT_USER)
+
+static int get_path(enum layer_attribute_type type,
const struct layer *ly, const char *user, char *path, int sz)
{
const char *prefix;
if (ly->type == LAYER_USER) {
if (user != NULL && user[0] != '\0' && type == LAYER_ATTRIBUTE_RW) {
snprintf(path, sz, "%s/user/%u/subsession/%s/%s.db",
- prefix, uid, user, ly->name);
+ prefix, BXT_DEFAULT_USER, user, ly->name);
} else {
snprintf(path, sz, "%s/%s.db", prefix, ly->name);
}
if (cache_get(type, key, (void **)data, len) == BUXTON_ERROR_NONE)
return BUXTON_ERROR_NONE;
- r = get_path(uid, type, ly, user, path, sizeof(path));
+ r = get_path(type, ly, user, path, sizeof(path));
if (r != BUXTON_ERROR_NONE)
return r;
return BUXTON_ERROR_NONE;
}
- r = get_path(uid, type, ly, user, path, sizeof(path));
+ r = get_path(type, ly, user, path, sizeof(path));
if (r != BUXTON_ERROR_NONE)
return r;
return BUXTON_ERROR_INVALID_OPERATION;
}
- r = get_path(layer->uid, LAYER_ATTRIBUTE_RO, ly, layer->user, path,
+ r = get_path(LAYER_ATTRIBUTE_RO, ly, layer->user, path,
sizeof(path));
if (r != BUXTON_ERROR_NONE)
return r;
return BUXTON_ERROR_INVALID_OPERATION;
}
- r = get_path(bxt_layer->uid, bxt_layer->type, ly, bxt_layer->user, path,
+ r = get_path(bxt_layer->type, ly, bxt_layer->user, path,
sizeof(path));
if (r != BUXTON_ERROR_NONE)
return r;
return BUXTON_ERROR_INVALID_OPERATION;
}
- r = get_path(layer->uid, is_base ?
+ r = get_path(is_base ?
LAYER_ATTRIBUTE_RO : LAYER_ATTRIBUTE_RW,
ly, layer->user, path, sizeof(path));
if (r != BUXTON_ERROR_NONE)
return BUXTON_ERROR_INVALID_OPERATION;
}
- ret = get_path(layer->uid, LAYER_ATTRIBUTE_RO,
+ ret = get_path(LAYER_ATTRIBUTE_RO,
ly, layer->user, path, sizeof(path));
if (ret != BUXTON_ERROR_NONE)
return ret;
return ret;
}
- ret = get_path(layer->uid, LAYER_ATTRIBUTE_RW,
+ ret = get_path(LAYER_ATTRIBUTE_RW,
ly, layer->user, path, sizeof(path));
if (ret != BUXTON_ERROR_NONE) {
bxt_err("dump: get_path failed");
return BUXTON_ERROR_INVALID_OPERATION;
}
- r = get_path(layer->uid, layer->type, ly, layer->user, path,
+ r = get_path(layer->type, ly, layer->user, path,
sizeof(path));
if (r != BUXTON_ERROR_NONE)
return r;
return BUXTON_ERROR_INVALID_OPERATION;
}
- r = get_path(0, LAYER_ATTRIBUTE_RW, ly, NULL, path, sizeof(path));
+ r = get_path(LAYER_ATTRIBUTE_RW, ly, NULL, path, sizeof(path));
if (r != BUXTON_ERROR_NONE)
return r;
return BUXTON_ERROR_INVALID_OPERATION;
}
- r = get_path(uid, LAYER_ATTRIBUTE_RW, ly, name, dst_path, sizeof(dst_path));
+ r = get_path(LAYER_ATTRIBUTE_RW, ly, name, dst_path, sizeof(dst_path));
if (r != BUXTON_ERROR_NONE)
return r;
parent, errno);
}
- r = get_path(uid, LAYER_ATTRIBUTE_RW, ly, "", src_path, sizeof(src_path));
+ r = get_path(LAYER_ATTRIBUTE_RW, ly, "", src_path, sizeof(src_path));
if (r != BUXTON_ERROR_NONE)
return r;
return BUXTON_ERROR_INVALID_OPERATION;
}
- r = get_path(uid, LAYER_ATTRIBUTE_RW, ly, name, path, sizeof(path));
+ r = get_path(LAYER_ATTRIBUTE_RW, ly, name, path, sizeof(path));
if (r != BUXTON_ERROR_NONE)
return r;