diff options
author | Jim Meyering <meyering@redhat.com> | 2010-10-11 11:19:02 +0200 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2011-01-30 20:44:11 +0100 |
commit | 50040d07e1fca7cae7aee3827053efb71454e6f2 (patch) | |
tree | 2cde0b27a584c3f23b3e7fcb1c9bc1b040755eb2 /src/copy.c | |
parent | 0b9f65dc017fa66a47c19f63f49bd013fac0d29c (diff) | |
download | coreutils-50040d07e1fca7cae7aee3827053efb71454e6f2.tar.xz |
extent-scan: adjust naming and formatting
* src/extent-scan.h [struct extent_scan]: Rename member:
s/hit_last_extent/hit_final_extent/. "final" is clearer,
since "last" can be interpreted as "preceding".
Rename extent-scan functions to start with extent_scan_.
* src/Makefile.am (copy_sources): Also distribute extent-scan.h.
* src/extent-scan.c: Don't include error.h or quote.h. Neither is used.
* src/copy.c: shorten a comment to fit in 80 columns
* src/extent-scan.c, src/extent-scan.h: Correct formatting.
Diffstat (limited to 'src/copy.c')
-rw-r--r-- | src/copy.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/copy.c b/src/copy.c index 902c6bbea..270009bbe 100644 --- a/src/copy.c +++ b/src/copy.c @@ -204,19 +204,18 @@ extent_copy (int src_fd, int dest_fd, size_t buf_size, uint64_t last_ext_len = 0; uint64_t last_read_size = 0; - open_extent_scan (src_fd, &scan); + extent_scan_init (src_fd, &scan); do { - bool ok = get_extents_info (&scan); + bool ok = extent_scan_read (&scan); if (! ok) { - if (scan.hit_last_extent) + if (scan.hit_final_extent) break; if (scan.initial_scan_failed) { - close_extent_scan (&scan); *require_normal_copy = true; return false; } @@ -288,7 +287,7 @@ extent_copy (int src_fd, int dest_fd, size_t buf_size, if (n_read == 0) { - /* Figure out how many bytes read from the previous extent. */ + /* Record number of bytes read from the previous extent. */ last_read_size = last_ext_len - ext_len; break; } @@ -304,11 +303,10 @@ extent_copy (int src_fd, int dest_fd, size_t buf_size, } /* Release the space allocated to scan->ext_info. */ - free_extents_info (&scan); - } while (! scan.hit_last_extent); + extent_scan_free (&scan); - /* Do nothing now. */ - close_extent_scan (&scan); + } + while (! scan.hit_final_extent); /* If a file ends up with holes, the sum of the last extent logical offset and the read-returned size or the last extent length will be shorter than |