===== Adding attributes to a target. ===== ''file: '' Write or add up the structure for attributes. Bump ''..._VERSION'' and keep a copy of the previous struct if the struct did already exist so that lists can convert the attributes to the new format. Don't forget to provide the default values too. The list of attributes at the end allows tools to auto detect what attributes are stored in this target. #define RSBAC_ACI_GROUP_NAME "groupaci" /* Old stuff are really dummies and not real life examples;p */ #define RSBAC_GEN_GROUP_OLD_ACI_VERSION 1 #define RSBAC_GEN_GROUP_ACI_VERSION 2 #define RSBAC_GEN_GROUP_ACI_KEY 1001 struct rsbac_gen_group_aci_t { rsbac_log_array_t log_array_low; /* of course those need to exist in types.h */ rsbac_log_array_t log_array_high; }; struct rsbac_gen_group_old_aci_t { rsbac_log_array_t log_array_low; } #define DEFAULT_GEN_G_ACI \ { \ .log_array_low = -1, \ .log_array_high = -1, \ } /* at the end of the file */ #define RSBAC_GROUP_NR_ATTRIBUTES 2 #define RSBAC_GROUP_ATTR_LIST { \ A_log_array_low, \ A_log_array_high \ } #ifdef __KERNEL__ struct rsbac_group_handles_t { rsbac_list_handle_t gen; #if defined(CONFIG_RSBAC_RC_UM_PROT) rsbac_list_handle_t rc; #endif }; #endif ''file: '' Take a look at the registration function and make sure the conversion function is called if this is not a new list. /* g_gen */ { rsbac_rc_type_id_t def_aci = RSBAC_RC_GENERAL_TYPE; list_info_p->version = RSBAC_RC_GROUP_ACI_VERSION; list_info_p->key = RSBAC_RC_GROUP_ACI_KEY; list_info_p->desc_size = sizeof(rsbac_gid_t); list_info_p->data_size = sizeof(rsbac_rc_type_id_t); list_info_p->max_age = 0; err = rsbac_list_register(RSBAC_LIST_VERSION, &group_handles.rc, list_info_p, #ifdef CONFIG_RSBAC_DEV_USER_BACKUP RSBAC_LIST_BACKUP | #endif RSBAC_LIST_PERSIST | /* second NULL would be gen_group_get_conv * like: RSBAC_LIST_DEF_DATA, NULL, gen_group_get_conv, */ RSBAC_LIST_DEF_DATA, NULL, NULL, &def_aci, RSBAC_RC_ACI_GROUP_NAME, RSBAC_AUTO_DEV); You will also need the conversion function if necessary, and the old functions to convert. static int gen_old_group_conv(void *old_desc, void *old_data, void *new_desc, void *new_data) { struct rsbac_gen_group_aci_t *new_aci = new_data; struct rsbac_gen_group_old_aci_t *old_aci = old_data; memcpy(new_desc, old_desc, sizeof(rsbac_gid_t)); new_aci->someoldstuff = old_aci->someoldstuff; new_aci->otheroldstuff = old_aci->otheroldstuff; new_aci->someNEWstuff = 0; new_aci->someNEWstuff = 0; return 0; } rsbac_list_conv_function_t *gen_group_get_conv(rsbac_version_t old_version) { switch (old_version) { case RSBAC_GEN_GROUP_OLD_ACI_VERSION: return gen_old_group_conv; /* and more cases if you have more older versions... */ default: return NULL; } }