[SCM] Samba Shared Repository - branch v3-2-test updated - initial-v3-2-unstable-753-g5de89dd

James Peach jpeach at samba.org
Thu Dec 20 06:43:00 GMT 2007


The branch, v3-2-test has been updated
       via  5de89dd6e0a8a56a5a0f998e3b1d3538367db7d6 (commit)
       via  36db6755103f01cb74bf4194fc81ca6d4b5320e4 (commit)
       via  555173eb3f6511e88798d6ef3d1fed0c219a9921 (commit)
       via  d5d9e4084cfb3db3bebff0334b93f376022ef5d3 (commit)
       via  9fead46b54519b3df78a869dbc99207046587d6a (commit)
      from  6d765e0de523211a2d0b43a2c4c4117f5f0c662f (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test


- Log -----------------------------------------------------------------
commit 5de89dd6e0a8a56a5a0f998e3b1d3538367db7d6
Author: James Peach <jpeach at samba.org>
Date:   Wed Dec 19 22:39:40 2007 -0800

    Remove unused variable 'didmsg'.

commit 36db6755103f01cb74bf4194fc81ca6d4b5320e4
Author: James Peach <jpeach at samba.org>
Date:   Wed Dec 19 22:33:43 2007 -0800

    Fix a couple of warnings in mDNS registration. One of these is an
    actual bug where we pass a pointer instead of a pointer to a pointer.

commit 555173eb3f6511e88798d6ef3d1fed0c219a9921
Author: James Peach <jpeach at apple.com>
Date:   Mon Oct 15 14:03:40 2007 -0700

    Add filesystem capabilities bitmask to statfs info.
    
    This patch adds Darwin support for the Samba statfs VFS call. It
    also adds a filesystem capabilities bitmask to the information
    returned by the call.

commit d5d9e4084cfb3db3bebff0334b93f376022ef5d3
Author: James Peach <jpeach at apple.com>
Date:   Mon Oct 15 14:01:12 2007 -0700

    Expose per-fsp extension talloc context.
    
    This patch supplements the fsp extension API with an operation to
    retrieve the malloc zone pointer for that fsp.

commit 9fead46b54519b3df78a869dbc99207046587d6a
Author: James Peach <jpeach at apple.com>
Date:   Mon Oct 15 13:59:37 2007 -0700

    Release per-fsp data on file closure.

-----------------------------------------------------------------------

Summary of changes:
 source/include/vfs.h           |   11 +++++
 source/modules/vfs_readahead.c |    4 --
 source/smbd/dnsregister.c      |    3 +-
 source/smbd/files.c            |    5 ++
 source/smbd/statvfs.c          |   85 ++++++++++++++++++++++++++++++++++++++++
 source/smbd/vfs.c              |   16 +++++++-
 6 files changed, 116 insertions(+), 8 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/include/vfs.h b/source/include/vfs.h
index e1669a2..5a3ec58 100644
--- a/source/include/vfs.h
+++ b/source/include/vfs.h
@@ -577,14 +577,25 @@ typedef struct vfs_statvfs_struct {
 	SMB_BIG_UINT FsIdentifier;   /* fsid */
 	/* NB Namelen comes from FILE_SYSTEM_ATTRIBUTE_INFO call */
 	/* NB flags can come from FILE_SYSTEM_DEVICE_INFO call   */
+
+	int FsCapabilities;
 } vfs_statvfs_struct;
 
+/* Add a new FSP extension of the given type. Returns a pointer to the
+ * extenstion data.
+ */
 #define VFS_ADD_FSP_EXTENSION(handle, fsp, type) \
     vfs_add_fsp_extension_notype(handle, (fsp), sizeof(type))
 
+/* Return a pointer to the existing FSP extension data. */
 #define VFS_FETCH_FSP_EXTENSION(handle, fsp) \
     vfs_fetch_fsp_extension(handle, (fsp))
 
+/* Return the talloc context associated with an FSP extension. */
+#define VFS_MEMCTX_FSP_EXTENSION(handle, fsp) \
+    vfs_memctx_fsp_extension(handle, (fsp))
+
+/* Remove and destroy an FSP extension. */
 #define VFS_REMOVE_FSP_EXTENSION(handle, fsp) \
     vfs_remove_fsp_extension((handle), (fsp))
 
diff --git a/source/modules/vfs_readahead.c b/source/modules/vfs_readahead.c
index 5b663a7..8fdd616 100644
--- a/source/modules/vfs_readahead.c
+++ b/source/modules/vfs_readahead.c
@@ -17,10 +17,6 @@
 
 #include "includes.h"
 
-#if !defined(HAVE_LINUX_READAHEAD) && !defined(HAVE_POSIX_FADVISE)
-static bool didmsg;
-#endif
-
 struct readahead_data {
 	SMB_OFF_T off_bound;
 	SMB_OFF_T len;
diff --git a/source/smbd/dnsregister.c b/source/smbd/dnsregister.c
index 44bd39f..2319097 100644
--- a/source/smbd/dnsregister.c
+++ b/source/smbd/dnsregister.c
@@ -41,7 +41,6 @@ struct dns_reg_state {
 
 void dns_register_close(struct dns_reg_state **dns_state_ptr)
 {
-	int mdnsd_conn_fd;
 	struct dns_reg_state *dns_state = *dns_state_ptr;
 
 	if (dns_state == NULL) {
@@ -74,7 +73,7 @@ static void dns_register_smbd_retry(struct event_context *ctx,
 	/* Clear previous registration state to force new
 	 * registration attempt. Clears event handler.
 	 */
-	dns_register_close(dns_state);
+	dns_register_close(&dns_state);
 }
 
 static void schedule_dns_register_smbd_retry(struct dns_reg_state *dns_state,
diff --git a/source/smbd/files.c b/source/smbd/files.c
index 179963d..95f01b8 100644
--- a/source/smbd/files.c
+++ b/source/smbd/files.c
@@ -460,6 +460,11 @@ void file_free(files_struct *fsp)
 		ZERO_STRUCT(fsp_fi_cache);
 	}
 
+	/* Drop all remaining extensions. */
+	while (fsp->vfs_extension) {
+		vfs_remove_fsp_extension(fsp->vfs_extension->owner, fsp);
+	}
+
 	SAFE_FREE(fsp);
 }
 
diff --git a/source/smbd/statvfs.c b/source/smbd/statvfs.c
index f666320..5fc0afd 100644
--- a/source/smbd/statvfs.c
+++ b/source/smbd/statvfs.c
@@ -3,6 +3,7 @@
    VFS API's statvfs abstraction
    Copyright (C) Alexander Bokovoy			2005
    Copyright (C) Steve French				2005
+   Copyright (C) James Peach				2006
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -37,11 +38,93 @@ static int linux_statvfs(const char *path, vfs_statvfs_struct *statbuf)
 		statbuf->TotalFileNodes = statvfs_buf.f_files;
 		statbuf->FreeFileNodes = statvfs_buf.f_ffree;
 		statbuf->FsIdentifier = statvfs_buf.f_fsid;
+
+		/* Good defaults for Linux filesystems are case sensitive
+		 * and case preserving.
+		 */
+		statbuf->FsCapabilities =
+		    FILE_CASE_SENSITIVE_SEARCH | FILE_CASE_PRESERVING_NAMES;
 	}
 	return result;
 }
 #endif
 
+#if defined(DARWINOS)
+
+#include <sys/attr.h>
+
+static int darwin_fs_capabilities(const char * path)
+{
+	int caps = 0;
+	vol_capabilities_attr_t *vcaps;
+	struct attrlist	attrlist;
+	char attrbuf[sizeof(u_int32_t) + sizeof(vol_capabilities_attr_t)];
+
+#define FORMAT_CAP(vinfo, cap) \
+	( ((vinfo)->valid[VOL_CAPABILITIES_FORMAT] & (cap)) && \
+	   ((vinfo)->capabilities[VOL_CAPABILITIES_FORMAT] & (cap)) )
+
+#define INTERFACE_CAP(vinfo, cap) \
+	( ((vinfo)->valid[VOL_CAPABILITIES_INTERFACES] & (cap)) && \
+	   ((vinfo)->capabilities[VOL_CAPABILITIES_INTERFACES] & (cap)) )
+
+	ZERO_STRUCT(attrlist);
+	attrlist.bitmapcount = ATTR_BIT_MAP_COUNT;
+	attrlist.volattr = ATTR_VOL_CAPABILITIES;
+
+	if (getattrlist(path, &attrlist, attrbuf, sizeof(attrbuf), 0) != 0) {
+		DEBUG(0, ("getattrlist for %s capabilities failed: %s\n",
+			    path, strerror(errno)));
+		/* Return no capabilities on failure. */
+		return 0;
+	}
+
+	vcaps =
+	    (vol_capabilities_attr_t *)(attrbuf + sizeof(u_int32_t));
+
+	if (FORMAT_CAP(vcaps, VOL_CAP_FMT_SPARSE_FILES)) {
+		caps |= FILE_SUPPORTS_SPARSE_FILES;
+	}
+
+	if (FORMAT_CAP(vcaps, VOL_CAP_FMT_CASE_SENSITIVE)) {
+		caps |= FILE_CASE_SENSITIVE_SEARCH;
+	}
+
+	if (FORMAT_CAP(vcaps, VOL_CAP_FMT_CASE_PRESERVING)) {
+		caps |= FILE_CASE_PRESERVED_NAMES;
+	}
+
+	if (INTERFACE_CAP(vcaps, VOL_CAP_INT_EXTENDED_SECURITY)) {
+		caps |= FILE_PERSISTENT_ACLS;
+	}
+
+	return caps;
+}
+
+static int darwin_statvfs(const char *path, vfs_statvfs_struct *statbuf)
+{
+	struct statfs sbuf;
+	int ret;
+
+	ret = statfs(path, &sbuf);
+	if (ret != 0) {
+		return ret;
+	}
+
+	statbuf->OptimalTransferSize = sbuf.f_iosize;
+	statbuf->BlockSize = sbuf.f_bsize;
+	statbuf->TotalBlocks = sbuf.f_blocks;
+	statbuf->BlocksAvail = sbuf.f_bfree;
+	statbuf->UserBlocksAvail = sbuf.f_bavail;
+	statbuf->TotalFileNodes = sbuf.f_files;
+	statbuf->FreeFileNodes = sbuf.f_ffree;
+	statbuf->FsIdentifier = *(SMB_BIG_UINT *)(&sbuf.f_fsid); /* Ick. */
+	statbuf->FsCapabilities = darwin_fs_capabilities(sbuf.f_mntonname);
+
+	return 0;
+}
+#endif
+
 /* 
  sys_statvfs() is an abstraction layer over system-dependent statvfs()/statfs()
  for particular POSIX systems. Due to controversy of what is considered more important
@@ -52,6 +135,8 @@ int sys_statvfs(const char *path, vfs_statvfs_struct *statbuf)
 {
 #if defined(LINUX) && defined(HAVE_FSID_INT)
 	return linux_statvfs(path, statbuf);
+#elif defined(DARWINOS)
+	return darwin_statvfs(path, statbuf);
 #else
 	/* BB change this to return invalid level */
 #ifdef EOPNOTSUPP
diff --git a/source/smbd/vfs.c b/source/smbd/vfs.c
index 45d0788..96d71da 100644
--- a/source/smbd/vfs.c
+++ b/source/smbd/vfs.c
@@ -263,19 +263,31 @@ void vfs_remove_fsp_extension(vfs_handle_struct *handle, files_struct *fsp)
 	}
 }
 
-void *vfs_fetch_fsp_extension(vfs_handle_struct *handle, files_struct *fsp)
+void *vfs_memctx_fsp_extension(vfs_handle_struct *handle, files_struct *fsp)
 {
 	struct vfs_fsp_data *head;
 
 	for (head = fsp->vfs_extension; head; head = head->next) {
 		if (head->owner == handle) {
-			return EXT_DATA_AREA(head);
+			return head;
 		}
 	}
 
 	return NULL;
 }
 
+void *vfs_fetch_fsp_extension(vfs_handle_struct *handle, files_struct *fsp)
+{
+	struct vfs_fsp_data *head;
+
+	head = vfs_memctx_fsp_extension(handle, fsp);
+	if (head != NULL) {
+		return EXT_DATA_AREA(head);
+	}
+
+	return NULL;
+}
+
 #undef EXT_DATA_AREA
 
 /*****************************************************************


-- 
Samba Shared Repository


More information about the samba-cvs mailing list