[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Cluster-devel] [RFC] Switch the entire project to use -Werror



Patch to make qdisk compile ... I haven't tested this BTW

Patrick
Index: disk.c
===================================================================
RCS file: /cvs/cluster/cluster/cman/qdisk/disk.c,v
retrieving revision 1.4
diff -u -p -r1.4 disk.c
--- disk.c	23 Jun 2006 16:05:33 -0000	1.4
+++ disk.c	31 Aug 2007 11:50:22 -0000
@@ -377,7 +377,7 @@ diskRawReadShadow(int fd, off_t readOffs
 static int
 diskRawRead(int fd, char *buf, int len)
 {
-	char *alignedBuf;
+	void *alignedBuf;
 	int readret;
 	int extraLength;
 	int readlen;
@@ -447,7 +447,7 @@ diskRawRead(int fd, char *buf, int len)
 static int
 diskRawWrite(int fd, char *buf, int len)
 {
-	char *alignedBuf;
+	void *alignedBuf;
 	int ret;
 	int extraLength;
 	int writelen;
@@ -546,6 +546,7 @@ diskRawWriteShadow(int fd, __off64_t wri
 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 @@ qdisk_read(int fd, __off64_t offset, voi
 	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 @@ qdisk_read(int fd, __off64_t offset, voi
 		       count - hdrp->h_length);
 	}
 
-	free(hdrp);
+	free(hdrbuf);
 	return count;
 }
 
@@ -597,6 +599,7 @@ int
 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 @@ qdisk_write(int fd, __off64_t offset, co
 	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 @@ qdisk_write(int fd, __off64_t offset, co
 	if (rv == -1)
 		perror("diskRawWriteShadow");
 	
-	free((char *)hdrp);
+	free(hdrbuf);
 	if (rv == -1)
 		return -1;
 	return count;
Index: proc.c
===================================================================
RCS file: /cvs/cluster/cluster/cman/qdisk/proc.c,v
retrieving revision 1.2
diff -u -p -r1.2 proc.c
--- proc.c	23 Jun 2006 16:05:33 -0000	1.2
+++ proc.c	31 Aug 2007 11:50:22 -0000
@@ -100,11 +100,12 @@ find_partitions(const char *partfile, co
 				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);
 			}
 

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]