r24670: Use torture functions for settings.
[kai/samba.git] / source4 / torture / basic / misc.c
index 0523aca9610aed5577b1975de4b6731975d7f11a..b4584fcf58c1843147343eff11bc6b418dbe4215 100644 (file)
@@ -6,7 +6,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,
@@ -15,8 +15,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/>.
 */
 
 #include "includes.h"
@@ -575,13 +574,14 @@ static NTSTATUS benchrw_readwrite(struct torture_context *tctx,
                                "Callback READ file:%d (%d/%d) Offset:%d\n",
                                state->nr,state->completed,torture_numops,
                                (state->readcnt*state->lp_params->blocksize));
-               rd.generic.level = RAW_READ_READX    ;
-               rd.read.in.file.fnum    = state->fnum   ;
-               rd.read.in.offset       = state->readcnt * 
-                                       state->lp_params->blocksize;
-               rd.read.in.count        = state->lp_params->blocksize;
-               rd.read.in.remaining    = 0     ;
-               rd.read.out.data        = state->buffer;
+               rd.generic.level = RAW_READ_READX;
+               rd.readx.in.file.fnum   = state->fnum   ;
+               rd.readx.in.offset      = state->readcnt*state->lp_params->blocksize; 
+               rd.readx.in.mincnt      = state->lp_params->blocksize;
+               rd.readx.in.maxcnt      = rd.readx.in.mincnt;
+               rd.readx.in.remaining   = 0     ;
+               rd.readx.out.data       = state->buffer;
+               rd.readx.in.read_for_execute = False;
                if(state->readcnt < state->lp_params->writeblocks){
                        state->readcnt++;       
                }else{
@@ -660,7 +660,7 @@ static NTSTATUS benchrw_mkdir(struct torture_context *tctx,
        
        /* open/create the files */
        torture_comment(tctx, "Open File %d/%d\n",state->nr+1,
-                       lp_parm_int(-1, "torture", "nprocs", 4));
+                       torture_setting_int(tctx, "nprocs", 4));
        open_parms=talloc_zero(tctx, union smb_open);
        NT_STATUS_HAVE_NO_MEMORY(open_parms);
        open_parms->openx.level = RAW_OPEN_OPENX;
@@ -726,6 +726,7 @@ static void benchrw_callback(struct smbcli_request *req)
                                        "file - %s\n", 
                                        nt_errstr(req->status));
                        state->mode=ERROR;
+                       state->readcnt=0;
                        return;
                }
                break;
@@ -836,7 +837,7 @@ BOOL run_benchrw(struct torture_context *tctx)
        union smb_mkdir parms;
        int finished = 0;
        BOOL success=True;
-       int torture_nprocs = lp_parm_int(-1, "torture", "nprocs", 4);
+       int torture_nprocs = torture_setting_int(tctx, "nprocs", 4);
        
        torture_comment(tctx, "Start BENCH-READWRITE num_ops=%d "
                        "num_nprocs=%d\n",