Changeset 01a9ef5 in mainline
- Timestamp:
- 2010-02-16T18:11:00Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 209faf9, bfd7aac
- Parents:
- 80ce111
- Files:
-
- 6 added
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
boot/Makefile.common
r80ce111 r01a9ef5 86 86 endif 87 87 88 CFG = 89 88 90 NET_SRVS = \ 89 91 $(USPACEDIR)/srv/net/net/net \ … … 100 102 $(USPACEDIR)/srv/net/app/nettest2/nettest2 101 103 104 NET_CFG = \ 105 $(USPACEDIR)/srv/net/cfg/$(NETWORKING)/general \ 106 $(USPACEDIR)/srv/net/cfg/$(NETWORKING)/lo \ 107 $(USPACEDIR)/srv/net/cfg/$(NETWORKING)/ne2k 108 102 109 ifeq ($(NETWORKING), module) 103 110 RD_APPS += $(NET_APPS) 104 111 105 112 RD_SRVS += $(NET_SRVS) 113 114 CFG += $(NET_CFG) 106 115 else 107 116 ifeq ($(NETWORKING), modular) … … 115 124 $(USPACEDIR)/srv/net/tl/tcp/tcp \ 116 125 $(USPACEDIR)/srv/net/tl/icmp/icmp 126 127 CFG += $(NET_CFG) 117 128 endif 118 129 endif -
boot/arch/amd64/Makefile.inc
-
Property mode
changed from
100644
to100755
r80ce111 r01a9ef5 39 39 build: $(BASE)/image.iso 40 40 41 $(BASE)/image.iso: arch/$(BARCH)/grub/stage2_eltorito $(KERNELDIR)/kernel.bin $(INIT_TASKS) $(RD_SRVS) $(RD_APPS) 41 $(BASE)/image.iso: arch/$(BARCH)/grub/stage2_eltorito $(KERNELDIR)/kernel.bin $(INIT_TASKS) $(RD_SRVS) $(RD_APPS) $(CFG) 42 42 mkdir -p $(TMP)/boot/grub 43 43 cp arch/$(BARCH)/grub/stage2_eltorito $(TMP)/boot/grub/ … … 56 56 done 57 57 58 rm -f $(USPACEDIR)/dist/srv/* 59 rm -f $(USPACEDIR)/dist/app/* 60 rm -f $(USPACEDIR)/dist/cfg/net/* 61 58 62 cp $(KERNELDIR)/kernel.bin $(TMP)/boot/ 59 63 for task in $(INIT_TASKS) ; do \ … … 65 69 for file in $(RD_APPS) ; do \ 66 70 cp $$file $(USPACEDIR)/dist/app/ ; \ 71 done 72 for file in $(NET_CFG) ; do \ 73 cp $$file $(USPACEDIR)/dist/cfg/net/ ; \ 67 74 done 68 75 … … 78 85 79 86 clean: 87 rm -f $(USPACEDIR)/dist/srv/* 88 rm -f $(USPACEDIR)/dist/app/* 89 rm -f $(USPACEDIR)/dist/cfg/net/* 90 80 91 for file in $(RD_SRVS) ; do \ 81 92 rm -f $(USPACEDIR)/dist/srv/`basename $$file` ; \ … … 84 95 rm -f $(USPACEDIR)/dist/app/`basename $$file` ; \ 85 96 done 97 for file in $(NET_CFG) ; do \ 98 rm -f $(USPACEDIR)/dist/cfg/net/`basename $$file` ; \ 99 done 86 100 rm -fr $(TMP) 87 101 rm -f $(BASE)/image.iso -
Property mode
changed from
-
boot/arch/arm32/loader/Makefile
r80ce111 r01a9ef5 37 37 38 38 clean: 39 rm -f $(USPACEDIR)/dist/srv/* 40 rm -f $(USPACEDIR)/dist/app/* 41 rm -f $(USPACEDIR)/dist/cfg/net/* 42 39 43 for file in $(RD_SRVS) ; do \ 40 44 rm -f $(USPACEDIR)/dist/srv/`basename $$file` ; \ … … 43 47 rm -f $(USPACEDIR)/dist/app/`basename $$file` ; \ 44 48 done 49 for file in $(NET_CFG) ; do \ 50 rm -f $(USPACEDIR)/dist/cfg/net/`basename $$file` ; \ 51 done 45 52 rm -f $(DEPEND) $(DEPEND_PREV) $(JOB) $(OUTPUT) $(COMPS).h $(COMPS).c $(LINK) $(INITRD).img $(INITRD).fs 46 53 find . -name '*.o' -follow -exec rm \{\} \; -
boot/arch/arm32/loader/Makefile.build
r80ce111 r01a9ef5 76 76 77 77 $(DEPEND): 78 rm -f $(USPACEDIR)/dist/srv/* 79 rm -f $(USPACEDIR)/dist/app/* 80 rm -f $(USPACEDIR)/dist/cfg/net/* 81 78 82 for file in $(RD_SRVS) ; do \ 79 83 cp $$file $(USPACEDIR)/dist/srv/ ; \ … … 81 85 for file in $(RD_APPS) ; do \ 82 86 cp $$file $(USPACEDIR)/dist/app/ ; \ 87 done 88 for file in $(NET_CFG) ; do \ 89 cp $$file $(USPACEDIR)/dist/cfg/net/ ; \ 83 90 done 84 91 ifeq ($(RDFMT),tmpfs) -
boot/arch/ia64/loader/Makefile
r80ce111 r01a9ef5 40 40 $(MAKE) -C gefi clean 41 41 $(MAKE) -C gefi/HelenOS clean 42 43 rm -f $(USPACEDIR)/dist/srv/* 44 rm -f $(USPACEDIR)/dist/app/* 45 rm -f $(USPACEDIR)/dist/cfg/net/* 46 42 47 for file in $(RD_SRVS) ; do \ 43 48 rm -f $(USPACEDIR)/dist/srv/`basename $$file` ; \ … … 46 51 rm -f $(USPACEDIR)/dist/app/`basename $$file` ; \ 47 52 done 53 for file in $(NET_CFG) ; do \ 54 rm -f $(USPACEDIR)/dist/cfg/net/`basename $$file` ; \ 55 done 48 56 rm -f $(DEPEND) $(DEPEND_PREV) $(JOB) $(OUTPUT) $(HELLO) $(COMPS).h $(COMPS).c $(LINK) $(INITRD).img $(INITRD).fs 49 57 find . -name '*.o' -follow -exec rm \{\} \; -
boot/arch/ia64/loader/Makefile.build
r80ce111 r01a9ef5 77 77 78 78 $(DEPEND): 79 rm -f $(USPACEDIR)/dist/srv/* 80 rm -f $(USPACEDIR)/dist/app/* 81 rm -f $(USPACEDIR)/dist/cfg/net/* 82 79 83 for file in $(RD_SRVS) ; do \ 80 84 cp $$file $(USPACEDIR)/dist/srv/ ; \ … … 82 86 for file in $(RD_APPS) ; do \ 83 87 cp $$file $(USPACEDIR)/dist/app/ ; \ 88 done 89 for file in $(NET_CFG) ; do \ 90 cp $$file $(USPACEDIR)/dist/cfg/net/ ; \ 84 91 done 85 92 ifeq ($(RDFMT),tmpfs) -
boot/arch/mips32/loader/Makefile
r80ce111 r01a9ef5 37 37 38 38 clean: 39 rm -f $(USPACEDIR)/dist/srv/* 40 rm -f $(USPACEDIR)/dist/app/* 41 rm -f $(USPACEDIR)/dist/cfg/net/* 42 39 43 for file in $(RD_SRVS) ; do \ 40 44 rm -f $(USPACEDIR)/dist/srv/`basename $$file` ; \ … … 43 47 rm -f $(USPACEDIR)/dist/app/`basename $$file` ; \ 44 48 done 49 for file in $(NET_CFG) ; do \ 50 rm -f $(USPACEDIR)/dist/cfg/net/`basename $$file` ; \ 51 done 45 52 rm -f $(DEPEND) $(DEPEND_PREV) $(JOB) $(OUTPUT) $(RAW) $(COMPS).h $(COMPS).c $(LINK) $(INITRD).img $(INITRD).fs 46 53 find . -name '*.o' -follow -exec rm \{\} \; -
boot/arch/mips32/loader/Makefile.build
r80ce111 r01a9ef5 77 77 78 78 $(DEPEND): 79 rm -f $(USPACEDIR)/dist/srv/* 80 rm -f $(USPACEDIR)/dist/app/* 81 rm -f $(USPACEDIR)/dist/cfg/net/* 82 79 83 for file in $(RD_SRVS) ; do \ 80 84 cp $$file $(USPACEDIR)/dist/srv/ ; \ … … 82 86 for file in $(RD_APPS) ; do \ 83 87 cp $$file $(USPACEDIR)/dist/app/ ; \ 88 done 89 for file in $(NET_CFG) ; do \ 90 cp $$file $(USPACEDIR)/dist/cfg/net/ ; \ 84 91 done 85 92 ifeq ($(RDFMT),tmpfs) -
boot/arch/ppc32/loader/Makefile
r80ce111 r01a9ef5 37 37 38 38 clean: 39 rm -f $(USPACEDIR)/dist/srv/* 40 rm -f $(USPACEDIR)/dist/app/* 41 rm -f $(USPACEDIR)/dist/cfg/net/* 42 39 43 for file in $(RD_SRVS) ; do \ 40 44 rm -f $(USPACEDIR)/dist/srv/`basename $$file` ; \ … … 43 47 rm -f $(USPACEDIR)/dist/app/`basename $$file` ; \ 44 48 done 49 for file in $(NET_CFG) ; do \ 50 rm -f $(USPACEDIR)/dist/cfg/net/`basename $$file` ; \ 51 done 45 52 rm -f $(DEPEND) $(DEPEND_PREV) $(JOB) $(OUTPUT) $(COMPS).h $(COMPS).c $(LINK) $(INITRD).img $(INITRD).fs 46 53 find . -name '*.o' -follow -exec rm \{\} \; -
boot/arch/ppc32/loader/Makefile.build
r80ce111 r01a9ef5 77 77 78 78 $(DEPEND): 79 rm -f $(USPACEDIR)/dist/srv/* 80 rm -f $(USPACEDIR)/dist/app/* 81 rm -f $(USPACEDIR)/dist/cfg/net/* 82 79 83 for file in $(RD_SRVS) ; do \ 80 84 cp $$file $(USPACEDIR)/dist/srv/ ; \ … … 82 86 for file in $(RD_APPS) ; do \ 83 87 cp $$file $(USPACEDIR)/dist/app/ ; \ 88 done 89 for file in $(NET_CFG) ; do \ 90 cp $$file $(USPACEDIR)/dist/cfg/net/ ; \ 84 91 done 85 92 ifeq ($(RDFMT),tmpfs) -
boot/arch/sparc64/loader/Makefile
r80ce111 r01a9ef5 37 37 38 38 clean: 39 rm -f $(USPACEDIR)/dist/srv/* 40 rm -f $(USPACEDIR)/dist/app/* 41 rm -f $(USPACEDIR)/dist/cfg/net/* 42 39 43 for file in $(RD_SRVS) $(RD_SRVS_GENERIC) ; do \ 40 44 rm -f $(USPACEDIR)/dist/srv/`basename $$file` ; \ … … 43 47 rm -f $(USPACEDIR)/dist/app/`basename $$file` ; \ 44 48 done 49 for file in $(NET_CFG) ; do \ 50 rm -f $(USPACEDIR)/dist/cfg/net/`basename $$file` ; \ 51 done 45 52 rm -f $(DEPEND) $(DEPEND_PREV) $(JOB) $(OUTPUT) $(COMPS).h $(COMPS).c $(LINK) $(INITRD).img $(INITRD).fs 46 53 find . -name '*.o' -follow -exec rm \{\} \; -
boot/arch/sparc64/loader/Makefile.build
r80ce111 r01a9ef5 88 88 89 89 $(DEPEND): 90 rm -f $(USPACEDIR)/dist/srv/* 91 rm -f $(USPACEDIR)/dist/app/* 92 rm -f $(USPACEDIR)/dist/cfg/net/* 93 90 94 for file in $(RD_SRVS) ; do \ 91 95 cp $$file $(USPACEDIR)/dist/srv/ ; \ … … 93 97 for file in $(RD_APPS) ; do \ 94 98 cp $$file $(USPACEDIR)/dist/app/ ; \ 99 done 100 for file in $(NET_CFG) ; do \ 101 cp $$file $(USPACEDIR)/dist/cfg/net/ ; \ 95 102 done 96 103 ifeq ($(RDFMT),tmpfs) -
uspace/srv/net/net/net.c
r80ce111 r01a9ef5 70 70 #define NAME "Networking" 71 71 72 /** File read buffer size. 73 */ 74 #define BUFFER_SIZE 256 75 72 76 /** Prints the module name. 73 77 * @see NAME … … 84 88 int module_start( async_client_conn_t client_connection ); 85 89 86 //int parse_line( measured_strings_ref configuration, char * line ); 90 /** \todo 91 */ 92 int read_configuration_file( const char * directory, const char * filename, measured_strings_ref configuration ); 93 94 /** \todo 95 */ 96 int parse_line( measured_strings_ref configuration, char * line ); 87 97 88 98 /** Reads the networking subsystem global configuration. … … 274 284 } 275 285 276 /* 286 int read_configuration_file( const char * directory, const char * filename, measured_strings_ref configuration ){ 287 ERROR_DECLARE; 288 289 size_t index = 0; 290 char line[ BUFFER_SIZE ]; 291 FILE * cfg; 292 int read; 293 int line_number = 0; 294 295 // construct the full filename 296 printf( "Reading file %s/%s\n", directory, filename ); 297 if( snprintf( line, BUFFER_SIZE, "%s/%s", directory, filename ) > BUFFER_SIZE ){ 298 return EOVERFLOW; 299 } 300 // open the file 301 cfg = fopen( line, "r" ); 302 if( ! cfg ){ 303 return ENOENT; 304 } 305 306 // read the configuration line by line 307 // until an error or the end of file 308 while(( ! ferror( cfg )) && ( ! feof( cfg ))){ 309 read = fgetc( cfg ); 310 if(( read > 0 ) && ( read != '\n' ) && ( read != '\r' )){ 311 if( index >= BUFFER_SIZE ){ 312 line[ BUFFER_SIZE - 1 ] = '\0'; 313 printf( "line %d too long: %s\n", line_number, line ); 314 // no space left in the line buffer 315 return EOVERFLOW; 316 }else{ 317 // append the character 318 line[ index ] = (char) read; 319 ++ index; 320 } 321 }else{ 322 // on error or new line 323 line[ index ] = '\0'; 324 ++ line_number; 325 if( ERROR_OCCURRED( parse_line( configuration, line ))){ 326 printf( "error on line %d: %s\n", line_number, line ); 327 //fclose( cfg ); 328 //return ERROR_CODE; 329 } 330 index = 0; 331 } 332 } 333 fclose( cfg ); 334 return EOK; 335 } 336 277 337 int parse_line( measured_strings_ref configuration, char * line ){ 278 338 ERROR_DECLARE; 279 339 280 340 measured_string_ref setting; 281 char * name;282 char * value;341 char * name; 342 char * value; 283 343 284 344 // from the beginning 285 345 name = line; 346 347 // skip comments and blank lines 348 if(( * name == '#' ) || ( * name == '\0' )){ 349 return EOK; 350 } 286 351 // skip spaces 287 352 while( isspace( * name )) ++ name; 353 288 354 // remember the name start 289 355 value = name; … … 294 360 ++ value; 295 361 } 362 296 363 if( * value == '=' ){ 297 364 // terminate the name … … 306 373 if( * value != '=' ) return EINVAL; 307 374 } 375 308 376 ++ value; 309 377 // skip spaces 310 378 while( isspace( * value )) ++ value; 311 379 // create a bulk measured string till the end 312 setting = measured_string_create_bulk( value, -1);380 setting = measured_string_create_bulk( value, 0 ); 313 381 if( ! setting ) return ENOMEM; 382 314 383 // add the configuration setting 315 384 if( ERROR_OCCURRED( measured_strings_add( configuration, name, 0, setting ))){ … … 319 388 return EOK; 320 389 } 321 */322 390 323 391 int add_configuration( measured_strings_ref configuration, const char * name, const char * value ){ … … 341 409 342 410 int read_configuration( void ){ 343 ERROR_DECLARE; 344 345 // read general configuration 346 ERROR_PROPAGATE( add_configuration( & net_globals.configuration, "IPV", "4" )); 347 ERROR_PROPAGATE( add_configuration( & net_globals.configuration, "IP_ROUTING", "no" )); 348 ERROR_PROPAGATE( add_configuration( & net_globals.configuration, "MTU", "1500" )); 349 ERROR_PROPAGATE( add_configuration( & net_globals.configuration, "ICMP_ERROR_REPORTING", "yes" )); //anything else not starting with 'y' 350 ERROR_PROPAGATE( add_configuration( & net_globals.configuration, "ICMP_ECHO_REPLYING", "yes" )); //anything else not starting with 'y' 351 ERROR_PROPAGATE( add_configuration( & net_globals.configuration, "UDP_CHECKSUM_COMPUTING", "yes" )); //anything else not starting with 'y' 352 ERROR_PROPAGATE( add_configuration( & net_globals.configuration, "UDP_AUTOBINDING", "yes" )); //anything else not starting with 'y' 353 return EOK; 411 // read the general configuration file 412 return read_configuration_file( CONF_DIR, CONF_GENERAL_FILE, & net_globals.configuration ); 354 413 } 355 414 356 415 int read_netif_configuration( char * name, netif_ref netif ){ 357 ERROR_DECLARE; 358 359 if( str_lcmp( name, "lo", 2 ) == 0 ){ 360 ERROR_PROPAGATE( add_configuration( & netif->configuration, "NAME", LO_NAME )); 361 ERROR_PROPAGATE( add_configuration( & netif->configuration, "NETIF", LO_NAME )); 362 ERROR_PROPAGATE( add_configuration( & netif->configuration, "IL", IP_NAME )); 363 ERROR_PROPAGATE( add_configuration( & netif->configuration, "IP_CONFIG", "static" )); 364 ERROR_PROPAGATE( add_configuration( & netif->configuration, "IP_ADDR", "127.0.0.1" )); 365 ERROR_PROPAGATE( add_configuration( & netif->configuration, "IP_NETMASK", "255.0.0.0" )); 366 ERROR_PROPAGATE( add_configuration( & netif->configuration, "MTU", "15535" )); 367 }else if( str_lcmp( name, "ne2k", 4 ) == 0 ){ 368 ERROR_PROPAGATE( add_configuration( & netif->configuration, "NAME", "eth0" )); 369 ERROR_PROPAGATE( add_configuration( & netif->configuration, "NETIF", DP8390_NAME )); 370 ERROR_PROPAGATE( add_configuration( & netif->configuration, "ETH_MODE", "DIX" )); //8023_2_LSAP( not supported ), 8023_2_SNAP 371 // ERROR_PROPAGATE( add_configuration( & netif->configuration, "ETH_DUMMY", "yes" )); //anything else not starting with 'y' 372 ERROR_PROPAGATE( add_configuration( & netif->configuration, "IL", IP_NAME )); 373 ERROR_PROPAGATE( add_configuration( & netif->configuration, "IRQ", "9" )); 374 ERROR_PROPAGATE( add_configuration( & netif->configuration, "IO", "300" )); 375 ERROR_PROPAGATE( add_configuration( & netif->configuration, "MTU", "1492" )); 376 ERROR_PROPAGATE( add_configuration( & netif->configuration, "IP_CONFIG", "static" )); 377 ERROR_PROPAGATE( add_configuration( & netif->configuration, "IP_ADDR", "10.0.2.15" )); 378 ERROR_PROPAGATE( add_configuration( & netif->configuration, "IP_ROUTING", "yes" )); 379 ERROR_PROPAGATE( add_configuration( & netif->configuration, "IP_NETMASK", "255.255.255.240" )); 380 ERROR_PROPAGATE( add_configuration( & netif->configuration, "IP_BROADCAST", "10.0.2.255" )); 381 ERROR_PROPAGATE( add_configuration( & netif->configuration, "IP_GATEWAY", "10.0.2.2" )); 382 ERROR_PROPAGATE( add_configuration( & netif->configuration, "ARP", "arp" )); 383 } 384 return read_netif_configuration_build( name, netif ); 416 // read the netif configuration file 417 return read_configuration_file( CONF_DIR, name, & netif->configuration ); 385 418 } 386 419 … … 451 484 ERROR_DECLARE; 452 485 486 #ifdef CONFIG_NETIF_DP8390 453 487 char * conf_files[] = { "lo", "ne2k" }; 488 #else 489 char * conf_files[] = { "lo" }; 490 #endif 491 454 492 int count = sizeof( conf_files ) / sizeof( char * ); 455 493 int index; -
uspace/srv/net/net/net.h
r80ce111 r01a9ef5 128 128 /*@}*/ 129 129 130 /** Configuration directory. 131 */ 132 #define CONF_DIR "/cfg/net" 133 134 /** General configuration file. 135 */ 136 #define CONF_GENERAL_FILE "general" 137 130 138 /** Type definition of the network interface specific data. 131 139 * @see netif … … 235 243 int module_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ); 236 244 237 /** Reads the network interface specific configuration for the chosen subsystem build type.238 * @param[in] name The network interface name.239 * @param[in,out] netif The network interface structure.240 * @returns EOK on success.241 * @returns Other error codes as defined for the add_configuration() function.242 */243 int read_netif_configuration_build( char * name, netif_ref netif );244 245 245 #endif 246 246 -
uspace/srv/net/net/net_bundle.c
r80ce111 r01a9ef5 117 117 } 118 118 119 int read_netif_configuration_build( char * name, netif_ref netif ){120 ERROR_DECLARE;121 122 if( str_lcmp( name, "lo", 2 ) == 0 ){123 ERROR_PROPAGATE( add_configuration( & netif->configuration, "NIL", LO_NAME ));124 }else if( str_lcmp( name, "ne2k", 4 ) == 0 ){125 ERROR_PROPAGATE( add_configuration( & netif->configuration, "NIL", DP8390_NAME ));126 }127 return EOK;128 }129 130 119 /** @} 131 120 */ -
uspace/srv/net/net/net_standalone.c
r80ce111 r01a9ef5 75 75 } 76 76 77 int read_netif_configuration_build( char * name, netif_ref netif ){78 ERROR_DECLARE;79 80 if( str_lcmp( name, "lo", 2 ) == 0 ){81 ERROR_PROPAGATE( add_configuration( & netif->configuration, "NIL", NILDUMMY_NAME ));82 }else if( str_lcmp( name, "ne2k", 4 ) == 0 ){83 ERROR_PROPAGATE( add_configuration( & netif->configuration, "NIL", ETHERNET_NAME ));84 }85 return EOK;86 }87 88 77 /** @} 89 78 */
Note:
See TracChangeset
for help on using the changeset viewer.