Skip to content
Snippets Groups Projects
Commit f83ed07f authored by Yorhel's avatar Yorhel
Browse files

Don't include "notreg" field for excluded/error'd files in export

+ some comment fixes.
parent 968471f6
No related branches found
No related tags found
No related merge requests found
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
static FILE *stream; static FILE *stream;
/* Stack of device IDs, also used to determine the */ /* Stack of device IDs, also used to keep track of the level of nesting */
struct stack { struct stack {
uint64_t *list; uint64_t *list;
int size, top; int size, top;
...@@ -77,6 +77,7 @@ static void output_info(struct dir *d) { ...@@ -77,6 +77,7 @@ static void output_info(struct dir *d) {
fputs("{\"name\":\"", stream); fputs("{\"name\":\"", stream);
output_string(d->name); output_string(d->name);
fputc('"', stream); fputc('"', stream);
/* No need for asize/dsize if they're 0 (which happens with excluded or failed-to-stat files) */ /* No need for asize/dsize if they're 0 (which happens with excluded or failed-to-stat files) */
if(d->asize) { if(d->asize) {
fputs(",\"asize\":", stream); fputs(",\"asize\":", stream);
...@@ -86,22 +87,27 @@ static void output_info(struct dir *d) { ...@@ -86,22 +87,27 @@ static void output_info(struct dir *d) {
fputs(",\"dsize\":", stream); fputs(",\"dsize\":", stream);
output_int((uint64_t)d->size); output_int((uint64_t)d->size);
} }
if(d->dev != nstack_top(&stack, 0)) { if(d->dev != nstack_top(&stack, 0)) {
fputs(",\"dev\":", stream); fputs(",\"dev\":", stream);
output_int(d->dev); output_int(d->dev);
} }
fputs(",\"ino\":", stream); fputs(",\"ino\":", stream);
output_int(d->ino); output_int(d->ino);
if(d->flags & FF_HLNKC) /* TODO: Including the actual number of links would be nicer. */
/* TODO: Including the actual number of links would be nicer. */
if(d->flags & FF_HLNKC)
fputs(",\"hlnkc\":true", stream); fputs(",\"hlnkc\":true", stream);
if(d->flags & FF_ERR) if(d->flags & FF_ERR)
fputs(",\"read_error\":true", stream); fputs(",\"read_error\":true", stream);
if(!(d->flags & (FF_DIR|FF_FILE))) /* excluded/error'd files are "unknown" with respect to the "notreg" field. */
if(!(d->flags & (FF_DIR|FF_FILE|FF_ERR|FF_EXL|FF_OTHFS)))
fputs(",\"notreg\":true", stream); fputs(",\"notreg\":true", stream);
if(d->flags & FF_EXL) if(d->flags & FF_EXL)
fputs(",\"excluded\":\"pattern\"", stream); fputs(",\"excluded\":\"pattern\"", stream);
else if(d->flags & FF_OTHFS) else if(d->flags & FF_OTHFS)
fputs(",\"excluded\":\"othfs\"", stream); fputs(",\"excluded\":\"othfs\"", stream);
fputc('}', stream); fputc('}', stream);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment