Skip to content

Commit

Permalink
move printits to gufi_treesummary
Browse files Browse the repository at this point in the history
  • Loading branch information
calccrypto committed Nov 30, 2023
1 parent 160beba commit f3a7800
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 44 deletions.
2 changes: 0 additions & 2 deletions include/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
42 changes: 42 additions & 0 deletions src/gufi_treesummary.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 ..) */
Expand Down
42 changes: 0 additions & 42 deletions src/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit f3a7800

Please sign in to comment.