[OpenBIOS] r30 - openbios-devel/modules
svn@openbios.org
svn at openbios.org
Wed May 24 12:59:54 CEST 2006
Author: stepan
Date: 2006-05-24 12:59:54 +0200 (Wed, 24 May 2006)
New Revision: 30
Modified:
openbios-devel/modules/disk-label.c
openbios-devel/modules/sun-parts.c
Log:
Added handling of alphabetic partition ids as used in Sparc. Fixed sizes
reported.
Modified: openbios-devel/modules/disk-label.c
===================================================================
--- openbios-devel/modules/disk-label.c 2006-05-22 22:37:46 UTC (rev 29)
+++ openbios-devel/modules/disk-label.c 2006-05-24 10:59:54 UTC (rev 30)
@@ -63,7 +63,9 @@
s = parstr;
filename = NULL;
if( s ) {
- if( *s == '-' || isdigit(*s) ) {
+ if( *s == '-' || isdigit(*s) ||
+ (*s >= 'a' && *s < ('a' + 8)
+ && (*(s + 1) == ',' || *(s + 1) == '\0'))) {
if( (s=strpbrk(parstr,",")) ) {
filename = s+1;
*s = 0;
Modified: openbios-devel/modules/sun-parts.c
===================================================================
--- openbios-devel/modules/sun-parts.c 2006-05-22 22:37:46 UTC (rev 29)
+++ openbios-devel/modules/sun-parts.c 2006-05-24 10:59:54 UTC (rev 30)
@@ -27,6 +27,7 @@
typedef struct {
ullong offs;
ullong size;
+ int type;
} sunparts_info_t;
DECLARE_NODE( sunparts, INSTALL_OPEN, sizeof(sunparts_info_t), "+/packages/sun-parts" );
@@ -93,15 +94,19 @@
int parnum = -1;
unsigned char buf[512];
struct sun_disklabel *p;
- unsigned int i;
+ unsigned int i, bs;
DPRINTF("sunparts_open '%s'\n", str );
if( str ) {
- parnum = atol(str);
- if( !strlen(str) )
- parnum = -1;
- free( str );
+ if( !strlen(str) )
+ parnum = -1;
+ else if (str[0] >= 'a' && str[0] < ('a' + 8))
+ parnum = str[0] - 'a';
+ else
+ parnum = atol(str);
+
+ free( str );
}
SEEK( 0 );
@@ -110,10 +115,11 @@
/* Check Magic */
if (!has_sun_part_magic(buf)) {
- DPRINTF("sun partition magic not found.\n");
+ DPRINTF("Sun partition magic not found.\n");
RET(0);
}
-
+
+ bs = 512; // XXX get real block size?
/* get partition data */
p = (struct sun_disklabel *)buf;
@@ -125,10 +131,16 @@
parnum = i;
}
}
+
+ if (parnum < 0)
+ parnum = 0;
+
+ DPRINTF("Selected partition %d\n", parnum);
di->offs = (llong)__be32_to_cpu(p->partitions[parnum].start_cylinder) *
- __be16_to_cpu(p->ntrks) * __be16_to_cpu(p->nsect);
+ __be16_to_cpu(p->ntrks) * __be16_to_cpu(p->nsect) * bs;
- di->size = (llong)__be32_to_cpu(p->partitions[parnum].num_sectors) ;
+ di->size = (llong)__be32_to_cpu(p->partitions[parnum].num_sectors) * bs;
+ di->type = __be32_to_cpu(p->infos[parnum].id);
DPRINTF("Found Sun partition table, offs %d size %d\n", (int)di->offs, (int)di->size);
RET( -1 );
@@ -147,7 +159,8 @@
static void
sunparts_get_info( sunparts_info_t *di )
{
- PUSH( -1 ); /* no type */
+ DPRINTF("Sun get_info\n");
+ PUSH( di->type );
DPUSH( di->offs );
DPUSH( di->size );
}
More information about the OpenBIOS
mailing list