All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ivan Gyurdiev <ivg2@cornell.edu>
To: SELinux List <SELinux@tycho.nsa.gov>
Cc: Stephen Smalley <sds@tycho.nsa.gov>
Subject: [SEMANAGE] Commit numbers for ro database calls
Date: Fri, 23 Dec 2005 06:28:05 -0500	[thread overview]
Message-ID: <43ABDF45.7020900@cornell.edu> (raw)

[-- Attachment #1: Type: text/plain, Size: 518 bytes --]

This should make Joshua happy... return commit numbers on all ro 
operations. This does not return commit numbers on rw operations, which 
is consistent with what the modules code does (I think...).

Next we should take advantage of commit numbers to only re-read the 
cache on ro calls when the commit number has changed.

----
I don't like how dependency on semanage_store.c is creeping into database.c.
(but it was there to begin with - active_lock, and so on...) - might 
need to reorganize some of this later..



[-- Attachment #2: libsemanage6.commit_numbers.diff --]
[-- Type: text/x-patch, Size: 1531 bytes --]

diff -Naurp --exclude-from excludes old/libsemanage/src/database.c new/libsemanage/src/database.c
--- old/libsemanage/src/database.c	2005-11-04 15:37:49.000000000 -0500
+++ new/libsemanage/src/database.c	2005-12-23 06:14:15.000000000 -0500
@@ -45,14 +45,18 @@ static int enter_ro(
 	return STATUS_ERR;
 }
 
-static inline void exit_ro(
+static inline int exit_ro(
 	semanage_handle_t* handle,
 	dbase_config_t* dconfig) {
 
+	int commit_num = semanage_get_commit_number(handle);
+
 	if (!handle->is_in_transaction) {
 		semanage_release_active_lock(handle);
 		dconfig->dtable->drop_cache(dconfig->dbase);
 	}
+
+	return commit_num;
 }
 
 static int enter_rw(
@@ -150,8 +154,7 @@ int dbase_query (
 		return STATUS_ERR;
 	}
 
-	exit_ro(handle, dconfig);
-	return STATUS_SUCCESS;
+	return exit_ro(handle, dconfig);
 }
 
 int dbase_exists (
@@ -168,8 +171,7 @@ int dbase_exists (
 		return STATUS_ERR;
 	}
 
-	exit_ro(handle, dconfig);
-	return STATUS_SUCCESS;
+	return exit_ro(handle, dconfig);
 }
 
 int dbase_count (
@@ -185,8 +187,7 @@ int dbase_count (
 		return STATUS_ERR;
 	}
 
-	exit_ro(handle, dconfig);
-	return STATUS_SUCCESS;
+	return exit_ro(handle, dconfig);
 }
 
 int dbase_iterate(
@@ -203,8 +204,7 @@ int dbase_iterate(
 		return STATUS_ERR;
 	}
 
-	exit_ro(handle, dconfig);
-	return STATUS_SUCCESS;
+	return exit_ro(handle, dconfig);
 }
 
 int dbase_list (
@@ -221,6 +221,5 @@ int dbase_list (
 		return STATUS_ERR;
 	}
 
-	exit_ro(handle, dconfig);
-	return STATUS_SUCCESS;
+	return exit_ro(handle, dconfig);
 }

             reply	other threads:[~2005-12-23 11:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-23 11:28 Ivan Gyurdiev [this message]
2006-01-02 18:44 ` [SEMANAGE] Commit numbers for ro database calls Joshua Brindle
2006-01-02 16:56   ` Ivan Gyurdiev
2006-01-02 19:11     ` Joshua Brindle
2006-01-02 17:17       ` Ivan Gyurdiev
2006-01-02 19:20         ` Joshua Brindle
2006-01-03 20:39       ` Stephen Smalley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=43ABDF45.7020900@cornell.edu \
    --to=ivg2@cornell.edu \
    --cc=SELinux@tycho.nsa.gov \
    --cc=sds@tycho.nsa.gov \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.