From 98b57d5eb61094a9c88e2f7d90d3e21b7e74e9d8 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 8 Sep 2007 16:46:30 +0000 Subject: r25035: Fix some more warnings, use service pointer rather than service number in more places. (This used to be commit df9cebcb97e20564359097148665bd519f31bc6f) --- source4/torture/raw/acls.c | 2 +- source4/torture/raw/composite.c | 20 ++++++++++---------- source4/torture/raw/context.c | 12 ++++++------ source4/torture/raw/eas.c | 10 +++++----- source4/torture/raw/lock.c | 4 ++-- source4/torture/raw/lockbench.c | 2 +- source4/torture/raw/mkdir.c | 2 +- source4/torture/raw/mux.c | 2 +- source4/torture/raw/notify.c | 3 +-- source4/torture/raw/open.c | 8 ++++---- source4/torture/raw/pingpong.c | 23 ++++++++++------------- source4/torture/raw/qfsinfo.c | 2 +- source4/torture/raw/read.c | 6 +++--- source4/torture/raw/streams.c | 4 ++-- source4/torture/raw/unlink.c | 10 +++++----- 15 files changed, 53 insertions(+), 57 deletions(-) (limited to 'source4/torture/raw') diff --git a/source4/torture/raw/acls.c b/source4/torture/raw/acls.c index 026384cb8b..ab112658e2 100644 --- a/source4/torture/raw/acls.c +++ b/source4/torture/raw/acls.c @@ -1736,7 +1736,7 @@ done: */ bool torture_raw_acls(struct torture_context *tctx, struct smbcli_state *cli) { - BOOL ret = True; + bool ret = true; if (!torture_setup_dir(cli, BASEDIR)) { return false; diff --git a/source4/torture/raw/composite.c b/source4/torture/raw/composite.c index ea5c09c335..370c1f510b 100644 --- a/source4/torture/raw/composite.c +++ b/source4/torture/raw/composite.c @@ -87,7 +87,7 @@ static BOOL test_loadfile(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) printf("waiting for completion\n"); while (*count != num_ops) { event_loop_once(cli->transport->socket->event.ctx); - if (lp_parm_bool(-1, "torture", "progress", true)) { + if (lp_parm_bool(NULL, "torture", "progress", true)) { printf("count=%d\r", *count); fflush(stdout); } @@ -152,10 +152,10 @@ static BOOL test_fetchfile(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) return False; } - io2.in.dest_host = lp_parm_string(-1, "torture", "host"); + io2.in.dest_host = lp_parm_string(NULL, "torture", "host"); io2.in.port = 0; - io2.in.called_name = lp_parm_string(-1, "torture", "host"); - io2.in.service = lp_parm_string(-1, "torture", "share"); + io2.in.called_name = lp_parm_string(NULL, "torture", "host"); + io2.in.service = lp_parm_string(NULL, "torture", "share"); io2.in.service_type = "A:"; io2.in.credentials = cmdline_credentials; @@ -177,7 +177,7 @@ static BOOL test_fetchfile(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) while (*count != torture_numops) { event_loop_once(event_ctx); - if (lp_parm_bool(-1, "torture", "progress", true)) { + if (lp_parm_bool(NULL, "torture", "progress", true)) { printf("count=%d\r", *count); fflush(stdout); } @@ -297,7 +297,7 @@ static BOOL test_appendacl(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) printf("waiting for completion\n"); while (*count != num_ops) { event_loop_once(event_ctx); - if (lp_parm_bool(-1, "torture", "progress", true)) { + if (lp_parm_bool(NULL, "torture", "progress", true)) { printf("count=%d\r", *count); fflush(stdout); } @@ -340,10 +340,10 @@ static BOOL test_fsinfo(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) int *count = talloc_zero(mem_ctx, int); BOOL ret = True; - io1.in.dest_host = lp_parm_string(-1, "torture", "host"); + io1.in.dest_host = lp_parm_string(NULL, "torture", "host"); io1.in.port = 0; - io1.in.called_name = lp_parm_string(-1, "torture", "host"); - io1.in.service = lp_parm_string(-1, "torture", "share"); + io1.in.called_name = lp_parm_string(NULL, "torture", "host"); + io1.in.service = lp_parm_string(NULL, "torture", "share"); io1.in.service_type = "A:"; io1.in.credentials = cmdline_credentials; io1.in.workgroup = lp_workgroup(); @@ -364,7 +364,7 @@ static BOOL test_fsinfo(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) while (*count < torture_numops) { event_loop_once(event_ctx); - if (lp_parm_bool(-1, "torture", "progress", true)) { + if (lp_parm_bool(NULL, "torture", "progress", true)) { printf("count=%d\r", *count); fflush(stdout); } diff --git a/source4/torture/raw/context.c b/source4/torture/raw/context.c index 79771a004d..dacc9958be 100644 --- a/source4/torture/raw/context.c +++ b/source4/torture/raw/context.c @@ -277,8 +277,8 @@ static BOOL test_tree(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) return False; } - share = lp_parm_string(-1, "torture", "share"); - host = lp_parm_string(-1, "torture", "host"); + share = lp_parm_string(NULL, "torture", "share"); + host = lp_parm_string(NULL, "torture", "host"); printf("create a second tree context on the same session\n"); tree = smbcli_tree_init(cli->session, mem_ctx, False); @@ -385,8 +385,8 @@ static BOOL test_tree_ulogoff(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) return False; } - share = lp_parm_string(-1, "torture", "share"); - host = lp_parm_string(-1, "torture", "host"); + share = lp_parm_string(NULL, "torture", "share"); + host = lp_parm_string(NULL, "torture", "host"); printf("create the first new sessions\n"); session1 = smbcli_session_init(cli->transport, mem_ctx, False); @@ -746,8 +746,8 @@ static BOOL test_pid_2tcon(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) return False; } - share = lp_parm_string(-1, "torture", "share"); - host = lp_parm_string(-1, "torture", "host"); + share = lp_parm_string(NULL, "torture", "share"); + host = lp_parm_string(NULL, "torture", "host"); printf("create a second tree context on the same session\n"); tree = smbcli_tree_init(cli->session, mem_ctx, False); diff --git a/source4/torture/raw/eas.c b/source4/torture/raw/eas.c index 5e80564380..810667134a 100644 --- a/source4/torture/raw/eas.c +++ b/source4/torture/raw/eas.c @@ -247,10 +247,10 @@ static BOOL test_max_eas(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) printf("TESTING SETFILEINFO MAX. EA_SET\n"); - maxeasize = lp_parm_int(-1, "torture", "maxeasize", 65536); - maxeanames = lp_parm_int(-1, "torture", "maxeanames", 101); - maxeastart = lp_parm_int(-1, "torture", "maxeastart", 1); - maxeadebug = lp_parm_int(-1, "torture", "maxeadebug", 0); + maxeasize = lp_parm_int(NULL, "torture", "maxeasize", 65536); + maxeanames = lp_parm_int(NULL, "torture", "maxeanames", 101); + maxeastart = lp_parm_int(NULL, "torture", "maxeastart", 1); + maxeadebug = lp_parm_int(NULL, "torture", "maxeadebug", 0); /* Do some sanity check on possibly passed parms */ if (maxeasize <= 0) { @@ -447,7 +447,7 @@ done: */ bool torture_raw_eas(struct torture_context *torture, struct smbcli_state *cli) { - BOOL ret = True; + bool ret = true; if (!torture_setup_dir(cli, BASEDIR)) { return False; diff --git a/source4/torture/raw/lock.c b/source4/torture/raw/lock.c index e4ab9d9e4a..c47f3c7978 100644 --- a/source4/torture/raw/lock.c +++ b/source4/torture/raw/lock.c @@ -599,8 +599,8 @@ static bool test_async(struct torture_context *tctx, session->vuid = setup.out.vuid; printf("create new tree context\n"); - share = lp_parm_string(-1, "torture", "share"); - host = lp_parm_string(-1, "torture", "host"); + share = lp_parm_string(NULL, "torture", "share"); + host = lp_parm_string(NULL, "torture", "host"); tree = smbcli_tree_init(session, tctx, False); tcon.generic.level = RAW_TCON_TCONX; tcon.tconx.in.flags = 0; diff --git a/source4/torture/raw/lockbench.c b/source4/torture/raw/lockbench.c index 6ef33be759..55cab9e117 100644 --- a/source4/torture/raw/lockbench.c +++ b/source4/torture/raw/lockbench.c @@ -318,7 +318,7 @@ BOOL torture_bench_lock(struct torture_context *torture) progress = torture_setting_bool(torture, "progress", true); - nprocs = lp_parm_int(-1, "torture", "nprocs", 4); + nprocs = lp_parm_int(NULL, "torture", "nprocs", 4); state = talloc_zero_array(mem_ctx, struct benchlock_state, nprocs); diff --git a/source4/torture/raw/mkdir.c b/source4/torture/raw/mkdir.c index c4d7bc2534..2df2c6c84e 100644 --- a/source4/torture/raw/mkdir.c +++ b/source4/torture/raw/mkdir.c @@ -130,7 +130,7 @@ static BOOL test_mkdir(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) md.t2mkdir.in.eas[2].value = data_blob_talloc(mem_ctx, "xx1", 3); status = smb_raw_mkdir(cli->tree, &md); - if (lp_parm_bool(-1, "torture", "samba3", False) + if (lp_parm_bool(NULL, "torture", "samba3", false) && NT_STATUS_EQUAL(status, NT_STATUS_EAS_NOT_SUPPORTED)) { d_printf("EAS not supported -- not treating as fatal\n"); } diff --git a/source4/torture/raw/mux.c b/source4/torture/raw/mux.c index b67d756ed9..95ba319eea 100644 --- a/source4/torture/raw/mux.c +++ b/source4/torture/raw/mux.c @@ -176,7 +176,7 @@ static BOOL test_mux_write(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) io.writex.in.wmode = 0; io.writex.in.remaining = 0; io.writex.in.count = 4; - io.writex.in.data = (void *)&fnum; + io.writex.in.data = (const uint8_t *)&fnum; req = smb_raw_write_send(cli->tree, &io); /* unlock the range */ diff --git a/source4/torture/raw/notify.c b/source4/torture/raw/notify.c index d744a891e5..b9d1d07b5e 100644 --- a/source4/torture/raw/notify.c +++ b/source4/torture/raw/notify.c @@ -434,7 +434,6 @@ static BOOL test_notify_mask_change(struct smbcli_state *cli, TALLOC_CTX *mem_ct union smb_open io; int fnum; struct smbcli_request *req1, *req2; - union smb_setfileinfo sfinfo; printf("TESTING CHANGE NOTIFY WITH MASK CHANGE\n"); @@ -712,7 +711,7 @@ static BOOL test_notify_mask(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) NOTIFY_ACTION_MODIFIED, FILE_NOTIFY_CHANGE_ATTRIBUTES, 1); - if (lp_parm_bool(-1, "torture", "samba3", False)) { + if (lp_parm_bool(NULL, "torture", "samba3", false)) { printf("Samba3 does not yet support create times " "everywhere\n"); } diff --git a/source4/torture/raw/open.c b/source4/torture/raw/open.c index 104a2056e3..c0a32e00f4 100644 --- a/source4/torture/raw/open.c +++ b/source4/torture/raw/open.c @@ -398,7 +398,7 @@ static BOOL test_openx(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) io.openx.in.file_attrs = FILE_ATTRIBUTE_SYSTEM; status = smb_raw_open(cli->tree, mem_ctx, &io); CHECK_STATUS(status, NT_STATUS_OK); - if (lp_parm_bool(-1, "torture", "samba3", False)) { + if (lp_parm_bool(NULL, "torture", "samba3", false)) { CHECK_ALL_INFO(FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_ARCHIVE, attrib & ~(FILE_ATTRIBUTE_NONINDEXED| FILE_ATTRIBUTE_SPARSE)); @@ -569,7 +569,7 @@ static BOOL test_t2open(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) status = smb_raw_open(cli->tree, mem_ctx, &io); if ((io.t2open.in.num_eas != 0) && NT_STATUS_EQUAL(status, NT_STATUS_EAS_NOT_SUPPORTED) - && lp_parm_bool(-1, "torture", "samba3", False)) { + && lp_parm_bool(NULL, "torture", "samba3", false)) { printf("(%s) EAs not supported, not treating as fatal " "in Samba3 test\n", __location__); io.t2open.in.num_eas = 0; @@ -1346,8 +1346,8 @@ static BOOL test_raw_open_multi(void) struct smbcli_state **clients; struct smbcli_request **requests; union smb_open *ios; - const char *host = lp_parm_string(-1, "torture", "host"); - const char *share = lp_parm_string(-1, "torture", "share"); + const char *host = lp_parm_string(NULL, "torture", "host"); + const char *share = lp_parm_string(NULL, "torture", "share"); int i, num_files = 3; struct event_context *ev; int num_ok = 0; diff --git a/source4/torture/raw/pingpong.c b/source4/torture/raw/pingpong.c index 6841253c91..6d84ff1ae9 100755 --- a/source4/torture/raw/pingpong.c +++ b/source4/torture/raw/pingpong.c @@ -52,10 +52,7 @@ #include "torture/util.h" #include "param/param.h" - - - -void lock_byte(struct smbcli_state *cli, int fd, int offset, int lock_timeout) +static void lock_byte(struct smbcli_state *cli, int fd, int offset, int lock_timeout) { union smb_lock io; struct smb_lock_entry lock; @@ -93,7 +90,7 @@ try_again: } } -void unlock_byte(struct smbcli_state *cli, int fd, int offset) +static void unlock_byte(struct smbcli_state *cli, int fd, int offset) { union smb_lock io; struct smb_lock_entry lock; @@ -120,7 +117,7 @@ void unlock_byte(struct smbcli_state *cli, int fd, int offset) } } -void write_byte(struct smbcli_state *cli, int fd, uint8_t c, int offset) +static void write_byte(struct smbcli_state *cli, int fd, uint8_t c, int offset) { union smb_write io; NTSTATUS status; @@ -140,7 +137,7 @@ void write_byte(struct smbcli_state *cli, int fd, uint8_t c, int offset) } } -void read_byte(struct smbcli_state *cli, int fd, uint8_t *c, int offset) +static void read_byte(struct smbcli_state *cli, int fd, uint8_t *c, int offset) { union smb_read io; NTSTATUS status; @@ -179,7 +176,7 @@ static double end_timer(void) /* ping pong */ -BOOL torture_ping_pong(struct torture_context *torture) +bool torture_ping_pong(struct torture_context *torture) { const char *fn; int num_locks; @@ -194,21 +191,21 @@ BOOL torture_ping_pong(struct torture_context *torture) uint8_t *val; int count, loops; - fn = lp_parm_string(-1, "torture", "filename"); + fn = lp_parm_string(NULL, "torture", "filename"); if (fn == NULL) { DEBUG(0,("You must specify the filename using --option=torture:filename=...\n")); return false; } - num_locks = lp_parm_int(-1, "torture", "num_locks", -1); + num_locks = lp_parm_int(NULL, "torture", "num_locks", -1); if (num_locks == -1) { DEBUG(0,("You must specify num_locks using --option=torture:num_locks=...\n")); return false; } - do_reads = lp_parm_bool(-1, "torture", "read", False); - do_writes = lp_parm_bool(-1, "torture", "write", False); - lock_timeout = lp_parm_int(-1, "torture", "lock_timeout", 100000); + do_reads = lp_parm_bool(NULL, "torture", "read", false); + do_writes = lp_parm_bool(NULL, "torture", "write", false); + lock_timeout = lp_parm_int(NULL, "torture", "lock_timeout", 100000); if (!torture_open_connection(&cli, 0)) { DEBUG(0,("Could not open connection\n")); diff --git a/source4/torture/raw/qfsinfo.c b/source4/torture/raw/qfsinfo.c index dc09e55b63..05e6f78324 100644 --- a/source4/torture/raw/qfsinfo.c +++ b/source4/torture/raw/qfsinfo.c @@ -121,7 +121,7 @@ static union smb_fsinfo *find(const char *name) quiescent, which is sometimes hard to achieve */ bool torture_raw_qfsinfo(struct torture_context *torture, - struct smbcli_state *cli) + struct smbcli_state *cli) { int i; BOOL ret = True; diff --git a/source4/torture/raw/read.c b/source4/torture/raw/read.c index b00b377c7f..61bf027ae8 100644 --- a/source4/torture/raw/read.c +++ b/source4/torture/raw/read.c @@ -482,7 +482,7 @@ static bool test_readx(struct torture_context *tctx, struct smbcli_state *cli) CHECK_STATUS(status, NT_STATUS_OK); CHECK_VALUE(io.readx.out.remaining, 0xFFFF); CHECK_VALUE(io.readx.out.compaction_mode, 0); - if (lp_parm_bool(-1, "torture", "samba3", False)) { + if (lp_parm_bool(NULL, "torture", "samba3", false)) { printf("SAMBA3: large read extension\n"); CHECK_VALUE(io.readx.out.nread, 80000); } else { @@ -526,7 +526,7 @@ static bool test_readx(struct torture_context *tctx, struct smbcli_state *cli) io.readx.in.maxcnt = 0x10000; status = smb_raw_read(cli->tree, &io); CHECK_STATUS(status, NT_STATUS_OK); - if (lp_parm_bool(-1, "torture", "samba3", False)) { + if (lp_parm_bool(NULL, "torture", "samba3", false)) { printf("SAMBA3: large read extension\n"); CHECK_VALUE(io.readx.out.nread, 0x10000); } else { @@ -536,7 +536,7 @@ static bool test_readx(struct torture_context *tctx, struct smbcli_state *cli) io.readx.in.maxcnt = 0x10001; status = smb_raw_read(cli->tree, &io); CHECK_STATUS(status, NT_STATUS_OK); - if (lp_parm_bool(-1, "torture", "samba3", False)) { + if (lp_parm_bool(NULL, "torture", "samba3", false)) { printf("SAMBA3: large read extension\n"); CHECK_VALUE(io.readx.out.nread, 0x10001); } else { diff --git a/source4/torture/raw/streams.c b/source4/torture/raw/streams.c index c51c6ea2df..81181e49ab 100644 --- a/source4/torture/raw/streams.c +++ b/source4/torture/raw/streams.c @@ -214,9 +214,9 @@ done: basic testing of streams calls */ bool torture_raw_streams(struct torture_context *torture, - struct smbcli_state *cli) + struct smbcli_state *cli) { - BOOL ret = True; + bool ret = true; if (!torture_setup_dir(cli, BASEDIR)) { return False; diff --git a/source4/torture/raw/unlink.c b/source4/torture/raw/unlink.c index 59e1aeb27c..88f9a71aaf 100644 --- a/source4/torture/raw/unlink.c +++ b/source4/torture/raw/unlink.c @@ -129,7 +129,7 @@ static bool test_unlink(struct torture_context *tctx, struct smbcli_state *cli) io.unlink.in.attrib = FILE_ATTRIBUTE_DIRECTORY; status = smb_raw_unlink(cli->tree, &io); - if (lp_parm_bool(-1, "torture", "samba3", False)) { + if (lp_parm_bool(NULL, "torture", "samba3", false)) { /* * In Samba3 we gave up upon getting the error codes in * wildcard unlink correct. Trying gentest showed that this is @@ -157,7 +157,7 @@ static bool test_unlink(struct torture_context *tctx, struct smbcli_state *cli) io.unlink.in.pattern = BASEDIR "\\t*"; io.unlink.in.attrib = FILE_ATTRIBUTE_DIRECTORY; status = smb_raw_unlink(cli->tree, &io); - if (lp_parm_bool(-1, "torture", "samba3", False)) { + if (lp_parm_bool(NULL, "torture", "samba3", false)) { CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_INVALID); } else { @@ -169,7 +169,7 @@ static bool test_unlink(struct torture_context *tctx, struct smbcli_state *cli) io.unlink.in.pattern = BASEDIR "\\*.dat"; io.unlink.in.attrib = FILE_ATTRIBUTE_DIRECTORY; status = smb_raw_unlink(cli->tree, &io); - if (lp_parm_bool(-1, "torture", "samba3", False)) { + if (lp_parm_bool(NULL, "torture", "samba3", false)) { CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_INVALID); } else { @@ -179,7 +179,7 @@ static bool test_unlink(struct torture_context *tctx, struct smbcli_state *cli) io.unlink.in.pattern = BASEDIR "\\*.tx?"; io.unlink.in.attrib = 0; status = smb_raw_unlink(cli->tree, &io); - if (lp_parm_bool(-1, "torture", "samba3", False)) { + if (lp_parm_bool(NULL, "torture", "samba3", false)) { CHECK_STATUS(status, NT_STATUS_NO_SUCH_FILE); } else { @@ -282,7 +282,7 @@ static bool test_delete_on_close(struct torture_context *tctx, CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND); - if (!lp_parm_bool(-1, "torture", "samba3", False)) { + if (!lp_parm_bool(NULL, "torture", "samba3", false)) { /* * Known deficiency, also skipped in base-delete. -- cgit