Patch for hdparm with CVS glibc

Ken Moffat ken at kenmoffat.uklinux.net
Thu Feb 12 07:40:31 PST 2004


 Glibc-2.3.3 added readahead to include/fs/bitsh some time in January.
Hdparm already had a variable of the same name, this fixes compilation.

Ken
-- 
Brighton tops UK Jedi league
http://www.theregister.co.uk/content/28/35186.html
-------------- next part --------------
Submitted By: Ken Moffat <ken at kenmoffat.uklinux.net>
Date: 2004-02-12
Initial Package Version: 5.5
Upstream Status: Mark Lord say he'll rename it to fsreadahead for 5.6.
Description: fixes compilation with glibc dated after mid January 2004. 

gcc-CVS from some time in January has started putting a readahead hint for
the kernel at the end of include/fs/bits.h  Detected in testing on ppc, I
assume other architectures will do the same.  

 This stops hdparm compiling because fsreadahead is changing from external
to static..  A simple rename of the readahead variable will do, but that's
obviously an aesthetic issue.  After mailing the maintainer, he's going to
rename it to fsreadahead, this is my interpretation of how he'll do it.

 Tested, at least as far as compiling and checking that ./hdparm -a returns
the expected value.  

diff -u hdparm-5.5/hdparm.c hdparm-5.5-renamed/hdparm.c
--- hdparm-5.5/hdparm.c	2004-01-27 17:01:37.000000000 +0000
+++ hdparm-5.5-renamed/hdparm.c	2004-02-12 15:04:29.000000000 +0000
@@ -52,7 +52,7 @@
 static int flagcount = 0, do_flush = 0, is_scsi_hd = 0, is_scsi_cd = 0, is_xt_hd = 0;
 static int do_ctimings, do_timings = 0;
 
-static unsigned long set_readahead= 0, get_readahead= 0, readahead= 0;     
+static unsigned long set_fsreadahead= 0, get_fsreadahead= 0, fsreadahead= 0;     
 static unsigned long set_readonly = 0, get_readonly = 0, readonly = 0;
 static unsigned long set_unmask   = 0, get_unmask   = 0, unmask   = 0;     
 static unsigned long set_mult     = 0, get_mult     = 0, mult     = 0;     
@@ -782,10 +782,10 @@
 	if (!quiet)
 		printf("\n%s:\n", devname);
 
-	if (set_readahead) {
-		if (get_readahead)
-			printf(" setting fs readahead to %ld\n", readahead);
-		if (ioctl(fd, BLKRASET, readahead)) 
+	if (set_fsreadahead) {
+		if (get_fsreadahead)
+			printf(" setting fs readahead to %ld\n", fsreadahead);
+		if (ioctl(fd, BLKRASET, fsreadahead)) 
 			perror(" BLKRASET failed");
 	}
 #ifdef HDIO_UNREGISTER_HWIF
@@ -1200,7 +1200,7 @@
 			on_off(parm);
 		}
 	}
-	if ((verbose && !is_scsi_hd) || get_readahead) {
+	if ((verbose && !is_scsi_hd) || get_fsreadahead) {
 		if (ioctl(fd, BLKRAGET, &parm))
 			perror(" BLKRAGET failed");
 		else {
@@ -1827,9 +1827,9 @@
 
 #endif /* HDIO_TRISTATE_HWIF */
 					case 'a':
-						get_readahead = noisy;
+						get_fsreadahead = noisy;
 						noisy = 1;
-						GET_NUMBER(set_readahead,readahead);
+						GET_NUMBER(set_fsreadahead,fsreadahead);
 						break;
 					case 'B':
 						get_apmmode = noisy;


More information about the patches mailing list