config: get the time stamp information early.
There is no need to have a function to get this information as we can easily obtain it when the interface is first created. Signed-off-by: Richard Cochran <richardcochran@gmail.com>
This commit is contained in:
		
							parent
							
								
									1b7088dea8
								
							
						
					
					
						commit
						2fc2af97d8
					
				
							
								
								
									
										7
									
								
								config.c
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								config.c
									
									
									
									
									
								
							| @ -534,7 +534,6 @@ int config_read(char *name, struct config *cfg) | ||||
| 				current_port = config_create_interface(port, cfg); | ||||
| 				if (!current_port) | ||||
| 					goto parse_error; | ||||
| 				config_init_interface(current_port, cfg); | ||||
| 			} | ||||
| 			continue; | ||||
| 		} | ||||
| @ -606,15 +605,11 @@ struct interface *config_create_interface(char *name, struct config *cfg) | ||||
| 	} | ||||
| 
 | ||||
| 	strncpy(iface->name, name, MAX_IFNAME_SIZE); | ||||
| 	sk_get_ts_info(iface->name, &iface->ts_info); | ||||
| 	STAILQ_INSERT_TAIL(&cfg->interfaces, iface, list); | ||||
| 	return iface; | ||||
| } | ||||
| 
 | ||||
| void config_init_interface(struct interface *iface, struct config *cfg) | ||||
| { | ||||
| 	sk_get_ts_info(iface->name, &iface->ts_info); | ||||
| } | ||||
| 
 | ||||
| struct config *config_create(void) | ||||
| { | ||||
| 	char buf[CONFIG_LABEL_SIZE + 8]; | ||||
|  | ||||
							
								
								
									
										1
									
								
								config.h
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								config.h
									
									
									
									
									
								
							| @ -48,7 +48,6 @@ struct config { | ||||
| 
 | ||||
| int config_read(char *name, struct config *cfg); | ||||
| struct interface *config_create_interface(char *name, struct config *cfg); | ||||
| void config_init_interface(struct interface *iface, struct config *cfg); | ||||
| void config_destroy(struct config *cfg); | ||||
| 
 | ||||
| /* New, hash table based methods: */ | ||||
|  | ||||
							
								
								
									
										1
									
								
								ptp4l.c
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								ptp4l.c
									
									
									
									
									
								
							| @ -296,7 +296,6 @@ int main(int argc, char *argv[]) | ||||
| 	/* Init interface configs and check whether timestamping mode is
 | ||||
| 	 * supported. */ | ||||
| 	STAILQ_FOREACH(iface, &cfg->interfaces, list) { | ||||
| 		config_init_interface(iface, cfg); | ||||
| 		if (iface->ts_info.valid && | ||||
| 		    ((iface->ts_info.so_timestamping & required_modes) != required_modes)) { | ||||
| 			fprintf(stderr, "interface '%s' does not support " | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user