[email protected]
[Top] [All Lists]

PERFORCE change 114877 for review

Subject: PERFORCE change 114877 for review
From: Todd Miller
Date: Fri, 23 Feb 2007 16:58:10 GMT
http://perforce.freebsd.org/chv.cgi?CH=114877

Change 114877 by [email protected]_macbook on 2007/02/23 16:57:09

        Use stdint.h bit types instead of a mix of Linux and BSD ones.

Affected files ...

.. 
//depot/projects/trustedbsd/sedarwin8/policies/sedarwin/libselinux/src/avc.c#6 
edit
.. 
//depot/projects/trustedbsd/sedarwin8/policies/sedarwin/libselinux/src/avc_internal.c#4
 edit
.. 
//depot/projects/trustedbsd/sedarwin8/policies/sedarwin/libselinux/src/avc_internal.h#3
 edit
.. 
//depot/projects/trustedbsd/sedarwin8/policies/sedarwin/libselinux/src/avc_sidtab.c#3
 edit
.. 
//depot/projects/trustedbsd/sedarwin8/policies/sedarwin/libselinux/src/selinux_netlink.h#3
 edit

Differences ...

==== 
//depot/projects/trustedbsd/sedarwin8/policies/sedarwin/libselinux/src/avc.c#6 
(text+ko) ====

@@ -49,9 +49,9 @@
        }
 };
 static const struct av_perm_to_string {
-       u16 tclass;
-       u16 nameidx;
-       u32 value;
+       uint16_t tclass;
+       uint16_t nameidx;
+       uint32_t value;
 } av_perm_to_string[] = {
 #define S_(c, v, s) { c, offsetof(union av_perm_to_string_data, L1(__LINE__)), 
v },
 #include "av_perm_to_string.h"
@@ -77,7 +77,7 @@
 #undef  S_
        }
 };
-static const u16 class_to_string[] = {
+static const uint16_t class_to_string[] = {
 #define S_(s) offsetof(union class_to_string_data, L1(__LINE__)),
 #include "class_to_string.h"
 #undef  S_
@@ -112,7 +112,7 @@
        struct {
 #define TB_(s) struct {
 #define TE_(s) } s##_part;
-#define S_(s) u16 L1(__LINE__)
+#define S_(s) uint16_t L1(__LINE__)
 #define L1(l) L2(l)
 #define L2(l) field_##l;
 #include "common_perm_to_string.h"
@@ -122,7 +122,7 @@
 #undef L1
 #undef L2
        };
-       u16 data[0];
+       uint16_t data[0];
 } common_perm_to_string = {
        {
 #define TB_(s) {
@@ -140,11 +140,11 @@
 };
 
 static const struct av_inherit {
-       u16 tclass;
-       u16 common_pts_idx;
-       u32 common_base;
+       uint16_t tclass;
+       uint16_t common_pts_idx;
+       uint32_t common_base;
 } av_inherit[] = {
-#define S_(c, i, b) { c, offsetof(union common_perm_to_string, 
common_##i##_perm_to_string_part)/sizeof(u16), b },
+#define S_(c, i, b) { c, offsetof(union common_perm_to_string, 
common_##i##_perm_to_string_part)/sizeof(uint16_t), b },
 #include "av_inherit.h"
 #undef S_
 };
@@ -168,17 +168,17 @@
 
 struct avc_cache {
        struct avc_node *slots[AVC_CACHE_SLOTS];
-       u_int32_t lru_hint;     /* LRU hint for reclaim scan */
-       u_int32_t active_nodes;
-       u_int32_t latest_notif; /* latest revocation notification */
+       uint32_t lru_hint;      /* LRU hint for reclaim scan */
+       uint32_t active_nodes;
+       uint32_t latest_notif;  /* latest revocation notification */
 };
 
 struct avc_callback_node {
-       int (*callback) (u_int32_t event, security_id_t ssid,
+       int (*callback) (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;
+       uint32_t events;
        security_id_t ssid;
        security_id_t tsid;
        security_class_t tclass;
@@ -406,7 +406,7 @@
 {
        struct avc_node *prev, *cur;
        int try;
-       u_int32_t hvalue;
+       uint32_t hvalue;
 
        hvalue = avc_cache.lru_hint;
        for (try = 0; try < 2; try++) {
@@ -801,8 +801,8 @@
  */
 static void avc_dump_av(security_class_t tclass, access_vector_t av)
 {
-       const u16 *common_pts_idx = 0;
-       u_int32_t common_base = 0, perm;
+       const uint16_t *common_pts_idx = 0;
+       uint32_t common_base = 0, perm;
        unsigned int i, i2;
 
        if (av == 0) {
@@ -1014,12 +1014,12 @@
        return rc;
 }
 
-int avc_add_callback(int (*callback) (u_int32_t event, security_id_t ssid,
+int avc_add_callback(int (*callback) (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)
 {
@@ -1049,7 +1049,7 @@
        return (x == y || x == SECSID_WILD || y == SECSID_WILD);
 }
 
-static inline void avc_update_node(u_int32_t event, struct avc_node *node,
+static inline void avc_update_node(uint32_t event, struct avc_node *node,
                                   access_vector_t perms)
 {
        switch (event) {
@@ -1075,7 +1075,7 @@
        }
 }
 
-static int avc_update_cache(u_int32_t event, security_id_t ssid,
+static int avc_update_cache(uint32_t event, security_id_t ssid,
                            security_id_t tsid, security_class_t tclass,
                            access_vector_t perms)
 {
@@ -1113,10 +1113,10 @@
  * This should not be called directly; use the individual event
  * functions instead.
  */
-static int avc_control(u_int32_t event, security_id_t ssid,
+static int avc_control(uint32_t event, security_id_t ssid,
                       security_id_t tsid, security_class_t tclass,
                       access_vector_t perms,
-                      u_int32_t seqno, access_vector_t * out_retained)
+                      uint32_t seqno, access_vector_t * out_retained)
 {
        struct avc_callback_node *c;
        access_vector_t tretained = 0, cretained = 0;
@@ -1175,7 +1175,7 @@
  */
 int avc_ss_grant(security_id_t ssid, security_id_t tsid,
                 security_class_t tclass, access_vector_t perms,
-                u_int32_t seqno)
+                uint32_t seqno)
 {
        return avc_control(AVC_CALLBACK_GRANT,
                           ssid, tsid, tclass, perms, seqno, 0);
@@ -1196,7 +1196,7 @@
  */
 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)
 {
        return avc_control(AVC_CALLBACK_TRY_REVOKE,
@@ -1216,7 +1216,7 @@
  */
 int avc_ss_revoke(security_id_t ssid, security_id_t tsid,
                  security_class_t tclass, access_vector_t perms,
-                 u_int32_t seqno)
+                 uint32_t seqno)
 {
        return avc_control(AVC_CALLBACK_REVOKE,
                           ssid, tsid, tclass, perms, seqno, 0);
@@ -1226,7 +1226,7 @@
  * avc_ss_reset - Flush the cache and revalidate migrated permissions.
  * @seqno: policy sequence number
  */
-int avc_ss_reset(u_int32_t seqno)
+int avc_ss_reset(uint32_t seqno)
 {
        int rc;
 
@@ -1251,7 +1251,7 @@
  */
 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)
+                         uint32_t seqno, uint32_t enable)
 {
        if (enable)
                return avc_control(AVC_CALLBACK_AUDITALLOW_ENABLE,
@@ -1272,7 +1272,7 @@
  */
 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)
+                        uint32_t seqno, uint32_t enable)
 {
        if (enable)
                return avc_control(AVC_CALLBACK_AUDITDENY_ENABLE,
@@ -1311,7 +1311,7 @@
 
 access_vector_t string_to_av_perm(security_class_t tclass, const char *s)
 {
-       const u16 *common_pts_idx = 0;
+       const uint16_t *common_pts_idx = 0;
        access_vector_t perm, common_base = 0;
        unsigned int i;
 
@@ -1348,7 +1348,7 @@
 
 void print_access_vector(security_class_t tclass, access_vector_t av)
 {
-       const u16 *common_pts_idx = 0;
+       const uint16_t *common_pts_idx = 0;
        access_vector_t common_base = 0;
        unsigned int i, i2, perm;
 

==== 
//depot/projects/trustedbsd/sedarwin8/policies/sedarwin/libselinux/src/avc_internal.c#4
 (text+ko) ====

@@ -11,13 +11,13 @@
 #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>
 #ifdef __linux__
-#include <asm/types.h>
 #include <linux/netlink.h>
 #include "selinux_netlink.h"
 #endif

==== 
//depot/projects/trustedbsd/sedarwin8/policies/sedarwin/libselinux/src/avc_internal.h#3
 (text+ko) ====

@@ -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;

==== 
//depot/projects/trustedbsd/sedarwin8/policies/sedarwin/libselinux/src/avc_sidtab.c#3
 (text+ko) ====

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

==== 
//depot/projects/trustedbsd/sedarwin8/policies/sedarwin/libselinux/src/selinux_netlink.h#3
 (text+ko) ====

@@ -25,7 +25,7 @@
 };
 
 struct selnl_msg_policyload {
-       u_int32_t seqno;
+       uint32_t seqno;
 };
 
 #endif                         /* _LINUX_SELINUX_NETLINK_H */
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/p4-projects
To unsubscribe, send any mail to "[email protected]"

<Prev in Thread] Current Thread [Next in Thread>
  • PERFORCE change 114877 for review, Todd Miller <=