From 6272f4c2f453c509b8a3893d4c2ac5fc356b348d Mon Sep 17 00:00:00 2001 From: Steven Danneman Date: Mon, 2 Feb 2009 21:37:51 -0800 Subject: s3: Added SMB_VFS_INIT_SEARCH_OP to initialize data at the beginning of SMB search requests. By default this VFS call is a NOOP, but the onefs vfs module takes advantage of it to initialize direntry search caches at the beginning of each TRANS2_FIND_FIRST, TRANS2_FIND_NEXT, SMBffirst, SMBsearch, and SMBunique --- source3/smbd/dir.c | 8 ++++++++ source3/smbd/reply.c | 3 +++ source3/smbd/trans2.c | 12 +++++++++--- 3 files changed, 20 insertions(+), 3 deletions(-) (limited to 'source3/smbd') diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c index c4f6b4fe55..6618bf07b0 100644 --- a/source3/smbd/dir.c +++ b/source3/smbd/dir.c @@ -680,6 +680,14 @@ void dptr_DirCacheAdd(struct dptr_struct *dptr, const char *name, long offset) DirCacheAdd(dptr->dir_hnd, name, offset); } +/**************************************************************************** + Initialize variables & state data at the beginning of all search SMB requests. +****************************************************************************/ +void dptr_init_search_op(struct dptr_struct *dptr) +{ + return SMB_VFS_INIT_SEARCH_OP(dptr->conn, dptr->dir_hnd->dir); +} + /**************************************************************************** Fill the 5 byte server reserved dptr field. ****************************************************************************/ diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index 628f481c1c..256160c402 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -1380,6 +1380,9 @@ 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(conn->dirptr); + if ((dirtype&0x1F) == aVOLID) { char buf[DIR_STRUCT_SIZE]; memcpy(buf,status,21); diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index 6a6e59a581..cea066e97f 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -1914,7 +1914,7 @@ close_if_end = %d requires_resume_key = %d level = 0x%x, max_data_bytes = %d\n", /* W2K3 seems to treat zero as 1. */ maxentries = 1; } - + switch (info_level) { case SMB_FIND_INFO_STANDARD: case SMB_FIND_EA_SIZE: @@ -2043,7 +2043,7 @@ total_data=%u (should be %u)\n", (unsigned int)total_data, (unsigned int)IVAL(pd } params = *pparams; - /* Save the wildcard match and attribs we are using on this directory - + /* Save the wildcard match and attribs we are using on this directory - needed as lanman2 assumes these are being saved between calls */ ntstatus = dptr_create(conn, @@ -2064,6 +2064,9 @@ total_data=%u (should be %u)\n", (unsigned int)total_data, (unsigned int)IVAL(pd dptr_num = dptr_dnum(conn->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(conn->dirptr); + /* We don't need to check for VOL here as this is returned by a different TRANS2 call. */ @@ -2078,7 +2081,7 @@ total_data=%u (should be %u)\n", (unsigned int)total_data, (unsigned int)IVAL(pd for (i=0;(i 0) { out_of_space = True; @@ -2374,6 +2377,9 @@ total_data=%u (should be %u)\n", (unsigned int)total_data, (unsigned int)IVAL(pd (long)conn->dirptr, dptr_TellDir(conn->dirptr))); + /* Initialize per TRANS2_FIND_NEXT operation data */ + dptr_init_search_op(conn->dirptr); + /* We don't need to check for VOL here as this is returned by a different TRANS2 call. */ -- cgit