public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
* cluster: STABLE3 - libgfs2: Change some macros into inline functions
@ 2009-02-19 10:09 Fabio M. Di Nitto
0 siblings, 0 replies; only message in thread
From: Fabio M. Di Nitto @ 2009-02-19 10:09 UTC (permalink / raw)
To: cluster-cvs-relay
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=cde167241333b285a48f9de1a46098a8bf902718
Commit: cde167241333b285a48f9de1a46098a8bf902718
Parent: 1edc94f4e876c18ff819fd17d47bc2407867aee2
Author: Steven Whitehouse <swhiteho@redhat.com>
AuthorDate: Mon Jan 26 08:29:32 2009 +0000
Committer: Fabio M. Di Nitto <fdinitto@redhat.com>
CommitterDate: Thu Feb 19 10:59:53 2009 +0100
libgfs2: Change some macros into inline functions
Also I've marked them deprecated. They can be removed when
all references to them have gone. I didn't mark die() yet
as there are far too many refs to it, and it generates huge
numbers of warnings, but its on my list for getting rid of.
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
---
gfs2/libgfs2/libgfs2.h | 54 ++++++++++++++++++++++++++++-------------------
1 files changed, 32 insertions(+), 22 deletions(-)
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index c67924a..c54501c 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -3,6 +3,12 @@
#include <features.h>
#include <inttypes.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <errno.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
#include <sys/types.h>
#include <linux/types.h>
#include <linux/limits.h>
@@ -23,32 +29,37 @@ __BEGIN_DECLS
#define FALSE (0)
#endif
-#define die(fmt, args...) \
-do { \
- fprintf(stderr, "%s: ", prog_name); \
- fprintf(stderr, fmt, ##args); \
- exit(EXIT_FAILURE); \
-} while (0)
+extern char *prog_name;
-#define do_lseek(fd, off) \
-{ \
- if (lseek((fd), (off), SEEK_SET) != (off)) \
- die("bad seek: %s on line %d of file %s\n", \
- strerror(errno),__LINE__, __FILE__); \
+static __inline__ __attribute__((noreturn)) void die(const char *fmt, ...)
+{
+ va_list ap;
+ fprintf(stderr, "%s: ", prog_name);
+ va_start(ap, fmt);
+ vfprintf(stderr, fmt, ap);
+ va_end(ap);
+ exit(-1);
}
-#define do_read(fd, buff, len) \
-{ \
- if (read((fd), (buff), (len)) < 0) \
- die("bad read: %s on line %d of file %s\n", \
- strerror(errno), __LINE__, __FILE__); \
+static __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__);
}
-#define do_write(fd, buff, len) \
-{ \
- if (write((fd), (buff), (len)) != (len)) \
- die("bad write: %s on line %d of file %s\n", \
- strerror(errno), __LINE__, __FILE__); \
+static __inline__ __attribute__((deprecated)) void do_read(int fd, char *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__);
+}
+
+static __inline__ __attribute__((deprecated)) void do_write(int fd, const char *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__);
}
#define zalloc(ptr, size) \
@@ -247,7 +258,6 @@ struct metapath {
unsigned int mp_list[GFS2_MAX_META_HEIGHT];
};
-extern char *prog_name;
#define GFS2_DEFAULT_BSIZE (4096)
#define GFS2_DEFAULT_JSIZE (128)
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2009-02-19 10:09 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-19 10:09 cluster: STABLE3 - libgfs2: Change some macros into inline functions Fabio M. Di Nitto
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).