From: Arvind Raghavan <raghavan.arvind@gmail.com>
To: fstests <fstests@vger.kernel.org>
Cc: Amir Goldstein <amir73il@gmail.com>,
Jayashree Mohan <jaya@cs.utexas.edu>,
Vijay Chidambaram <vijay@cs.utexas.edu>,
Arvind Raghavan <raghavan.arvind@gmail.com>
Subject: [PATCH v2 5/7] src/fssum: Add a flag for including file size in checksum
Date: Sun, 21 Jun 2020 19:16:31 -0400 [thread overview]
Message-ID: <da0cea4f8106cf67525045d04f0435d945ecf989.1592779555.git.raghavan.arvind@gmail.com> (raw)
In-Reply-To: <cover.1592779555.git.raghavan.arvind@gmail.com>
File size is currently included by default. It is useful to ignore file
sizes when testing the fsync of a directory, as the data in children is
not guaranteed to be persisted.
Signed-off-by: Arvind Raghavan <raghavan.arvind@gmail.com>
Signed-off-by: Jayashree Mohan <jaya@cs.utexas.edu>
Signed-off-by: Vijay Chidambaram <vijay@cs.utexas.edu>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
---
src/fssum.c | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/src/fssum.c b/src/fssum.c
index 3667ec2f..26b0096c 100644
--- a/src/fssum.c
+++ b/src/fssum.c
@@ -76,13 +76,14 @@ enum _flags {
FLAG_XATTRS,
FLAG_OPEN_ERROR,
FLAG_STRUCTURE,
+ FLAG_SIZE,
NUM_FLAGS
};
-const char flchar[] = "ugoamcdtes";
+const char flchar[] = "ugoamcdtesz";
char line[65536];
-int flags[NUM_FLAGS] = {1, 1, 1, 1, 1, 0, 1, 1, 0, 0};
+int flags[NUM_FLAGS] = {1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1};
char *
getln(char *buf, int size, FILE *fp)
@@ -137,7 +138,7 @@ usage(void)
fprintf(stderr, " -w <file> : send output to file\n");
fprintf(stderr, " -v : verbose mode (debugging only)\n");
fprintf(stderr, " -r <file> : read checksum or manifest from file\n");
- fprintf(stderr, " -[ugoamcdtes]: specify which fields to include in checksum calculation.\n");
+ fprintf(stderr, " -[ugoamcdtesz]: specify which fields to include in checksum calculation.\n");
fprintf(stderr, " u : include uid\n");
fprintf(stderr, " g : include gid\n");
fprintf(stderr, " o : include mode\n");
@@ -148,13 +149,14 @@ usage(void)
fprintf(stderr, " t : include xattrs\n");
fprintf(stderr, " e : include open errors (aborts otherwise)\n");
fprintf(stderr, " s : include block structure (holes)\n");
- fprintf(stderr, " -[UGOAMCDTES]: exclude respective field from calculation\n");
+ fprintf(stderr, " z : include file size\n");
+ fprintf(stderr, " -[UGOAMCDTESZ]: exclude respective field from calculation\n");
fprintf(stderr, " -n : reset all flags\n");
fprintf(stderr, " -N : set all flags\n");
fprintf(stderr, " -x path : exclude path when building checksum (multiple ok)\n");
fprintf(stderr, " -R : traverse dirs non-recursively (recursive is default)\n");
fprintf(stderr, " -h : this help\n\n");
- fprintf(stderr, "The default field mask is ugoamCdtES. If the checksum/manifest is read from a\n");
+ fprintf(stderr, "The default field mask is ugoamCdtESz. If the checksum/manifest is read from a\n");
fprintf(stderr, "file, the mask is taken from there and the values given on the command line\n");
fprintf(stderr, "are ignored.\n");
exit(-1);
@@ -656,7 +658,8 @@ sum_one(int dirfd, int level, sum_t *dircs, char *path_prefix,
close(fd);
}
} else if (S_ISREG(st.st_mode)) {
- sum_add_u64(&meta, st.st_size);
+ if (flags[FLAG_SIZE])
+ sum_add_u64(&meta, st.st_size);
if (flags[FLAG_DATA]) {
if (verbose)
fprintf(stderr, "file %s\n",
@@ -736,7 +739,7 @@ main(int argc, char *argv[])
int plen;
int elen;
int n_flags = 0;
- const char *allopts = "heEfuUgGoOaAmMcCdDtTsSnNRw:r:vx:";
+ const char *allopts = "heEfuUgGoOaAmMcCdDtTsSzZnNRw:r:vx:";
out_fp = stdout;
while ((c = getopt(argc, argv, allopts)) != EOF) {
@@ -767,6 +770,8 @@ main(int argc, char *argv[])
case 'E':
case 's':
case 'S':
+ case 'z':
+ case 'Z':
++n_flags;
parse_flag(c);
break;
--
2.20.1
next prev parent reply other threads:[~2020-06-21 23:16 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-21 23:14 [PATCH v2 0/7] Change fssum to support POSIX Arvind Raghavan
2020-06-21 23:15 ` [PATCH v2 1/7] src/fssum: Make sum_file_data global Arvind Raghavan
2020-06-21 23:15 ` [PATCH v2 2/7] src/fssum: Refactoring changes for recursive traversal Arvind Raghavan
2020-06-22 6:47 ` Amir Goldstein
2020-06-21 23:16 ` [PATCH v2 3/7] src/fssum: Recursive traversal refactoring Arvind Raghavan
2020-06-22 7:42 ` Amir Goldstein
2020-06-21 23:16 ` [PATCH v2 4/7] src/fssum: Add flag -R for non-recursive mode Arvind Raghavan
2020-06-21 23:16 ` Arvind Raghavan [this message]
2020-06-21 23:16 ` [PATCH v2 6/7] src/fssum: Allow single file input Arvind Raghavan
2020-06-22 6:56 ` Amir Goldstein
2020-06-21 23:17 ` [PATCH v2 7/7] src/fssum: Fix whitespace in usage Arvind Raghavan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=da0cea4f8106cf67525045d04f0435d945ecf989.1592779555.git.raghavan.arvind@gmail.com \
--to=raghavan.arvind@gmail.com \
--cc=amir73il@gmail.com \
--cc=fstests@vger.kernel.org \
--cc=jaya@cs.utexas.edu \
--cc=vijay@cs.utexas.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).