[PATCHES] vfs: remove SMB_VFS_INIT_SEARCH_OP
Uri Simchoni
uri at samba.org
Fri Nov 10 20:14:54 UTC 2017
Hi,
This patch set removes SMB_VFS_INIT_SEARCH_OP and all its uses and
implementations.
- Originally, this op was added in 2009 to support Isilon Onefs (commit
6272f4c2f453c509b8a3893d4c2ac5fc356b348d).
- Currently, all in-tree VFS modules treat this as a no-op.
- SMB2 code omits calling SMB_VFS_INIT_SEARCH_OP, which kind of hints
that no maintained out-of-tree module uses it (or people would complain)
Please review and maybe push...
Thanks,
Uri.
-------------- next part --------------
From 932af3ccd5d6c1b63190a494dfca7ec69b4114cb Mon Sep 17 00:00:00 2001
From: Uri Simchoni <uri at samba.org>
Date: Fri, 10 Nov 2017 21:32:49 +0200
Subject: [PATCH 1/9] smbd: remove calls to dptr_init_search_op()
dptr_init_search_op() invokes a VFS operation which is
a no-op in all in-tree VFS modules. Furthermore,
dptr_init_search_op() is not being called from SMB2 search
code, which hints that no out-of-tree VFS module needs it.
Signed-off-by: Uri Simchoni <uri at samba.org>
---
source3/smbd/reply.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 7b07078..9c82ebf 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -1896,9 +1896,6 @@ void reply_search(struct smb_request *req)
DEBUG(4,("dptr_num is %d\n",dptr_num));
- /* Initialize per SMBsearch/SMBffirst/SMBfunique operation data */
- dptr_init_search_op(dirptr);
-
if ((dirtype&0x1F) == FILE_ATTRIBUTE_VOLUME) {
char buf[DIR_STRUCT_SIZE];
memcpy(buf,status,21);
--
2.9.5
From 19c1bfcb44c0441ca88d80f266f478258b0334d3 Mon Sep 17 00:00:00 2001
From: Uri Simchoni <uri at samba.org>
Date: Fri, 10 Nov 2017 21:35:54 +0200
Subject: [PATCH 2/9] smbd: remove calls to dptr_init_search_op() from TRANS2
search code
dptr_init_search_op() invokes VFS operations which are no-op in all
in-tree VFS modules. Furthermore, it's not being called by the SMB2
search code, so probably it's not being used by any out-of-tree VFS
module either.
Signed-off-by: Uri Simchoni <uri at samba.org>
---
source3/smbd/trans2.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index de6073a..dbad71b 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -2867,9 +2867,6 @@ total_data=%u (should be %u)\n", (unsigned int)total_data, (unsigned int)IVAL(pd
dptr_num = dptr_dnum(dirptr);
DEBUG(4,("dptr_num is %d, wcard = %s, attr = %d\n", dptr_num, mask, dirtype));
- /* Initialize per TRANS2_FIND_FIRST operation data */
- dptr_init_search_op(dirptr);
-
/* We don't need to check for VOL here as this is returned by
a different TRANS2 call. */
@@ -3237,9 +3234,6 @@ total_data=%u (should be %u)\n", (unsigned int)total_data, (unsigned int)IVAL(pd
dptr_TellDir(dirptr),
(int)backup_priv));
- /* Initialize per TRANS2_FIND_NEXT operation data */
- dptr_init_search_op(dirptr);
-
/* We don't need to check for VOL here as this is returned by
a different TRANS2 call. */
--
2.9.5
From 6bf85176b4ead75529b7fa81b2c37f7ccf1fca57 Mon Sep 17 00:00:00 2001
From: Uri Simchoni <uri at samba.org>
Date: Fri, 10 Nov 2017 21:38:41 +0200
Subject: [PATCH 3/9] smbd: remove dptr_init_search_op()
This function is now not being used.
Signed-off-by: Uri Simchoni <uri at samba.org>
---
source3/smbd/dir.c | 8 --------
source3/smbd/proto.h | 1 -
2 files changed, 9 deletions(-)
diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c
index 19e2964..6621b4e 100644
--- a/source3/smbd/dir.c
+++ b/source3/smbd/dir.c
@@ -887,14 +887,6 @@ bool dptr_SearchDir(struct dptr_struct *dptr, const char *name, long *poffset, S
}
/****************************************************************************
- Initialize variables & state data at the beginning of all search SMB requests.
-****************************************************************************/
-void dptr_init_search_op(struct dptr_struct *dptr)
-{
- SMB_VFS_INIT_SEARCH_OP(dptr->conn, dptr->dir_hnd->dir);
-}
-
-/****************************************************************************
Map a native directory offset to a 32-bit cookie.
****************************************************************************/
diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h
index a688341..565ba08 100644
--- a/source3/smbd/proto.h
+++ b/source3/smbd/proto.h
@@ -207,7 +207,6 @@ int dptr_dnum(struct dptr_struct *dptr);
bool dptr_get_priv(struct dptr_struct *dptr);
void dptr_set_priv(struct dptr_struct *dptr);
bool dptr_SearchDir(struct dptr_struct *dptr, const char *name, long *poffset, SMB_STRUCT_STAT *pst);
-void dptr_init_search_op(struct dptr_struct *dptr);
bool dptr_fill(struct smbd_server_connection *sconn,
char *buf1,unsigned int key);
struct dptr_struct *dptr_fetch(struct smbd_server_connection *sconn,
--
2.9.5
From 22340a9b117eb6e788290a55a45a0207ba6f09ae Mon Sep 17 00:00:00 2001
From: Uri Simchoni <uri at samba.org>
Date: Fri, 10 Nov 2017 21:20:47 +0200
Subject: [PATCH 4/9] VFS examples: remove init_search_ops
Signed-off-by: Uri Simchoni <uri at samba.org>
---
examples/VFS/skel_opaque.c | 6 ------
examples/VFS/skel_transparent.c | 6 ------
2 files changed, 12 deletions(-)
diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c
index 614dcff..e6c066d 100644
--- a/examples/VFS/skel_opaque.c
+++ b/examples/VFS/skel_opaque.c
@@ -185,11 +185,6 @@ static int skel_closedir(vfs_handle_struct *handle, DIR *dir)
return -1;
}
-static void skel_init_search_op(struct vfs_handle_struct *handle, DIR *dirp)
-{
- ;
-}
-
static int skel_open(vfs_handle_struct *handle, struct smb_filename *smb_fname,
files_struct *fsp, int flags, mode_t mode)
{
@@ -954,7 +949,6 @@ struct vfs_fn_pointers skel_opaque_fns = {
.mkdir_fn = skel_mkdir,
.rmdir_fn = skel_rmdir,
.closedir_fn = skel_closedir,
- .init_search_op_fn = skel_init_search_op,
/* File operations */
diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c
index 2f59a3d..59d1634 100644
--- a/examples/VFS/skel_transparent.c
+++ b/examples/VFS/skel_transparent.c
@@ -182,11 +182,6 @@ static int skel_closedir(vfs_handle_struct *handle, DIR *dir)
return SMB_VFS_NEXT_CLOSEDIR(handle, dir);
}
-static void skel_init_search_op(struct vfs_handle_struct *handle, DIR *dirp)
-{
- SMB_VFS_NEXT_INIT_SEARCH_OP(handle, dirp);
-}
-
static int skel_open(vfs_handle_struct *handle, struct smb_filename *smb_fname,
files_struct *fsp, int flags, mode_t mode)
{
@@ -1127,7 +1122,6 @@ struct vfs_fn_pointers skel_transparent_fns = {
.mkdir_fn = skel_mkdir,
.rmdir_fn = skel_rmdir,
.closedir_fn = skel_closedir,
- .init_search_op_fn = skel_init_search_op,
/* File operations */
--
2.9.5
From 47af19092aec5fe9b849074be865c7a66d8074a7 Mon Sep 17 00:00:00 2001
From: Uri Simchoni <uri at samba.org>
Date: Fri, 10 Nov 2017 21:39:54 +0200
Subject: [PATCH 5/9] vfs_glusterfs: remove init_search_op handling
This VFS function is about to be removed. It can be
removed by a separate commit because both the glusterfs
and the default implementations are no-ops.
Signed-off-by: Uri Simchoni <uri at samba.org>
---
source3/modules/vfs_glusterfs.c | 7 -------
1 file changed, 7 deletions(-)
diff --git a/source3/modules/vfs_glusterfs.c b/source3/modules/vfs_glusterfs.c
index 3534ed7..17f7178 100644
--- a/source3/modules/vfs_glusterfs.c
+++ b/source3/modules/vfs_glusterfs.c
@@ -541,12 +541,6 @@ static void vfs_gluster_rewinddir(struct vfs_handle_struct *handle, DIR *dirp)
glfs_seekdir((void *)dirp, 0);
}
-static void vfs_gluster_init_search_op(struct vfs_handle_struct *handle,
- DIR *dirp)
-{
- return;
-}
-
static int vfs_gluster_mkdir(struct vfs_handle_struct *handle,
const struct smb_filename *smb_fname,
mode_t mode)
@@ -1434,7 +1428,6 @@ static struct vfs_fn_pointers glusterfs_fns = {
.mkdir_fn = vfs_gluster_mkdir,
.rmdir_fn = vfs_gluster_rmdir,
.closedir_fn = vfs_gluster_closedir,
- .init_search_op_fn = vfs_gluster_init_search_op,
/* File Operations */
--
2.9.5
From 5b62d5163e4b3f9c2ff8cba190dd04be105731d5 Mon Sep 17 00:00:00 2001
From: Uri Simchoni <uri at samba.org>
Date: Fri, 10 Nov 2017 21:47:29 +0200
Subject: [PATCH 6/9] vfs_time_audit: remove init_search_op implementation
This VFS call is about to be removed in a following commit.
Signed-off-by: Uri Simchoni <uri at samba.org>
---
source3/modules/vfs_time_audit.c | 17 -----------------
1 file changed, 17 deletions(-)
diff --git a/source3/modules/vfs_time_audit.c b/source3/modules/vfs_time_audit.c
index 7116796..8e08a7b 100644
--- a/source3/modules/vfs_time_audit.c
+++ b/source3/modules/vfs_time_audit.c
@@ -550,22 +550,6 @@ static int smb_time_audit_closedir(vfs_handle_struct *handle,
return result;
}
-static void smb_time_audit_init_search_op(vfs_handle_struct *handle,
- DIR *dirp)
-{
- struct timespec ts1,ts2;
- double timediff;
-
- clock_gettime_mono(&ts1);
- SMB_VFS_NEXT_INIT_SEARCH_OP(handle, dirp);
- clock_gettime_mono(&ts2);
- timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
-
- if (timediff > audit_timeout) {
- smb_time_audit_log("init_search_op", timediff);
- }
-}
-
static int smb_time_audit_open(vfs_handle_struct *handle,
struct smb_filename *fname,
files_struct *fsp,
@@ -2708,7 +2692,6 @@ static struct vfs_fn_pointers vfs_time_audit_fns = {
.mkdir_fn = smb_time_audit_mkdir,
.rmdir_fn = smb_time_audit_rmdir,
.closedir_fn = smb_time_audit_closedir,
- .init_search_op_fn = smb_time_audit_init_search_op,
.open_fn = smb_time_audit_open,
.create_file_fn = smb_time_audit_create_file,
.close_fn = smb_time_audit_close,
--
2.9.5
From 206cf364e6684090021959191bf193d924817129 Mon Sep 17 00:00:00 2001
From: Uri Simchoni <uri at samba.org>
Date: Fri, 10 Nov 2017 21:48:26 +0200
Subject: [PATCH 7/9] vfs_media_harmony: remove handling of init_search_op
This VFS function is about to be removed in a following commit.
In the meantime, not handling it by vfs_media_harmony poses no
issue because the underlying implenentation is a no-op.
Signed-off-by: Uri Simchoni <uri at samba.org>
---
source3/modules/vfs_media_harmony.c | 13 -------------
1 file changed, 13 deletions(-)
diff --git a/source3/modules/vfs_media_harmony.c b/source3/modules/vfs_media_harmony.c
index e39a444..43e6908 100644
--- a/source3/modules/vfs_media_harmony.c
+++ b/source3/modules/vfs_media_harmony.c
@@ -1129,18 +1129,6 @@ static int mh_closedir(vfs_handle_struct *handle,
}
/*
- * Success: no success result defined.
- * Failure: no failure result defined.
- */
-static void mh_init_search_op(vfs_handle_struct *handle,
- DIR *dirp)
-{
- DEBUG(MH_INFO_DEBUG, ("Entering and leaving mh_init_search_op\n"));
- SMB_VFS_NEXT_INIT_SEARCH_OP(handle,
- ((mh_dirinfo_struct*)dirp)->dirstream);
-}
-
-/*
* Success: return non-negative file descriptor
* Failure: set errno, return -1
*/
@@ -2321,7 +2309,6 @@ static struct vfs_fn_pointers vfs_mh_fns = {
.mkdir_fn = mh_mkdir,
.rmdir_fn = mh_rmdir,
.closedir_fn = mh_closedir,
- .init_search_op_fn = mh_init_search_op,
/* File operations */
--
2.9.5
From 882514cbb023a9ebd1a0f8880889724d2c0ac8fd Mon Sep 17 00:00:00 2001
From: Uri Simchoni <uri at samba.org>
Date: Fri, 10 Nov 2017 21:50:17 +0200
Subject: [PATCH 8/9] vfs_unityed_media: remove handling of init_search_op
init_search_op is about to be removed from the VFS in
a following commit. In the meantime, removing it poses
no issue because he underlying impementation is a no-op.
Signed-off-by: Uri Simchoni <uri at samba.org>
---
source3/modules/vfs_unityed_media.c | 10 ----------
1 file changed, 10 deletions(-)
diff --git a/source3/modules/vfs_unityed_media.c b/source3/modules/vfs_unityed_media.c
index 34881bc..f55061a 100644
--- a/source3/modules/vfs_unityed_media.c
+++ b/source3/modules/vfs_unityed_media.c
@@ -846,15 +846,6 @@ static int um_closedir(vfs_handle_struct *handle,
return SMB_VFS_NEXT_CLOSEDIR(handle, realdirp);
}
-static void um_init_search_op(vfs_handle_struct *handle,
- DIR *dirp)
-{
- DEBUG(10, ("Entering and leaving um_init_search_op\n"));
-
- SMB_VFS_NEXT_INIT_SEARCH_OP(handle,
- ((um_dirinfo_struct*)dirp)->dirstream);
-}
-
static int um_open(vfs_handle_struct *handle,
struct smb_filename *smb_fname,
files_struct *fsp,
@@ -1908,7 +1899,6 @@ static struct vfs_fn_pointers vfs_um_fns = {
.mkdir_fn = um_mkdir,
.rmdir_fn = um_rmdir,
.closedir_fn = um_closedir,
- .init_search_op_fn = um_init_search_op,
/* File operations */
--
2.9.5
From 09ae182c9ce2b979f9f71ca690c59cad4bc4568c Mon Sep 17 00:00:00 2001
From: Uri Simchoni <uri at samba.org>
Date: Fri, 10 Nov 2017 21:53:58 +0200
Subject: [PATCH 9/9] vfs: remove SMB_VFS_INIT_SEARCH_OP
This VFS is no longer being called, hence removed.
Signed-off-by: Uri Simchoni <uri at samba.org>
---
source3/include/vfs.h | 6 ++----
source3/include/vfs_macros.h | 5 -----
source3/modules/vfs_default.c | 7 -------
source3/modules/vfs_full_audit.c | 11 -----------
source3/smbd/vfs.c | 7 -------
5 files changed, 2 insertions(+), 34 deletions(-)
diff --git a/source3/include/vfs.h b/source3/include/vfs.h
index d71d7cc..7372440 100644
--- a/source3/include/vfs.h
+++ b/source3/include/vfs.h
@@ -244,8 +244,9 @@
/* Version 37 - Remove SMB_VFS_STRICT_UNLOCK */
/* Version 37 - Rename SMB_VFS_STRICT_LOCK to
SMB_VFS_STRICT_LOCK_CHECK */
+/* Version 38 - Remove SMB_VFS_INIT_SEARCH_OP */
-#define SMB_VFS_INTERFACE_VERSION 37
+#define SMB_VFS_INTERFACE_VERSION 38
/*
All intercepted VFS operations must be declared as static functions inside module source
@@ -656,7 +657,6 @@ struct vfs_fn_pointers {
int (*rmdir_fn)(struct vfs_handle_struct *handle,
const struct smb_filename *smb_fname);
int (*closedir_fn)(struct vfs_handle_struct *handle, DIR *dir);
- void (*init_search_op_fn)(struct vfs_handle_struct *handle, DIR *dirp);
/* File operations */
@@ -1145,8 +1145,6 @@ int smb_vfs_call_rmdir(struct vfs_handle_struct *handle,
const struct smb_filename *smb_fname);
int smb_vfs_call_closedir(struct vfs_handle_struct *handle,
DIR *dir);
-void smb_vfs_call_init_search_op(struct vfs_handle_struct *handle,
- DIR *dirp);
int smb_vfs_call_open(struct vfs_handle_struct *handle,
struct smb_filename *smb_fname, struct files_struct *fsp,
int flags, mode_t mode);
diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h
index 3cce192..dcf788e 100644
--- a/source3/include/vfs_macros.h
+++ b/source3/include/vfs_macros.h
@@ -124,11 +124,6 @@
#define SMB_VFS_NEXT_CLOSEDIR(handle, dir) \
smb_vfs_call_closedir((handle)->next, (dir))
-#define SMB_VFS_INIT_SEARCH_OP(conn, dirp) \
- smb_vfs_call_init_search_op((conn)->vfs_handles, (dirp))
-#define SMB_VFS_NEXT_INIT_SEARCH_OP(handle, dirp) \
- smb_vfs_call_init_search_op((handle)->next, (dirp))
-
/* File operations */
#define SMB_VFS_OPEN(conn, fname, fsp, flags, mode) \
smb_vfs_call_open((conn)->vfs_handles, (fname), (fsp), (flags), (mode))
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index 53d9785..3379493 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -554,12 +554,6 @@ static int vfswrap_closedir(vfs_handle_struct *handle, DIR *dirp)
return result;
}
-static void vfswrap_init_search_op(vfs_handle_struct *handle,
- DIR *dirp)
-{
- /* Default behavior is a NOOP */
-}
-
/* File operations */
static int vfswrap_open(vfs_handle_struct *handle,
@@ -3052,7 +3046,6 @@ static struct vfs_fn_pointers vfs_default_fns = {
.mkdir_fn = vfswrap_mkdir,
.rmdir_fn = vfswrap_rmdir,
.closedir_fn = vfswrap_closedir,
- .init_search_op_fn = vfswrap_init_search_op,
/* File operations */
diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c
index a205007..b847159 100644
--- a/source3/modules/vfs_full_audit.c
+++ b/source3/modules/vfs_full_audit.c
@@ -110,7 +110,6 @@ typedef enum _vfs_op_type {
SMB_VFS_OP_MKDIR,
SMB_VFS_OP_RMDIR,
SMB_VFS_OP_CLOSEDIR,
- SMB_VFS_OP_INIT_SEARCH_OP,
/* File operations */
@@ -256,7 +255,6 @@ static struct {
{ SMB_VFS_OP_MKDIR, "mkdir" },
{ SMB_VFS_OP_RMDIR, "rmdir" },
{ SMB_VFS_OP_CLOSEDIR, "closedir" },
- { SMB_VFS_OP_INIT_SEARCH_OP, "init_search_op" },
{ SMB_VFS_OP_OPEN, "open" },
{ SMB_VFS_OP_CREATE_FILE, "create_file" },
{ SMB_VFS_OP_CLOSE, "close" },
@@ -930,14 +928,6 @@ static int smb_full_audit_closedir(vfs_handle_struct *handle,
return result;
}
-static void smb_full_audit_init_search_op(vfs_handle_struct *handle,
- DIR *dirp)
-{
- SMB_VFS_NEXT_INIT_SEARCH_OP(handle, dirp);
-
- do_log(SMB_VFS_OP_INIT_SEARCH_OP, True, handle, "");
-}
-
static int smb_full_audit_open(vfs_handle_struct *handle,
struct smb_filename *smb_fname,
files_struct *fsp, int flags, mode_t mode)
@@ -2516,7 +2506,6 @@ static struct vfs_fn_pointers vfs_full_audit_fns = {
.mkdir_fn = smb_full_audit_mkdir,
.rmdir_fn = smb_full_audit_rmdir,
.closedir_fn = smb_full_audit_closedir,
- .init_search_op_fn = smb_full_audit_init_search_op,
.open_fn = smb_full_audit_open,
.create_file_fn = smb_full_audit_create_file,
.close_fn = smb_full_audit_close,
diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c
index d4fccb7..5970220 100644
--- a/source3/smbd/vfs.c
+++ b/source3/smbd/vfs.c
@@ -1685,13 +1685,6 @@ int smb_vfs_call_closedir(struct vfs_handle_struct *handle,
return handle->fns->closedir_fn(handle, dir);
}
-void smb_vfs_call_init_search_op(struct vfs_handle_struct *handle,
- DIR *dirp)
-{
- VFS_FIND(init_search_op);
- handle->fns->init_search_op_fn(handle, dirp);
-}
-
int smb_vfs_call_open(struct vfs_handle_struct *handle,
struct smb_filename *smb_fname, struct files_struct *fsp,
int flags, mode_t mode)
--
2.9.5
More information about the samba-technical
mailing list