cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: pcaulfield@sourceware.org <pcaulfield@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] cluster/cman/qdisk disk.c proc.c
Date: 11 Sep 2007 12:38:10 -0000	[thread overview]
Message-ID: <20070911123810.24306.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/cluster
Module name:	cluster
Changes by:	pcaulfield at sourceware.org	2007-09-11 12:38:09

Modified files:
	cman/qdisk     : disk.c proc.c 

Log message:
	Allow it to build with -O2

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/qdisk/disk.c.diff?cvsroot=cluster&r1=1.4&r2=1.5
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/qdisk/proc.c.diff?cvsroot=cluster&r1=1.2&r2=1.3

--- cluster/cman/qdisk/disk.c	2006/06/23 16:05:33	1.4
+++ cluster/cman/qdisk/disk.c	2007/09/11 12:38:08	1.5
@@ -377,7 +377,7 @@
 static int
 diskRawRead(int fd, char *buf, int len)
 {
-	char *alignedBuf;
+	void *alignedBuf;
 	int readret;
 	int extraLength;
 	int readlen;
@@ -447,7 +447,7 @@
 static int
 diskRawWrite(int fd, char *buf, int len)
 {
-	char *alignedBuf;
+	void *alignedBuf;
 	int ret;
 	int extraLength;
 	int writelen;
@@ -546,6 +546,7 @@
 int
 qdisk_read(int fd, __off64_t offset, void *buf, int count)
 {
+	void *hdrbuf;
 	shared_header_t *hdrp;
 	char *data;
 	size_t total;
@@ -563,14 +564,15 @@
 	if (total % 512) 
 		total = total + (512 * !!(total % 512)) - (total % 512);
 
-	hdrp = NULL;
-	rv = posix_memalign((void **)&hdrp, sysconf(_SC_PAGESIZE), total);
+	hdrbuf = NULL;
+	rv = posix_memalign((void **)&hdrbuf, sysconf(_SC_PAGESIZE), total);
 	if (rv < 0)
 		return -1;
 
-	if (hdrp == NULL) 
+	if (hdrbuf == NULL) 
 		return -1;
 
+	hdrp = (shared_header_t *)hdrbuf;
 	data = (char *)hdrp + sizeof(shared_header_t);
 
 	rv = diskRawReadShadow(fd, offset, (char *)hdrp, total);
@@ -588,7 +590,7 @@
 		       count - hdrp->h_length);
 	}
 
-	free(hdrp);
+	free(hdrbuf);
 	return count;
 }
 
@@ -597,6 +599,7 @@
 qdisk_write(int fd, __off64_t offset, const void *buf, int count)
 {
 	size_t maxsize;
+	void *hdrbuf;
 	shared_header_t *hdrp;
 	char *data;
 	size_t total = 0, rv = -1, psz = 512; //sysconf(_SC_PAGESIZE);
@@ -621,12 +624,13 @@
 	if (total % psz) 
 		total = total + (psz * !!(total % psz)) - (total % psz);
 
-	hdrp = NULL;
-	rv = posix_memalign((void **)&hdrp, sysconf(_SC_PAGESIZE), total);
+	hdrbuf = NULL;
+	rv = posix_memalign((void **)&hdrbuf, sysconf(_SC_PAGESIZE), total);
 	if (rv < 0) {
 		perror("posix_memalign");
 		return -1;
 	}
+	hdrp = (shared_header_t *)hdrbuf;
 
 	/* 
 	 * Copy the data into our new buffer
@@ -650,7 +654,7 @@
 	if (rv == -1)
 		perror("diskRawWriteShadow");
 	
-	free((char *)hdrp);
+	free(hdrbuf);
 	if (rv == -1)
 		return -1;
 	return count;
--- cluster/cman/qdisk/proc.c	2006/06/23 16:05:33	1.2
+++ cluster/cman/qdisk/proc.c	2007/09/11 12:38:08	1.3
@@ -100,11 +100,12 @@
 				continue;
 
 			if (print) {
+				time_t timestamp = qh.qh_timestamp;
 				printf("%s:\n", realdev);
 				printf("\tMagic:   %08x\n", qh.qh_magic);
 				printf("\tLabel:   %s\n", qh.qh_cluster);
 				printf("\tCreated: %s",
-				       ctime((time_t *)&qh.qh_timestamp));
+				       ctime((time_t *)&timestamp));
 				printf("\tHost:    %s\n\n", qh.qh_updatehost);
 			}
 



                 reply	other threads:[~2007-09-11 12:38 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=20070911123810.24306.qmail@sourceware.org \
    --to=pcaulfield@sourceware.org \
    /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 NNTP newsgroup(s).