diff --git a/src/util-file.c b/src/util-file.c index 7c613fc04c..ce291feb68 100644 --- a/src/util-file.c +++ b/src/util-file.c @@ -387,12 +387,44 @@ static int FilePruneFile(File *file) SCReturnInt(0); } +#ifdef DEBUG +#define P(file, flag) ((file)->flags & (flag)) ? "true" : "false" +void FilePrintFlags(const File *file) +{ + SCLogDebug("file %p flags %04x " + "FILE_TRUNCATED %s " + "FILE_NOMAGIC %s " + "FILE_NOMD5 %s " + "FILE_MD5 %s " + "FILE_NOSHA1 %s " + "FILE_SHA1 %s " + "FILE_NOSHA256 %s " + "FILE_SHA256 %s " + "FILE_LOGGED %s " + "FILE_NOSTORE %s " + "FILE_STORE %s " + "FILE_STORED %s " + "FILE_NOTRACK %s " + "FILE_USE_DETECT %s " + "FILE_HAS_GAPS %s", + file, file->flags, P(file, FILE_TRUNCATED), P(file, FILE_NOMAGIC), P(file, FILE_NOMD5), + P(file, FILE_MD5), P(file, FILE_NOSHA1), P(file, FILE_SHA1), P(file, FILE_NOSHA256), + P(file, FILE_SHA256), P(file, FILE_LOGGED), P(file, FILE_NOSTORE), P(file, FILE_STORE), + P(file, FILE_STORED), P(file, FILE_NOTRACK), P(file, FILE_USE_DETECT), + P(file, FILE_HAS_GAPS)); +} +#undef P +#endif + void FilePrune(FileContainer *ffc) { File *file = ffc->head; File *prev = NULL; while (file) { +#ifdef DEBUG + FilePrintFlags(file); +#endif if (FilePruneFile(file) == 0) { prev = file; file = file->next; diff --git a/src/util-file.h b/src/util-file.h index 7d81f6d873..b633030690 100644 --- a/src/util-file.h +++ b/src/util-file.h @@ -253,4 +253,10 @@ uint64_t FileTrackedSize(const File *file); uint16_t FileFlowToFlags(const Flow *flow, uint8_t direction); +#ifdef DEBUG +void FilePrintFlags(const File *file); +#else +#define FilePrintFlags(file) +#endif + #endif /* __UTIL_FILE_H__ */