This is the mail archive of the cluster-cvs@sourceware.org mailing list for the cluster.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

gfs2-utils: master - libgfs2: Move prog_name out of the library


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__ */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]