コード例 #1
0
ファイル: uid_utils.c プロジェクト: openhpi1/testrepo
/**
 * oh_uid_initialize
 *
 * UID utils initialization routine
 * This functions must be called before any other uid_utils
 * are made.
 *
 * Returns: success 0, failure -1.
 **/
SaErrorT oh_uid_initialize(void)
{
        int rval;

        uid_lock(&oh_uid_lock);
        if(!initialized) {

                /* initialize hash tables */
                oh_ep_table = g_hash_table_new(oh_entity_path_hash, oh_entity_path_equal);
                oh_resource_id_table = g_hash_table_new(g_int_hash, g_int_equal);

                initialized = TRUE;

                resource_id = 1;

                /* initialize uid map */
                rval = uid_map_from_file();

        } else { rval = SA_ERR_HPI_ERROR; }

        uid_unlock(&oh_uid_lock);

        return(rval);

}
コード例 #2
0
ファイル: uid_utils.c プロジェクト: CSU-GH/okl4_3.0
/**
 * oh_uid_initialize: uid utils initialization routine
 *
 * This functions must be called before any other uid_utils
 * are made. 
 * 
 * Return value: success 0, failed -1.
 **/
SaErrorT oh_uid_initialize(void) 
{
        static int initialized = FALSE;

        int rval;
        
        if(!initialized) {

                /* initialize has tables */
                ep_hash_table = g_hash_table_new(oh_entity_path_hash, oh_entity_path_equal);
                resource_id_hash_table = g_hash_table_new(g_int_hash, g_int_equal);

                initialized = TRUE;

                resource_id = 1;

                /* initialize uid map */
                rval = uid_map_from_file();
        }
	else
		rval = SA_ERR_HPI_ERROR;

        return(rval);

}
コード例 #3
0
ファイル: uid_utils.c プロジェクト: openhpi1/testrepo
/**
 * oh_uid_initialize: uid utils initialization routine
 *
 * This functions must be called before any other uid_utils
 * are made. 
 * 
 * Return value: success 0, failed -1.
 **/
guint oh_uid_initialize(void) 
{
        static int initialized = FALSE;

        int rval;
        
        if(!initialized) {

                /* initialize has tables */
                ep_hash_table = g_hash_table_new(oh_entity_path_hash, oh_entity_path_equal);
                resource_id_hash_table = g_hash_table_new(g_int_hash, g_int_equal);

                initialized = TRUE;

                resource_id = 0;

                /* initialize uid map */
                rval = uid_map_from_file();

                return(rval);
        }

        return(-1);

}
コード例 #4
0
ファイル: uid_utils.c プロジェクト: openhpi1/testrepo
/**
 * oh_uid_initialize
 *
 * UID utils initialization routine
 * This functions must be called before any other uid_utils
 * are made.
 *
 * Returns: success 0, failure -1.
 **/
SaErrorT oh_uid_initialize(void)
{
        uid_lock(&oh_uid_lock);
        if (!initialized) {
                int cc;
                const char * uid_map_file = 0;

                /* initialize hash tables */
                oh_ep_table = g_hash_table_new(oh_entity_path_hash, oh_entity_path_equal);
                oh_resource_id_table = g_hash_table_new(g_int_hash, g_int_equal);
                initialized = TRUE;
                resource_id = 1;

                /* determine if we can use map file */
                uid_map_file = (char *)getenv("OPENHPI_UID_MAP");
                if (uid_map_file == 0) {
                        uid_map_file = OH_DEFAULT_UID_MAP;
                }
                if ((uid_map_file == 0) || (strlen(uid_map_file) == 0)) {
                        WARN( "UID Map file will not be used." );
                        WARN( "Resource Id will not be persistent." );
                } else {
                        oh_uid_map_file = g_strdup(uid_map_file);
                        INFO( "Using UID Map file %s.", oh_uid_map_file );
                }

                /* initialize uid map */
                cc = uid_map_from_file();
                if (cc != 0) {
                        g_free(oh_uid_map_file);
                        oh_uid_map_file = 0;
                        WARN( "Disabling using UID Map file." );
                        WARN( "Resource Id will not be persistent." );
                }
        }
        uid_unlock(&oh_uid_lock);

        return 0;
}