btrfs-progs: Introduce warning and error for common use
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v3 Latest2 patches 2 repliesIn review
- v2 posting 2/22 patches 2 repliesSuperseded
- v2 posting 1/24 patches 2 repliesSuperseded
Earlier versions · 1
| Version | Posted | Patches | Replies | Status |
|---|---|---|---|---|
| v1 | 4 patches | 2 replies | Superseded |
Changes in v3 from the cover letter
1: Put variable definition to top of function 2: Move __veprintf() to warning()/error()'s internal All suggested-by: David Sterba <[email protected]>
Patches in v3 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | btrfs-progs: Introduce warning and error for common useutils.h | +51 | 1 reply | |
| 2/2 | btrfs-progs: use common warning/error for cmds-scrub.ccmds-scrub.c | +87 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.
Cover letter [PATCH v3 0/2] btrfs-progs: Introduce warning and error for common use
Current code use fprintf(stderr, "...") to output warnning and error information.
The error message have different style, as:
# grep fprintf *.c fprintf(stderr, "Open ctree failed\n"); fprintf(stderr, "%s: open ctree failed\n", __func__); fprintf(stderr, "ERROR: cannot open ctree\n"); ...
And sometimes, we forgot add tailed '\n', or use printf instead, as in current code:
printf("warning, device %llu is missing\n",
This patch introduce warning() and error() as common function, to make:
1: Each warning and error information have same format
2: Easy to search/change all error message
3: Easy to modify function's internal for debug or other requirement,
for example:
print function/linenumber in error()
dumpstack in error()
add some trace for some style of message
add support for -v, -vv, ...
support for locales
custom output functions
support some special device/tty
Converting all source is a big work, this patch convert cmds-scrub.c We'll convert others these days, and new code can use these function directly.
Changelog v2->v3:
1: Put variable definition to top of function 2: Move __veprintf() to warning()/error()'s internal All suggested-by: David Sterba <[email protected]>
Changelog v1->v2:
1: Rename following functions:
warningon() -> warning_on()
erroron() -> error_on()
Suggested-by: David Sterba <[email protected]>2: Use static inline instead of macro
3: Add return value of warning/error_on()
Zhao Lei (2):
btrfs-progs: Introduce warning and error for common use
btrfs-progs: use common warning/error for cmds-scrub.c
cmds-scrub.c | 176 +++++++++++++++++++++++++++++------------------------------ utils.h | 51 +++++++++++++++++ 2 files changed, 138 insertions(+), 89 deletions(-)
Signature · 1 line
1.8.5.1