r23792: convert Samba4 to GPLv3
[kai/samba-autobuild/.git] / source4 / ntvfs / nbench / vfs_nbench.c
index 3c95621694ba239943efca8eb45e7e6262a256bc..9379419c50d86a93fe9e7be4f6b5e4d1c1b8e7e9 100644 (file)
@@ -7,7 +7,7 @@
 
    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
-   the Free Software Foundation; either version 2 of the License, or
+   the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
    
    This program is distributed in the hope that it will be useful,
@@ -16,8 +16,7 @@
    GNU General Public License for more details.
    
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
 /*
@@ -25,9 +24,8 @@
 */
 
 #include "includes.h"
-#include "system/filesys.h"
-#include "smb_server/smb_server.h"
 #include "ntvfs/ntvfs.h"
+#include "system/filesys.h"
 
 /* this is stored in ntvfs_private */
 struct nbench_private {
@@ -37,10 +35,10 @@ struct nbench_private {
 /*
   log one request to the nbench log
 */
-static void nbench_log(struct smbsrv_request *req,
+static void nbench_log(struct ntvfs_request *req,
                       const char *format, ...) PRINTF_ATTRIBUTE(2, 3);
 
-static void nbench_log(struct smbsrv_request *req,
+static void nbench_log(struct ntvfs_request *req,
                       const char *format, ...)
 {
        struct nbench_private *private = req->async_states->ntvfs->private_data;
@@ -55,6 +53,26 @@ static void nbench_log(struct smbsrv_request *req,
        free(s);
 }
 
+static char *nbench_ntvfs_handle_string(struct ntvfs_request *req, struct ntvfs_handle *h)
+{
+       DATA_BLOB key;
+       uint16_t fnum = 0;
+
+       key = ntvfs_handle_get_wire_key(h, req);
+
+       switch (key.length) {
+       case 2: /* SMB fnum */
+               fnum = SVAL(key.data, 0);
+               break;
+       default:
+               DEBUG(0,("%s: invalid wire handle size: %u\n",
+                       __FUNCTION__, (unsigned)key.length));
+               break;
+       }
+
+       return talloc_asprintf(req, "%u", fnum);
+}
+
 /*
   this pass through macro operates on request contexts, and disables
   async calls. 
@@ -63,7 +81,7 @@ static void nbench_log(struct smbsrv_request *req,
   status code and any result parameters much harder.
 */
 #define PASS_THRU_REQ_PRE_ASYNC(ntvfs, req, op, par1) do { \
-       status = ntvfs_async_state_push(req, par1, nbench_##op##_send, ntvfs); \
+       status = ntvfs_async_state_push(ntvfs, req, par1, nbench_##op##_send); \
        if (!NT_STATUS_IS_OK(status)) { \
                return status; \
        } \
@@ -93,13 +111,13 @@ static void nbench_log(struct smbsrv_request *req,
   connect to a share - used when a tree_connect operation comes in.
 */
 static NTSTATUS nbench_connect(struct ntvfs_module_context *ntvfs,
-                              struct smbsrv_request *req, const char *sharename)
+                              struct ntvfs_request *req, const char *sharename)
 {
        struct nbench_private *nprivates;
        NTSTATUS status;
        char *logname = NULL;
 
-       nprivates = talloc(req->tcon, struct nbench_private);
+       nprivates = talloc(ntvfs, struct nbench_private);
        if (!nprivates) {
                return NT_STATUS_NO_MEMORY;
        }
@@ -123,15 +141,14 @@ static NTSTATUS nbench_connect(struct ntvfs_module_context *ntvfs,
 /*
   disconnect from a share
 */
-static NTSTATUS nbench_disconnect(struct ntvfs_module_context *ntvfs,
-                                 struct smbsrv_tcon *tcon)
+static NTSTATUS nbench_disconnect(struct ntvfs_module_context *ntvfs)
 {
        struct nbench_private *nprivates = ntvfs->private_data;
        NTSTATUS status;
 
        close(nprivates->log_fd);
 
-       status = ntvfs_next_disconnect(ntvfs, tcon);
+       status = ntvfs_next_disconnect(ntvfs);
 
        return status;
 }
@@ -140,19 +157,20 @@ static NTSTATUS nbench_disconnect(struct ntvfs_module_context *ntvfs,
   delete a file - the dirtype specifies the file types to include in the search. 
   The name can contain CIFS wildcards, but rarely does (except with OS/2 clients)
 */
-static void nbench_unlink_send(struct smbsrv_request *req)
+static void nbench_unlink_send(struct ntvfs_request *req)
 {
-       struct smb_unlink *unl = req->async_states->private_data;
+       union smb_unlink *unl = req->async_states->private_data;
 
        nbench_log(req, "Unlink \"%s\" 0x%x %s\n", 
-                  unl->in.pattern, unl->in.attrib, 
+                  unl->unlink.in.pattern, unl->unlink.in.attrib, 
                   get_nt_error_c_code(req->async_states->status));
 
        PASS_THRU_REP_POST(req);
 }
 
 static NTSTATUS nbench_unlink(struct ntvfs_module_context *ntvfs,
-                             struct smbsrv_request *req, struct smb_unlink *unl)
+                             struct ntvfs_request *req,
+                             union smb_unlink *unl)
 {
        NTSTATUS status;
 
@@ -164,7 +182,7 @@ static NTSTATUS nbench_unlink(struct ntvfs_module_context *ntvfs,
 /*
   ioctl interface
 */
-static void nbench_ioctl_send(struct smbsrv_request *req)
+static void nbench_ioctl_send(struct ntvfs_request *req)
 {
        nbench_log(req, "Ioctl - NOT HANDLED\n");
 
@@ -172,7 +190,7 @@ static void nbench_ioctl_send(struct smbsrv_request *req)
 }
 
 static NTSTATUS nbench_ioctl(struct ntvfs_module_context *ntvfs,
-                            struct smbsrv_request *req, union smb_ioctl *io)
+                            struct ntvfs_request *req, union smb_ioctl *io)
 {
        NTSTATUS status;
 
@@ -184,19 +202,20 @@ static NTSTATUS nbench_ioctl(struct ntvfs_module_context *ntvfs,
 /*
   check if a directory exists
 */
-static void nbench_chkpath_send(struct smbsrv_request *req)
+static void nbench_chkpath_send(struct ntvfs_request *req)
 {
-       struct smb_chkpath *cp = req->async_states->private_data;
+       union smb_chkpath *cp = req->async_states->private_data;
 
        nbench_log(req, "Chkpath \"%s\" %s\n", 
-                  cp->in.path, 
+                  cp->chkpath.in.path, 
                   get_nt_error_c_code(req->async_states->status));
 
        PASS_THRU_REP_POST(req);
 }
 
 static NTSTATUS nbench_chkpath(struct ntvfs_module_context *ntvfs,
-                              struct smbsrv_request *req, struct smb_chkpath *cp)
+                              struct ntvfs_request *req,
+                              union smb_chkpath *cp)
 {
        NTSTATUS status;
 
@@ -208,12 +227,12 @@ static NTSTATUS nbench_chkpath(struct ntvfs_module_context *ntvfs,
 /*
   return info on a pathname
 */
-static void nbench_qpathinfo_send(struct smbsrv_request *req)
+static void nbench_qpathinfo_send(struct ntvfs_request *req)
 {
        union smb_fileinfo *info = req->async_states->private_data;
 
        nbench_log(req, "QUERY_PATH_INFORMATION \"%s\" %d %s\n", 
-                  info->generic.in.fname
+                  info->generic.in.file.path
                   info->generic.level,
                   get_nt_error_c_code(req->async_states->status));
 
@@ -221,7 +240,7 @@ static void nbench_qpathinfo_send(struct smbsrv_request *req)
 }
 
 static NTSTATUS nbench_qpathinfo(struct ntvfs_module_context *ntvfs,
-                                struct smbsrv_request *req, union smb_fileinfo *info)
+                                struct ntvfs_request *req, union smb_fileinfo *info)
 {
        NTSTATUS status;
 
@@ -233,12 +252,12 @@ static NTSTATUS nbench_qpathinfo(struct ntvfs_module_context *ntvfs,
 /*
   query info on a open file
 */
-static void nbench_qfileinfo_send(struct smbsrv_request *req)
+static void nbench_qfileinfo_send(struct ntvfs_request *req)
 {
        union smb_fileinfo *info = req->async_states->private_data;
 
-       nbench_log(req, "QUERY_FILE_INFORMATION %d %d %s\n", 
-                  info->generic.in.fnum, 
+       nbench_log(req, "QUERY_FILE_INFORMATION %s %d %s\n", 
+                  nbench_ntvfs_handle_string(req, info->generic.in.file.ntvfs),
                   info->generic.level,
                   get_nt_error_c_code(req->async_states->status));
 
@@ -246,7 +265,7 @@ static void nbench_qfileinfo_send(struct smbsrv_request *req)
 }
 
 static NTSTATUS nbench_qfileinfo(struct ntvfs_module_context *ntvfs,
-                                struct smbsrv_request *req, union smb_fileinfo *info)
+                                struct ntvfs_request *req, union smb_fileinfo *info)
 {
        NTSTATUS status;
 
@@ -258,12 +277,12 @@ static NTSTATUS nbench_qfileinfo(struct ntvfs_module_context *ntvfs,
 /*
   set info on a pathname
 */
-static void nbench_setpathinfo_send(struct smbsrv_request *req)
+static void nbench_setpathinfo_send(struct ntvfs_request *req)
 {
        union smb_setfileinfo *st = req->async_states->private_data;
 
        nbench_log(req, "SET_PATH_INFORMATION \"%s\" %d %s\n", 
-                  st->generic.file.fname
+                  st->generic.in.file.path
                   st->generic.level,
                   get_nt_error_c_code(req->async_states->status));
 
@@ -271,7 +290,7 @@ static void nbench_setpathinfo_send(struct smbsrv_request *req)
 }
 
 static NTSTATUS nbench_setpathinfo(struct ntvfs_module_context *ntvfs,
-                                  struct smbsrv_request *req, union smb_setfileinfo *st)
+                                  struct ntvfs_request *req, union smb_setfileinfo *st)
 {
        NTSTATUS status;
 
@@ -283,7 +302,7 @@ static NTSTATUS nbench_setpathinfo(struct ntvfs_module_context *ntvfs,
 /*
   open a file
 */
-static void nbench_openfile_send(struct smbsrv_request *req)
+static void nbench_open_send(struct ntvfs_request *req)
 {
        union smb_open *io = req->async_states->private_data;
 
@@ -292,11 +311,11 @@ static void nbench_openfile_send(struct smbsrv_request *req)
                if (!NT_STATUS_IS_OK(req->async_states->status)) {
                        ZERO_STRUCT(io->ntcreatex.out);
                }
-               nbench_log(req, "NTCreateX \"%s\" 0x%x 0x%x %d %s\n", 
+               nbench_log(req, "NTCreateX \"%s\" 0x%x 0x%x %s %s\n", 
                           io->ntcreatex.in.fname, 
                           io->ntcreatex.in.create_options, 
                           io->ntcreatex.in.open_disposition, 
-                          io->ntcreatex.out.fnum,
+                          nbench_ntvfs_handle_string(req, io->ntcreatex.out.file.ntvfs),
                           get_nt_error_c_code(req->async_states->status));
                break;
 
@@ -309,12 +328,13 @@ static void nbench_openfile_send(struct smbsrv_request *req)
        PASS_THRU_REP_POST(req);
 }
 
-static NTSTATUS nbench_openfile(struct ntvfs_module_context *ntvfs,
-                               struct smbsrv_request *req, union smb_open *io)
+static NTSTATUS nbench_open(struct ntvfs_module_context *ntvfs,
+                           struct ntvfs_request *req, union smb_open *io)
 {
        NTSTATUS status;
 
-       PASS_THRU_REQ(ntvfs, req, openfile, io, (ntvfs, req, io));
+#undef open /* AIX defines open to be open64 */
+       PASS_THRU_REQ(ntvfs, req, open, io, (ntvfs, req, io));
 
        return status;
 }
@@ -322,7 +342,7 @@ static NTSTATUS nbench_openfile(struct ntvfs_module_context *ntvfs,
 /*
   create a directory
 */
-static void nbench_mkdir_send(struct smbsrv_request *req)
+static void nbench_mkdir_send(struct ntvfs_request *req)
 {
        nbench_log(req, "Mkdir - NOT HANDLED\n");
 
@@ -330,7 +350,7 @@ static void nbench_mkdir_send(struct smbsrv_request *req)
 }
 
 static NTSTATUS nbench_mkdir(struct ntvfs_module_context *ntvfs,
-                            struct smbsrv_request *req, union smb_mkdir *md)
+                            struct ntvfs_request *req, union smb_mkdir *md)
 {
        NTSTATUS status;
 
@@ -342,7 +362,7 @@ static NTSTATUS nbench_mkdir(struct ntvfs_module_context *ntvfs,
 /*
   remove a directory
 */
-static void nbench_rmdir_send(struct smbsrv_request *req)
+static void nbench_rmdir_send(struct ntvfs_request *req)
 {
        struct smb_rmdir *rd = req->async_states->private_data;
 
@@ -354,7 +374,7 @@ static void nbench_rmdir_send(struct smbsrv_request *req)
 }
 
 static NTSTATUS nbench_rmdir(struct ntvfs_module_context *ntvfs,
-                            struct smbsrv_request *req, struct smb_rmdir *rd)
+                            struct ntvfs_request *req, struct smb_rmdir *rd)
 {
        NTSTATUS status;
 
@@ -366,7 +386,7 @@ static NTSTATUS nbench_rmdir(struct ntvfs_module_context *ntvfs,
 /*
   rename a set of files
 */
-static void nbench_rename_send(struct smbsrv_request *req)
+static void nbench_rename_send(struct ntvfs_request *req)
 {
        union smb_rename *ren = req->async_states->private_data;
 
@@ -388,7 +408,7 @@ static void nbench_rename_send(struct smbsrv_request *req)
 }
 
 static NTSTATUS nbench_rename(struct ntvfs_module_context *ntvfs,
-                             struct smbsrv_request *req, union smb_rename *ren)
+                             struct ntvfs_request *req, union smb_rename *ren)
 {
        NTSTATUS status;
 
@@ -400,7 +420,7 @@ static NTSTATUS nbench_rename(struct ntvfs_module_context *ntvfs,
 /*
   copy a set of files
 */
-static void nbench_copy_send(struct smbsrv_request *req)
+static void nbench_copy_send(struct ntvfs_request *req)
 {
        nbench_log(req, "Copy - NOT HANDLED\n");
 
@@ -408,7 +428,7 @@ static void nbench_copy_send(struct smbsrv_request *req)
 }
 
 static NTSTATUS nbench_copy(struct ntvfs_module_context *ntvfs,
-                           struct smbsrv_request *req, struct smb_copy *cp)
+                           struct ntvfs_request *req, struct smb_copy *cp)
 {
        NTSTATUS status;
 
@@ -420,7 +440,7 @@ static NTSTATUS nbench_copy(struct ntvfs_module_context *ntvfs,
 /*
   read from a file
 */
-static void nbench_read_send(struct smbsrv_request *req)
+static void nbench_read_send(struct ntvfs_request *req)
 {
        union smb_read *rd = req->async_states->private_data;
        
@@ -429,8 +449,8 @@ static void nbench_read_send(struct smbsrv_request *req)
                if (!NT_STATUS_IS_OK(req->async_states->status)) {
                        ZERO_STRUCT(rd->readx.out);
                }
-               nbench_log(req, "ReadX %d %d %d %d %s\n", 
-                          rd->readx.in.fnum, 
+               nbench_log(req, "ReadX %s %d %d %d %s\n", 
+                          nbench_ntvfs_handle_string(req, rd->readx.in.file.ntvfs),
                           (int)rd->readx.in.offset,
                           rd->readx.in.maxcnt,
                           rd->readx.out.nread,
@@ -446,7 +466,7 @@ static void nbench_read_send(struct smbsrv_request *req)
 }
 
 static NTSTATUS nbench_read(struct ntvfs_module_context *ntvfs,
-                           struct smbsrv_request *req, union smb_read *rd)
+                           struct ntvfs_request *req, union smb_read *rd)
 {
        NTSTATUS status;
 
@@ -458,7 +478,7 @@ static NTSTATUS nbench_read(struct ntvfs_module_context *ntvfs,
 /*
   write to a file
 */
-static void nbench_write_send(struct smbsrv_request *req)
+static void nbench_write_send(struct ntvfs_request *req)
 {
        union smb_write *wr = req->async_states->private_data;
 
@@ -467,8 +487,8 @@ static void nbench_write_send(struct smbsrv_request *req)
                if (!NT_STATUS_IS_OK(req->async_states->status)) {
                        ZERO_STRUCT(wr->writex.out);
                }
-               nbench_log(req, "WriteX %d %d %d %d %s\n", 
-                          wr->writex.in.fnum, 
+               nbench_log(req, "WriteX %s %d %d %d %s\n", 
+                          nbench_ntvfs_handle_string(req, wr->writex.in.file.ntvfs),
                           (int)wr->writex.in.offset,
                           wr->writex.in.count,
                           wr->writex.out.nwritten,
@@ -479,8 +499,8 @@ static void nbench_write_send(struct smbsrv_request *req)
                if (!NT_STATUS_IS_OK(req->async_states->status)) {
                        ZERO_STRUCT(wr->write.out);
                }
-               nbench_log(req, "Write %d %d %d %d %s\n", 
-                          wr->write.in.fnum, 
+               nbench_log(req, "Write %s %d %d %d %s\n", 
+                          nbench_ntvfs_handle_string(req, wr->write.in.file.ntvfs),
                           wr->write.in.offset,
                           wr->write.in.count,
                           wr->write.out.nwritten,
@@ -497,7 +517,7 @@ static void nbench_write_send(struct smbsrv_request *req)
 }
 
 static NTSTATUS nbench_write(struct ntvfs_module_context *ntvfs,
-                            struct smbsrv_request *req, union smb_write *wr)
+                            struct ntvfs_request *req, union smb_write *wr)
 {
        NTSTATUS status;
 
@@ -509,7 +529,7 @@ static NTSTATUS nbench_write(struct ntvfs_module_context *ntvfs,
 /*
   seek in a file
 */
-static void nbench_seek_send(struct smbsrv_request *req)
+static void nbench_seek_send(struct ntvfs_request *req)
 {
        nbench_log(req, "Seek - NOT HANDLED\n");
 
@@ -517,7 +537,8 @@ static void nbench_seek_send(struct smbsrv_request *req)
 }
 
 static NTSTATUS nbench_seek(struct ntvfs_module_context *ntvfs,
-                           struct smbsrv_request *req, struct smb_seek *io)
+                           struct ntvfs_request *req,
+                           union smb_seek *io)
 {
        NTSTATUS status;
 
@@ -529,19 +550,33 @@ static NTSTATUS nbench_seek(struct ntvfs_module_context *ntvfs,
 /*
   flush a file
 */
-static void nbench_flush_send(struct smbsrv_request *req)
+static void nbench_flush_send(struct ntvfs_request *req)
 {
-       struct smb_flush *io = req->async_states->private_data;
+       union smb_flush *io = req->async_states->private_data;
 
-       nbench_log(req, "Flush %d %s\n",
-                  io->in.fnum,
-                  get_nt_error_c_code(req->async_states->status));
+       switch (io->generic.level) {
+       case RAW_FLUSH_FLUSH:
+               nbench_log(req, "Flush %s %s\n",
+                          nbench_ntvfs_handle_string(req, io->flush.in.file.ntvfs),
+                          get_nt_error_c_code(req->async_states->status));
+               break;
+       case RAW_FLUSH_ALL:
+               nbench_log(req, "Flush %d %s\n",
+                          0xFFFF,
+                          get_nt_error_c_code(req->async_states->status));
+               break;
+       default:
+               nbench_log(req, "Flush-%d - NOT HANDLED\n",
+                          io->generic.level);
+               break;
+       }
 
        PASS_THRU_REP_POST(req);
 }
 
 static NTSTATUS nbench_flush(struct ntvfs_module_context *ntvfs,
-                            struct smbsrv_request *req, struct smb_flush *io)
+                            struct ntvfs_request *req,
+                            union smb_flush *io)
 {
        NTSTATUS status;
 
@@ -553,14 +588,14 @@ static NTSTATUS nbench_flush(struct ntvfs_module_context *ntvfs,
 /*
   close a file
 */
-static void nbench_close_send(struct smbsrv_request *req)
+static void nbench_close_send(struct ntvfs_request *req)
 {
        union smb_close *io = req->async_states->private_data;
 
        switch (io->generic.level) {
        case RAW_CLOSE_CLOSE:
-               nbench_log(req, "Close %d %s\n",
-                          io->close.in.fnum,
+               nbench_log(req, "Close %s %s\n",
+                          nbench_ntvfs_handle_string(req, io->close.in.file.ntvfs),
                           get_nt_error_c_code(req->async_states->status));
                break;
 
@@ -574,7 +609,7 @@ static void nbench_close_send(struct smbsrv_request *req)
 }
 
 static NTSTATUS nbench_close(struct ntvfs_module_context *ntvfs,
-                            struct smbsrv_request *req, union smb_close *io)
+                            struct ntvfs_request *req, union smb_close *io)
 {
        NTSTATUS status;
 
@@ -586,7 +621,7 @@ static NTSTATUS nbench_close(struct ntvfs_module_context *ntvfs,
 /*
   exit - closing files
 */
-static void nbench_exit_send(struct smbsrv_request *req)
+static void nbench_exit_send(struct ntvfs_request *req)
 {
        nbench_log(req, "Exit - NOT HANDLED\n");
 
@@ -594,7 +629,7 @@ static void nbench_exit_send(struct smbsrv_request *req)
 }
 
 static NTSTATUS nbench_exit(struct ntvfs_module_context *ntvfs,
-                           struct smbsrv_request *req)
+                           struct ntvfs_request *req)
 {
        NTSTATUS status;
 
@@ -606,7 +641,7 @@ static NTSTATUS nbench_exit(struct ntvfs_module_context *ntvfs,
 /*
   logoff - closing files
 */
-static void nbench_logoff_send(struct smbsrv_request *req)
+static void nbench_logoff_send(struct ntvfs_request *req)
 {
        nbench_log(req, "Logoff - NOT HANDLED\n");
 
@@ -614,7 +649,7 @@ static void nbench_logoff_send(struct smbsrv_request *req)
 }
 
 static NTSTATUS nbench_logoff(struct ntvfs_module_context *ntvfs,
-                             struct smbsrv_request *req)
+                             struct ntvfs_request *req)
 {
        NTSTATUS status;
 
@@ -626,7 +661,7 @@ static NTSTATUS nbench_logoff(struct ntvfs_module_context *ntvfs,
 /*
   async_setup - send fn
 */
-static void nbench_async_setup_send(struct smbsrv_request *req)
+static void nbench_async_setup_send(struct ntvfs_request *req)
 {
        PASS_THRU_REP_POST(req);
 }
@@ -635,7 +670,7 @@ static void nbench_async_setup_send(struct smbsrv_request *req)
   async setup
 */
 static NTSTATUS nbench_async_setup(struct ntvfs_module_context *ntvfs,
-                                  struct smbsrv_request *req,
+                                  struct ntvfs_request *req,
                                   void *private)
 {
        NTSTATUS status;
@@ -646,7 +681,7 @@ static NTSTATUS nbench_async_setup(struct ntvfs_module_context *ntvfs,
 }
 
 
-static void nbench_cancel_send(struct smbsrv_request *req)
+static void nbench_cancel_send(struct ntvfs_request *req)
 {
        PASS_THRU_REP_POST(req);
 }
@@ -655,7 +690,7 @@ static void nbench_cancel_send(struct smbsrv_request *req)
   cancel an existing async request
 */
 static NTSTATUS nbench_cancel(struct ntvfs_module_context *ntvfs,
-                             struct smbsrv_request *req)
+                             struct ntvfs_request *req)
 {
        NTSTATUS status;
 
@@ -667,22 +702,22 @@ static NTSTATUS nbench_cancel(struct ntvfs_module_context *ntvfs,
 /*
   lock a byte range
 */
-static void nbench_lock_send(struct smbsrv_request *req)
+static void nbench_lock_send(struct ntvfs_request *req)
 {
        union smb_lock *lck = req->async_states->private_data;
 
        if (lck->generic.level == RAW_LOCK_LOCKX &&
            lck->lockx.in.lock_cnt == 1 &&
            lck->lockx.in.ulock_cnt == 0) {
-               nbench_log(req, "LockX %d %d %d %s\n", 
-                          lck->lockx.in.fnum,
+               nbench_log(req, "LockX %s %d %d %s\n", 
+                          nbench_ntvfs_handle_string(req, lck->lockx.in.file.ntvfs),
                           (int)lck->lockx.in.locks[0].offset,
                           (int)lck->lockx.in.locks[0].count,
                           get_nt_error_c_code(req->async_states->status));
        } else if (lck->generic.level == RAW_LOCK_LOCKX &&
                   lck->lockx.in.ulock_cnt == 1) {
-               nbench_log(req, "UnlockX %d %d %d %s\n", 
-                          lck->lockx.in.fnum,
+               nbench_log(req, "UnlockX %s %d %d %s\n", 
+                          nbench_ntvfs_handle_string(req, lck->lockx.in.file.ntvfs),
                           (int)lck->lockx.in.locks[0].offset,
                           (int)lck->lockx.in.locks[0].count,
                           get_nt_error_c_code(req->async_states->status));
@@ -694,7 +729,7 @@ static void nbench_lock_send(struct smbsrv_request *req)
 }
 
 static NTSTATUS nbench_lock(struct ntvfs_module_context *ntvfs,
-                           struct smbsrv_request *req, union smb_lock *lck)
+                           struct ntvfs_request *req, union smb_lock *lck)
 {
        NTSTATUS status;
 
@@ -706,12 +741,12 @@ static NTSTATUS nbench_lock(struct ntvfs_module_context *ntvfs,
 /*
   set info on a open file
 */
-static void nbench_setfileinfo_send(struct smbsrv_request *req)
+static void nbench_setfileinfo_send(struct ntvfs_request *req)
 {
        union smb_setfileinfo *info = req->async_states->private_data;
 
-       nbench_log(req, "SET_FILE_INFORMATION %d %d %s\n", 
-                  info->generic.file.fnum,
+       nbench_log(req, "SET_FILE_INFORMATION %s %d %s\n", 
+                  nbench_ntvfs_handle_string(req, info->generic.in.file.ntvfs),
                   info->generic.level,
                   get_nt_error_c_code(req->async_states->status));
 
@@ -719,7 +754,7 @@ static void nbench_setfileinfo_send(struct smbsrv_request *req)
 }
 
 static NTSTATUS nbench_setfileinfo(struct ntvfs_module_context *ntvfs,
-                                  struct smbsrv_request *req, 
+                                  struct ntvfs_request *req, 
                                   union smb_setfileinfo *info)
 {
        NTSTATUS status;
@@ -732,7 +767,7 @@ static NTSTATUS nbench_setfileinfo(struct ntvfs_module_context *ntvfs,
 /*
   return filesystem space info
 */
-static void nbench_fsinfo_send(struct smbsrv_request *req)
+static void nbench_fsinfo_send(struct ntvfs_request *req)
 {
        union smb_fsinfo *fs = req->async_states->private_data;
 
@@ -744,7 +779,7 @@ static void nbench_fsinfo_send(struct smbsrv_request *req)
 }
 
 static NTSTATUS nbench_fsinfo(struct ntvfs_module_context *ntvfs,
-                             struct smbsrv_request *req, union smb_fsinfo *fs)
+                             struct ntvfs_request *req, union smb_fsinfo *fs)
 {
        NTSTATUS status;
 
@@ -756,7 +791,7 @@ static NTSTATUS nbench_fsinfo(struct ntvfs_module_context *ntvfs,
 /*
   return print queue info
 */
-static void nbench_lpq_send(struct smbsrv_request *req)
+static void nbench_lpq_send(struct ntvfs_request *req)
 {
        union smb_lpq *lpq = req->async_states->private_data;
 
@@ -766,7 +801,7 @@ static void nbench_lpq_send(struct smbsrv_request *req)
 }
 
 static NTSTATUS nbench_lpq(struct ntvfs_module_context *ntvfs,
-                          struct smbsrv_request *req, union smb_lpq *lpq)
+                          struct ntvfs_request *req, union smb_lpq *lpq)
 {
        NTSTATUS status;
 
@@ -778,18 +813,18 @@ static NTSTATUS nbench_lpq(struct ntvfs_module_context *ntvfs,
 /* 
    list files in a directory matching a wildcard pattern
 */
-static void nbench_search_first_send(struct smbsrv_request *req)
+static void nbench_search_first_send(struct ntvfs_request *req)
 {
        union smb_search_first *io = req->async_states->private_data;
        
        switch (io->generic.level) {
-       case RAW_SEARCH_BOTH_DIRECTORY_INFO:
+       case RAW_SEARCH_TRANS2:
                if (NT_STATUS_IS_ERR(req->async_states->status)) {
                        ZERO_STRUCT(io->t2ffirst.out);
                }
                nbench_log(req, "FIND_FIRST \"%s\" %d %d %d %s\n", 
                           io->t2ffirst.in.pattern,
-                          io->generic.level,
+                          io->t2ffirst.data_level,
                           io->t2ffirst.in.max_count,
                           io->t2ffirst.out.count,
                           get_nt_error_c_code(req->async_states->status));
@@ -804,9 +839,9 @@ static void nbench_search_first_send(struct smbsrv_request *req)
 }
 
 static NTSTATUS nbench_search_first(struct ntvfs_module_context *ntvfs,
-                                   struct smbsrv_request *req, union smb_search_first *io, 
+                                   struct ntvfs_request *req, union smb_search_first *io, 
                                    void *search_private, 
-                                   BOOL (*callback)(void *, union smb_search_data *))
+                                   BOOL (*callback)(void *, const union smb_search_data *))
 {
        NTSTATUS status;
 
@@ -816,7 +851,7 @@ static NTSTATUS nbench_search_first(struct ntvfs_module_context *ntvfs,
 }
 
 /* continue a search */
-static void nbench_search_next_send(struct smbsrv_request *req)
+static void nbench_search_next_send(struct ntvfs_request *req)
 {
        union smb_search_next *io = req->async_states->private_data;
 
@@ -826,9 +861,9 @@ static void nbench_search_next_send(struct smbsrv_request *req)
 }
 
 static NTSTATUS nbench_search_next(struct ntvfs_module_context *ntvfs,
-                                  struct smbsrv_request *req, union smb_search_next *io, 
+                                  struct ntvfs_request *req, union smb_search_next *io, 
                                   void *search_private, 
-                                  BOOL (*callback)(void *, union smb_search_data *))
+                                  BOOL (*callback)(void *, const union smb_search_data *))
 {
        NTSTATUS status;
 
@@ -838,7 +873,7 @@ static NTSTATUS nbench_search_next(struct ntvfs_module_context *ntvfs,
 }
 
 /* close a search */
-static void nbench_search_close_send(struct smbsrv_request *req)
+static void nbench_search_close_send(struct ntvfs_request *req)
 {
        union smb_search_close *io = req->async_states->private_data;
 
@@ -848,7 +883,7 @@ static void nbench_search_close_send(struct smbsrv_request *req)
 }
 
 static NTSTATUS nbench_search_close(struct ntvfs_module_context *ntvfs,
-                                   struct smbsrv_request *req, union smb_search_close *io)
+                                   struct ntvfs_request *req, union smb_search_close *io)
 {
        NTSTATUS status;
 
@@ -858,7 +893,7 @@ static NTSTATUS nbench_search_close(struct ntvfs_module_context *ntvfs,
 }
 
 /* SMBtrans - not used on file shares */
-static void nbench_trans_send(struct smbsrv_request *req)
+static void nbench_trans_send(struct ntvfs_request *req)
 {
        nbench_log(req, "Trans - NOT HANDLED\n");
 
@@ -866,7 +901,7 @@ static void nbench_trans_send(struct smbsrv_request *req)
 }
 
 static NTSTATUS nbench_trans(struct ntvfs_module_context *ntvfs,
-                            struct smbsrv_request *req, struct smb_trans2 *trans2)
+                            struct ntvfs_request *req, struct smb_trans2 *trans2)
 {
        NTSTATUS status;
 
@@ -882,6 +917,7 @@ NTSTATUS ntvfs_nbench_init(void)
 {
        NTSTATUS ret;
        struct ntvfs_ops ops;
+       NTVFS_CURRENT_CRITICAL_SIZES(vers);
 
        ZERO_STRUCT(ops);
 
@@ -896,7 +932,7 @@ NTSTATUS ntvfs_nbench_init(void)
        ops.chkpath = nbench_chkpath;
        ops.qpathinfo = nbench_qpathinfo;
        ops.setpathinfo = nbench_setpathinfo;
-       ops.openfile = nbench_openfile;
+       ops.open = nbench_open;
        ops.mkdir = nbench_mkdir;
        ops.rmdir = nbench_rmdir;
        ops.rename = nbench_rename;
@@ -926,7 +962,7 @@ NTSTATUS ntvfs_nbench_init(void)
        ops.trans2 = NULL;
 
        /* register ourselves with the NTVFS subsystem. */
-       ret = ntvfs_register(&ops);
+       ret = ntvfs_register(&ops, &vers);
 
        if (!NT_STATUS_IS_OK(ret)) {
                DEBUG(0,("Failed to register nbench backend!\n"));