void Detail_Init( void ) { DD.details = 0 ; DD.lock_depth = 0 ; DirblobInit( & (DD.sn) ) ; DirblobInit( & (DD.length) ) ; }
/* Only error is if parsename fails */ GOOD_OR_BAD DS9490_root_dir( struct dirblob * db, struct connection_in * in ) { ASCII path[PATH_MAX] ; struct parsedname pn_root ; UCLIBCLOCK; /* Force this adapter with bus.n path */ snprintf(path, PATH_MAX, "/uncached/bus.%d", in->index); UCLIBCUNLOCK; if ( FS_ParsedName(path, &pn_root) != 0 ) { LEVEL_DATA("Cannot get root directory on [%s] Parsing %s error.", SAFESTRING(DEVICENAME(in)), path); return gbBAD ; } DirblobInit( db ) ; /* First time pretend there are devices */ pn_root.selected_connection->changed_bus_settings |= CHANGED_USB_SPEED ; // Trigger needing new configuration pn_root.selected_connection->overdrive = 0 ; // not overdrive at start pn_root.selected_connection->flex = Globals.usb_flextime ; SetReconnect(&pn_root) ; FS_dir( DS9490_dir_callback, db, &pn_root ) ; LEVEL_DEBUG("Finished FS_dir"); FS_ParsedName_destroy(&pn_root) ; return gbGOOD ; // Dirblob must be cleared by recipient. }
static void BUS_first_both(struct device_search *ds) { // reset the search state memset(ds->sn, 0, 8); // clear the serial number ds->LastDiscrepancy = -1; ds->LastDevice = 0; ds->index = -1; // true place in dirblob /* Initialize dir-at-once structure */ DirblobInit(&(ds->gulp)); }
static void Fake_setroutines(struct connection_in *in) { in->iroutines.detect = Fake_detect; in->iroutines.reset = Fake_reset; in->iroutines.next_both = Fake_next_both; in->iroutines.PowerByte = NO_POWERBYTE_ROUTINE; in->iroutines.ProgramPulse = Fake_ProgramPulse; in->iroutines.sendback_data = Fake_sendback_data; in->iroutines.sendback_bits = Fake_sendback_bits; in->iroutines.select = NO_SELECT_ROUTINE; in->iroutines.select_and_sendback = NO_SELECTANDSENDBACK_ROUTINE; in->iroutines.set_config = NO_SET_CONFIG_ROUTINE; in->iroutines.get_config = NO_GET_CONFIG_ROUTINE; in->iroutines.reconnect = NO_RECONNECT_ROUTINE; in->iroutines.close = Fake_close; in->iroutines.verify = NO_VERIFY_ROUTINE ; in->iroutines.flags = ADAP_FLAG_no2409path | ADAP_FLAG_presence_from_dirblob | ADAP_FLAG_no2404delay ; DirblobInit( &(in->master.fake.main) ); DirblobInit( &(in->master.fake.alarm) ); }
/* Look in caches, 0=found and valid, 1=not or uncachable in the first place */ GOOD_OR_BAD Cache_Get_Dir(struct dirblob *db, const struct parsedname *pn) { time_t duration = TimeOut(fc_directory); struct tree_node tn; struct parsedname pn_directory; DirblobInit(db); if (duration <= 0) { return gbBAD; } LEVEL_DEBUG("Looking for directory "SNformat, SNvar(pn->sn)); FS_LoadDirectoryOnly(&pn_directory, pn); LoadTK( pn_directory.sn, Directory_Marker, pn->selected_connection->index, &tn) ; return Get_Stat(&cache_dir, Cache_Get_Common_Dir(db, &duration, &tn)); }