FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Cluster Development

 
 
LinkBack Thread Tools
 
Old 12-14-2011, 03:20 PM
Andrew Price
 
Default libgfs2: Push down die() into the utils and remove it

This patch removes the definition of die() from libgfs2.h and pushes it
down into the utils which still require it. In the case of gfs2_convert,
which only had a few die() calls, it was dropped altogether.

Signed-off-by: Andrew Price <anprice@redhat.com>
---
gfs2/convert/gfs2_convert.c | 18 ++++++++++++------
gfs2/edit/hexedit.h | 12 ++++++++++++
gfs2/fsck/util.c | 1 +
gfs2/libgfs2/libgfs2.h | 12 ------------
gfs2/mkfs/gfs2_mkfs.h | 13 +++++++++++++
gfs2/quota/gfs2_quota.h | 13 +++++++++++++
gfs2/tool/gfs2_tool.h | 13 +++++++++++++
7 files changed, 64 insertions(+), 18 deletions(-)

diff --git a/gfs2/convert/gfs2_convert.c b/gfs2/convert/gfs2_convert.c
index 09a689c..ff5f50f 100644
--- a/gfs2/convert/gfs2_convert.c
+++ b/gfs2/convert/gfs2_convert.c
@@ -1847,8 +1847,10 @@ static void update_inode_file(struct gfs2_sbd *sdp)

buf = cpu_to_be64(sdp->md.next_inum);
count = gfs2_writei(ip, &buf, 0, sizeof(uint64_t));
- if (count != sizeof(uint64_t))
- die("update_inode_file
");
+ if (count != sizeof(uint64_t)) {
+ fprintf(stderr, "update_inode_file
");
+ exit(1);
+ }

log_debug(_("
Next Inum: %llu
"), (unsigned long long)sdp->md.next_inum);
}/* update_inode_file */
@@ -1869,8 +1871,10 @@ static void write_statfs_file(struct gfs2_sbd *sdp)

gfs2_statfs_change_out(&sc, buf);
count = gfs2_writei(ip, buf, 0, sizeof(struct gfs2_statfs_change));
- if (count != sizeof(struct gfs2_statfs_change))
- die("do_init (2)
");
+ if (count != sizeof(struct gfs2_statfs_change)) {
+ fprintf(stderr, "do_init (2)
");
+ exit(1);
+ }
}/* write_statfs_file */

/* ------------------------------------------------------------------------- */
@@ -2043,8 +2047,10 @@ static void copy_quotas(struct gfs2_sbd *sdp)
int err;

err = gfs2_lookupi(sdp->master_dir, "quota", 5, &nq_ip);
- if (err)
- die(_("Couldn't lookup new quota file: %d
"), err);
+ if (err) {
+ fprintf(stderr, _("Couldn't lookup new quota file: %d
"), err);
+ exit(1);
+ }

gfs2_inum_in(&inum, (char *)&raw_gfs1_ondisk_sb.sb_quota_di);
oq_ip = inode_read(sdp, inum.no_addr);
diff --git a/gfs2/edit/hexedit.h b/gfs2/edit/hexedit.h
index 27950b0..b05b5c0 100644
--- a/gfs2/edit/hexedit.h
+++ b/gfs2/edit/hexedit.h
@@ -124,6 +124,18 @@ static inline int block_is_rgtree(void)
#define SCREEN_HEIGHT (16)
#define SCREEN_WIDTH (16)

+/* die() used to be in libgfs2.h */
+static __inline__ __attribute__((noreturn, format (printf, 1, 2)))
+void die(const char *fmt, ...)
+{
+ va_list ap;
+ fprintf(stderr, "%s: ", __FILE__);
+ va_start(ap, fmt);
+ vfprintf(stderr, fmt, ap);
+ va_end(ap);
+ exit(-1);
+}
+
/* Memory macros */

#define type_alloc(ptr, type, count)
diff --git a/gfs2/fsck/util.c b/gfs2/fsck/util.c
index d912920..f37fe7d 100644
--- a/gfs2/fsck/util.c
+++ b/gfs2/fsck/util.c
@@ -6,6 +6,7 @@
#include <unistd.h>
#include <sys/time.h>
#include <stdio.h>
+#include <stdarg.h>
#include <termios.h>
#include <libintl.h>
#include <ctype.h>
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index c356bbf..0e521fb 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -3,7 +3,6 @@

#include <features.h>
#include <inttypes.h>
-#include <stdarg.h>
#include <stdio.h>
#include <errno.h>
#include <sys/types.h>
@@ -86,17 +85,6 @@ struct lgfs2_dev_info {
uint64_t size;
};

-static __inline__ __attribute__((noreturn, format (printf, 1, 2)))
-void die(const char *fmt, ...)
-{
- va_list ap;
- fprintf(stderr, "%s: ", __FILE__);
- va_start(ap, fmt);
- vfprintf(stderr, fmt, ap);
- va_end(ap);
- exit(-1);
-}
-
struct device {
uint64_t length;
};
diff --git a/gfs2/mkfs/gfs2_mkfs.h b/gfs2/mkfs/gfs2_mkfs.h
index 6f0ac2b..d7d7da7 100644
--- a/gfs2/mkfs/gfs2_mkfs.h
+++ b/gfs2/mkfs/gfs2_mkfs.h
@@ -1,6 +1,7 @@
#ifndef __GFS2_MKFS_DOT_H__
#define __GFS2_MKFS_DOT_H__

+#include <stdarg.h>
#include <linux/gfs2_ondisk.h>
#include "osi_list.h"
#include "copyright.cf"
@@ -18,6 +19,18 @@ extern void main_mkfs(int argc, char *argv[]);
/* main_shrink */
extern void main_shrink(int argc, char *argv[]);

+/* die() used to be in libgfs2.h */
+static __inline__ __attribute__((noreturn, format (printf, 1, 2)))
+void die(const char *fmt, ...)
+{
+ va_list ap;
+ fprintf(stderr, "%s: ", __FILE__);
+ va_start(ap, fmt);
+ vfprintf(stderr, fmt, ap);
+ va_end(ap);
+ exit(-1);
+}
+
/*
* The following inode IOCTL macros and inode flags
* are copied from linux/fs.h, because we have duplicate
diff --git a/gfs2/quota/gfs2_quota.h b/gfs2/quota/gfs2_quota.h
index 80c0d3f..744f02b 100644
--- a/gfs2/quota/gfs2_quota.h
+++ b/gfs2/quota/gfs2_quota.h
@@ -1,6 +1,7 @@
#ifndef __GFS2_QUOTA_DOT_H__
#define __GFS2_QUOTA_DOT_H__

+#include <stdarg.h>
#include "libgfs2.h"
#include <linux/gfs2_ondisk.h>

@@ -79,4 +80,16 @@ void do_quota_init(struct gfs2_sbd *sdp, commandline_t *comline);
uint32_t name_to_id(int user, char *name, int numbers);
char *id_to_name(int user, uint32_t id, int numbers);

+/* die() used to be in libgfs2.h */
+static __inline__ __attribute__((noreturn, format (printf, 1, 2)))
+void die(const char *fmt, ...)
+{
+ va_list ap;
+ fprintf(stderr, "%s: ", __FILE__);
+ va_start(ap, fmt);
+ vfprintf(stderr, fmt, ap);
+ va_end(ap);
+ exit(-1);
+}
+
#endif /* __GFS2_QUOTA_DOT_H__ */
diff --git a/gfs2/tool/gfs2_tool.h b/gfs2/tool/gfs2_tool.h
index 884856f..3a181ff 100644
--- a/gfs2/tool/gfs2_tool.h
+++ b/gfs2/tool/gfs2_tool.h
@@ -1,6 +1,7 @@
#ifndef __GFS2_TOOL_DOT_H__
#define __GFS2_TOOL_DOT_H__

+#include <stdarg.h>

#define OUTPUT_BLOCKS 0
#define OUTPUT_K 1
@@ -48,4 +49,16 @@ void do_sb(int argc, char **argv);
void get_tune(int argc, char **argv);
void set_tune(int argc, char **argv);

+/* die() used to be in libgfs2.h */
+static __inline__ __attribute__((noreturn, format (printf, 1, 2)))
+void die(const char *fmt, ...)
+{
+ va_list ap;
+ fprintf(stderr, "%s: ", __FILE__);
+ va_start(ap, fmt);
+ vfprintf(stderr, fmt, ap);
+ va_end(ap);
+ exit(-1);
+}
+
#endif /* __GFS2_TOOL_DOT_H__ */
--
1.7.6.4
 

Thread Tools




All times are GMT. The time now is 03:28 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org