Mercurial > nomad > old-fuse
changeset 96:e76e3ee73fb5
objstore: implement a getattr wrapper
Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
author | Josef 'Jeff' Sipek <jeffpc@josefsipek.net> |
---|---|
date | Sat, 17 Oct 2015 11:33:05 -0400 |
parents | 17a1cd072c43 |
children | 2fcbd483c1c3 |
files | src/objstore/include/nomad/objstore.h src/objstore/include/nomad/objstore_impl.h src/objstore/objstore.c |
diffstat | 3 files changed, 19 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/objstore/include/nomad/objstore.h Sat Oct 17 11:32:45 2015 -0400 +++ b/src/objstore/include/nomad/objstore.h Sat Oct 17 11:33:05 2015 -0400 @@ -50,4 +50,9 @@ /* store operations */ extern int objstore_getroot(struct objstore *store, struct nobjhndl *hndl); +/* object operations */ +extern int objstore_obj_getattr(struct objstore *store, + const struct nobjhndl *hndl, + struct nattr *attr); + #endif
--- a/src/objstore/include/nomad/objstore_impl.h Sat Oct 17 11:32:45 2015 -0400 +++ b/src/objstore/include/nomad/objstore_impl.h Sat Oct 17 11:33:05 2015 -0400 @@ -47,7 +47,8 @@ int (*commit)(); /* make temp object live */ int (*abort)(); /* delete temp object */ - int (*getattr)(); /* get attributes for object */ + int (*getattr)(struct objstore *store, const struct nobjhndl *hndl, + struct nattr *attr); int (*setattr)(); /* set attributes of an object */ ssize_t (*read)(); /* read portion of an object */ ssize_t (*write)(); /* write portion of an object */
--- a/src/objstore/objstore.c Sat Oct 17 11:32:45 2015 -0400 +++ b/src/objstore/objstore.c Sat Oct 17 11:33:05 2015 -0400 @@ -123,3 +123,15 @@ return store->def->store_ops->getroot(store, hndl); } + +int objstore_obj_getattr(struct objstore *store, const struct nobjhndl *hndl, + struct nattr *attr) +{ + if (!hndl || !hndl->clock) + return EINVAL; + + if (!store || !store->def->obj_ops || !store->def->obj_ops->getattr) + return EINVAL; + + return store->def->obj_ops->getattr(store, hndl, attr); +}