We missed to handle "LPF_BROADCAST" and "LPF_ORPHAN" when dump
the lfsck parameters and caused the output via /proc interface
incomplete and bad formatted.
Signed-off-by: Fan Yong <fan.yong@intel.com>
Change-Id: I462c79e80be5b384a291b30980a95698a8dd9d19
Reviewed-on: http://review.whamcloud.com/9690
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Lai Siyao <lai.siyao@intel.com>
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
"failout",
"dryrun",
"all_targets",
+ "broadcast",
+ "orphan",
NULL
};
int flag;
int rc;
int i;
+ bool newline = (bits != 0 ? false : true);
- rc = snprintf(*buf, *len, "%s:%c", prefix, bits != 0 ? ' ' : '\n');
+ rc = snprintf(*buf, *len, "%s:%c", prefix, newline ? '\n' : ' ');
if (rc <= 0)
return -ENOSPC;
if (flag & bits) {
bits &= ~flag;
if (names[i] != NULL) {
+ if (bits == 0)
+ newline = true;
+
rc = snprintf(*buf, *len, "%s%c", names[i],
- bits != 0 ? ',' : '\n');
+ newline ? '\n' : ',');
if (rc <= 0)
return -ENOSPC;
}
}
}
+
+ if (!newline) {
+ rc = snprintf(*buf, *len, "\n");
+ if (rc <= 0)
+ return -ENOSPC;
+
+ *buf += rc;
+ *len -= rc;
+ }
+
return save - *len;
}