Mercurial > nomad > old-fuse
changeset 156:f17edce1a103
objstore/mem: implement getattr object operation
Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
author | Josef 'Jeff' Sipek <jeffpc@josefsipek.net> |
---|---|
date | Sun, 18 Oct 2015 16:08:37 -0400 |
parents | 716577380451 |
children | 6dd1b43f0589 |
files | src/objstore/mem/main.c |
diffstat | 1 files changed, 25 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/objstore/mem/main.c Sun Oct 18 16:08:17 2015 -0400 +++ b/src/objstore/mem/main.c Sun Oct 18 16:08:37 2015 -0400 @@ -154,12 +154,37 @@ return 0; } +static int mem_obj_getattr(struct objstore_vol *vol, const struct nobjhndl *hndl, + struct nattr *attr) +{ + struct memstore *ms; + struct memobj *obj; + struct memobj key; + + if (!vol || !hndl || !attr) + return EINVAL; + + ms = vol->private; + + key.oid = hndl->oid; + key.ver = hndl->clock; + + obj = avl_find(&ms->objs, &key, NULL); + if (!obj) + return ENOENT; + + *attr = obj->attrs; + + return 0; +} + static const struct vol_ops vol_ops = { .create = mem_vol_create, .getroot = mem_vol_getroot, }; static const struct obj_ops obj_ops = { + .getattr = mem_obj_getattr, }; const struct objstore_vol_def objvol = {