329 |
{ |
{ |
330 |
struct ccs_policy_manager_entry *entry = NULL; |
struct ccs_policy_manager_entry *entry = NULL; |
331 |
struct ccs_policy_manager_entry *ptr; |
struct ccs_policy_manager_entry *ptr; |
332 |
const struct ccs_path_info *saved_manager; |
struct ccs_policy_manager_entry e = { }; |
333 |
int error = is_delete ? -ENOENT : -ENOMEM; |
int error = is_delete ? -ENOENT : -ENOMEM; |
|
bool is_domain = false; |
|
334 |
if (ccs_is_domain_def(manager)) { |
if (ccs_is_domain_def(manager)) { |
335 |
if (!ccs_is_correct_domain(manager)) |
if (!ccs_is_correct_domain(manager)) |
336 |
return -EINVAL; |
return -EINVAL; |
337 |
is_domain = true; |
e.is_domain = true; |
338 |
} else { |
} else { |
339 |
if (!ccs_is_correct_path(manager, 1, -1, -1)) |
if (!ccs_is_correct_path(manager, 1, -1, -1)) |
340 |
return -EINVAL; |
return -EINVAL; |
341 |
} |
} |
342 |
saved_manager = ccs_get_name(manager); |
e.manager = ccs_get_name(manager); |
343 |
if (!saved_manager) |
if (!e.manager) |
344 |
return -ENOMEM; |
return -ENOMEM; |
345 |
if (!is_delete) |
if (!is_delete) |
346 |
entry = kzalloc(sizeof(*entry), GFP_KERNEL); |
entry = kmalloc(sizeof(e), GFP_KERNEL); |
347 |
mutex_lock(&ccs_policy_lock); |
mutex_lock(&ccs_policy_lock); |
348 |
list_for_each_entry_rcu(ptr, &ccs_policy_manager_list, list) { |
list_for_each_entry_rcu(ptr, &ccs_policy_manager_list, list) { |
349 |
if (ptr->manager != saved_manager) |
if (ptr->manager != e.manager) |
350 |
continue; |
continue; |
351 |
ptr->is_deleted = is_delete; |
ptr->is_deleted = is_delete; |
352 |
error = 0; |
error = 0; |
353 |
break; |
break; |
354 |
} |
} |
355 |
if (!is_delete && error && ccs_memory_ok(entry, sizeof(*entry))) { |
if (!is_delete && error && ccs_commit_ok(entry, &e, sizeof(e))) { |
|
entry->manager = saved_manager; |
|
|
saved_manager = NULL; |
|
|
entry->is_domain = is_domain; |
|
356 |
list_add_tail_rcu(&entry->list, &ccs_policy_manager_list); |
list_add_tail_rcu(&entry->list, &ccs_policy_manager_list); |
357 |
entry = NULL; |
entry = NULL; |
358 |
error = 0; |
error = 0; |
359 |
} |
} |
360 |
mutex_unlock(&ccs_policy_lock); |
mutex_unlock(&ccs_policy_lock); |
361 |
ccs_put_name(saved_manager); |
ccs_put_name(e.manager); |
362 |
kfree(entry); |
kfree(entry); |
363 |
return error; |
return error; |
364 |
} |
} |
704 |
} |
} |
705 |
} |
} |
706 |
|
|
707 |
static bool ccs_print_number_union(struct ccs_io_buffer *head, |
bool ccs_print_number_union(struct ccs_io_buffer *head, |
708 |
const struct ccs_number_union *ptr) |
const struct ccs_number_union *ptr) |
709 |
{ |
{ |
710 |
return ccs_print_number_union_common(head, ptr, true); |
return ccs_print_number_union_common(head, ptr, true); |
711 |
} |
} |
1253 |
struct ccs_acl_info *ptr) |
struct ccs_acl_info *ptr) |
1254 |
{ |
{ |
1255 |
const struct ccs_condition *cond = ptr->cond; |
const struct ccs_condition *cond = ptr->cond; |
1256 |
const u8 acl_type = ccs_acl_type2(ptr); |
const u8 acl_type = ptr->type; |
1257 |
if (acl_type & CCS_ACL_DELETED) |
if (ptr->is_deleted) |
1258 |
return true; |
return true; |
1259 |
if (acl_type == CCS_TYPE_SINGLE_PATH_ACL) { |
if (acl_type == CCS_TYPE_SINGLE_PATH_ACL) { |
1260 |
struct ccs_single_path_acl_record *acl |
struct ccs_single_path_acl_record *acl |
1338 |
head); |
head); |
1339 |
return ccs_print_pivot_root_acl(head, acl, cond); |
return ccs_print_pivot_root_acl(head, acl, cond); |
1340 |
} |
} |
|
/* Workaround for gcc 3.2.2's inline bug. */ |
|
|
if (acl_type & CCS_ACL_DELETED) |
|
|
return true; |
|
1341 |
BUG(); /* This must not happen. */ |
BUG(); /* This must not happen. */ |
1342 |
return false; |
return false; |
1343 |
} |
} |
1870 |
ccs_query_entry = kzalloc(sizeof(*ccs_query_entry), GFP_KERNEL); |
ccs_query_entry = kzalloc(sizeof(*ccs_query_entry), GFP_KERNEL); |
1871 |
if (!ccs_query_entry) |
if (!ccs_query_entry) |
1872 |
goto out; |
goto out; |
1873 |
|
len = ccs_round2(len); |
1874 |
ccs_query_entry->query = kzalloc(len, GFP_KERNEL); |
ccs_query_entry->query = kzalloc(len, GFP_KERNEL); |
1875 |
if (!ccs_query_entry->query) |
if (!ccs_query_entry->query) |
1876 |
goto out; |
goto out; |