Changeset 745 for trunk/server/source4/torture/gentest.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/source4/torture/gentest.c
r414 r745 49 49 int analyze_always; 50 50 int analyze_continuous; 51 u int_t max_open_handles;52 u int_t seed;53 u int_t numops;51 unsigned int max_open_handles; 52 unsigned int seed; 53 unsigned int numops; 54 54 int use_oplocks; 55 55 char **ignore_patterns; … … 68 68 static struct { 69 69 bool active; 70 u int_t instance;70 unsigned int instance; 71 71 struct smb2_handle smb2_handle[NSERVERS]; /* SMB2 */ 72 72 uint16_t smb_handle[NSERVERS]; /* SMB */ 73 73 const char *name; 74 74 } *open_handles; 75 static u int_t num_open_handles;75 static unsigned int num_open_handles; 76 76 77 77 /* state information for the servers. We open NINSTANCES connections to … … 87 87 /* the seeds and flags for each operation */ 88 88 static struct { 89 u int_t seed;89 unsigned int seed; 90 90 bool disabled; 91 91 } *op_parms; … … 112 112 static struct { 113 113 const char *name; 114 u int_t seed;114 unsigned int seed; 115 115 NTSTATUS status; 116 u int_t opnum;116 unsigned int opnum; 117 117 TALLOC_CTX *mem_ctx; 118 118 const char *mismatch; … … 216 216 struct smbcli_options smb_options; 217 217 struct smbcli_session_options smb_session_options; 218 lp _smbcli_options(lp_ctx, &smb_options);219 lp _smbcli_session_options(lp_ctx, &smb_session_options);218 lpcfg_smbcli_options(lp_ctx, &smb_options); 219 lpcfg_smbcli_session_options(lp_ctx, &smb_session_options); 220 220 221 221 printf("Connecting to \\\\%s\\%s as %s - instance %d\n", … … 228 228 if (options.smb2) { 229 229 status = smb2_connect(NULL, servers[i].server_name, 230 lp _smb_ports(lp_ctx),230 lpcfg_smb_ports(lp_ctx), 231 231 servers[i].share_name, 232 lp _resolve_context(lp_ctx),232 lpcfg_resolve_context(lp_ctx), 233 233 servers[i].credentials, 234 234 &servers[i].smb2_tree[j], 235 235 ev, &smb_options, 236 lp _socket_options(lp_ctx),237 lp _gensec_settings(lp_ctx, lp_ctx)236 lpcfg_socket_options(lp_ctx), 237 lpcfg_gensec_settings(lp_ctx, lp_ctx) 238 238 ); 239 239 } else { … … 241 241 &servers[i].smb_tree[j], 242 242 servers[i].server_name, 243 lp _smb_ports(lp_ctx),243 lpcfg_smb_ports(lp_ctx), 244 244 servers[i].share_name, "A:", 245 lp _socket_options(lp_ctx),245 lpcfg_socket_options(lp_ctx), 246 246 servers[i].credentials, 247 lp _resolve_context(lp_ctx), ev,247 lpcfg_resolve_context(lp_ctx), ev, 248 248 &smb_options, 249 249 &smb_session_options, 250 lp_iconv_convenience(lp_ctx), 251 lp_gensec_settings(lp_ctx, lp_ctx)); 250 lpcfg_gensec_settings(lp_ctx, lp_ctx)); 252 251 } 253 252 if (!NT_STATUS_IS_OK(status)) { … … 278 277 work out the time skew between the servers - be conservative 279 278 */ 280 static u int_t time_skew(void)281 { 282 u int_t ret;279 static unsigned int time_skew(void) 280 { 281 unsigned int ret; 283 282 if (options.smb2) { 284 283 ret = labs(servers[0].smb2_tree[0]->session->transport->negotiate.system_time - … … 300 299 turn a server handle into a local handle 301 300 */ 302 static u int_t fnum_to_handle_smb2(int server, int instance, struct smb2_handle server_handle)303 { 304 u int_t i;301 static unsigned int fnum_to_handle_smb2(int server, int instance, struct smb2_handle server_handle) 302 { 303 unsigned int i; 305 304 for (i=0;i<options.max_open_handles;i++) { 306 305 if (!open_handles[i].active || … … 318 317 turn a server handle into a local handle 319 318 */ 320 static u int_t fnum_to_handle_smb(int server, int instance, uint16_t server_handle)321 { 322 u int_t i;319 static unsigned int fnum_to_handle_smb(int server, int instance, uint16_t server_handle) 320 { 321 unsigned int i; 323 322 for (i=0;i<options.max_open_handles;i++) { 324 323 if (!open_handles[i].active || … … 451 450 return true with 'chance' probability as a percentage 452 451 */ 453 static bool gen_chance(u int_t chance)452 static bool gen_chance(unsigned int chance) 454 453 { 455 454 return ((random() % 100) <= chance); … … 512 511 static int gen_int_range(uint64_t min, uint64_t max) 513 512 { 514 u int_t r = random();513 unsigned int r = random(); 515 514 return min + (r % (1+max-min)); 516 515 } … … 641 640 generate a bitmask 642 641 */ 643 static uint32_t gen_bits_mask(u int_t mask)644 { 645 u int_t ret = random();642 static uint32_t gen_bits_mask(unsigned int mask) 643 { 644 unsigned int ret = random(); 646 645 return ret & mask; 647 646 } … … 870 869 generate a file allocation size 871 870 */ 872 static u int_t gen_alloc_size(void)873 { 874 u int_t ret;871 static unsigned int gen_alloc_size(void) 872 { 873 unsigned int ret; 875 874 876 875 if (gen_chance(30)) return 0; … … 1213 1212 int i, j; 1214 1213 1215 msleep(20);1214 smb_msleep(20); 1216 1215 1217 1216 for (j=0;j<NINSTANCES;j++) { … … 1820 1819 parm[0].ntcreatex.level = RAW_OPEN_NTCREATEX; 1821 1820 parm[0].ntcreatex.in.flags = gen_ntcreatex_flags(); 1822 parm[0].ntcreatex.in.root_fid = gen_root_fid(instance);1821 parm[0].ntcreatex.in.root_fid.fnum = gen_root_fid(instance); 1823 1822 parm[0].ntcreatex.in.access_mask = gen_access_mask(); 1824 1823 parm[0].ntcreatex.in.alloc_size = gen_alloc_size(); … … 1838 1837 1839 1838 GEN_COPY_PARM; 1840 if (parm[0].ntcreatex.in.root_fid != 0) {1841 GEN_SET_FNUM_SMB(ntcreatex.in.root_fid );1839 if (parm[0].ntcreatex.in.root_fid.fnum != 0) { 1840 GEN_SET_FNUM_SMB(ntcreatex.in.root_fid.fnum); 1842 1841 } 1843 1842 GEN_CALL_SMB(smb_raw_open(tree, current_op.mem_ctx, &parm[i])); … … 2662 2661 parm[0].in.file.handle.data[0] = gen_fnum(instance); 2663 2662 parm[0].in.lock_count = gen_lock_count(); 2664 parm[0].in. reserved= gen_reserved32();2663 parm[0].in.lock_sequence = gen_reserved32(); 2665 2664 2666 2665 parm[0].in.locks = talloc_array(current_op.mem_ctx, … … 3187 3186 switch (opt) { 3188 3187 case OPT_UNCLIST: 3189 lp _set_cmdline(cmdline_lp_ctx, "torture:unclist", poptGetOptArg(pc));3188 lpcfg_set_cmdline(cmdline_lp_ctx, "torture:unclist", poptGetOptArg(pc)); 3190 3189 break; 3191 3190 case 'U':
Note:
See TracChangeset
for help on using the changeset viewer.