btrfs-progs: Eliminate remaining uses of strerror(errno)
PATCH 1/1 btrfs-progs: Eliminate remaining uses of strerror(errno)
%m allows a smaller filesize. Useful on embedded systems.
Signed-off-by Rosen Penev <[email protected]>
--- build/Documentation/Makefile | 142 +++++ build/Makefile.inc | 42 ++ build/config.h | 139 +++++ build/config.log | 822 ++++++++++++++++++++++++++ build/config.status | 1059 ++++++++++++++++++++++++++++++++++ build/version.h | 14 + cmds-qgroup.c | 3 +- messages.h | 4 +- mkfs/rootdir.c | 47 +- qgroup.c | 3 +- 10 files changed, 2243 insertions(+), 32 deletions(-) create mode 100644 build/Documentation/Makefile create mode 100644 build/Makefile.inc create mode 100644 build/config.h create mode 100644 build/config.log create mode 100755 build/config.status create mode 100644 build/version.h
build/Documentation/Makefile new file +142 -0
@@ -0,0 +1,142 @@ +# Guard against environment variables +MAN8_TXT = + +# Top level commands +MAN8_TXT += btrfs.asciidoc +MAN8_TXT += btrfs-convert.asciidoc +MAN8_TXT += btrfs-find-root.asciidoc +MAN8_TXT += btrfs-image.asciidoc +MAN8_TXT += btrfs-map-logical.asciidoc +MAN8_TXT += btrfs-select-super.asciidoc +MAN8_TXT += btrfstune.asciidoc +MAN8_TXT += fsck.btrfs.asciidoc +MAN8_TXT += mkfs.btrfs.asciidoc + +# Sub commands for btrfs +MAN8_TXT += btrfs-subvolume.asciidoc +MAN8_TXT += btrfs-filesystem.asciidoc +MAN8_TXT += btrfs-balance.asciidoc +MAN8_TXT += btrfs-device.asciidoc +MAN8_TXT += btrfs-scrub.asciidoc +MAN8_TXT += btrfs-check.asciidoc +MAN8_TXT += btrfs-rescue.asciidoc +MAN8_TXT += btrfs-inspect-internal.asciidoc +MAN8_TXT += btrfs-send.asciidoc +MAN8_TXT += btrfs-receive.asciidoc +MAN8_TXT += btrfs-quota.asciidoc +MAN8_TXT += btrfs-qgroup.asciidoc +MAN8_TXT += btrfs-replace.asciidoc +MAN8_TXT += btrfs-restore.asciidoc +MAN8_TXT += btrfs-property.asciidoc + +# Category 5 manual page +MAN5_TXT += btrfs-man5.asciidoc + +MAN3_TXT += btrfs-ioctl.asciidoc + +MAN_TXT = $(MAN3_TXT) $(MAN8_TXT) $(MAN5_TXT) +MAN_XML = $(patsubst %.asciidoc,%.xml,$(MAN_TXT)) +MAN_HTML = $(patsubst %.asciidoc,%.html,$(MAN_TXT)) +GZ_MAN3 = $(patsubst %.asciidoc,%.3.gz,$(MAN3_TXT)) +GZ_MAN5 = $(patsubst %.asciidoc,%.5.gz,$(MAN5_TXT)) +GZ_MAN8 = $(patsubst %.asciidoc,%.8.gz,$(MAN8_TXT)) + +mandir ?= $(prefix)/share/man +man3dir = $(mandir)/man3 +man5dir = $(mandir)/man5 +man8dir = $(mandir)/man8 + +ifeq (none,asciidoc) +ASCIIDOC = +ASCIIDOC_ARGS = -abtrfs_version=$(BTRFS_VERSION) -f asciidoc.conf +ASCIIDOC_HTML = html +ASCIIDOC_DOCBOOK = docbook +ASCIIDOC_DEPS = asciidoc.conf +endif +ifeq (none,asciidoctor) +ASCIIDOC = +ASCIIDOC_ARGS = -abtrfs_version=$(BTRFS_VERSION) +ASCIIDOC_HTML = xhtml5 +ASCIIDOC_DOCBOOK = docbook45 +ASCIIDOC_DEPS = +endif + +MANPAGE_XSL = manpage-normal.xsl +XMLTO = +XMLTO_EXTRA = +XMLTO_EXTRA = -m manpage-bold-literal.xsl +GZIPCMD = +INSTALL = /usr/bin/install -c +RM = /usr/bin/rm +RMDIR = /usr/bin/rmdir +LN_S = ln -s +MV = +SED = +BTRFS_VERSION = $(shell $(SED) -n 's/.*PACKAGE_VERSION "\(.*\)"/\1/p'\ + ../config.h) + +ifneq ($(findstring $(MAKEFLAGS),s),s) +ifndef V + QUIET_RM = @ + QUIET_ASCIIDOC = @echo " [ASCII] $@"; + QUIET_XMLTO = @echo " [XMLTO] $@"; + QUIET_GZIP = @echo " [GZ] $@"; +endif +endif + +all: man +man: man3 man5 man8 +man3: $(GZ_MAN3) +man5: $(GZ_MAN5) +man8: $(GZ_MAN8) +html: $(MAN_HTML) + +install: install-man + +install-man: man + $(INSTALL) -d -m 755 $(DESTDIR)$(man5dir) + $(INSTALL) -d -m 755 $(DESTDIR)$(man8dir) + $(INSTALL) -m 644 $(GZ_MAN5) $(DESTDIR)$(man5dir) + # the source file name of btrfs.5 clashes with section 8 page, but we + # want to keep the code generic + $(MV) $(DESTDIR)$(man5dir)/btrfs-man5.5.gz $(DESTDIR)$(man5dir)/btrfs.5.gz + $(INSTALL) -m 644 $(GZ_MAN8) $(DESTDIR)$(man8dir) + $(LN_S) -f btrfs-check.8.gz $(DESTDIR)$(man8dir)/btrfsck.8.gz + +uninstall: + cd $(DESTDIR)$(man8dir); rm -f btrfs-check.8.gz $(GZ_MAN8) + $(RMDIR) -p --ignore-fail-on-non-empty $(DESTDIR)$(man8dir) + +clean: + $(QUIET_RM)$(RM) -f *.xml *.xml+ *.3 *.3.gz *.5 *.5.gz *.8 *.8.gz *.html + +%.3.gz : %.3 + $(QUIET_GZIP)$(GZIPCMD) -n -c $< > $@ + +%.5.gz : %.5 + $(QUIET_GZIP)$(GZIPCMD) -n -c $< > $@ + +%.8.gz : %.8 + $(QUIET_GZIP)$(GZIPCMD) -n -c $< > $@ + +%.3 : %.xml + $(QUIET_XMLTO)$(RM) -f $@ && \ + $(XMLTO) -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $< + +%.5 : %.xml + $(QUIET_XMLTO)$(RM) -f $@ && \ + $(XMLTO) -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $< + +%.8 : %.xml + $(QUIET_XMLTO)$(RM) -f $@ && \ + $(XMLTO) -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $< + +%.xml : %.asciidoc $(ASCIIDOC_DEPS) + $(QUIET_ASCIIDOC)$(RM) -f $@+ $@ && \ + $(ASCIIDOC) $(ASCIIDOC_ARGS) -b $(ASCIIDOC_DOCBOOK) -d manpage -o $@+ $< && \ + $(MV) $@+ $@ + +%.html : %.asciidoc $(ASCIIDOC_DEPS) + $(QUIET_ASCIIDOC)$(RM) -f $@+ $@ && \ + $(ASCIIDOC) $(ASCIIDOC_ARGS) -b $(ASCIIDOC_HTML) -d article -o $@+ $< && \ + $(MV) $@+ $@
build/Makefile.inc new file +42 -0
42 lines not on this page · raw message
build/config.h new file +139 -0
139 lines not on this page · raw message
build/config.log new file +822 -0
822 lines not on this page · raw message
build/config.status new file +1059 -0
1,059 lines not on this page · raw message
build/version.h new file +14 -0
@@ -0,0 +1,14 @@ +#ifndef __LIBBTRFS_VERSION_H__ +#define __LIBBTRFS_VERSION_H__ + +#define BTRFS_LIB_MAJOR 0 +#define BTRFS_LIB_MINOR 1 +#define BTRFS_LIB_PATCHLEVEL 2 + +#define BTRFS_LIB_VERSION ( BTRFS_LIB_MAJOR * 10000 + \ + BTRFS_LIB_MINOR * 100 + \ + BTRFS_LIB_PATCHLEVEL ) + +#define BTRFS_BUILD_VERSION "Btrfs v4.16.1" + +#endif
cmds-qgroup.c +1 -2
@@ -380,8 +380,7 @@ static int cmd_qgroup_show(int argc, char **argv)if (sync) { err =btrfs_util_sync_fd (fd);if (err) -warning ("sync ioctl failed on '%s': %s" , path, -strerror (errno)); +warning ("sync ioctl failed on '%s': %m" , path); }if (filter_flag) {
messages.h +2 -2
@@ -61,9 +61,9 @@PRINT_TRACE_ON_ERROR ; \PRINT_VERBOSE_ERROR ; \if (lib_str &&strcmp (errno_str, lib_str) !=0 ) \ -__btrfs_error ("%s: %s" , lib_str, errno_str); \ +__btrfs_error ("%s: %m" , lib_str); \else \ -__btrfs_error ("%s" , errno_str); \ +__btrfs_error ("%m" ); \DO_ABORT_ON_ERROR ; \ }while (0 )
mkfs/rootdir.c +21 -26
134 lines not on this page · raw message
qgroup.c +1 -2
@@ -1072,8 +1072,7 @@ static int __qgroups_search(int fd, struct qgroup_lookup *qgroup_lookup)error ("can't list qgroups: quotas not enabled" ); ret = -ENOTTY ; }else { -error ("can't list qgroups: %s" , -strerror (errno)); +error ("can't list qgroups: %m" ); ret = -errno; }
Signature · 1 line
2.17.1
Quoted 13 lines · Rosen Penev
%m allows a smaller filesize. Useful on embedded systems.
Signed-off-by Rosen Penev <[email protected]>--- build/Documentation/Makefile | 142 +++++ build/Makefile.inc | 42 ++ build/config.h | 139 +++++ build/config.log | 822 ++++++++++++++++++++++++++ build/config.status | 1059 ++++++++++++++++++++++++++++++++++ build/version.h | 14 + cmds-qgroup.c | 3 +- messages.h | 4 +- mkfs/rootdir.c | 47 +-
Quoted 8 lines
qgroup.c | 3 +- 10 files changed, 2243 insertions(+), 32 deletions(-) create mode 100644 build/Documentation/Makefile create mode 100644 build/Makefile.inc create mode 100644 build/config.h create mode 100644 build/config.log create mode 100755 build/config.status create mode 100644 build/version.h
You clearly need to resend with changes only to the *.[ch] files
Quoted 25 lines · Nikolay Borisov
Quoted 13 lines · Rosen Penev
%m allows a smaller filesize. Useful on embedded systems.
Signed-off-by Rosen Penev <[email protected]>--- build/Documentation/Makefile | 142 +++++ build/Makefile.inc | 42 ++ build/config.h | 139 +++++ build/config.log | 822 ++++++++++++++++++++++++++ build/config.status | 1059 ++++++++++++++++++++++++++++++++++ build/version.h | 14 + cmds-qgroup.c | 3 +- messages.h | 4 +- mkfs/rootdir.c | 47 +-Quoted 8 lines
qgroup.c | 3 +- 10 files changed, 2243 insertions(+), 32 deletions(-) create mode 100644 build/Documentation/Makefile create mode 100644 build/Makefile.inc create mode 100644 build/config.h create mode 100644 build/config.log create mode 100755 build/config.status create mode 100644 build/version.h
Quoted 1 line
You clearly need to resend with changes only to the *.[ch] files
No need to resend, the .[ch] changes look good, I'll drop the rest.