summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorVolker Lendecke <vl@sernet.de>2007-12-05 20:53:22 +0100
committerVolker Lendecke <vl@samba.org>2007-12-10 12:22:01 +0100
commitd60fac2a5a789680b6dd9f05ab15a3033ec2887c (patch)
tree18a22107352f58657179bfdd8c2bad81efebf180 /source3
parent0527d3758ad7522995e1e1cc85a3c1b9ee22de52 (diff)
downloadsamba-d60fac2a5a789680b6dd9f05ab15a3033ec2887c.tar.gz
samba-d60fac2a5a789680b6dd9f05ab15a3033ec2887c.tar.bz2
samba-d60fac2a5a789680b6dd9f05ab15a3033ec2887c.zip
Tiny simplifications
locking.c:open_read_only was unused don't export the silly boolean flag locking_init(bool read_only) (This used to be commit 2f3c865707010bc7c463a02782dbee3dc2479da1)
Diffstat (limited to 'source3')
-rw-r--r--source3/locking/brlock.c7
-rw-r--r--source3/locking/locking.c24
-rw-r--r--source3/locking/posix.c2
-rw-r--r--source3/printing/printing.c2
-rw-r--r--source3/smbd/server.c2
-rw-r--r--source3/torture/locktest2.c2
-rw-r--r--source3/utils/status.c2
-rw-r--r--source3/web/statuspage.c2
8 files changed, 22 insertions, 21 deletions
diff --git a/source3/locking/brlock.c b/source3/locking/brlock.c
index f821761cd7..eb42d081fe 100644
--- a/source3/locking/brlock.c
+++ b/source3/locking/brlock.c
@@ -258,7 +258,7 @@ static NTSTATUS brl_lock_failed(files_struct *fsp, const struct lock_struct *loc
Open up the brlock.tdb database.
****************************************************************************/
-void brl_init(int read_only)
+void brl_init(bool read_only)
{
if (brlock_db) {
return;
@@ -279,11 +279,8 @@ void brl_init(int read_only)
Close down the brlock.tdb database.
****************************************************************************/
-void brl_shutdown(int read_only)
+void brl_shutdown(void)
{
- if (!brlock_db) {
- return;
- }
TALLOC_FREE(brlock_db);
}
diff --git a/source3/locking/locking.c b/source3/locking/locking.c
index 296323f7da..dab21e53b3 100644
--- a/source3/locking/locking.c
+++ b/source3/locking/locking.c
@@ -385,9 +385,7 @@ void locking_close_file(struct messaging_context *msg_ctx,
Initialise the locking functions.
****************************************************************************/
-static int open_read_only;
-
-bool locking_init(int read_only)
+static bool locking_init_internal(bool read_only)
{
brl_init(read_only);
@@ -408,22 +406,28 @@ bool locking_init(int read_only)
if (!posix_locking_init(read_only))
return False;
- open_read_only = read_only;
-
return True;
}
+bool locking_init(void)
+{
+ return locking_init_internal(false);
+}
+
+bool locking_init_readonly(void)
+{
+ return locking_init_internal(true);
+}
+
/*******************************************************************
Deinitialize the share_mode management.
******************************************************************/
bool locking_end(void)
{
- brl_shutdown(open_read_only);
- if (lock_db) {
- TALLOC_FREE(lock_db);
- }
- return True;
+ brl_shutdown();
+ TALLOC_FREE(lock_db);
+ return true;
}
/*******************************************************************
diff --git a/source3/locking/posix.c b/source3/locking/posix.c
index 7669b140f6..4b0b91bd19 100644
--- a/source3/locking/posix.c
+++ b/source3/locking/posix.c
@@ -347,7 +347,7 @@ static TDB_DATA fd_array_key_fsp(files_struct *fsp)
Create the in-memory POSIX lock databases.
********************************************************************/
-bool posix_locking_init(int read_only)
+bool posix_locking_init(bool read_only)
{
if (posix_pending_close_tdb) {
return True;
diff --git a/source3/printing/printing.c b/source3/printing/printing.c
index 1c7ad158d4..fa6ed89edd 100644
--- a/source3/printing/printing.c
+++ b/source3/printing/printing.c
@@ -1403,7 +1403,7 @@ void start_background_queue(void)
claim_connection( NULL, "smbd lpq backend",
FLAG_MSG_GENERAL|FLAG_MSG_SMBD|FLAG_MSG_PRINT_GENERAL);
- if (!locking_init(0)) {
+ if (!locking_init()) {
exit(1);
}
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index 6b1ab6ff17..7d0dff0480 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -1174,7 +1174,7 @@ extern void build_options(bool screen);
if (!connections_init(True))
exit(1);
- if (!locking_init(0))
+ if (!locking_init())
exit(1);
namecache_enable();
diff --git a/source3/torture/locktest2.c b/source3/torture/locktest2.c
index 45a957e3a4..b99fdbc093 100644
--- a/source3/torture/locktest2.c
+++ b/source3/torture/locktest2.c
@@ -558,7 +558,7 @@ static void usage(void)
DEBUG(0,("seed=%u\n", seed));
srandom(seed);
- locking_init(1);
+ locking_init_readonly();
test_locks(share1, share2, nfspath1, nfspath2);
return(0);
diff --git a/source3/utils/status.c b/source3/utils/status.c
index 9a4b3a4835..5de80fa555 100644
--- a/source3/utils/status.c
+++ b/source3/utils/status.c
@@ -440,7 +440,7 @@ static int traverse_sessionid(struct db_record *db, void *state)
TALLOC_FREE(db);
}
- if (!locking_init(1)) {
+ if (!locking_init_readonly()) {
d_printf("Can't initialise locking module - exiting\n");
ret = 1;
goto done;
diff --git a/source3/web/statuspage.c b/source3/web/statuspage.c
index 647e4fcb5b..eda53b66ab 100644
--- a/source3/web/statuspage.c
+++ b/source3/web/statuspage.c
@@ -427,7 +427,7 @@ void status_page(void)
printf("<table border=1>\n");
printf("<tr><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th></tr>\n", _("PID"), _("Sharing"), _("R/W"), _("Oplock"), _("File"), _("Date"));
- locking_init(1);
+ locking_init_readonly();
share_mode_forall(print_share_mode, NULL);
locking_end();
printf("</table>\n");