xref: /aosp_15_r20/system/sepolicy/private/mls_macros (revision e4a36f4174b17bbab9dc043f4a65dc8d87377290)
1*e4a36f41SAndroid Build Coastguard Worker########################################
2*e4a36f41SAndroid Build Coastguard Worker#
3*e4a36f41SAndroid Build Coastguard Worker# gen_cats(N)
4*e4a36f41SAndroid Build Coastguard Worker#
5*e4a36f41SAndroid Build Coastguard Worker# declares categores c0 to c(N-1)
6*e4a36f41SAndroid Build Coastguard Worker#
7*e4a36f41SAndroid Build Coastguard Workerdefine(`decl_cats',`dnl
8*e4a36f41SAndroid Build Coastguard Workercategory c$1;
9*e4a36f41SAndroid Build Coastguard Workerifelse(`$1',`$2',,`decl_cats(incr($1),$2)')dnl
10*e4a36f41SAndroid Build Coastguard Worker')
11*e4a36f41SAndroid Build Coastguard Worker
12*e4a36f41SAndroid Build Coastguard Workerdefine(`gen_cats',`decl_cats(0,decr($1))')
13*e4a36f41SAndroid Build Coastguard Worker
14*e4a36f41SAndroid Build Coastguard Worker########################################
15*e4a36f41SAndroid Build Coastguard Worker#
16*e4a36f41SAndroid Build Coastguard Worker# gen_sens(N)
17*e4a36f41SAndroid Build Coastguard Worker#
18*e4a36f41SAndroid Build Coastguard Worker# declares sensitivites s0 to s(N-1) with dominance
19*e4a36f41SAndroid Build Coastguard Worker# in increasing numeric order with s0 lowest, s(N-1) highest
20*e4a36f41SAndroid Build Coastguard Worker#
21*e4a36f41SAndroid Build Coastguard Workerdefine(`decl_sens',`dnl
22*e4a36f41SAndroid Build Coastguard Workersensitivity s$1;
23*e4a36f41SAndroid Build Coastguard Workerifelse(`$1',`$2',,`decl_sens(incr($1),$2)')dnl
24*e4a36f41SAndroid Build Coastguard Worker')
25*e4a36f41SAndroid Build Coastguard Worker
26*e4a36f41SAndroid Build Coastguard Workerdefine(`gen_dominance',`s$1 ifelse(`$1',`$2',,`gen_dominance(incr($1),$2)')')
27*e4a36f41SAndroid Build Coastguard Worker
28*e4a36f41SAndroid Build Coastguard Workerdefine(`gen_sens',`
29*e4a36f41SAndroid Build Coastguard Worker# Each sensitivity has a name and zero or more aliases.
30*e4a36f41SAndroid Build Coastguard Workerdecl_sens(0,decr($1))
31*e4a36f41SAndroid Build Coastguard Worker
32*e4a36f41SAndroid Build Coastguard Worker# Define the ordering of the sensitivity levels (least to greatest)
33*e4a36f41SAndroid Build Coastguard Workerdominance { gen_dominance(0,decr($1)) }
34*e4a36f41SAndroid Build Coastguard Worker')
35*e4a36f41SAndroid Build Coastguard Worker
36*e4a36f41SAndroid Build Coastguard Worker########################################
37*e4a36f41SAndroid Build Coastguard Worker#
38*e4a36f41SAndroid Build Coastguard Worker# gen_levels(N,M)
39*e4a36f41SAndroid Build Coastguard Worker#
40*e4a36f41SAndroid Build Coastguard Worker# levels from s0 to (N-1) with categories c0 to (M-1)
41*e4a36f41SAndroid Build Coastguard Worker#
42*e4a36f41SAndroid Build Coastguard Workerdefine(`decl_levels',`dnl
43*e4a36f41SAndroid Build Coastguard Workerlevel s$1:c0.c$3;
44*e4a36f41SAndroid Build Coastguard Workerifelse(`$1',`$2',,`decl_levels(incr($1),$2,$3)')dnl
45*e4a36f41SAndroid Build Coastguard Worker')
46*e4a36f41SAndroid Build Coastguard Worker
47*e4a36f41SAndroid Build Coastguard Workerdefine(`gen_levels',`decl_levels(0,decr($1),decr($2))')
48*e4a36f41SAndroid Build Coastguard Worker
49*e4a36f41SAndroid Build Coastguard Worker########################################
50*e4a36f41SAndroid Build Coastguard Worker#
51*e4a36f41SAndroid Build Coastguard Worker# Basic level names for system low and high
52*e4a36f41SAndroid Build Coastguard Worker#
53*e4a36f41SAndroid Build Coastguard Workerdefine(`mls_systemlow',`s0')
54*e4a36f41SAndroid Build Coastguard Workerdefine(`mls_systemhigh',`s`'decr(mls_num_sens):c0.c`'decr(mls_num_cats)')
55