From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13257 invoked by alias); 27 Jan 2009 12:15:10 -0000 Received: (qmail 13250 invoked by alias); 27 Jan 2009 12:15:10 -0000 X-SWARE-Spam-Status: No, hits=-1.2 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_35,KAM_MX,SPF_HELO_PASS X-Spam-Status: No, hits=-1.2 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_35,KAM_MX,SPF_HELO_PASS X-Spam-Check-By: sourceware.org X-Spam-Checker-Version: SpamAssassin 3.2.4 (2008-01-01) on bastion.fedora.phx.redhat.com Subject: gfs2-utils: master - libgfs2: Move prog_name out of the library To: cluster-cvs-relay@redhat.com X-Project: Cluster Project X-Git-Module: gfs2-utils.git X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: c6be237624909f776bc8881498b9c145754d4ce0 X-Git-Newrev: a37669e733de6bf412fd3bb549b300e9032689d6 From: Steven Whitehouse Message-Id: <20090127121447.24F9DC024D@lists.fedorahosted.org> Date: Tue, 27 Jan 2009 12:15:00 -0000 X-Scanned-By: MIMEDefang 2.58 on 172.16.52.254 Mailing-List: contact cluster-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: cluster-cvs-owner@sourceware.org X-SW-Source: 2009-q1/txt/msg00291.txt.bz2 Gitweb: http://git.fedorahosted.org/git/gfs2-utils.git?p=gfs2-utils.git;a=commitdiff;h=a37669e733de6bf412fd3bb549b300e9032689d6 Commit: a37669e733de6bf412fd3bb549b300e9032689d6 Parent: c6be237624909f776bc8881498b9c145754d4ce0 Author: Steven Whitehouse AuthorDate: Tue Jan 27 11:12:41 2009 +0000 Committer: Steven Whitehouse CommitterDate: Tue Jan 27 11:12:41 2009 +0000 libgfs2: Move prog_name out of the library This has no business being in the library, it was only used by die() which is deprecated, so at the expense of being a little less detailed in the error reports (well I'm guessing people know what tool they are using, so it shouldn't be a big deal) we can move it into the utils themselves. Signed-off-by: Steven Whitehouse --- gfs2/libgfs2/libgfs2.h | 34 +++++++++++++++++++--------------- gfs2/mkfs/gfs2_mkfs.h | 1 + 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h index e681608..c627f19 100644 --- a/gfs2/libgfs2/libgfs2.h +++ b/gfs2/libgfs2/libgfs2.h @@ -69,37 +69,41 @@ __BEGIN_DECLS #endif /* __BYTE_ORDER == __LITTLE_ENDIAN */ -extern char *prog_name; - static __inline__ __attribute__((noreturn)) void die(const char *fmt, ...) { va_list ap; - fprintf(stderr, "%s: ", prog_name); + fprintf(stderr, "%s: ", __FILE__); va_start(ap, fmt); vfprintf(stderr, fmt, ap); va_end(ap); exit(-1); } -static __inline__ __attribute__((deprecated)) void do_lseek(int fd, off_t off) +extern __inline__ __attribute__((deprecated)) void do_lseek(int fd, off_t off) { - if (lseek(fd, off, SEEK_SET) != off) - die("bad seek: %s on line %d of file %s\n", - strerror(errno),__LINE__, __FILE__); + if (lseek(fd, off, SEEK_SET) != off) { + fprintf(stderr, "bad seek: %s on line %d of file %s\n", + strerror(errno),__LINE__, __FILE__); + exit(-1); + } } -static __inline__ __attribute__((deprecated)) void do_read(int fd, void *buf, size_t len) +extern __inline__ __attribute__((deprecated)) void do_read(int fd, void *buf, size_t len) { - if (read(fd, buf, len) < 0) - die("bad read: %s on line %d of file %s\n", - strerror(errno), __LINE__, __FILE__); + if (read(fd, buf, len) < 0) { + fprintf(stderr, "bad read: %s on line %d of file %s\n", + strerror(errno), __LINE__, __FILE__); + exit(-1); + } } -static __inline__ __attribute__((deprecated)) void do_write(int fd, const void *buf, size_t len) +extern __inline__ __attribute__((deprecated)) void do_write(int fd, const void *buf, size_t len) { - if (write(fd, buf, len) != len) - die("bad write: %s on line %d of file %s\n", - strerror(errno), __LINE__, __FILE__); + if (write(fd, buf, len) != len) { + fprintf(stderr, "bad write: %s on line %d of file %s\n", + strerror(errno), __LINE__, __FILE__); + exit(-1); + } } #define DIV_RU(x, y) (((x) + (y) - 1) / (y)) diff --git a/gfs2/mkfs/gfs2_mkfs.h b/gfs2/mkfs/gfs2_mkfs.h index 493fa54..a058b79 100644 --- a/gfs2/mkfs/gfs2_mkfs.h +++ b/gfs2/mkfs/gfs2_mkfs.h @@ -64,5 +64,6 @@ void main_shrink(int argc, char *argv[]); #define FS_FL_USER_VISIBLE 0x0003DFFF /* User visible flags */ #define FS_FL_USER_MODIFIABLE 0x000380FF /* User modifiable flags */ +extern char *prog_name; #endif /* __GFS2_MKFS_DOT_H__ */