From 5dd73b91a5c9411a3e81035d84c207d98771cf88 Mon Sep 17 00:00:00 2001 From: Matt Benjamin Date: Thu, 3 Sep 2015 15:11:10 -0400 Subject: [PATCH] librgw: update rgw_readdir interface (stub impl) Signed-off-by: Matt Benjamin --- src/include/rados/rgw_file.h | 5 ++++- src/rgw/rgw_file.cc | 12 ++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/include/rados/rgw_file.h b/src/include/rados/rgw_file.h index e07f66bcbe513..c39d0f8859abb 100644 --- a/src/include/rados/rgw_file.h +++ b/src/include/rados/rgw_file.h @@ -101,7 +101,10 @@ int rgw_lookup(const struct rgw_file_handle *parent_handle, const char *path, /* read directory content */ -int rgw_readdir(const struct rgw_file_handle *parent_handle, const char *path); +typedef bool (*rgw_readdir_cb)(const char *name, void *arg, uint64_t cookie); + +int rgw_readdir(const struct rgw_file_handle *parent_handle, uint64_t offset, + rgw_readdir_cb cb, void *cb_arg, int *eof); int rgw_set_attributes(const struct rgw_file_handle *handle); diff --git a/src/rgw/rgw_file.cc b/src/rgw/rgw_file.cc index a08700e1676b4..9579f75c081a0 100644 --- a/src/rgw/rgw_file.cc +++ b/src/rgw/rgw_file.cc @@ -172,7 +172,8 @@ int rgw_getattr(const struct rgw_file_handle *handle, struct stat *st) /* read directory content */ -int rgw_readdir(const struct rgw_file_handle* parent_handle, const char* path) +int rgw_readdir(const struct rgw_file_handle *parent_handle, uint64_t offset, + rgw_readdir_cb rcb, void *cb_arg, int *eof) { string uri; int rc; @@ -182,7 +183,7 @@ int rgw_readdir(const struct rgw_file_handle* parent_handle, const char* path) return rc; } -#if 0 +#if 0 /* TODO: implement */ if (is_root(uri)) { /* get the bucket list */ return librgw.get_user_buckets_list(); @@ -194,5 +195,12 @@ int rgw_readdir(const struct rgw_file_handle* parent_handle, const char* path) } #endif + /* XXXX */ + (void) rcb("test1", cb_arg, 1); + (void) rcb("test2", cb_arg, 2); + (void) rcb("test3", cb_arg, 3); + + *eof = true; + return 0; } -- 2.39.5