commit-grub
[Top][All Lists]
Advanced

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

grub2 ChangeLog NEWS fs/iso9660.c kern/i386/pc/...


From: Yoshinori K. Okuji
Subject: grub2 ChangeLog NEWS fs/iso9660.c kern/i386/pc/...
Date: Mon, 05 Jun 2006 17:18:32 +0000

CVSROOT:        /cvsroot/grub
Module name:    grub2
Changes by:     Yoshinori K. Okuji <okuji>      06/06/05 17:18:32

Modified files:
        .              : ChangeLog NEWS 
        fs             : iso9660.c 
        kern/i386/pc   : init.c 
        partmap        : acorn.c amiga.c apple.c gpt.c pc.c sun.c 

Log message:
        2006-06-05  Yoshinori K. Okuji  <address@hidden>
        
                Count partitions from 1 instead of 0 in the string 
representation
                of partitions. Still use 0-based internally.
                
                * partmap/sun.c (grub_sun_is_valid): A cosmetic change.
                (sun_partition_map_iterate): Use grub_partition_t instead of
                struct grub_partition *. Cast DESC->START_CYLINDER to
                grub_uint64_t after converting the endian.
                (sun_partition_map_probe): Subtract 1 for PARTNUM.
                (sun_partition_map_get_name): Add 1 to P->INDEX.
        
                * partmap/pc.c (grub_partition_parse): Subtract 1 for
                PCDATA->DOS_PART.
                (pc_partition_map_get_name): Add 1 into PCDATA->DOS_PART.
        
                * partmap/gpt.c (gpt_partition_map_iterate): Initialize PARTNO 
to
                zero instead of one.
                (gpt_partition_map_probe): Subtract 1 for PARTNUM.
                (gpt_partition_map_get_name): Add 1 into P->INDEX.
        
                * partmap/apple.c (apple_partition_map_iterate): Change the type
                of POS to unsigned.
                (apple_partition_map_probe): Subtract 1 for PARTNUM.
                (apple_partition_map_get_name): Add 1 into P->INDEX.
        
                * partmap/amiga.c (amiga_partition_map_iterate): Change the type
                of POS to unsigned.
                (amiga_partition_map_iterate): Cast NEXT to grub_off_t to
                calculate the offset of a partition.
                (amiga_partition_map_probe): Subtract 1 for PARTNUM.
                (amiga_partition_map_get_name): Add 1 into P->INDEX.
        
                * partmap/acorn.c (acorn_partition_map_find): Change the type of
                SECTOR to grub_disk_addr_t.
                (acorn_partition_map_iterate): Likewise.
                (acorn_partition_map_probe): Subtract 1 for PARTNUM.
                Change the type of SECTOR to grub_disk_addr_t. Declare P on the
                top.
                (acorn_partition_map_get_name): Add 1 into P->INDEX.
        
                * kern/i386/pc/init.c (make_install_device): Add 1 into
                GRUB_INSTALL_DOS_PART.
        
                * fs/iso9660.c (grub_iso9660_mount): Fixed a reversed
                conditional.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/grub2/ChangeLog?cvsroot=grub&r1=1.279&r2=1.280
http://cvs.savannah.gnu.org/viewcvs/grub2/NEWS?cvsroot=grub&r1=1.24&r2=1.25
http://cvs.savannah.gnu.org/viewcvs/grub2/fs/iso9660.c?cvsroot=grub&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/grub2/kern/i386/pc/init.c?cvsroot=grub&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/grub2/partmap/acorn.c?cvsroot=grub&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/grub2/partmap/amiga.c?cvsroot=grub&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/grub2/partmap/apple.c?cvsroot=grub&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/grub2/partmap/gpt.c?cvsroot=grub&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/grub2/partmap/pc.c?cvsroot=grub&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/grub2/partmap/sun.c?cvsroot=grub&r1=1.3&r2=1.4

Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/grub/grub2/ChangeLog,v
retrieving revision 1.279
retrieving revision 1.280
diff -u -b -r1.279 -r1.280
--- ChangeLog   4 Jun 2006 15:56:53 -0000       1.279
+++ ChangeLog   5 Jun 2006 17:18:31 -0000       1.280
@@ -1,3 +1,50 @@
+2006-06-05  Yoshinori K. Okuji  <address@hidden>
+
+       Count partitions from 1 instead of 0 in the string representation
+       of partitions. Still use 0-based internally.
+       
+       * partmap/sun.c (grub_sun_is_valid): A cosmetic change.
+       (sun_partition_map_iterate): Use grub_partition_t instead of
+       struct grub_partition *. Cast DESC->START_CYLINDER to
+       grub_uint64_t after converting the endian.
+       (sun_partition_map_probe): Subtract 1 for PARTNUM.
+       (sun_partition_map_get_name): Add 1 to P->INDEX.
+
+       * partmap/pc.c (grub_partition_parse): Subtract 1 for
+       PCDATA->DOS_PART.
+       (pc_partition_map_get_name): Add 1 into PCDATA->DOS_PART.
+
+       * partmap/gpt.c (gpt_partition_map_iterate): Initialize PARTNO to
+       zero instead of one.
+       (gpt_partition_map_probe): Subtract 1 for PARTNUM.
+       (gpt_partition_map_get_name): Add 1 into P->INDEX.
+
+       * partmap/apple.c (apple_partition_map_iterate): Change the type
+       of POS to unsigned.
+       (apple_partition_map_probe): Subtract 1 for PARTNUM.
+       (apple_partition_map_get_name): Add 1 into P->INDEX.
+
+       * partmap/amiga.c (amiga_partition_map_iterate): Change the type
+       of POS to unsigned.
+       (amiga_partition_map_iterate): Cast NEXT to grub_off_t to
+       calculate the offset of a partition.
+       (amiga_partition_map_probe): Subtract 1 for PARTNUM.
+       (amiga_partition_map_get_name): Add 1 into P->INDEX.
+
+       * partmap/acorn.c (acorn_partition_map_find): Change the type of
+       SECTOR to grub_disk_addr_t.
+       (acorn_partition_map_iterate): Likewise.
+       (acorn_partition_map_probe): Subtract 1 for PARTNUM.
+       Change the type of SECTOR to grub_disk_addr_t. Declare P on the
+       top.
+       (acorn_partition_map_get_name): Add 1 into P->INDEX.
+
+       * kern/i386/pc/init.c (make_install_device): Add 1 into
+       GRUB_INSTALL_DOS_PART.
+
+       * fs/iso9660.c (grub_iso9660_mount): Fixed a reversed
+       conditional.
+
 2006-06-04  Yoshinori K. Okuji  <address@hidden>
 
        Clean up the code to support 64-bit addressing in disks and

Index: NEWS
===================================================================
RCS file: /cvsroot/grub/grub2/NEWS,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -b -r1.24 -r1.25
--- NEWS        4 Jun 2006 12:59:19 -0000       1.24
+++ NEWS        5 Jun 2006 17:18:31 -0000       1.25
@@ -1,3 +1,8 @@
+New in 1.95:
+
+* Number partitions from 1 instead of 0. For instance, the first
+  partition of "hd0" is now "hd0,1" but not "hd0,0".
+
 New in 1.94 - 2006-06-04:
 
 * Fix several serious bugs in HFS+.

Index: fs/iso9660.c
===================================================================
RCS file: /cvsroot/grub/grub2/fs/iso9660.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- fs/iso9660.c        4 Jun 2006 15:56:54 -0000       1.3
+++ fs/iso9660.c        5 Jun 2006 17:18:31 -0000       1.4
@@ -236,7 +236,7 @@
       goto fail;
     }
 
-  if (grub_strncmp ((char *) data->voldesc.voldesc.magic, "CD001", 5) == 0)
+  if (grub_strncmp ((char *) data->voldesc.voldesc.magic, "CD001", 5) != 0)
     {
       grub_error (GRUB_ERR_BAD_FS, "not a iso9660 filesystem");
       goto fail;
@@ -268,7 +268,7 @@
   sua_size = rootdir.len - sua_pos;
 
   sua = grub_malloc (sua_size);
-  if (!sua)
+  if (! sua)
     goto fail;
   
   if (grub_disk_read (disk, (grub_le_to_cpu32 
(data->voldesc.rootdir.first_sector)
@@ -622,7 +622,7 @@
 #endif
 
   data = grub_iso9660_mount (device->disk);
-  if (!data)
+  if (! data)
     goto fail;
   
   rootnode.data = data;

Index: kern/i386/pc/init.c
===================================================================
RCS file: /cvsroot/grub/grub2/kern/i386/pc/init.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- kern/i386/pc/init.c 25 Apr 2006 20:08:31 -0000      1.12
+++ kern/i386/pc/init.c 5 Jun 2006 17:18:31 -0000       1.13
@@ -1,6 +1,6 @@
 /*
  *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2002, 2003, 2004, 2005  Free Software Foundation, Inc.
+ *  Copyright (C) 2002,2003,2004,2005,2006  Free Software Foundation, Inc.
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -64,7 +64,7 @@
                grub_boot_drive & 0x7f);
   
   if (grub_install_dos_part >= 0)
-    grub_sprintf (dev + grub_strlen (dev), ",%u", grub_install_dos_part);
+    grub_sprintf (dev + grub_strlen (dev), ",%u", grub_install_dos_part + 1);
 
   if (grub_install_bsd_part >= 0)
     grub_sprintf (dev + grub_strlen (dev), ",%c", grub_install_bsd_part + 'a');

Index: partmap/acorn.c
===================================================================
RCS file: /cvsroot/grub/grub2/partmap/acorn.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- partmap/acorn.c     23 Nov 2005 02:44:34 -0000      1.2
+++ partmap/acorn.c     5 Jun 2006 17:18:31 -0000       1.3
@@ -51,7 +51,7 @@
 
 static grub_err_t
 acorn_partition_map_find (grub_disk_t disk, struct linux_part *m,
-                         unsigned int *sector)
+                         grub_disk_addr_t *sector)
 {
   struct grub_acorn_boot_block boot;
   grub_err_t err;
@@ -62,7 +62,7 @@
 
   err = grub_disk_read (disk, 0xC00 / GRUB_DISK_SECTOR_SIZE, 0,
                                   sizeof (struct grub_acorn_boot_block),
-                                  (char *)&boot);
+                       (char *) &boot);
   if (err)
     return err;
 
@@ -82,7 +82,7 @@
 
   return grub_disk_read (disk, *sector, 0,
                         sizeof (struct linux_part) * LINUX_MAP_ENTRIES,
-                        (char *)m);
+                        (char *) m);
 
 fail:
   return grub_error (GRUB_ERR_BAD_PART_TABLE,
@@ -100,7 +100,7 @@
   struct grub_disk raw;
   struct linux_part map[LINUX_MAP_ENTRIES];
   int i;
-  unsigned int sector;
+  grub_disk_addr_t sector;
   grub_err_t err;
 
   /* Enforce raw disk access.  */
@@ -119,7 +119,7 @@
          && map[i].magic != LINUX_SWAP_MAGIC)
        return GRUB_ERR_NONE;
 
-      part.start = (grub_disk_addr_t)sector + map[i].start;
+      part.start = sector + map[i].start;
       part.len = map[i].size;
       part.offset = 6;
       part.index = i;
@@ -137,9 +137,10 @@
 {
   struct linux_part map[LINUX_MAP_ENTRIES];
   struct grub_disk raw = *disk;
-  unsigned long partnum = grub_strtoul (str, 0, 10);
-  unsigned int sector;
+  unsigned long partnum = grub_strtoul (str, 0, 10) - 1;
+  grub_disk_addr_t sector;
   grub_err_t err;
+  grub_partition_t p;
 
   /* Enforce raw disk access.  */
   raw.partition = 0;
@@ -156,11 +157,11 @@
       && map[partnum].magic != LINUX_SWAP_MAGIC)
     goto fail;
 
-  grub_partition_t p = grub_malloc (sizeof (struct grub_partition));
-  if (!p)
+  p = grub_malloc (sizeof (struct grub_partition));
+  if (! p)
     return 0;
 
-  p->start = (grub_disk_addr_t)sector + map[partnum].start;
+  p->start = sector + map[partnum].start;
   p->len = map[partnum].size;
   p->offset = 6;
   p->index = partnum;
@@ -178,10 +179,10 @@
   char *name;
 
   name = grub_malloc (13);
-  if (!name)
+  if (! name)
     return 0;
 
-  grub_sprintf (name, "%d", p->index);
+  grub_sprintf (name, "%d", p->index + 1);
   return name;
 }
 

Index: partmap/amiga.c
===================================================================
RCS file: /cvsroot/grub/grub2/partmap/amiga.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- partmap/amiga.c     4 Jun 2006 15:56:55 -0000       1.5
+++ partmap/amiga.c     5 Jun 2006 17:18:31 -0000       1.6
@@ -84,7 +84,7 @@
   struct grub_disk raw;
   int partno = 0;
   int next = -1;
-  int pos;
+  unsigned pos;
   
   /* Enforce raw disk access.  */
   raw = *disk;
@@ -94,8 +94,7 @@
   for (pos = 0; pos < 15; pos++)
     {
       /* Read the RDSK block which is a descriptor for the entire disk.  */
-      if (grub_disk_read (&raw, pos, 0,
-                         sizeof (rdsk),  (char *) &rdsk))
+      if (grub_disk_read (&raw, pos, 0, sizeof (rdsk), (char *) &rdsk))
        return grub_errno;
       
       if (grub_strcmp ((char *) rdsk.magic, "RDSK") == 0)
@@ -116,8 +115,7 @@
       struct grub_amiga_partition apart;
      
       /* Read the RDSK block which is a descriptor for the entire disk.  */
-      if (grub_disk_read (&raw, next, 0,
-                         sizeof (apart),  (char *) &apart))
+      if (grub_disk_read (&raw, next, 0, sizeof (apart), (char *) &apart))
        return grub_errno;
       
       /* Calculate the first block and the size of the partition.  */
@@ -129,7 +127,7 @@
                  * grub_be_to_cpu32 (apart.heads)
                  * grub_be_to_cpu32 (apart.block_per_track));
       
-      part.offset = next * 512;
+      part.offset = (grub_off_t) next * 512;
       part.index = partno;
       part.partmap = &grub_amiga_partition_map;
       
@@ -170,7 +168,7 @@
     }
   
   /* Get the partition number.  */
-  partnum = grub_strtoul (s, 0, 10);
+  partnum = grub_strtoul (s, 0, 10) - 1;
   if (grub_errno)
     {
       grub_error (GRUB_ERR_BAD_FILENAME, "invalid partition");
@@ -197,7 +195,7 @@
   if (! name)
     return 0;
 
-  grub_sprintf (name, "%d", p->index);
+  grub_sprintf (name, "%d", p->index + 1);
   return name;
 }
 

Index: partmap/apple.c
===================================================================
RCS file: /cvsroot/grub/grub2/partmap/apple.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- partmap/apple.c     3 Jan 2006 16:02:18 -0000       1.7
+++ partmap/apple.c     5 Jun 2006 17:18:31 -0000       1.8
@@ -1,7 +1,7 @@
 /* apple.c - Read macintosh partition tables.  */
 /*
  *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2002, 2004, 2005  Free Software Foundation, Inc.
+ *  Copyright (C) 2002,2004,2005,2006  Free Software Foundation, Inc.
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -102,7 +102,7 @@
   struct grub_apple_part apart;
   struct grub_disk raw;
   int partno = 0;
-  int pos = GRUB_DISK_SECTOR_SIZE;
+  unsigned pos = GRUB_DISK_SECTOR_SIZE;
 
   /* Enforce raw disk access.  */
   raw = *disk;
@@ -140,7 +140,8 @@
       if (hook (disk, &part))
        return grub_errno;
 
-      if (grub_be_to_cpu32 (apart.first_phys_block) == GRUB_DISK_SECTOR_SIZE * 
2)
+      if (grub_be_to_cpu32 (apart.first_phys_block)
+         == GRUB_DISK_SECTOR_SIZE * 2)
        return 0;
 
       pos += sizeof (struct grub_apple_part);
@@ -181,7 +182,7 @@
     }
   
   /* Get the partition number.  */
-  partnum = grub_strtoul (s, 0, 10);
+  partnum = grub_strtoul (s, 0, 10) - 1;
   if (grub_errno)
     {
       grub_error (GRUB_ERR_BAD_FILENAME, "invalid partition");
@@ -208,7 +209,7 @@
   if (! name)
     return 0;
 
-  grub_sprintf (name, "%d", p->index);
+  grub_sprintf (name, "%d", p->index + 1);
   return name;
 }
 

Index: partmap/gpt.c
===================================================================
RCS file: /cvsroot/grub/grub2/partmap/gpt.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- partmap/gpt.c       4 Jun 2006 15:56:55 -0000       1.3
+++ partmap/gpt.c       5 Jun 2006 17:18:31 -0000       1.4
@@ -79,7 +79,7 @@
   struct grub_disk raw;
   struct grub_pc_partition_mbr mbr;
   grub_uint64_t entries;
-  int partno = 1;
+  int partno = 0;
   unsigned int i;
   int last_offset = 0;
 
@@ -172,7 +172,7 @@
     }
   
   /* Get the partition number.  */
-  partnum = grub_strtoul (s, 0, 10);
+  partnum = grub_strtoul (s, 0, 10) - 1;
   if (grub_errno)
     {
       grub_error (GRUB_ERR_BAD_FILENAME, "invalid partition");
@@ -199,7 +199,7 @@
   if (! name)
     return 0;
 
-  grub_sprintf (name, "%d", p->index);
+  grub_sprintf (name, "%d", p->index + 1);
   return name;
 }
 

Index: partmap/pc.c
===================================================================
RCS file: /cvsroot/grub/grub2/partmap/pc.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- partmap/pc.c        4 Jun 2006 15:56:55 -0000       1.8
+++ partmap/pc.c        5 Jun 2006 17:18:31 -0000       1.9
@@ -55,8 +55,9 @@
   /* Initialize some of the fields with invalid values.  */
   pcdata->bsd_part = pcdata->dos_type = pcdata->bsd_type = p->index = -1;
 
-  /* Get the DOS partition number.  */
-  pcdata->dos_part = grub_strtoul (s, &s, 0);
+  /* Get the DOS partition number. The number is counted from one for
+     the user interface, and from zero internally.  */
+  pcdata->dos_part = grub_strtoul (s, &s, 0) - 1;
   
   if (grub_errno)
     {
@@ -237,6 +238,7 @@
                 const grub_partition_t partition)
     {
       struct grub_pc_partition *partdata = partition->data;
+
       if ((pcdata->dos_part == partdata->dos_part || pcdata->dos_part == -1)
          && pcdata->bsd_part == partdata->bsd_part)
        {
@@ -283,9 +285,11 @@
     return 0;
 
   if (pcdata->bsd_part < 0)
-    grub_sprintf (name, "%d", pcdata->dos_part);
+    grub_sprintf (name, "%d", pcdata->dos_part + 1);
+  else if (pcdata->dos_part < 0)
+    grub_sprintf (name, "%c", pcdata->bsd_part + 'a');
   else
-    grub_sprintf (name, "%d,%c", pcdata->dos_part, pcdata->bsd_part + 'a');
+    grub_sprintf (name, "%d,%c", pcdata->dos_part + 1, pcdata->bsd_part + 'a');
 
   return name;
 }

Index: partmap/sun.c
===================================================================
RCS file: /cvsroot/grub/grub2/partmap/sun.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- partmap/sun.c       13 Nov 2005 15:47:09 -0000      1.3
+++ partmap/sun.c       5 Jun 2006 17:18:31 -0000       1.4
@@ -1,7 +1,7 @@
 /* sun.c - Read SUN style partition tables.  */
 /*
  *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2002, 2005 Free Software Foundation, Inc.
+ *  Copyright (C) 2002,2005,2006 Free Software Foundation, Inc.
  *
  *  GRUB is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -78,9 +78,13 @@
 {
   grub_uint16_t *pos;
   grub_uint16_t sum = 0;
-  for (pos = (grub_uint16_t *) label; pos < (grub_uint16_t *) (label + 1); 
pos++)
+  
+  for (pos = (grub_uint16_t *) label;
+       pos < (grub_uint16_t *) (label + 1);
+       pos++)
     sum ^= *pos;
-  return !sum;
+  
+  return ! sum;
 }
 
 static grub_err_t
@@ -88,14 +92,16 @@
                            int (*hook) (grub_disk_t disk,
                                        const grub_partition_t partition))
 {
-  struct grub_partition *p;
+  grub_partition_t p;
   struct grub_disk raw;
   struct grub_sun_block block;
   int partnum;
+  
   raw = *disk;
   raw.partition = 0;
-  p = (struct grub_partition *) grub_malloc (sizeof (struct grub_partition));
-  if (!p)
+  
+  p = (grub_partition_t) grub_malloc (sizeof (struct grub_partition));
+  if (! p)
     return grub_errno;
 
   p->offset = 0;
@@ -106,20 +112,25 @@
     {
       if (GRUB_PARTMAP_SUN_MAGIC != grub_be_to_cpu16 (block.magic))
        grub_error (GRUB_ERR_BAD_PART_TABLE, "not a sun partiton table");
-      if (!grub_sun_is_valid (&block))
+      
+      if (! grub_sun_is_valid (&block))
        grub_error (GRUB_ERR_BAD_PART_TABLE, "invalid checksum");
+      
       /* Maybe another error value would be better, because partition
         table _is_ recognised but invalid.  */
       for (partnum = 0; partnum < GRUB_PARTMAP_SUN_MAX_PARTS; partnum++)
        {
-         if (block.infos[partnum].id == 0 ||
-             block.infos[partnum].id == GRUB_PARTMAP_SUN_WHOLE_DISK_ID)
+         struct grub_sun_partition_descriptor *desc;
+         
+         if (block.infos[partnum].id == 0
+             || block.infos[partnum].id == GRUB_PARTMAP_SUN_WHOLE_DISK_ID)
            continue;
-         p->start = grub_be_to_cpu32
-           (block.partitions[partnum].start_cylinder)
+
+         desc = &block.partitions[partnum];
+         p->start = ((grub_uint64_t) grub_be_to_cpu32 (desc->start_cylinder)
            * grub_be_to_cpu16 (block.ntrks)
-           * grub_be_to_cpu16 (block.nsect);
-         p->len = grub_be_to_cpu32 (block.partitions[partnum].num_sectors);
+                     * grub_be_to_cpu16 (block.nsect));
+         p->len = grub_be_to_cpu32 (desc->num_sectors);
          p->index = partnum;
          if (p->len)
            {
@@ -128,6 +139,7 @@
            }
        }
     }
+  
   grub_free (p);
 
   return grub_errno;
@@ -150,13 +162,15 @@
           p = (grub_partition_t) grub_malloc (sizeof (*p));
           if (p)
             grub_memcpy (p, partition, sizeof (*p));
+         
           return 1;
         }
+      
       return 0;
     }
 
   grub_errno = GRUB_ERR_NONE;
-  partnum = grub_strtoul (s, 0, 10);
+  partnum = grub_strtoul (s, 0, 10) - 1;
   if (grub_errno == GRUB_ERR_NONE)
     {
       if (sun_partition_map_iterate (disk, find_func))
@@ -170,6 +184,7 @@
       grub_error (GRUB_ERR_BAD_FILENAME, "invalid partition");
       p = 0;
     }
+  
   return p;
 }
 
@@ -177,9 +192,11 @@
 sun_partition_map_get_name (const grub_partition_t p)
 {
   char *name;
+  
   name = grub_malloc (13);
   if (name)
-    grub_sprintf (name, "%d", p->index);
+    grub_sprintf (name, "%d", p->index + 1);
+  
   return name;
 }
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]