diff options
author | Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> | 2011-06-26 10:21:19 -0400 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2011-06-28 19:31:21 -0400 |
commit | 2c47ab9353242b0f061959318f83c55360b88fa4 (patch) | |
tree | 03693079bf04572d30ef0ca37f717ae8acc29863 /security/tomoyo/common.h | |
parent | 2e503bbb435ae418aebbe4aeede1c6f2a33d6f74 (diff) |
TOMOYO: Cleanup part 4.
Gather string constants to one file in order to make the object size smaller.
Use unsigned type where appropriate.
read()/write() returns ssize_t.
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'security/tomoyo/common.h')
-rw-r--r-- | security/tomoyo/common.h | 51 |
1 files changed, 33 insertions, 18 deletions
diff --git a/security/tomoyo/common.h b/security/tomoyo/common.h index a5eeabcc0738..b54455dfe0ca 100644 --- a/security/tomoyo/common.h +++ b/security/tomoyo/common.h | |||
@@ -67,6 +67,20 @@ enum tomoyo_policy_id { | |||
67 | TOMOYO_MAX_POLICY | 67 | TOMOYO_MAX_POLICY |
68 | }; | 68 | }; |
69 | 69 | ||
70 | /* Index numbers for domain's attributes. */ | ||
71 | enum tomoyo_domain_info_flags_index { | ||
72 | /* Quota warnning flag. */ | ||
73 | TOMOYO_DIF_QUOTA_WARNED, | ||
74 | /* | ||
75 | * This domain was unable to create a new domain at | ||
76 | * tomoyo_find_next_domain() because the name of the domain to be | ||
77 | * created was too long or it could not allocate memory. | ||
78 | * More than one process continued execve() without domain transition. | ||
79 | */ | ||
80 | TOMOYO_DIF_TRANSITION_FAILED, | ||
81 | TOMOYO_MAX_DOMAIN_INFO_FLAGS | ||
82 | }; | ||
83 | |||
70 | /* Index numbers for group entries. */ | 84 | /* Index numbers for group entries. */ |
71 | enum tomoyo_group_id { | 85 | enum tomoyo_group_id { |
72 | TOMOYO_PATH_GROUP, | 86 | TOMOYO_PATH_GROUP, |
@@ -364,8 +378,7 @@ struct tomoyo_domain_info { | |||
364 | u8 profile; /* Profile number to use. */ | 378 | u8 profile; /* Profile number to use. */ |
365 | u8 group; /* Group number to use. */ | 379 | u8 group; /* Group number to use. */ |
366 | bool is_deleted; /* Delete flag. */ | 380 | bool is_deleted; /* Delete flag. */ |
367 | bool quota_warned; /* Quota warnning flag. */ | 381 | bool flags[TOMOYO_MAX_DOMAIN_INFO_FLAGS]; |
368 | bool transition_failed; /* Domain transition failed flag. */ | ||
369 | atomic_t users; /* Number of referring credentials. */ | 382 | atomic_t users; /* Number of referring credentials. */ |
370 | }; | 383 | }; |
371 | 384 | ||
@@ -442,15 +455,15 @@ struct tomoyo_io_buffer { | |||
442 | /* Exclusive lock for this structure. */ | 455 | /* Exclusive lock for this structure. */ |
443 | struct mutex io_sem; | 456 | struct mutex io_sem; |
444 | char __user *read_user_buf; | 457 | char __user *read_user_buf; |
445 | int read_user_buf_avail; | 458 | size_t read_user_buf_avail; |
446 | struct { | 459 | struct { |
447 | struct list_head *ns; | 460 | struct list_head *ns; |
448 | struct list_head *domain; | 461 | struct list_head *domain; |
449 | struct list_head *group; | 462 | struct list_head *group; |
450 | struct list_head *acl; | 463 | struct list_head *acl; |
451 | int avail; | 464 | size_t avail; |
452 | int step; | 465 | unsigned int step; |
453 | int query_index; | 466 | unsigned int query_index; |
454 | u16 index; | 467 | u16 index; |
455 | u8 acl_group_index; | 468 | u8 acl_group_index; |
456 | u8 bit; | 469 | u8 bit; |
@@ -465,19 +478,19 @@ struct tomoyo_io_buffer { | |||
465 | /* The position currently writing to. */ | 478 | /* The position currently writing to. */ |
466 | struct tomoyo_domain_info *domain; | 479 | struct tomoyo_domain_info *domain; |
467 | /* Bytes available for writing. */ | 480 | /* Bytes available for writing. */ |
468 | int avail; | 481 | size_t avail; |
469 | bool is_delete; | 482 | bool is_delete; |
470 | } w; | 483 | } w; |
471 | /* Buffer for reading. */ | 484 | /* Buffer for reading. */ |
472 | char *read_buf; | 485 | char *read_buf; |
473 | /* Size of read buffer. */ | 486 | /* Size of read buffer. */ |
474 | int readbuf_size; | 487 | size_t readbuf_size; |
475 | /* Buffer for writing. */ | 488 | /* Buffer for writing. */ |
476 | char *write_buf; | 489 | char *write_buf; |
477 | /* Size of write buffer. */ | 490 | /* Size of write buffer. */ |
478 | int writebuf_size; | 491 | size_t writebuf_size; |
479 | /* Type of this interface. */ | 492 | /* Type of this interface. */ |
480 | u8 type; | 493 | enum tomoyo_securityfs_interface_index type; |
481 | /* Users counter protected by tomoyo_io_buffer_list_lock. */ | 494 | /* Users counter protected by tomoyo_io_buffer_list_lock. */ |
482 | u8 users; | 495 | u8 users; |
483 | /* List for telling GC not to kfree() elements. */ | 496 | /* List for telling GC not to kfree() elements. */ |
@@ -569,10 +582,10 @@ void tomoyo_check_profile(void); | |||
569 | int tomoyo_open_control(const u8 type, struct file *file); | 582 | int tomoyo_open_control(const u8 type, struct file *file); |
570 | int tomoyo_close_control(struct tomoyo_io_buffer *head); | 583 | int tomoyo_close_control(struct tomoyo_io_buffer *head); |
571 | int tomoyo_poll_control(struct file *file, poll_table *wait); | 584 | int tomoyo_poll_control(struct file *file, poll_table *wait); |
572 | int tomoyo_read_control(struct tomoyo_io_buffer *head, char __user *buffer, | 585 | ssize_t tomoyo_read_control(struct tomoyo_io_buffer *head, char __user *buffer, |
573 | const int buffer_len); | 586 | const int buffer_len); |
574 | int tomoyo_write_control(struct tomoyo_io_buffer *head, | 587 | ssize_t tomoyo_write_control(struct tomoyo_io_buffer *head, |
575 | const char __user *buffer, const int buffer_len); | 588 | const char __user *buffer, const int buffer_len); |
576 | bool tomoyo_domain_quota_is_ok(struct tomoyo_request_info *r); | 589 | bool tomoyo_domain_quota_is_ok(struct tomoyo_request_info *r); |
577 | void tomoyo_warn_oom(const char *function); | 590 | void tomoyo_warn_oom(const char *function); |
578 | const struct tomoyo_path_info * | 591 | const struct tomoyo_path_info * |
@@ -707,15 +720,17 @@ extern struct tomoyo_domain_info tomoyo_kernel_domain; | |||
707 | extern struct tomoyo_policy_namespace tomoyo_kernel_namespace; | 720 | extern struct tomoyo_policy_namespace tomoyo_kernel_namespace; |
708 | extern struct list_head tomoyo_namespace_list; | 721 | extern struct list_head tomoyo_namespace_list; |
709 | 722 | ||
710 | extern const char *tomoyo_path_keyword[TOMOYO_MAX_PATH_OPERATION]; | 723 | extern const char * const tomoyo_mac_keywords[TOMOYO_MAX_MAC_INDEX + |
711 | extern const char *tomoyo_mkdev_keyword[TOMOYO_MAX_MKDEV_OPERATION]; | 724 | TOMOYO_MAX_MAC_CATEGORY_INDEX]; |
712 | extern const char *tomoyo_path2_keyword[TOMOYO_MAX_PATH2_OPERATION]; | 725 | extern const char * const tomoyo_path_keyword[TOMOYO_MAX_PATH_OPERATION]; |
713 | extern const char *tomoyo_path_number_keyword[TOMOYO_MAX_PATH_NUMBER_OPERATION]; | 726 | extern const u8 tomoyo_index2category[TOMOYO_MAX_MAC_INDEX]; |
727 | |||
714 | 728 | ||
715 | extern const u8 tomoyo_pnnn2mac[TOMOYO_MAX_MKDEV_OPERATION]; | 729 | extern const u8 tomoyo_pnnn2mac[TOMOYO_MAX_MKDEV_OPERATION]; |
716 | extern const u8 tomoyo_pp2mac[TOMOYO_MAX_PATH2_OPERATION]; | 730 | extern const u8 tomoyo_pp2mac[TOMOYO_MAX_PATH2_OPERATION]; |
717 | extern const u8 tomoyo_pn2mac[TOMOYO_MAX_PATH_NUMBER_OPERATION]; | 731 | extern const u8 tomoyo_pn2mac[TOMOYO_MAX_PATH_NUMBER_OPERATION]; |
718 | 732 | ||
733 | extern const char * const tomoyo_dif[TOMOYO_MAX_DOMAIN_INFO_FLAGS]; | ||
719 | extern const char * const tomoyo_mode[TOMOYO_CONFIG_MAX_MODE]; | 734 | extern const char * const tomoyo_mode[TOMOYO_CONFIG_MAX_MODE]; |
720 | extern unsigned int tomoyo_memory_quota[TOMOYO_MAX_MEMORY_STAT]; | 735 | extern unsigned int tomoyo_memory_quota[TOMOYO_MAX_MEMORY_STAT]; |
721 | extern unsigned int tomoyo_memory_used[TOMOYO_MAX_MEMORY_STAT]; | 736 | extern unsigned int tomoyo_memory_used[TOMOYO_MAX_MEMORY_STAT]; |