Patch to export init_stat_ex_from_stat so that it can be used in VFS modules rather than duplicating code

Richard Sharpe realrichardsharpe at gmail.com
Wed Jun 8 10:31:22 MDT 2011


Hi folks,

here is a patch from master ...

It is attached as well. I am not sure that adding #include
<sys/stat.h> to includes.h is the correct thing to do here, but I have
received no feedback on this.

Signed-off-by: Richard Sharpe <realrichardsharpe at gmail.com>

From: Richard Sharpe <realrichardsharpe at gmail.com>
Date: Fri, 3 Jun 2011 08:27:13 -0700
Subject: [PATCH] Export init_stat_ex_from_stat for use in VFS modules.

---
 source3/include/includes.h |    3 +++
 source3/include/proto.h    |   11 +++++++++++
 source3/lib/system.c       |   12 ++++++------
 3 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/source3/include/includes.h b/source3/include/includes.h
index e6b70c7..78b0ca1 100644
--- a/source3/include/includes.h
+++ b/source3/include/includes.h
@@ -58,6 +58,9 @@
 #undef HAVE_TERMIOS_H
 #endif

+/* Needed for init_stat_ex_from_stat */
+#include <sys/stat.h>
+
 #ifdef RELIANTUNIX
 /*
  * <unistd.h> has to be included before any other to get
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 7e25f8e..6700320 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -472,6 +472,17 @@ int sys_aio_cancel(int fd, SMB_STRUCT_AIOCB *aiocb);
 int sys_aio_error(const SMB_STRUCT_AIOCB *aiocb);
 int sys_aio_fsync(int op, SMB_STRUCT_AIOCB *aiocb);
 int sys_aio_suspend(const SMB_STRUCT_AIOCB * const cblist[], int n,
const struct timespec *timeout);
+
+#if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_OFF64_T)
&& defined(HAVE_STAT64)
+void init_stat_ex_from_stat (struct stat_ex *dst,
+                           const struct stat64 *src,
+                           bool fake_dir_create_times);
+#else
+void init_stat_ex_from_stat (struct stat_ex *dst,
+                           const struct stat *src,
+                           bool fake_dir_create_times);
+#endif
+
 /* The following definitions come from lib/system_smbd.c  */

 bool getgroups_unix_user(TALLOC_CTX *mem_ctx, const char *user,
diff --git a/source3/lib/system.c b/source3/lib/system.c
index 292965f..83ad47b 100644
--- a/source3/lib/system.c
+++ b/source3/lib/system.c
@@ -545,13 +545,13 @@ void update_stat_ex_create_time(struct stat_ex *dst,
 }

 #if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_OFF64_T)
&& defined(HAVE_STAT64)
-static void init_stat_ex_from_stat (struct stat_ex *dst,
-                                   const struct stat64 *src,
-                                   bool fake_dir_create_times)
+void init_stat_ex_from_stat (struct stat_ex *dst,
+                           const struct stat64 *src,
+                           bool fake_dir_create_times)
 #else
-static void init_stat_ex_from_stat (struct stat_ex *dst,
-                                   const struct stat *src,
-                                   bool fake_dir_create_times)
+void init_stat_ex_from_stat (struct stat_ex *dst,
+                           const struct stat *src,
+                           bool fake_dir_create_times)
 #endif
 {
        dst->st_ex_dev = src->st_dev;
-- 
1.7.1



-- 
Regards,
Richard Sharpe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Export-init_stat_ex_from_stat-for-use-in-VFS-modules.patch
Type: application/octet-stream
Size: 2577 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20110608/29898d40/attachment.obj>


More information about the samba-technical mailing list