3 |
* |
* |
4 |
* Copyright (C) 2005-2009 NTT DATA CORPORATION |
* Copyright (C) 2005-2009 NTT DATA CORPORATION |
5 |
* |
* |
6 |
* Version: 1.7.0 2009/09/03 |
* Version: 1.7.0 2009/09/04 |
7 |
* |
* |
8 |
* This file is applicable to both 2.4.30 and 2.6.11 and later. |
* This file is applicable to both 2.4.30 and 2.6.11 and later. |
9 |
* See README.ccs for ChangeLog. |
* See README.ccs for ChangeLog. |
283 |
} |
} |
284 |
|
|
285 |
/** |
/** |
286 |
|
* ccs_check_profile - Check all profiles currently assigned to domains are defined. |
287 |
|
*/ |
288 |
|
void ccs_check_profile(void) |
289 |
|
{ |
290 |
|
struct ccs_domain_info *domain; |
291 |
|
ccs_policy_loaded = true; |
292 |
|
list_for_each_entry_rcu(domain, &ccs_domain_list, list) { |
293 |
|
const u8 profile = domain->profile; |
294 |
|
if (ccs_profile_ptr[profile]) |
295 |
|
continue; |
296 |
|
panic("Profile %u (used by '%s') not defined.\n", |
297 |
|
profile, domain->domainname->name); |
298 |
|
} |
299 |
|
} |
300 |
|
|
301 |
|
/** |
302 |
* ccs_profile - Find a profile. |
* ccs_profile - Find a profile. |
303 |
* |
* |
304 |
* @profile: Profile number to find. |
* @profile: Profile number to find. |
305 |
* |
* |
306 |
* Returns pointer to "struct ccs_profile" on success, NULL otherwise. |
* Returns pointer to "struct ccs_profile". |
307 |
*/ |
*/ |
308 |
struct ccs_profile *ccs_profile(const u8 profile) |
struct ccs_profile *ccs_profile(const u8 profile) |
309 |
{ |
{ |
933 |
|
|
934 |
if (sscanf(data, CCS_KEYWORD_USE_PROFILE "%u", &profile) == 1 |
if (sscanf(data, CCS_KEYWORD_USE_PROFILE "%u", &profile) == 1 |
935 |
&& profile < CCS_MAX_PROFILES) { |
&& profile < CCS_MAX_PROFILES) { |
936 |
if (ccs_profile(profile)) |
if (!ccs_policy_loaded || ccs_profile_ptr[(u8) profile]) |
937 |
domain->profile = (u8) profile; |
domain->profile = (u8) profile; |
938 |
return 0; |
return 0; |
939 |
} |
} |
1801 |
if (profile >= CCS_MAX_PROFILES) |
if (profile >= CCS_MAX_PROFILES) |
1802 |
return -EINVAL; |
return -EINVAL; |
1803 |
domain = ccs_find_domain(cp + 1); |
domain = ccs_find_domain(cp + 1); |
1804 |
if (domain && ccs_profile(profile)) |
if (domain && (!ccs_policy_loaded || ccs_profile_ptr[(u8) profile])) |
1805 |
domain->profile = (u8) profile; |
domain->profile = (u8) profile; |
1806 |
return 0; |
return 0; |
1807 |
} |
} |