/* Find an object in the registry */ void *hypervisor_find_object(hypervisor_conn_t *conn,char *name,int obj_type) { void *p; if (!(p = registry_find(name,obj_type))) { hypervisor_send_reply(conn,HSC_ERR_UNK_OBJ,1, "unable to find object '%s'",name); return NULL; } return p; }
sp_playlist * sp_session_starred_for_user_create(sp_session *session, const char *name) { char *link; if (sp_session_connectionstate(session) != SP_CONNECTION_STATE_LOGGED_IN) { return NULL; } link = ALLOC_STR(strlen("spotify:user:"******":starred")); sprintf(link, "spotify:user:%s:starred", name); return (sp_playlist *)registry_find(link); }
sp_search * sp_search_create(sp_session *UNUSED(session), const char *query, int UNUSED(tracks_offset), int UNUSED(tracks), int UNUSED(albums_offset), int UNUSED(albums), int UNUSED(artists_offset), int UNUSED(artists), int UNUSED(playlist_offset), int UNUSED(playlists), sp_search_type type, search_complete_cb *UNUSED(cb), void *UNUSED(userdata)) { sp_link *link; sp_search *search; search = ALLOC(sp_search); search->query = strclone(query); search->type = type; link = sp_link_create_from_search(search); return (sp_search *)registry_find(link->data); }
sp_playlistcontainer * sp_session_publishedcontainer_for_user_create(sp_session *session, const char *username) { char *link; if (sp_session_connectionstate(session) != SP_CONNECTION_STATE_LOGGED_IN) { return NULL; } if (username == NULL && session->user) { username = session->user->canonical_name; } link = ALLOC_STR(strlen("spotify:container:") + strlen(username)); sprintf(link, "spotify:container:%s", username); return (sp_playlistcontainer *)registry_find(link); }
/* Get an instance given a name */ vm_instance_t *vm_acquire(char *name) { return(registry_find(name,OBJ_TYPE_VM)); }
/* Acquire a reference to an Ethernet switch (increment reference count) */ ethsw_table_t *ethsw_acquire(char *name) { return(registry_find(name,OBJ_TYPE_ETHSW)); }
/* Acquire a reference to an ATM bridge (increment reference count) */ atm_bridge_t *atm_bridge_acquire(char *name) { return(registry_find(name,OBJ_TYPE_ATM_BRIDGE)); }
/* Acquire a reference to NIO from registry (increment reference count) */ netio_desc_t *netio_acquire(char *name) { return(registry_find(name,OBJ_TYPE_NIO)); }