public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
From: Steven Whitehouse <swhiteho@fedoraproject.org>
To: cluster-cvs-relay@redhat.com
Subject: gfs2-utils: master - libgfs2: Move prog_name out of the library
Date: Tue, 27 Jan 2009 12:15:00 -0000	[thread overview]
Message-ID: <20090127121447.24F9DC024D@lists.fedorahosted.org> (raw)

Gitweb:        http://git.fedorahosted.org/git/gfs2-utils.git?p=gfs2-utils.git;a=commitdiff;h=a37669e733de6bf412fd3bb549b300e9032689d6
Commit:        a37669e733de6bf412fd3bb549b300e9032689d6
Parent:        c6be237624909f776bc8881498b9c145754d4ce0
Author:        Steven Whitehouse <swhiteho@redhat.com>
AuthorDate:    Tue Jan 27 11:12:41 2009 +0000
Committer:     Steven Whitehouse <swhiteho@redhat.com>
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 <swhiteho@redhat.com>
---
 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__ */


                 reply	other threads:[~2009-01-27 12:15 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090127121447.24F9DC024D@lists.fedorahosted.org \
    --to=swhiteho@fedoraproject.org \
    --cc=cluster-cvs-relay@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).