libsmack: use 16 bits for smack access codes instead of sizeof(int) * 2
authorRafal Krypa <r.krypa@samsung.com>
Tue, 7 Jan 2014 15:25:32 +0000 (16:25 +0100)
committerRafal Krypa <r.krypa@samsung.com>
Tue, 7 Jan 2014 15:46:02 +0000 (16:46 +0100)
There are 6 access bits to be stored in the access field. Special value -1
is used to distinguish set rules from change rules. Shrinking the filed to
8 bits still leaves space for one more future access bit.

Signed-off-by: Rafal Krypa <r.krypa@samsung.com>
libsmack/libsmack.c

index 82a2b67..0e6eaea 100644 (file)
@@ -27,6 +27,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <stdint.h>
 #include <sys/socket.h>
 #include <sys/stat.h>
 #include <sys/types.h>
@@ -70,10 +71,10 @@ struct label_dict {
 };
 
 struct smack_rule {
+       int8_t allow_code;
+       int8_t deny_code;
        int subject_id;
        int object_id;
-       int allow_code;
-       int deny_code;
        struct smack_rule *next;
 };