From f3a780037428a7dea4d389169fc4385309fc52f2 Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Thu, 30 Nov 2023 16:11:50 -0700 Subject: [PATCH] move printits to gufi_treesummary --- include/utils.h | 2 -- src/gufi_treesummary.c | 42 ++++++++++++++++++++++++++++++++++++++++++ src/utils.c | 42 ------------------------------------------ 3 files changed, 42 insertions(+), 44 deletions(-) diff --git a/include/utils.h b/include/utils.h index d63d4a839..6ea1eea99 100644 --- a/include/utils.h +++ b/include/utils.h @@ -88,8 +88,6 @@ int SNPRINTF(char *str, size_t size, const char *format, ...); to size_t or weird bugs may occur */ size_t SNFORMAT_S(char *dst, const size_t dst_len, size_t count, ...); -int printits(struct input *in, struct work *pwork, struct entry_data *data, FILE *out); - int zeroit(struct sum *summary); int sumit(struct sum *summary, struct entry_data *data); diff --git a/src/gufi_treesummary.c b/src/gufi_treesummary.c index e4f152141..c8983a9b6 100644 --- a/src/gufi_treesummary.c +++ b/src/gufi_treesummary.c @@ -77,6 +77,48 @@ OF SUCH DAMAGE. #include "dbutils.h" #include "QueuePerThreadPool.h" +static int printits(struct input *in, struct work *pwork, struct entry_data *ed, FILE *out) { + fprintf(out, "%s%c", pwork->name, in->delim); + fprintf(out, "%c%c", ed->type, in->delim); + fprintf(out, "%"STAT_ino "%c", ed->statuso.st_ino, in->delim); + fprintf(out, "%"STAT_mode "%c", ed->statuso.st_mode, in->delim); + fprintf(out, "%"STAT_nlink "%c", ed->statuso.st_nlink, in->delim); + fprintf(out, "%"STAT_uid "%c", ed->statuso.st_uid, in->delim); + fprintf(out, "%"STAT_gid "%c", ed->statuso.st_gid, in->delim); + fprintf(out, "%"STAT_size "%c", ed->statuso.st_size, in->delim); + fprintf(out, "%"STAT_bsize "%c", ed->statuso.st_blksize, in->delim); + fprintf(out, "%"STAT_blocks"%c", ed->statuso.st_blocks, in->delim); + fprintf(out, "%ld%c", ed->statuso.st_atime, in->delim); + fprintf(out, "%ld%c", ed->statuso.st_mtime, in->delim); + fprintf(out, "%ld%c", ed->statuso.st_ctime, in->delim); + +/* we need this field even if its not populated for gufi_trace2index */ +/* + if (!strncmp(pwork->type,"l",1)) { + fprintf(out, "%s%c", ed->linkname,in->delim); + } +*/ + fprintf(out, "%s%c", ed->linkname,in->delim); + +/* we need this field even if its not populated for gufi_trace2index */ +/* + if (ed->xattrs > 0) { + //printf("xattr: "); + fprintf(out,"%s%c",ed->xattr,in->delim); + } +*/ + /* fwrite(ed->xattrs, sizeof(char), ed->xattrs_len, out); */ + fprintf(out,"%c",in->delim); + + /* this one is for create time which posix doesnt have */ + fprintf(out,"%c", in->delim); + /* moved this to end because we would like to use this for input to gufi_trace2index load from file */ + fprintf(out, "%lld%c", pwork->pinode, in->delim); + fprintf(out, "%d%c", ed->suspect, in->delim); + fprintf(out,"\n"); + return 0; +} + struct PoolArgs { struct input in; trie_t *skip; /* paths to skip during descent (only . and ..) */ diff --git a/src/utils.c b/src/utils.c index 51dd5417d..a3764be7a 100644 --- a/src/utils.c +++ b/src/utils.c @@ -74,48 +74,6 @@ OF SUCH DAMAGE. #include "utils.h" -int printits(struct input *in, struct work *pwork, struct entry_data *ed, FILE *out) { - fprintf(out, "%s%c", pwork->name, in->delim); - fprintf(out, "%c%c", ed->type, in->delim); - fprintf(out, "%"STAT_ino"%c", ed->statuso.st_ino, in->delim); - fprintf(out, "%d%c", ed->statuso.st_mode, in->delim); - fprintf(out, "%"STAT_nlink"%c", ed->statuso.st_nlink, in->delim); - fprintf(out, "%d%c", ed->statuso.st_uid, in->delim); - fprintf(out, "%d%c", ed->statuso.st_gid, in->delim); - fprintf(out, "%"STAT_size"%c", ed->statuso.st_size, in->delim); - fprintf(out, "%"STAT_bsize"%c", ed->statuso.st_blksize, in->delim); - fprintf(out, "%"STAT_blocks"%c", ed->statuso.st_blocks, in->delim); - fprintf(out, "%ld%c", ed->statuso.st_atime, in->delim); - fprintf(out, "%ld%c", ed->statuso.st_mtime, in->delim); - fprintf(out, "%ld%c", ed->statuso.st_ctime, in->delim); - -/* we need this field even if its not populated for gufi_trace2index */ -/* - if (!strncmp(pwork->type,"l",1)) { - fprintf(out, "%s%c", ed->linkname,in->delim); - } -*/ - fprintf(out, "%s%c", ed->linkname,in->delim); - -/* we need this field even if its not populated for gufi_trace2index */ -/* - if (ed->xattrs > 0) { - //printf("xattr: "); - fprintf(out,"%s%c",ed->xattr,in->delim); - } -*/ - /* fwrite(ed->xattrs, sizeof(char), ed->xattrs_len, out); */ - fprintf(out,"%c",in->delim); - - /* this one is for create time which posix doesnt have */ - fprintf(out,"%c", in->delim); - /* moved this to end because we would like to use this for input to gufi_trace2index load from file */ - fprintf(out, "%lld%c", pwork->pinode, in->delim); - fprintf(out, "%d%c", ed->suspect, in->delim); - fprintf(out,"\n"); - return 0; -} - int zeroit(struct sum *summary) { summary->totfiles=0;