/daten/src/linux-2.4.27-rsbac-v1.2.3/include/rsbac/gen_lists.h

Go to the documentation of this file.
00001 /*************************************************** */ 00002 /* Rule Set Based Access Control */ 00003 /* Author and (c) 1999-2004: Amon Ott <ao@rsbac.org> */ 00004 /* Generic lists - internal structures */ 00005 /* Last modified: 02/Mar/2004 */ 00006 /*************************************************** */ 00007 00008 #ifndef __RSBAC_GEN_LISTS_H 00009 #define __RSBAC_GEN_LISTS_H 00010 00011 #include <linux/init.h> 00012 #include <rsbac/rkmem.h> 00013 #include <rsbac/lists.h> 00014 00015 #define RSBAC_LIST_DISK_VERSION 10002 00016 #define RSBAC_LIST_DISK_OLD_VERSION 10001 00017 #define RSBAC_LIST_NONAME "(no name)" 00018 #define RSBAC_LIST_PROC_NAME "gen_lists" 00019 #define RSBAC_LIST_DEVICENAME "gen_list_device" 00020 #define RSBAC_LIST_FILENAME "genlst" 00021 00022 #define RSBAC_GEN_LIST_DISK_VERSION 10001 00023 #define RSBAC_GEN_LIST_KEY 0x101face 00024 00025 /* Prototypes */ 00026 00027 /* Init */ 00028 #ifdef CONFIG_RSBAC_INIT_DELAY 00029 void rsbac_list_init(void); 00030 #else 00031 void __init rsbac_list_init(void); 00032 #endif 00033 00034 /* mount / umount */ 00035 int rsbac_list_mount(kdev_t kdev); 00036 int rsbac_list_umount(kdev_t kdev); 00037 00038 /* Status checking */ 00039 int rsbac_check_lists(int correct); 00040 00041 #if defined(CONFIG_RSBAC_AUTO_WRITE) 00042 int rsbac_write_lists(boolean need_lock); 00043 #endif 00044 00045 /* Data Structures */ 00046 00047 /* All items will be organized in double linked lists 00048 * However, we do not know the descriptor or item sizes, so we will access them 00049 with offsets later and only define the list links here. 00050 */ 00051 00052 struct rsbac_list_item_t 00053 { 00054 struct rsbac_list_item_t * prev; 00055 struct rsbac_list_item_t * next; 00056 rsbac_time_t max_age; 00057 }; 00058 00059 /* lists of lists ds */ 00060 struct rsbac_list_lol_item_t 00061 { 00062 struct rsbac_list_lol_item_t * prev; 00063 struct rsbac_list_lol_item_t * next; 00064 struct rsbac_list_item_t * head; 00065 struct rsbac_list_item_t * tail; 00066 struct rsbac_list_item_t * curr; 00067 u_long count; 00068 rsbac_time_t max_age; 00069 }; 00070 00071 /* Since all registrations will be organized in double linked lists, we must 00072 * have list items and a list head. 00073 * The pointer to this item will also be used as list handle. */ 00074 00075 typedef __u32 rsbac_list_count_t; 00076 00077 struct rsbac_list_reg_item_t 00078 { 00079 struct rsbac_list_info_t info; 00080 u_int flags; 00081 rsbac_list_compare_function_t * compare; 00082 rsbac_list_get_conv_t * get_conv; 00083 void * def_data; 00084 char name[RSBAC_LIST_MAX_FILENAME+1]; 00085 kdev_t device; 00086 struct rsbac_list_item_t * head; 00087 struct rsbac_list_item_t * tail; 00088 struct rsbac_list_item_t * curr; 00089 rwlock_t lock; 00090 rsbac_list_count_t count; 00091 boolean dirty; 00092 boolean no_write; 00093 #if defined(CONFIG_RSBAC_PROC) && defined(CONFIG_PROC_FS) 00094 struct proc_dir_entry * proc_entry_p; 00095 #endif 00096 struct rsbac_list_reg_item_t * prev; 00097 struct rsbac_list_reg_item_t * next; 00098 struct rsbac_list_reg_item_t * self; 00099 }; 00100 00101 struct rsbac_list_lol_reg_item_t 00102 { 00103 struct rsbac_list_lol_info_t info; 00104 u_int flags; 00105 rsbac_list_compare_function_t * compare; 00106 rsbac_list_compare_function_t * subcompare; 00107 rsbac_list_get_conv_t * get_conv; 00108 rsbac_list_get_conv_t * get_subconv; 00109 void * def_data; 00110 void * def_subdata; 00111 char name[RSBAC_LIST_MAX_FILENAME+1]; 00112 kdev_t device; 00113 struct rsbac_list_lol_item_t * head; 00114 struct rsbac_list_lol_item_t * tail; 00115 struct rsbac_list_lol_item_t * curr; 00116 rwlock_t lock; 00117 rsbac_list_count_t count; 00118 boolean dirty; 00119 boolean no_write; 00120 #if defined(CONFIG_RSBAC_PROC) && defined(CONFIG_PROC_FS) 00121 struct proc_dir_entry * proc_entry_p; 00122 #endif 00123 struct rsbac_list_lol_reg_item_t * prev; 00124 struct rsbac_list_lol_reg_item_t * next; 00125 struct rsbac_list_lol_reg_item_t * self; 00126 }; 00127 00128 /* To provide consistency we use spinlocks for all list accesses. The 00129 'curr' entry is used to avoid repeated lookups for the same item. */ 00130 00131 struct rsbac_list_reg_head_t 00132 { 00133 struct rsbac_list_reg_item_t * head; 00134 struct rsbac_list_reg_item_t * tail; 00135 struct rsbac_list_reg_item_t * curr; 00136 rwlock_t lock; 00137 u_int count; 00138 }; 00139 00140 struct rsbac_list_lol_reg_head_t 00141 { 00142 struct rsbac_list_lol_reg_item_t * head; 00143 struct rsbac_list_lol_reg_item_t * tail; 00144 struct rsbac_list_lol_reg_item_t * curr; 00145 rwlock_t lock; 00146 u_int count; 00147 }; 00148 00149 /* Internal helper list of filled write buffers */ 00150 00151 struct rsbac_list_write_item_t 00152 { 00153 struct rsbac_list_write_item_t * prev; 00154 struct rsbac_list_write_item_t * next; 00155 struct rsbac_list_reg_item_t * list; 00156 u_long buflen; 00157 char * buf; 00158 boolean vmalloc_used; 00159 char name[RSBAC_LIST_MAX_FILENAME+1]; 00160 kdev_t device; 00161 }; 00162 00163 struct rsbac_list_write_head_t 00164 { 00165 struct rsbac_list_write_item_t * head; 00166 struct rsbac_list_write_item_t * tail; 00167 u_long total; 00168 u_int count; 00169 }; 00170 00171 struct rsbac_list_lol_write_item_t 00172 { 00173 struct rsbac_list_lol_write_item_t * prev; 00174 struct rsbac_list_lol_write_item_t * next; 00175 struct rsbac_list_lol_reg_item_t * list; 00176 u_long buflen; 00177 char * buf; 00178 boolean vmalloc_used; 00179 char name[RSBAC_LIST_MAX_FILENAME+1]; 00180 kdev_t device; 00181 }; 00182 00183 struct rsbac_list_lol_write_head_t 00184 { 00185 struct rsbac_list_lol_write_item_t * head; 00186 struct rsbac_list_lol_write_item_t * tail; 00187 u_long total; 00188 u_int count; 00189 }; 00190 00191 00192 /* Data structs for file timeout book keeping list filelist */ 00193 struct rsbac_list_filelist_desc_t 00194 { 00195 char filename[RSBAC_LIST_MAX_FILENAME+1]; 00196 }; 00197 00198 struct rsbac_list_filelist_data_t 00199 { 00200 rsbac_time_t timestamp; 00201 rsbac_time_t max_age; 00202 }; 00203 00204 #endif

Generated on Tue Aug 31 10:05:22 2004 for RSBAC by doxygen 1.3.8