Changeset 745 for trunk/server/source3/torture/nbio.c
- Timestamp:
- Nov 27, 2012, 4:43:17 PM (13 years ago)
- Location:
- trunk/server
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/server
- Property svn:mergeinfo changed
/vendor/current merged: 581,587,591,594,597,600,615,618,740
- Property svn:mergeinfo changed
-
trunk/server/source3/torture/nbio.c
r414 r745 21 21 22 22 #include "includes.h" 23 #include "torture/proto.h" 24 #include "../libcli/security/security.h" 25 #include "libsmb/libsmb.h" 26 #include "libsmb/clirap.h" 23 27 24 28 #define MAX_FILES 1000 … … 28 32 extern int nbio_id; 29 33 static int nprocs; 34 static struct timeval nb_start; 30 35 31 36 static struct { … … 61 66 } 62 67 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)); 64 71 65 72 signal(SIGALRM, nb_alarm); … … 122 129 signal(SIGSEGV, sigsegv); 123 130 c = cli; 124 start_timer();131 nb_start = timeval_current(); 125 132 children[nbio_id].done = 0; 126 133 } … … 129 136 void nb_unlink(const char *fname) 130 137 { 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))) { 132 139 #if NBDEBUG 133 140 printf("(%d) unlink %s failed (%s)\n", … … 184 191 { 185 192 int i; 193 NTSTATUS status; 186 194 187 195 if (buf[0] == 0) memset(buf, 1, sizeof(buf)); 188 196 189 197 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)); 193 204 exit(1); 194 205 } … … 242 253 void nb_qpathinfo(const char *fname) 243 254 { 244 cli_qpathinfo (c, fname, NULL, NULL, NULL, NULL, NULL);255 cli_qpathinfo1(c, fname, NULL, NULL, NULL, NULL, NULL); 245 256 } 246 257 … … 249 260 int i; 250 261 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); 252 264 } 253 265 … … 259 271 } 260 272 261 static void find_fn(const char *mnt, file_info *finfo, const char *name, void *state) 273 static NTSTATUS find_fn(const char *mnt, struct file_info *finfo, const char *name, 274 void *state) 262 275 { 263 276 /* noop */ 277 return NT_STATUS_OK; 264 278 } 265 279 … … 278 292 static int total_deleted; 279 293 280 static void delete_fn(const char *mnt, file_info *finfo, const char *name, void *state) 281 { 294 static NTSTATUS delete_fn(const char *mnt, struct file_info *finfo, 295 const char *name, void *state) 296 { 297 NTSTATUS status; 282 298 char *s, *n; 283 if (finfo->name[0] == '.') return; 299 if (finfo->name[0] == '.') { 300 return NT_STATUS_OK; 301 } 284 302 285 303 n = SMB_STRDUP(name); … … 287 305 if (asprintf(&s, "%s%s", n, finfo->name) == -1) { 288 306 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) { 292 310 char *s2; 293 311 if (asprintf(&s2, "%s\\*", s) == -1) { 294 312 printf("asprintf failed\n"); 295 return ;313 return NT_STATUS_NO_MEMORY; 296 314 } 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 } 298 321 nb_rmdir(s); 299 322 } else { … … 303 326 free(s); 304 327 free(n); 328 return NT_STATUS_OK; 305 329 } 306 330 … … 314 338 315 339 total_deleted = 0; 316 cli_list(c, mask, aDIR, delete_fn, NULL);340 cli_list(c, mask, FILE_ATTRIBUTE_DIRECTORY, delete_fn, NULL); 317 341 free(mask); 318 342 cli_rmdir(c, dname);
Note:
See TracChangeset
for help on using the changeset viewer.