~ubuntu-branches/ubuntu/vivid/samba/vivid

« back to all changes in this revision

Viewing changes to source4/torture/nbench/nbio.c

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2011-12-21 13:18:04 UTC
  • mfrom: (0.39.21 sid)
  • Revision ID: package-import@ubuntu.com-20111221131804-xtlr39wx6njehxxr
Tags: 2:3.6.1-3ubuntu1
* Merge from Debian testing.  Remaining changes:
  + debian/patches/VERSION.patch:
    - set SAMBA_VERSION_SUFFIX to Ubuntu.
  + debian/patches/error-trans.fix-276472:
    - Add the translation of Unix Error code -ENOTSUP to NT Error Code
    - NT_STATUS_NOT_SUPPORTED to prevent the Permission denied error.
  + debian/smb.conf:
    - add "(Samba, Ubuntu)" to server string.
    - comment out the default [homes] share, and add a comment about
      "valid users = %S" to show users how to restrict access to
      \\server\username to only username.
    - Set 'usershare allow guests', so that usershare admins are 
      allowed to create public shares in addition to authenticated
      ones.
    - add map to guest = Bad user, maps bad username to guest access.
  + debian/samba-common.config:
    - Do not change priority to high if dhclient3 is installed.
    - Use priority medium instead of high for the workgroup question.
  + debian/control:
    - Don't build against or suggest ctdb.
    - Add dependency on samba-common-bin to samba.
  + Add ufw integration:
    - Created debian/samba.ufw.profile
    - debian/rules, debian/samba.dirs, debian/samba.files: install
      profile
    - debian/control: have samba suggest ufw
  + Add apport hook:
    - Created debian/source_samba.py.
    - debian/rules, debian/samba.dirs, debian/samba-common-bin.files: install
  + Switch to upstart:
    - Add debian/samba.{nmbd,smbd}.upstart.
  + debian/samba.logrotate, debian/samba-common.dhcp, debian/samba.if-up:
    - Make them upstart compatible
  + debian/samba.postinst: 
    - Avoid scary pdbedit warnings on first import.
  + debian/samba-common.postinst: Add more informative error message for
    the case where smb.conf was manually deleted
  + debian/patches/fix-debuglevel-name-conflict.patch: don't use 'debug_level'
    as a global variable name in an NSS module 
  + Dropped:
    - debian/patches/error-trans.fix-276472
    - debian/patches/fix-debuglevel-name-conflict.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
#include "system/filesys.h"
28
28
#include "../lib/util/dlinklist.h"
29
29
#include "libcli/libcli.h"
30
 
#include "libcli/raw/libcliraw.h"
31
 
#include "torture/torture.h"
32
 
#include "libcli/libcli.h"
33
30
#include "torture/util.h"
34
31
#include "torture/nbench/proto.h"
35
32
 
49
46
 
50
47
struct createx_params {
51
48
        char *fname;
52
 
        uint_t create_options;
53
 
        uint_t create_disposition;
 
49
        unsigned int create_options;
 
50
        unsigned int create_disposition;
54
51
        int handle;
55
52
};
56
53
 
75
72
 
76
73
static bool nb_do_createx(struct ftable *f,
77
74
                          const char *fname,
78
 
                          uint_t create_options,
79
 
                          uint_t create_disposition,
 
75
                          unsigned int create_options,
 
76
                          unsigned int create_disposition,
80
77
                          int handle,
81
78
                          NTSTATUS status,
82
79
                          bool retry);
85
82
 
86
83
static void nb_set_createx_params(struct ftable *f,
87
84
                                  const char *fname,
88
 
                                  uint_t create_options,
89
 
                                  uint_t create_disposition,
 
85
                                  unsigned int create_options,
 
86
                                  unsigned int create_disposition,
90
87
                                  int handle)
91
88
{
92
89
        struct createx_params *cp = &f->cp;
195
192
 
196
193
        tdelay = (children[nbio_id].bytes - last_bytes)/(1.0e6*rate) - timeval_elapsed(&last_time);
197
194
        if (tdelay > 0) {
198
 
                msleep(tdelay*1000);
 
195
                smb_msleep(tdelay*1000);
199
196
        } else {
200
197
                children[nbio_id].max_latency = MAX(children[nbio_id].max_latency, -tdelay);
201
198
        }
213
210
{
214
211
        double elapsed = timeval_elapsed(&children[nbio_id].starttime);
215
212
        if (targett > elapsed) {
216
 
                msleep(1000*(targett - elapsed));
 
213
                smb_msleep(1000*(targett - elapsed));
217
214
        } else if (elapsed - targett > children[nbio_id].max_latency) {
218
215
                children[nbio_id].max_latency = MAX(elapsed - targett, children[nbio_id].max_latency);
219
216
        }
458
455
 
459
456
static bool nb_do_createx(struct ftable *f,
460
457
                          const char *fname,
461
 
                          uint_t create_options,
462
 
                          uint_t create_disposition,
 
458
                          unsigned int create_options,
 
459
                          unsigned int create_disposition,
463
460
                          int handle,
464
461
                          NTSTATUS status,
465
462
                          bool retry)
468
465
        uint32_t desired_access;
469
466
        NTSTATUS ret;
470
467
        TALLOC_CTX *mem_ctx;
471
 
        uint_t flags = 0;
 
468
        unsigned int flags = 0;
472
469
 
473
470
        mem_ctx = talloc_init("raw_open");
474
471
 
487
484
 
488
485
        io.ntcreatex.level = RAW_OPEN_NTCREATEX;
489
486
        io.ntcreatex.in.flags = flags;
490
 
        io.ntcreatex.in.root_fid = 0;
 
487
        io.ntcreatex.in.root_fid.fnum = 0;
491
488
        io.ntcreatex.in.access_mask = desired_access;
492
489
        io.ntcreatex.in.file_attr = 0;
493
490
        io.ntcreatex.in.alloc_size = 0;
534
531
}
535
532
 
536
533
bool nb_createx(const char *fname, 
537
 
               uint_t create_options, uint_t create_disposition, int handle,
 
534
               unsigned int create_options, unsigned int create_disposition, int handle,
538
535
               NTSTATUS status)
539
536
{
540
537
        return nb_do_createx(NULL, fname, create_options, create_disposition, handle, status, false);
667
664
        return nb_do_lockx(false, handle, offset, size, status);
668
665
}
669
666
 
670
 
bool nb_unlockx(int handle, uint_t offset, int size, NTSTATUS status)
 
667
bool nb_unlockx(int handle, unsigned int offset, int size, NTSTATUS status)
671
668
{
672
669
        union smb_lock io;
673
670
        int i;