Print this page
grub patch

Split Close
Expand all
Collapse all
          --- old/grub/grub-core/partmap/sun.c
          +++ new/grub/grub-core/partmap/sun.c
↓ open down ↓ 84 lines elided ↑ open up ↑
  85   85  }
  86   86  
  87   87  static grub_err_t
  88   88  sun_partition_map_iterate (grub_disk_t disk,
  89   89                             int (*hook) (grub_disk_t disk,
  90   90                                          const grub_partition_t partition))
  91   91  {
  92   92    struct grub_partition p;
  93   93    union
  94   94    {
  95      -    struct grub_sun_block sun;
       95 +    struct grub_sun_block sunb;
  96   96      grub_uint16_t raw[0];
  97   97    } block;
  98   98    int partnum;
  99   99    grub_err_t err;
 100  100  
 101  101    p.partmap = &grub_sun_partition_map;
 102  102    err = grub_disk_read (disk, 0, 0, sizeof (struct grub_sun_block),
 103  103                          &block);
 104  104    if (err)
 105  105      return err;
 106  106  
 107      -  if (GRUB_PARTMAP_SUN_MAGIC != grub_be_to_cpu16 (block.sun.magic))
      107 +  if (GRUB_PARTMAP_SUN_MAGIC != grub_be_to_cpu16 (block.sunb.magic))
 108  108      return grub_error (GRUB_ERR_BAD_PART_TABLE, "not a sun partition table");
 109  109  
 110  110    if (! grub_sun_is_valid (block.raw))
 111  111        return grub_error (GRUB_ERR_BAD_PART_TABLE, "invalid checksum");
 112  112    
 113  113    /* Maybe another error value would be better, because partition
 114  114       table _is_ recognized but invalid.  */
 115  115    for (partnum = 0; partnum < GRUB_PARTMAP_SUN_MAX_PARTS; partnum++)
 116  116      {
 117  117        struct grub_sun_partition_descriptor *desc;
 118  118  
 119      -      if (block.sun.infos[partnum].id == 0
 120      -          || block.sun.infos[partnum].id == GRUB_PARTMAP_SUN_WHOLE_DISK_ID)
      119 +      if (block.sunb.infos[partnum].id == 0
      120 +          || block.sunb.infos[partnum].id == GRUB_PARTMAP_SUN_WHOLE_DISK_ID)
 121  121          continue;
 122  122  
 123      -      desc = &block.sun.partitions[partnum];
      123 +      desc = &block.sunb.partitions[partnum];
 124  124        p.start = ((grub_uint64_t) grub_be_to_cpu32 (desc->start_cylinder)
 125      -                  * grub_be_to_cpu16 (block.sun.ntrks)
 126      -                  * grub_be_to_cpu16 (block.sun.nsect));
      125 +                  * grub_be_to_cpu16 (block.sunb.ntrks)
      126 +                  * grub_be_to_cpu16 (block.sunb.nsect));
 127  127        p.len = grub_be_to_cpu32 (desc->num_sectors);
 128  128        p.number = p.index = partnum;
 129  129        if (p.len)
 130  130          {
 131  131            if (hook (disk, &p))
 132  132              partnum = GRUB_PARTMAP_SUN_MAX_PARTS;
 133  133          }
 134  134      }
 135  135  
 136  136    return grub_errno;
↓ open down ↓ 19 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX