summaryrefslogtreecommitdiff
path: root/src/extent-scan.c
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2010-10-11 11:19:02 +0200
committerJim Meyering <meyering@redhat.com>2011-01-30 20:44:11 +0100
commit50040d07e1fca7cae7aee3827053efb71454e6f2 (patch)
tree2cde0b27a584c3f23b3e7fcb1c9bc1b040755eb2 /src/extent-scan.c
parent0b9f65dc017fa66a47c19f63f49bd013fac0d29c (diff)
downloadcoreutils-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/extent-scan.c')
-rw-r--r--src/extent-scan.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/extent-scan.c b/src/extent-scan.c
index f371b8718..3bb0d536c 100644
--- a/src/extent-scan.c
+++ b/src/extent-scan.c
@@ -24,23 +24,21 @@
#include "system.h"
#include "extent-scan.h"
-#include "error.h"
-#include "quote.h"
#ifndef HAVE_FIEMAP
# include "fiemap.h"
#endif
/* Allocate space for struct extent_scan, initialize the entries if
- necessary and return it as the input argument of get_extents_info(). */
+ necessary and return it as the input argument of extent_scan_read(). */
extern void
-open_extent_scan (int src_fd, struct extent_scan *scan)
+extent_scan_init (int src_fd, struct extent_scan *scan)
{
scan->fd = src_fd;
scan->ei_count = 0;
scan->scan_start = 0;
scan->initial_scan_failed = false;
- scan->hit_last_extent = false;
+ scan->hit_final_extent = false;
}
#ifdef __linux__
@@ -50,14 +48,13 @@ open_extent_scan (int src_fd, struct extent_scan *scan)
/* Call ioctl(2) with FS_IOC_FIEMAP (available in linux 2.6.27) to
obtain a map of file extents excluding holes. */
extern bool
-get_extents_info (struct extent_scan *scan)
+extent_scan_read (struct extent_scan *scan)
{
union { struct fiemap f; char c[4096]; } fiemap_buf;
struct fiemap *fiemap = &fiemap_buf.f;
struct fiemap_extent *fm_extents = &fiemap->fm_extents[0];
enum { count = (sizeof fiemap_buf - sizeof *fiemap) / sizeof *fm_extents };
verify (count != 0);
- unsigned int i;
/* This is required at least to initialize fiemap->fm_start,
but also serves (in mid 2010) to appease valgrind, which
@@ -81,13 +78,14 @@ get_extents_info (struct extent_scan *scan)
/* If 0 extents are returned, then more get_extent_table() are not needed. */
if (fiemap->fm_mapped_extents == 0)
{
- scan->hit_last_extent = true;
+ scan->hit_final_extent = true;
return false;
}
scan->ei_count = fiemap->fm_mapped_extents;
scan->ext_info = xnmalloc (scan->ei_count, sizeof (struct extent_info));
+ unsigned int i;
for (i = 0; i < scan->ei_count; i++)
{
assert (fm_extents[i].fe_logical <= OFF_T_MAX);
@@ -100,7 +98,7 @@ get_extents_info (struct extent_scan *scan)
i--;
if (scan->ext_info[i].ext_flags & FIEMAP_EXTENT_LAST)
{
- scan->hit_last_extent = true;
+ scan->hit_final_extent = true;
return true;
}
@@ -109,5 +107,10 @@ get_extents_info (struct extent_scan *scan)
return true;
}
#else
-extern bool get_extents_info (ignored) { errno = ENOTSUP; return false; }
+extern bool
+extent_scan_read (struct extent_scan *scan ATTRIBUTE_UNUSED)
+{
+ errno = ENOTSUP;
+ return false;
+}
#endif