Skip to contentSkip to conversation

PATCH: libselinux-1.34.0 bit type usage

PATCH Applied [email protected] 2 participants 2 messages Feb 7, 2007 – Feb 20, 2007 SELinux security module

lore
Share & tools
lore
#0 lore raw

libselinux uses a mix of bit type styles: BSD-style (u_XXint_t), Linux kernel style (uXX), and C99 (uintXX_t). The following patch makes things consistent by replacing use of BSD and Linux kernel styles with the standard C99 bit types from stdint.h. Most files included stdint.h already.

- todd

include/selinux/avc.h +2 -2
diff -ur libselinux-1.34.0.DIST/include/selinux/avc.h libselinux-1.34.0/include/selinux/avc.h
@@ -304,11 +304,11 @@
  * -%1 if insufficient memory exists to add the callback.
  */
 	int avc_add_callback(int (*callback)
-			      (u_int32_t event, security_id_t ssid,
+			      (uint32_t event, security_id_t ssid,
 			       security_id_t tsid, security_class_t tclass,
 			       access_vector_t perms,
 			       access_vector_t * out_retained),
-			     u_int32_t events, security_id_t ssid,
+			     uint32_t events, security_id_t ssid,
 			     security_id_t tsid, security_class_t tclass,
 			     access_vector_t perms);
 
man/man3/avc_add_callback.3 +2 -2
diff -ur libselinux-1.34.0.DIST/man/man3/avc_add_callback.3 libselinux-1.34.0/man/man3/avc_add_callback.3
@@ -9,7 +9,7 @@
 .br
 .B #include <selinux/avc.h>
 .sp
-.BI "int avc_add_callback(int (*" callback ")(u_int32_t " event , 
+.BI "int avc_add_callback(int (*" callback ")(uint32_t " event , 
 .in +\w'int avc_add_callback(int (*callback)('u
 .BI "security_id_t " ssid ,
 .br
@@ -22,7 +22,7 @@
 .BI "access_vector_t *" out_retained "),"
 .in
 .in +\w'int avc_add_callback('u
-.BI "u_int32_t " events ", security_id_t " ssid , 
+.BI "uint32_t " events ", security_id_t " ssid , 
 .br
 .BI "security_id_t " tsid ", security_class_t " tclass ,
 .br
src/avc.c +32 -32

197 lines not on this page · raw message

src/avc_internal.c +1 -1
diff -ur libselinux-1.34.0.DIST/src/avc_internal.c libselinux-1.34.0/src/avc_internal.c
@@ -11,12 +11,12 @@
 #include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <stdint.h>
 #include <unistd.h>
 #include <fcntl.h>
 #include <string.h>
 #include <sys/types.h>
 #include <sys/socket.h>
-#include <asm/types.h>
 #include <linux/netlink.h>
 #include "selinux_netlink.h"
 #include "avc_internal.h"
src/avc_internal.h +6 -10
diff -ur libselinux-1.34.0.DIST/src/avc_internal.h libselinux-1.34.0/src/avc_internal.h
@@ -15,10 +15,6 @@
 #include <selinux/avc.h>
 #include "dso.h"
 
-typedef u_int32_t u32;
-typedef u_int16_t u16;
-typedef u_int8_t u8;
-
 /* SID reference counter manipulation */
 static inline int sid_inc_refcnt(security_id_t sid)
 {
@@ -164,21 +160,21 @@
 /* internal callbacks */
 int avc_ss_grant(security_id_t ssid, security_id_t tsid,
 		 security_class_t tclass, access_vector_t perms,
-		 u_int32_t seqno) hidden;
+		 uint32_t seqno) hidden;
 int avc_ss_try_revoke(security_id_t ssid, security_id_t tsid,
 		      security_class_t tclass,
-		      access_vector_t perms, u_int32_t seqno,
+		      access_vector_t perms, uint32_t seqno,
 		      access_vector_t * out_retained) hidden;
 int avc_ss_revoke(security_id_t ssid, security_id_t tsid,
 		  security_class_t tclass, access_vector_t perms,
-		  u_int32_t seqno) hidden;
-int avc_ss_reset(u_int32_t seqno) hidden;
+		  uint32_t seqno) hidden;
+int avc_ss_reset(uint32_t seqno) hidden;
 int avc_ss_set_auditallow(security_id_t ssid, security_id_t tsid,
 			  security_class_t tclass, access_vector_t perms,
-			  u_int32_t seqno, u_int32_t enable) hidden;
+			  uint32_t seqno, uint32_t enable) hidden;
 int avc_ss_set_auditdeny(security_id_t ssid, security_id_t tsid,
 			 security_class_t tclass, access_vector_t perms,
-			 u_int32_t seqno, u_int32_t enable) hidden;
+			 uint32_t seqno, uint32_t enable) hidden;
 
 /* netlink kernel message code */
 extern int avc_netlink_trouble hidden;
src/avc_sidtab.c +1 -0
diff -ur libselinux-1.34.0.DIST/src/avc_sidtab.c libselinux-1.34.0/src/avc_sidtab.c
@@ -6,6 +6,7 @@
 #include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <stdint.h>
 #include <string.h>
 #include "selinux_internal.h"
 #include <selinux/avc.h>
src/selinux_netlink.h +1 -1
diff -ur libselinux-1.34.0.DIST/src/selinux_netlink.h libselinux-1.34.0/src/selinux_netlink.h
@@ -25,7 +25,7 @@
 };
 
 struct selnl_msg_policyload {
-	u_int32_t seqno;
+	uint32_t seqno;
 };
 
 #endif				/* _LINUX_SELINUX_NETLINK_H */

--
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
Quoted 5 lines · On Wed, 2007-02-07 at 12:10 -0500, [email protected] wrote:

libselinux uses a mix of bit type styles: BSD-style (u_XXint_t), Linux kernel style (uXX), and C99 (uintXX_t). The following patch makes things consistent by replacing use of BSD and Linux kernel styles with the standard C99 bit types from stdint.h. Most files included stdint.h already.

Merged to -stable and to -trunk.

Signature · 8 lines
Stephen Smalley
National Security Agency


--
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.