* read one request from reader precede current position, * in other words, read the line above current line, * and currently file points to either the end of current line or * beginning of next line * * this method is used when reading the trace from end to beginning * @param reader * @param c * @return 0 on success */
| 433 | * @return 0 on success |
| 434 | */ |
| 435 | int read_one_req_above(reader_t *const reader, request_t *req) { |
| 436 | if (reader->n_req_left > 0) { |
| 437 | reader->n_req_left -= 1; |
| 438 | req->clock_time = reader->last_req_clock_time; |
| 439 | return 0; |
| 440 | } |
| 441 | |
| 442 | if (go_back_two_req(reader) == 0) { |
| 443 | return read_one_req(reader, req); |
| 444 | } else { |
| 445 | req->valid = false; |
| 446 | return 1; |
| 447 | } |
| 448 | } |
| 449 | |
| 450 | /** |
| 451 | * skip the next following N elements in the trace, |