Ignore:
Timestamp:
Nov 27, 2012, 4:43:17 PM (13 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: updated trunk to 3.6.0

Location:
trunk/server
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/server

  • trunk/server/source3/torture/nbio.c

    r414 r745  
    2121
    2222#include "includes.h"
     23#include "torture/proto.h"
     24#include "../libcli/security/security.h"
     25#include "libsmb/libsmb.h"
     26#include "libsmb/clirap.h"
    2327
    2428#define MAX_FILES 1000
     
    2832extern int nbio_id;
    2933static int nprocs;
     34static struct timeval nb_start;
    3035
    3136static struct {
     
    6166        }
    6267
    63         printf("%4d  %8d  %.2f MB/sec\r", num_clients, lines/nprocs, 1.0e-6 * nbio_total() / end_timer());
     68        printf("%4d  %8d  %.2f MB/sec\r",
     69               num_clients, lines/nprocs,
     70               1.0e-6 * nbio_total() / timeval_elapsed(&nb_start));
    6471
    6572        signal(SIGALRM, nb_alarm);
     
    122129        signal(SIGSEGV, sigsegv);
    123130        c = cli;
    124         start_timer();
     131        nb_start = timeval_current();
    125132        children[nbio_id].done = 0;
    126133}
     
    129136void nb_unlink(const char *fname)
    130137{
    131         if (!NT_STATUS_IS_OK(cli_unlink(c, fname, aSYSTEM | aHIDDEN))) {
     138        if (!NT_STATUS_IS_OK(cli_unlink(c, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN))) {
    132139#if NBDEBUG
    133140                printf("(%d) unlink %s failed (%s)\n",
     
    184191{
    185192        int i;
     193        NTSTATUS status;
    186194
    187195        if (buf[0] == 0) memset(buf, 1, sizeof(buf));
    188196
    189197        i = find_handle(handle);
    190         if (cli_write(c, ftable[i].fd, 0, buf, offset, size) != ret_size) {
    191                 printf("(%d) ERROR: write failed on handle %d, fd %d \
    192 errno %d (%s)\n", line_count, handle, ftable[i].fd, errno, strerror(errno));
     198        status = cli_writeall(c, ftable[i].fd, 0, (uint8_t *)buf, offset, size,
     199                              NULL);
     200        if (!NT_STATUS_IS_OK(status)) {
     201                printf("(%d) ERROR: write failed on handle %d, fd %d "
     202                       "error %s\n", line_count, handle, ftable[i].fd,
     203                       nt_errstr(status));
    193204                exit(1);
    194205        }
     
    242253void nb_qpathinfo(const char *fname)
    243254{
    244         cli_qpathinfo(c, fname, NULL, NULL, NULL, NULL, NULL);
     255        cli_qpathinfo1(c, fname, NULL, NULL, NULL, NULL, NULL);
    245256}
    246257
     
    249260        int i;
    250261        i = find_handle(fnum);
    251         cli_qfileinfo(c, ftable[i].fd, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
     262        cli_qfileinfo_basic(c, ftable[i].fd, NULL, NULL, NULL, NULL, NULL,
     263                            NULL, NULL);
    252264}
    253265
     
    259271}
    260272
    261 static void find_fn(const char *mnt, file_info *finfo, const char *name, void *state)
     273static NTSTATUS find_fn(const char *mnt, struct file_info *finfo, const char *name,
     274                    void *state)
    262275{
    263276        /* noop */
     277        return NT_STATUS_OK;
    264278}
    265279
     
    278292static int total_deleted;
    279293
    280 static void delete_fn(const char *mnt, file_info *finfo, const char *name, void *state)
    281 {
     294static NTSTATUS delete_fn(const char *mnt, struct file_info *finfo,
     295                      const char *name, void *state)
     296{
     297        NTSTATUS status;
    282298        char *s, *n;
    283         if (finfo->name[0] == '.') return;
     299        if (finfo->name[0] == '.') {
     300                return NT_STATUS_OK;
     301        }
    284302
    285303        n = SMB_STRDUP(name);
     
    287305        if (asprintf(&s, "%s%s", n, finfo->name) == -1) {
    288306                printf("asprintf failed\n");
    289                 return;
    290         }
    291         if (finfo->mode & aDIR) {
     307                return NT_STATUS_NO_MEMORY;
     308        }
     309        if (finfo->mode & FILE_ATTRIBUTE_DIRECTORY) {
    292310                char *s2;
    293311                if (asprintf(&s2, "%s\\*", s) == -1) {
    294312                        printf("asprintf failed\n");
    295                         return;
     313                        return NT_STATUS_NO_MEMORY;
    296314                }
    297                 cli_list(c, s2, aDIR, delete_fn, NULL);
     315                status = cli_list(c, s2, FILE_ATTRIBUTE_DIRECTORY, delete_fn, NULL);
     316                if (!NT_STATUS_IS_OK(status)) {
     317                        free(n);
     318                        free(s2);
     319                        return status;
     320                }
    298321                nb_rmdir(s);
    299322        } else {
     
    303326        free(s);
    304327        free(n);
     328        return NT_STATUS_OK;
    305329}
    306330
     
    314338
    315339        total_deleted = 0;
    316         cli_list(c, mask, aDIR, delete_fn, NULL);
     340        cli_list(c, mask, FILE_ATTRIBUTE_DIRECTORY, delete_fn, NULL);
    317341        free(mask);
    318342        cli_rmdir(c, dname);
Note: See TracChangeset for help on using the changeset viewer.