Store .obs and .json paths in stream struct
This commit is contained in:
		
							parent
							
								
									8e9cc34e5e
								
							
						
					
					
						commit
						3f6ec86890
					
				| @ -361,7 +361,7 @@ execute_sort_plan(struct sortplan *sp) | ||||
| static int | ||||
| stream_winsort(struct stream *stream, struct ring *r) | ||||
| { | ||||
| 	char *fn = stream->path; | ||||
| 	char *fn = stream->obspath; | ||||
| 	int fd = open(fn, O_WRONLY); | ||||
| 
 | ||||
| 	if (fd < 0) | ||||
|  | ||||
| @ -158,25 +158,22 @@ stream_load(struct stream *stream, const char *tracedir, const char *relpath) | ||||
| 
 | ||||
| 	dbg("loading %s", stream->relpath); | ||||
| 
 | ||||
| 	char path_json[PATH_MAX]; | ||||
| 	char path_obs[PATH_MAX]; | ||||
| 
 | ||||
| 	if (path_append(path_json, stream->path, "stream.json") != 0) { | ||||
| 	if (path_append(stream->jsonpath, stream->path, "stream.json") != 0) { | ||||
| 		err("path_append failed"); | ||||
| 		return -1; | ||||
| 	} | ||||
| 
 | ||||
| 	if ((stream->meta = load_json(path_json)) == NULL) { | ||||
| 		err("load_json failed for: %s", path_json); | ||||
| 	if ((stream->meta = load_json(stream->jsonpath)) == NULL) { | ||||
| 		err("load_json failed for: %s", stream->jsonpath); | ||||
| 		return -1; | ||||
| 	} | ||||
| 
 | ||||
| 	if (path_append(path_obs, stream->path, "stream.obs") != 0) { | ||||
| 	if (path_append(stream->obspath, stream->path, "stream.obs") != 0) { | ||||
| 		err("path_append failed"); | ||||
| 		return -1; | ||||
| 	} | ||||
| 
 | ||||
| 	if (load_obs(stream, path_obs) != 0) { | ||||
| 	if (load_obs(stream, stream->obspath) != 0) { | ||||
| 		err("load_obs failed"); | ||||
| 		return -1; | ||||
| 	} | ||||
|  | ||||
| @ -28,8 +28,10 @@ struct stream { | ||||
| 	int active; | ||||
| 	int unsorted; | ||||
| 
 | ||||
| 	char path[PATH_MAX]; | ||||
| 	char path[PATH_MAX]; /* To stream dir */ | ||||
| 	char relpath[PATH_MAX]; /* To tracedir */ | ||||
| 	char obspath[PATH_MAX]; /* To obs file */ | ||||
| 	char jsonpath[PATH_MAX]; /* To json file */ | ||||
| 
 | ||||
| 	int64_t usize; /* Useful size for events */ | ||||
| 	int64_t offset; | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user