ppcrcd/trunk/yaboot: fs_reiserfs.c include/ext2fs/bitops.h include/stdlib.h yaboot.c

sparky cvs at pld-linux.org
Sat Jan 7 23:19:11 CET 2006


Author: sparky
Date: Sat Jan  7 23:19:06 2006
New Revision: 6772

Modified:
   ppcrcd/trunk/yaboot/fs_reiserfs.c
   ppcrcd/trunk/yaboot/include/ext2fs/bitops.h
   ppcrcd/trunk/yaboot/include/stdlib.h
   ppcrcd/trunk/yaboot/yaboot.c
Log:
- use atoi instead of my own function
- killed two warnings


Modified: ppcrcd/trunk/yaboot/fs_reiserfs.c
==============================================================================
--- ppcrcd/trunk/yaboot/fs_reiserfs.c	(original)
+++ ppcrcd/trunk/yaboot/fs_reiserfs.c	Sat Jan  7 23:19:06 2006
@@ -150,7 +150,7 @@
 
 
 static __inline__ __u32
-log2( __u32 word )
+reiser_log2( __u32 word )
 {
      int i = 0;
      while( word && (word & (1 << ++i)) == 0 );
@@ -422,7 +422,7 @@
 
      INFO->version = le16_to_cpu(super.s_version);
      INFO->blocksize = le16_to_cpu(super.s_blocksize);
-     INFO->blocksize_shift = log2( INFO->blocksize );
+     INFO->blocksize_shift = reiser_log2( INFO->blocksize );
 
      INFO->journal_block = le32_to_cpu(super.s_journal_block);
      INFO->journal_block_count = le32_to_cpu(super.s_orig_journal_size);

Modified: ppcrcd/trunk/yaboot/include/ext2fs/bitops.h
==============================================================================
--- ppcrcd/trunk/yaboot/include/ext2fs/bitops.h	(original)
+++ ppcrcd/trunk/yaboot/include/ext2fs/bitops.h	Sat Jan  7 23:19:06 2006
@@ -410,6 +410,8 @@
 #endif /* !_EXT2_HAVE_ASM_SWAB */
 
 #if !defined(_EXT2_HAVE_ASM_FINDBIT_)
+extern int ffs (int __i);
+	
 _INLINE_ int ext2fs_find_first_bit_set(void * addr, unsigned size)
 {
 	char	*cp = (unsigned char *) addr;

Modified: ppcrcd/trunk/yaboot/include/stdlib.h
==============================================================================
--- ppcrcd/trunk/yaboot/include/stdlib.h	(original)
+++ ppcrcd/trunk/yaboot/include/stdlib.h	Sat Jan  7 23:19:06 2006
@@ -6,6 +6,7 @@
 #define __STDLIB_H
 
 #include "stdarg.h"
+#include "stddef.h"
 
 extern int __alloc_freelist_init(void);
 //extern void malloc_init(void *bottom, unsigned long size);
@@ -22,4 +23,13 @@
 extern long simple_strtol(const char *cp,char **endp,unsigned int base);
 #define strtol(x,y,z) simple_strtol(x,y,z)
 
+extern inline int atoi( const char *ptr );
+
+extern inline int
+atoi (const char *ptr)
+{
+	return (int) strtol (ptr, (char **) NULL, 10);
+}
+
+
 #endif

Modified: ppcrcd/trunk/yaboot/yaboot.c
==============================================================================
--- ppcrcd/trunk/yaboot/yaboot.c	(original)
+++ ppcrcd/trunk/yaboot/yaboot.c	Sat Jan  7 23:19:06 2006
@@ -505,17 +505,6 @@
 		*paramsp = p;
 }
 
-int
-string_to_int(char *str) {
-	int number = 0;
-	int len, i;
-	len = strlen(str);
-	for (i=0; i<len; i++)
-		if ( str[i] <= '9' && str[i] >= '0' )
-			number = number * 10 + str[i] - '0';
-	return number;
-}
-
 char *
 make_params(char *label, char *params)
 {
@@ -561,7 +550,7 @@
 	}
 	p = cfg_get_strg(label, "initrd-size");
 	if (p) {
-		initrd_size = string_to_int(p);
+		initrd_size = atoi(p);
 
 		strcpy (q, "ramdisk_size=");
 		strcpy (q + 13, p);
@@ -570,7 +559,7 @@
 	}
 	p = cfg_get_strg(label, "kernel-size");
 	if (p) {
-		kernel_size = string_to_int(p);
+		kernel_size = atoi(p);
 	}
 
 	if (cfg_get_flag(label, "novideo")) {
@@ -903,7 +892,7 @@
 		memset(&file, 0, sizeof(file));
 		if ( ( loc = strchr(params.kernel.file, '@')) != NULL ) {
 			*loc = '\0';
-			kernel_position = string_to_int( ++loc);
+			kernel_position = atoi( ++loc);
 			prom_printf("kernel at: %d, uncompressed size: %d\n",
 				(int)kernel_position, (int)kernel_size);
 		}
@@ -1046,7 +1035,7 @@
 					/* initrd is an elf part */
 					unsigned int initrd_position=0;
 					*sep = '\0';
-					initrd_position = string_to_int( ++sep);
+					initrd_position = atoi( ++sep);
 					prom_printf("initrd position: %d, size: %d\n",
 						(int)initrd_position, (int)initrd_size);
 


More information about the pld-cvs-commit mailing list