Changeset 91b72d3 for lib/format_legacy.c
- Timestamp:
- 01/05/09 11:29:11 (12 years ago)
- Branches:
- 4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, getfragoff, help, libtrace4, master, ndag_format, pfring, rc-4.0.1, rc-4.0.2, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance, ringtimestampfixes
- Children:
- ad36006
- Parents:
- 9d0049cf
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/format_legacy.c
rc66068d r91b72d3 62 62 63 63 #define DATA(x) ((struct legacy_format_data_t *)x->format_data) 64 #define INPUT DATA(libtrace)->input65 64 66 65 struct legacy_format_data_t { 67 union {68 int fd;69 io_t *file;70 } input;71 66 time_t starttime; /* Used for legacy_nzix */ 72 67 uint64_t ts_high; /* Used for legacy_nzix */ … … 77 72 libtrace->format_data = malloc(sizeof(struct legacy_format_data_t)); 78 73 79 DATA(libtrace)->input.file = NULL;80 74 DATA(libtrace)->ts_high = 0; 81 75 DATA(libtrace)->ts_old = 0; … … 164 158 static int erf_start_input(libtrace_t *libtrace) 165 159 { 166 if (DATA(libtrace)->input.file) 160 if (libtrace->io) 161 return 0; /* Already open */ 162 163 libtrace->io = trace_open_file(libtrace); 164 165 if (libtrace->io) 167 166 return 0; 168 167 169 DATA(libtrace)->input.file = trace_open_file(libtrace);170 171 if (DATA(libtrace)->input.file)172 return 0;173 174 168 return -1; 175 169 } 176 170 177 171 static int erf_fin_input(libtrace_t *libtrace) { 178 wandio_destroy( INPUT.file);172 wandio_destroy(libtrace->io); 179 173 free(libtrace->format_data); 180 174 return 0; … … 238 232 while (1) { 239 233 240 if ((numbytes=wandio_read( INPUT.file,234 if ((numbytes=wandio_read(libtrace->io, 241 235 buffer, 242 236 (size_t)64)) != 64) { … … 280 274 281 275 while (1) { 282 if ((numbytes = wandio_read( INPUT.file, buffer,276 if ((numbytes = wandio_read(libtrace->io, buffer, 283 277 (size_t)68)) != 68) { 284 278 if (numbytes < 0) { … … 466 460 "$Id$", 467 461 TRACE_FORMAT_LEGACY_ATM, 462 NULL, /* probe filename */ 463 NULL, /* probe magic */ 468 464 erf_init_input, /* init_input */ 469 465 NULL, /* config_input */ … … 506 502 "$Id$", 507 503 TRACE_FORMAT_LEGACY_ETH, 504 NULL, /* probe filename */ 505 NULL, /* probe magic */ 508 506 erf_init_input, /* init_input */ 509 507 NULL, /* config_input */ … … 546 544 "$Id$", 547 545 TRACE_FORMAT_LEGACY_POS, 546 NULL, /* probe filename */ 547 NULL, /* probe magic */ 548 548 erf_init_input, /* init_input */ 549 549 NULL, /* config_input */ … … 586 586 "$Id$", 587 587 TRACE_FORMAT_LEGACY_NZIX, 588 NULL, /* probe filename */ 589 NULL, /* probe magic */ 588 590 legacynzix_init_input, /* init_input */ 589 591 NULL, /* config_input */
Note: See TracChangeset
for help on using the changeset viewer.