summaryrefslogtreecommitdiff
path: root/source3/include
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2019-10-18 10:29:48 -0700
committerRalph Boehme <slow@samba.org>2019-10-30 20:44:31 +0000
commitabbbbbff376877bbe92f3695e480472a4070937a (patch)
tree14138367bfd783b7785b91c482637ce4d638b993 /source3/include
parente26487aab01096492ec5ed4251039147963a8d1b (diff)
downloadsamba-abbbbbff376877bbe92f3695e480472a4070937a.tar.gz
s3: libsmb: Added new API smbc_readdirplus2()
Returns the same as smbc_readdirplus() but also can return a struct stat if passed in by the caller. struct stat is synthesized from the data returned by the SMB server. Signed-off-by: Puran Chand <pchand@vmware.com> Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
Diffstat (limited to 'source3/include')
-rw-r--r--source3/include/libsmb_internal.h5
-rw-r--r--source3/include/libsmbclient.h26
2 files changed, 31 insertions, 0 deletions
diff --git a/source3/include/libsmb_internal.h b/source3/include/libsmb_internal.h
index 93b8336f067..bfb3e064297 100644
--- a/source3/include/libsmb_internal.h
+++ b/source3/include/libsmb_internal.h
@@ -306,6 +306,11 @@ const struct libsmb_file_info *
SMBC_readdirplus_ctx(SMBCCTX *context,
SMBCFILE *dir);
+const struct libsmb_file_info *
+SMBC_readdirplus2_ctx(SMBCCTX *context,
+ SMBCFILE *dir,
+ struct stat *st);
+
int
SMBC_getdents_ctx(SMBCCTX *context,
SMBCFILE *dir,
diff --git a/source3/include/libsmbclient.h b/source3/include/libsmbclient.h
index b045221f12b..835c832b76a 100644
--- a/source3/include/libsmbclient.h
+++ b/source3/include/libsmbclient.h
@@ -1046,6 +1046,12 @@ typedef const struct libsmb_file_info * (*smbc_readdirplus_fn)(SMBCCTX *c,
smbc_readdirplus_fn smbc_getFunctionReaddirPlus(SMBCCTX *c);
void smbc_setFunctionReaddirPlus(SMBCCTX *c, smbc_readdirplus_fn fn);
+typedef const struct libsmb_file_info * (*smbc_readdirplus2_fn)(SMBCCTX *c,
+ SMBCFILE *dir,
+ struct stat *st);
+smbc_readdirplus2_fn smbc_getFunctionReaddirPlus2(SMBCCTX *c);
+void smbc_setFunctionReaddirPlus2(SMBCCTX *c, smbc_readdirplus2_fn fn);
+
typedef int (*smbc_getdents_fn)(SMBCCTX *c,
SMBCFILE *dir,
struct smbc_dirent *dirp,
@@ -1654,6 +1660,25 @@ struct smbc_dirent* smbc_readdir(unsigned int dh);
*/
const struct libsmb_file_info *smbc_readdirplus(unsigned int dh);
+/**@ingroup directory
+ * Works similar as smbc_readdirplus as well as fills up stat structure if
+ * provided.
+ *
+ * @param dh Valid directory as returned by smbc_opendir()
+ *
+ * @param stat Pointer to stat structure which will receive the
+ * information. If this pointer is null the call
+ * is identical to smbc_readdirplus.
+ *
+ * @return A const pointer to a libsmb_file_info structure,
+ * or NULL if an error occurs or end-of-directory is reached:
+ * - EBADF Invalid directory handle
+ * - EINVAL smbc_init() failed or has not been called
+ *
+ * @see smbc_open(), smbc_readdir(), smbc_readdirplus2()
+ */
+const struct libsmb_file_info *smbc_readdirplus2(unsigned int dh,
+ struct stat *st);
/**@ingroup directory
* Get the current directory offset.
@@ -3104,6 +3129,7 @@ struct _SMBCCTX
smbc_closedir_fn closedir DEPRECATED_SMBC_INTERFACE;
smbc_readdir_fn readdir DEPRECATED_SMBC_INTERFACE;
smbc_readdirplus_fn readdirplus DEPRECATED_SMBC_INTERFACE;
+ smbc_readdirplus2_fn readdirplus2 DEPRECATED_SMBC_INTERFACE;
smbc_getdents_fn getdents DEPRECATED_SMBC_INTERFACE;
smbc_mkdir_fn mkdir DEPRECATED_SMBC_INTERFACE;
smbc_rmdir_fn rmdir DEPRECATED_SMBC_INTERFACE;