>From ba0788cc9b952c02bf3acb8b81ed6bb6d218d5b8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd@samba.org>
Date: Wed, 20 Apr 2011 22:55:25 +0200
Subject: [PATCH] s3-vfs: rename open function to open_fn.

This should finally fix the AIX build and allow to remove AIX specific ifdefs.

Guenther
---
 examples/VFS/skel_opaque.c                 |    2 +-
 examples/VFS/skel_transparent.c            |    2 +-
 source3/include/vfs.h                      |    7 ++++---
 source3/modules/vfs_acl_tdb.c              |    2 +-
 source3/modules/vfs_acl_xattr.c            |    2 +-
 source3/modules/vfs_audit.c                |    2 +-
 source3/modules/vfs_cap.c                  |    2 +-
 source3/modules/vfs_catia.c                |    2 +-
 source3/modules/vfs_commit.c               |    2 +-
 source3/modules/vfs_default.c              |    6 +-----
 source3/modules/vfs_extd_audit.c           |    2 +-
 source3/modules/vfs_full_audit.c           |    2 +-
 source3/modules/vfs_onefs.c                |    2 +-
 source3/modules/vfs_onefs_shadow_copy.c    |    2 +-
 source3/modules/vfs_prealloc.c             |    2 +-
 source3/modules/vfs_preopen.c              |    2 +-
 source3/modules/vfs_scannedonly.c          |    2 +-
 source3/modules/vfs_shadow_copy2.c         |    2 +-
 source3/modules/vfs_smb_traffic_analyzer.c |    2 +-
 source3/modules/vfs_streams_depot.c        |    2 +-
 source3/modules/vfs_streams_xattr.c        |    2 +-
 source3/modules/vfs_syncops.c              |    2 +-
 source3/modules/vfs_time_audit.c           |    2 +-
 source3/smbd/vfs.c                         |    7 ++-----
 24 files changed, 28 insertions(+), 34 deletions(-)

diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c
index ef7c3af..f60f0fe 100644
--- a/examples/VFS/skel_opaque.c
+++ b/examples/VFS/skel_opaque.c
@@ -801,7 +801,7 @@ struct vfs_fn_pointers skel_transparent_fns = {
 
 	/* File operations */
 
-	.open = skel_open,
+	.open_fn = skel_open,
 	.create_file = skel_create_file,
 	.close_fn = skel_close_fn,
 	.vfs_read = skel_vfs_read,
diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c
index 403e28d..f06e02a 100644
--- a/examples/VFS/skel_transparent.c
+++ b/examples/VFS/skel_transparent.c
@@ -745,7 +745,7 @@ struct vfs_fn_pointers skel_transparent_fns = {
 
 	/* File operations */
 
-	.open = skel_open,
+	.open_fn = skel_open,
 	.create_file = skel_create_file,
 	.close_fn = skel_close_fn,
 	.vfs_read = skel_vfs_read,
diff --git a/source3/include/vfs.h b/source3/include/vfs.h
index ad15bd8..28d6c38 100644
--- a/source3/include/vfs.h
+++ b/source3/include/vfs.h
@@ -133,6 +133,7 @@
 /* Leave at 28 - not yet released. Rename posix_fallocate to fallocate
 		to split out the two possible uses. JRA. */
 /* Leave at 28 - not yet released. Add fdopendir. JRA. */
+/* Leave at 28 - not yet released. Rename open function to open_fn. - gd */
 #define SMB_VFS_INTERFACE_VERSION 28
 
 
@@ -214,9 +215,9 @@ struct vfs_fn_pointers {
 
 	/* File operations */
 
-	int (*open)(struct vfs_handle_struct *handle,
-		    struct smb_filename *smb_fname, files_struct *fsp,
-		    int flags, mode_t mode);
+	int (*open_fn)(struct vfs_handle_struct *handle,
+		       struct smb_filename *smb_fname, files_struct *fsp,
+		       int flags, mode_t mode);
 	NTSTATUS (*create_file)(struct vfs_handle_struct *handle,
 				struct smb_request *req,
 				uint16_t root_dir_fid,
diff --git a/source3/modules/vfs_acl_tdb.c b/source3/modules/vfs_acl_tdb.c
index 17cf493..f2e0415 100644
--- a/source3/modules/vfs_acl_tdb.c
+++ b/source3/modules/vfs_acl_tdb.c
@@ -402,7 +402,7 @@ static struct vfs_fn_pointers vfs_acl_tdb_fns = {
 	.opendir = opendir_acl_common,
 	.mkdir = mkdir_acl_common,
 	.rmdir = rmdir_acl_tdb,
-	.open = open_acl_common,
+	.open_fn = open_acl_common,
 	.create_file = create_file_acl_common,
 	.unlink = unlink_acl_tdb,
 	.chmod = chmod_acl_module_common,
diff --git a/source3/modules/vfs_acl_xattr.c b/source3/modules/vfs_acl_xattr.c
index 90959f3..2a83430 100644
--- a/source3/modules/vfs_acl_xattr.c
+++ b/source3/modules/vfs_acl_xattr.c
@@ -206,7 +206,7 @@ static struct vfs_fn_pointers vfs_acl_xattr_fns = {
 	.opendir = opendir_acl_common,
 	.mkdir = mkdir_acl_common,
 	.rmdir = rmdir_acl_common,
-	.open = open_acl_common,
+	.open_fn = open_acl_common,
 	.create_file = create_file_acl_common,
 	.unlink = unlink_acl_common,
 	.chmod = chmod_acl_module_common,
diff --git a/source3/modules/vfs_audit.c b/source3/modules/vfs_audit.c
index e816a0b..349600f 100644
--- a/source3/modules/vfs_audit.c
+++ b/source3/modules/vfs_audit.c
@@ -270,7 +270,7 @@ static struct vfs_fn_pointers vfs_audit_fns = {
 	.opendir = audit_opendir,
 	.mkdir = audit_mkdir,
 	.rmdir = audit_rmdir,
-	.open = audit_open,
+	.open_fn = audit_open,
 	.close_fn = audit_close,
 	.rename = audit_rename,
 	.unlink = audit_unlink,
diff --git a/source3/modules/vfs_cap.c b/source3/modules/vfs_cap.c
index 9edf133..7aab6c3 100644
--- a/source3/modules/vfs_cap.c
+++ b/source3/modules/vfs_cap.c
@@ -576,7 +576,7 @@ static struct vfs_fn_pointers vfs_cap_fns = {
 	.readdir = cap_readdir,
 	.mkdir = cap_mkdir,
 	.rmdir = cap_rmdir,
-	.open = cap_open,
+	.open_fn = cap_open,
 	.rename = cap_rename,
 	.stat = cap_stat,
 	.lstat = cap_lstat,
diff --git a/source3/modules/vfs_catia.c b/source3/modules/vfs_catia.c
index 12a32d2..31b9f18 100644
--- a/source3/modules/vfs_catia.c
+++ b/source3/modules/vfs_catia.c
@@ -990,7 +990,7 @@ static struct vfs_fn_pointers vfs_catia_fns = {
         .mkdir = catia_mkdir,
         .rmdir = catia_rmdir,
         .opendir = catia_opendir,
-        .open = catia_open,
+        .open_fn = catia_open,
         .rename = catia_rename,
         .stat = catia_stat,
         .lstat = catia_lstat,
diff --git a/source3/modules/vfs_commit.c b/source3/modules/vfs_commit.c
index 4a202a0..2acfb97 100644
--- a/source3/modules/vfs_commit.c
+++ b/source3/modules/vfs_commit.c
@@ -304,7 +304,7 @@ static int commit_ftruncate(
 }
 
 static struct vfs_fn_pointers vfs_commit_fns = {
-        .open = commit_open,
+        .open_fn = commit_open,
         .close_fn = commit_close,
         .write = commit_write,
         .pwrite = commit_pwrite,
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index 4e993e1..cf6e24f 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -1649,10 +1649,6 @@ static int vfswrap_set_offline(struct vfs_handle_struct *handle,
 	return -1;
 }
 
-#ifdef AIX
-#undef open /* AIX defines open to be open64 */
-#endif
-
 static struct vfs_fn_pointers vfs_default_fns = {
 	/* Disk operations */
 
@@ -1680,7 +1676,7 @@ static struct vfs_fn_pointers vfs_default_fns = {
 
 	/* File operations */
 
-	.open = vfswrap_open,
+	.open_fn = vfswrap_open,
 	.create_file = vfswrap_create_file,
 	.close_fn = vfswrap_close,
 	.vfs_read = vfswrap_read,
diff --git a/source3/modules/vfs_extd_audit.c b/source3/modules/vfs_extd_audit.c
index bb33489..34a43c7 100644
--- a/source3/modules/vfs_extd_audit.c
+++ b/source3/modules/vfs_extd_audit.c
@@ -347,7 +347,7 @@ static struct vfs_fn_pointers vfs_extd_audit_fns = {
 	.opendir = audit_opendir,
 	.mkdir = audit_mkdir,
 	.rmdir = audit_rmdir,
-	.open = audit_open,
+	.open_fn = audit_open,
 	.close_fn = audit_close,
 	.rename = audit_rename,
 	.unlink = audit_unlink,
diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c
index 9f450e8..a723a0c 100644
--- a/source3/modules/vfs_full_audit.c
+++ b/source3/modules/vfs_full_audit.c
@@ -2253,7 +2253,7 @@ static struct vfs_fn_pointers vfs_full_audit_fns = {
 	.rmdir = smb_full_audit_rmdir,
 	.closedir = smb_full_audit_closedir,
 	.init_search_op = smb_full_audit_init_search_op,
-	.open = smb_full_audit_open,
+	.open_fn = smb_full_audit_open,
 	.create_file = smb_full_audit_create_file,
 	.close_fn = smb_full_audit_close,
 	.vfs_read = smb_full_audit_read,
diff --git a/source3/modules/vfs_onefs.c b/source3/modules/vfs_onefs.c
index 94685f6..efc8b8a 100644
--- a/source3/modules/vfs_onefs.c
+++ b/source3/modules/vfs_onefs.c
@@ -265,7 +265,7 @@ static struct vfs_fn_pointers onefs_fns = {
 	.mkdir = onefs_mkdir,
 	.closedir = onefs_closedir,
 	.init_search_op = onefs_init_search_op,
-	.open = onefs_open,
+	.open_fn = onefs_open,
 	.create_file = onefs_create_file,
 	.close_fn = onefs_close,
 	.sendfile = onefs_sendfile,
diff --git a/source3/modules/vfs_onefs_shadow_copy.c b/source3/modules/vfs_onefs_shadow_copy.c
index 89be05d..a8a41bf 100644
--- a/source3/modules/vfs_onefs_shadow_copy.c
+++ b/source3/modules/vfs_onefs_shadow_copy.c
@@ -663,7 +663,7 @@ static struct vfs_fn_pointers onefs_shadow_copy_fns = {
 	.opendir = onefs_shadow_copy_opendir,
 	.mkdir = onefs_shadow_copy_mkdir,
 	.rmdir = onefs_shadow_copy_rmdir,
-	.open = onefs_shadow_copy_open,
+	.open_fn = onefs_shadow_copy_open,
 	.create_file = onefs_shadow_copy_create_file,
 	.rename = onefs_shadow_copy_rename,
 	.stat = onefs_shadow_copy_stat,
diff --git a/source3/modules/vfs_prealloc.c b/source3/modules/vfs_prealloc.c
index dce3044..4d1b2e1 100644
--- a/source3/modules/vfs_prealloc.c
+++ b/source3/modules/vfs_prealloc.c
@@ -214,7 +214,7 @@ static int prealloc_ftruncate(vfs_handle_struct * handle,
 }
 
 static struct vfs_fn_pointers prealloc_fns = {
-	.open = prealloc_open,
+	.open_fn = prealloc_open,
 	.ftruncate = prealloc_ftruncate,
 	.connect_fn = prealloc_connect,
 };
diff --git a/source3/modules/vfs_preopen.c b/source3/modules/vfs_preopen.c
index 10519c9..82969e4 100644
--- a/source3/modules/vfs_preopen.c
+++ b/source3/modules/vfs_preopen.c
@@ -443,7 +443,7 @@ static int preopen_open(vfs_handle_struct *handle,
 }
 
 static struct vfs_fn_pointers vfs_preopen_fns = {
-	.open = preopen_open
+	.open_fn = preopen_open
 };
 
 NTSTATUS vfs_preopen_init(void);
diff --git a/source3/modules/vfs_scannedonly.c b/source3/modules/vfs_scannedonly.c
index bc9ae64..d0eba21 100644
--- a/source3/modules/vfs_scannedonly.c
+++ b/source3/modules/vfs_scannedonly.c
@@ -1026,7 +1026,7 @@ static struct vfs_fn_pointers vfs_scannedonly_fns = {
 	.rmdir = scannedonly_rmdir,
 	.stat = scannedonly_stat,
 	.lstat = scannedonly_lstat,
-	.open = scannedonly_open,
+	.open_fn = scannedonly_open,
 	.close_fn = scannedonly_close,
 	.rename = scannedonly_rename,
 	.unlink = scannedonly_unlink,
diff --git a/source3/modules/vfs_shadow_copy2.c b/source3/modules/vfs_shadow_copy2.c
index 3fbe22b..df3bde7 100644
--- a/source3/modules/vfs_shadow_copy2.c
+++ b/source3/modules/vfs_shadow_copy2.c
@@ -956,7 +956,7 @@ static struct vfs_fn_pointers vfs_shadow_copy2_fns = {
         .lremovexattr = shadow_copy2_lremovexattr,
         .setxattr = shadow_copy2_setxattr,
         .lsetxattr = shadow_copy2_lsetxattr,
-        .open = shadow_copy2_open,
+        .open_fn = shadow_copy2_open,
         .rename = shadow_copy2_rename,
         .stat = shadow_copy2_stat,
         .lstat = shadow_copy2_lstat,
diff --git a/source3/modules/vfs_smb_traffic_analyzer.c b/source3/modules/vfs_smb_traffic_analyzer.c
index 48251bb..e8aa385 100644
--- a/source3/modules/vfs_smb_traffic_analyzer.c
+++ b/source3/modules/vfs_smb_traffic_analyzer.c
@@ -893,7 +893,7 @@ static struct vfs_fn_pointers vfs_smb_traffic_analyzer_fns = {
 	.mkdir = smb_traffic_analyzer_mkdir,
 	.rename = smb_traffic_analyzer_rename,
 	.chdir = smb_traffic_analyzer_chdir,
-	.open = smb_traffic_analyzer_open,
+	.open_fn = smb_traffic_analyzer_open,
 	.rmdir = smb_traffic_analyzer_rmdir,
 	.close_fn = smb_traffic_analyzer_close,
 	.sendfile = smb_traffic_analyzer_sendfile,
diff --git a/source3/modules/vfs_streams_depot.c b/source3/modules/vfs_streams_depot.c
index 0f94820..01851cd 100644
--- a/source3/modules/vfs_streams_depot.c
+++ b/source3/modules/vfs_streams_depot.c
@@ -876,7 +876,7 @@ static uint32_t streams_depot_fs_capabilities(struct vfs_handle_struct *handle,
 
 static struct vfs_fn_pointers vfs_streams_depot_fns = {
 	.fs_capabilities = streams_depot_fs_capabilities,
-	.open = streams_depot_open,
+	.open_fn = streams_depot_open,
 	.stat = streams_depot_stat,
 	.lstat = streams_depot_lstat,
 	.unlink = streams_depot_unlink,
diff --git a/source3/modules/vfs_streams_xattr.c b/source3/modules/vfs_streams_xattr.c
index 19cded6..34e01b0 100644
--- a/source3/modules/vfs_streams_xattr.c
+++ b/source3/modules/vfs_streams_xattr.c
@@ -1053,7 +1053,7 @@ static int streams_xattr_fallocate(struct vfs_handle_struct *handle,
 
 static struct vfs_fn_pointers vfs_streams_xattr_fns = {
 	.fs_capabilities = streams_xattr_fs_capabilities,
-	.open = streams_xattr_open,
+	.open_fn = streams_xattr_open,
 	.stat = streams_xattr_stat,
 	.fstat = streams_xattr_fstat,
 	.lstat = streams_xattr_lstat,
diff --git a/source3/modules/vfs_syncops.c b/source3/modules/vfs_syncops.c
index 22044f9..a792fb4 100644
--- a/source3/modules/vfs_syncops.c
+++ b/source3/modules/vfs_syncops.c
@@ -282,7 +282,7 @@ static struct vfs_fn_pointers vfs_syncops_fns = {
 	.connect_fn = syncops_connect,
         .mkdir = syncops_mkdir,
         .rmdir = syncops_rmdir,
-        .open = syncops_open,
+        .open_fn = syncops_open,
         .rename = syncops_rename,
         .unlink = syncops_unlink,
         .symlink = syncops_symlink,
diff --git a/source3/modules/vfs_time_audit.c b/source3/modules/vfs_time_audit.c
index 6ceeb2e..37fe1c6 100644
--- a/source3/modules/vfs_time_audit.c
+++ b/source3/modules/vfs_time_audit.c
@@ -2355,7 +2355,7 @@ static struct vfs_fn_pointers vfs_time_audit_fns = {
 	.rmdir = smb_time_audit_rmdir,
 	.closedir = smb_time_audit_closedir,
 	.init_search_op = smb_time_audit_init_search_op,
-	.open = smb_time_audit_open,
+	.open_fn = smb_time_audit_open,
 	.create_file = smb_time_audit_create_file,
 	.close_fn = smb_time_audit_close,
 	.vfs_read = smb_time_audit_read,
diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c
index aaa713e..414e00c 100644
--- a/source3/smbd/vfs.c
+++ b/source3/smbd/vfs.c
@@ -1273,11 +1273,8 @@ int smb_vfs_call_open(struct vfs_handle_struct *handle,
 		      struct smb_filename *smb_fname, struct files_struct *fsp,
 		      int flags, mode_t mode)
 {
-#ifdef AIX
-#undef open /* AIX defines open to be open64 */
-#endif
-	VFS_FIND(open);
-	return handle->fns->open(handle, smb_fname, fsp, flags, mode);
+	VFS_FIND(open_fn);
+	return handle->fns->open_fn(handle, smb_fname, fsp, flags, mode);
 }
 
 NTSTATUS smb_vfs_call_create_file(struct vfs_handle_struct *handle,
-- 
1.7.4.4

