Skip to contentSkip to conversation

Annotate objects

SEMANAGE Ivan Gyurdiev 2 participants 3 messages Dec 23, 2005 – Jan 2, 2006 SELinux security module

lore
Share & tools
lore
#0 lore raw

This patch adds comments that explain the object relationships, to avoid confusion...

libsemanage/src/boolean_record.c +6 -0
diff -Naurp --exclude-from excludes old/libsemanage/src/boolean_record.c new/libsemanage/src/boolean_record.c
@@ -1,5 +1,11 @@
 /* Copyright (C) 2005 Red Hat, Inc. */
 
+/* Object: semanage_bool_t (Policy Boolean)
+ * Object: semanage_bool_key_t (Policy Boolean Key)
+ * Implements: record_t (Database Record)
+ * Implements: record_key_t (Database Record Key)
+ */
+
 #include <sepol/boolean_record.h>
 
 typedef sepol_bool_t semanage_bool_t;
libsemanage/src/database_file.c +5 -0
diff -Naurp --exclude-from excludes old/libsemanage/src/database_file.c new/libsemanage/src/database_file.c
@@ -1,5 +1,10 @@
 /* Copyright (C) 2005 Red Hat, Inc. */
 
+/* Object: dbase_file_t (File)
+ * Extends: dbase_llist_t (Linked List) 
+ * Implements: dbase_t (Database)
+ */
+
 struct dbase_file;
 typedef struct dbase_file dbase_t;
 #define DBASE_DEFINED
libsemanage/src/database_llist.c +4 -1
diff -Naurp --exclude-from excludes old/libsemanage/src/database_llist.c new/libsemanage/src/database_llist.c
@@ -1,5 +1,9 @@
 /* Copyright (C) 2005 Red Hat, Inc. */
 
+/* Object: dbase_llist_t (Linked List)
+ * Partially Implements: dbase_t (Database)
+ */
+
 struct dbase_llist;
 typedef struct dbase_llist dbase_t;
 #define DBASE_DEFINED
@@ -30,7 +34,6 @@ hidden int dbase_llist_cache_prepend(
 	if (dbase->cache_tail == NULL)
 		dbase->cache_tail = entry;
 	dbase->cache = entry;
-
 	dbase->cache_sz++;
         return STATUS_SUCCESS;
 
libsemanage/src/database_policydb.c +4 -0
diff -Naurp --exclude-from excludes old/libsemanage/src/database_policydb.c new/libsemanage/src/database_policydb.c
@@ -1,5 +1,9 @@
 /* Copyright (C) 2005 Red Hat, Inc. */
 
+/* Object: dbase_policydb_t (Policy)
+ * Implements: dbase_t (Database)
+ */
+
 struct dbase_policydb;
 typedef struct dbase_policydb dbase_t;
 #define DBASE_DEFINED
libsemanage/src/iface_record.c +6 -0
diff -Naurp --exclude-from excludes old/libsemanage/src/iface_record.c new/libsemanage/src/iface_record.c
@@ -1,5 +1,11 @@
 /* Copyright (C) 2005 Red Hat, Inc. */
 
+/* Object: semanage_iface_t (Network Interface)
+ * Object: semanage_iface_key_t (Network Interface Key)
+ * Implements: record_t (Database Record)
+ * Implements: record_key_t (Database Record Key)
+ */
+
 #include <sepol/context_record.h>
 #include <sepol/iface_record.h>
 
libsemanage/src/port_record.c +6 -0
diff -Naurp --exclude-from excludes old/libsemanage/src/port_record.c new/libsemanage/src/port_record.c
@@ -1,5 +1,11 @@
 /* Copyright (C) 2005 Red Hat, Inc. */
 
+/* Object: semanage_port_t (Network Port)
+ * Object: semanage_port_key_t (Network Port Key)
+ * Implements: record_t (Database Record)
+ * Implements: record_key_t (Database Record Key)
+ */
+
 #include <sepol/context_record.h>
 #include <sepol/port_record.h>
 
libsemanage/src/seuser_record.c +6 -0
diff -Naurp --exclude-from excludes old/libsemanage/src/seuser_record.c new/libsemanage/src/seuser_record.c
@@ -1,5 +1,11 @@
 /* Copyright (C) 2005 Red Hat, Inc. */
 
+/* Object: semanage_seuser_t (Unix User)
+ * Object: semanage_seuser_key_t (Unix User Key)
+ * Implements: record_t (Database Record)
+ * Implements: record_key_t (Database Record Key)
+ */
+
 struct semanage_seuser;
 struct semanage_seuser_key;
 typedef struct semanage_seuser record_t;
libsemanage/src/user_record.c +6 -0
diff -Naurp --exclude-from excludes old/libsemanage/src/user_record.c new/libsemanage/src/user_record.c
@@ -1,5 +1,11 @@
 /* Copyright (C) 2005 Red Hat, Inc. */
 
+/* Object: semanage_user_t (SELinux User/Class)
+ * Object: semanage_user_key_t (SELinux User/Class Key)
+ * Implements: record_t (Database Record)
+ * Implements: record_key_t (Database Record Key)
+ */
+
 #include <sepol/user_record.h>
 
 typedef sepol_user_t semanage_user_t;
#2 lore raw
In reply to Joshua Brindle
Quoted 5 lines
Quoted 3 lines

This patch adds comments that explain the object relationships, to avoid confusion...

I don't think this avoids confusion at all. This isn't Java and C programmers aren't going to automatically understand Implements, Extends, etc.

Yes, the vocabulary draws from Java, because I have some Java background - feel free to suggest something different, and I'll change the comments. Implements -> interface (?) Extends -> inherits from (?)

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

#1 lore raw
In reply to Ivan Gyurdiev
Quoted 2 lines · Ivan Gyurdiev

This patch adds comments that explain the object relationships, to avoid confusion...

I don't think this avoids confusion at all. This isn't Java and C programmers aren't going to automatically understand Implements, Extends, etc.

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.