]> www.infradead.org Git - mtd-utils.git/commitdiff
fs-tests: integck: move mem_page_size to fsinfo
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Tue, 12 Apr 2011 09:00:22 +0000 (12:00 +0300)
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Mon, 18 Apr 2011 14:44:45 +0000 (17:44 +0300)
The fsinfo structure will aggregate all the information about the
tested file-system. Move 'mem_page_size' which we use for 'mmap()'
there as well.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
tests/fs-tests/integrity/integck.c

index 3ee20b2632303f6f8d6e4c937841c69343075039..e7a35470e92ef379237a4880a004ec7f9ab0bb3e 100644 (file)
@@ -55,10 +55,12 @@ static struct {
  * The below data structure describes the tested file-system.
  *
  * max_name_len: maximum file name length
+ * page_size: memory page size to use with 'mmap()'
  * fstype: file-system type (e.g., "ubifs")
  */
 static struct {
        int max_name_len;
+       int page_size;
        const char *fstype;
 } fsinfo;
 
@@ -163,8 +165,6 @@ static int check_nospc_files = 1; /* Also check data in files that incurred a
 
 static int can_mmap = 1; /* Can write via mmap */
 
-static long mem_page_size; /* Page size for mmap */
-
 static unsigned int check_run_no;
 
 /*
@@ -846,7 +846,7 @@ static void file_mmap_write(struct file_info *file)
        for (i = 0; w && w->next && i < r; i++)
                w = w->next;
 
-       offs = (w->offset / mem_page_size) * mem_page_size;
+       offs = (w->offset / fsinfo.page_size) * fsinfo.page_size;
        len = w->size + (w->offset - offs);
        if (len > 1 << 24)
                len = 1 << 24;
@@ -1958,9 +1958,6 @@ static int integck(void)
        uint64_t z;
        char dir_name[256];
 
-       /* Get memory page size for mmap */
-       mem_page_size = sysconf(_SC_PAGE_SIZE);
-       CHECK(mem_page_size > 0);
        /* Make our top directory */
        pid = getpid();
        normsg("pid is %u", (unsigned) pid);
@@ -2051,6 +2048,10 @@ static void get_tested_fs_info(void)
         fclose(f);
 
        fsinfo.fstype = dup_string(mntent->mnt_type);
+
+       /* Get memory page size for 'mmap()' */
+       fsinfo.page_size = sysconf(_SC_PAGE_SIZE);
+       CHECK(fsinfo.page_size > 0);
 }
 
 static const char doc[] = PROGRAM_NAME " version " PROGRAM_VERSION