All of lore.kernel.org
 help / color / mirror / Atom feed
* [SEMANAGE] Commit numbers for ro database calls
@ 2005-12-23 11:28 Ivan Gyurdiev
  2006-01-02 18:44 ` Joshua Brindle
  0 siblings, 1 reply; 7+ messages in thread
From: Ivan Gyurdiev @ 2005-12-23 11:28 UTC (permalink / raw)
  To: SELinux List; +Cc: Stephen Smalley

[-- 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);
 }

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2006-01-03 20:39 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-23 11:28 [SEMANAGE] Commit numbers for ro database calls Ivan Gyurdiev
2006-01-02 18:44 ` 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

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.