> From: Karel Zak [mailto:k...@redhat.com]
> Sent: Wednesday, July 31, 2013 9:25 PM
> To: Caizhiyong
> Cc: Andrew Morton; linux-kernel@vger.kernel.org; Wanglin (Albert); Quyaxin
> Subject: Re: [PATCH] block: support embedded device command line partition
> 
> On Sat, Jul 27, 2013 at 01:56:24PM +0000, Caizhiyong wrote:
> > +static int parse_partitions(struct parsed_partitions *state,
> > +                       struct cmdline_parts *parts)
> > +{
> > +   int slot;
> > +   uint64_t from = 0;
> > +   uint64_t disk_size;
> > +   char buf[BDEVNAME_SIZE];
> > +   struct cmdline_subpart *subpart;
> > +
> > +   bdevname(state->bdev, buf);
> > +
> > +   while (parts && strncmp(buf, parts->name, BDEVNAME_SIZE))
> > +           parts = parts->next_parts;
> > +
> > +   if (!parts)
> > +           return 0;
> > +
> > +   disk_size = (uint64_t) get_capacity(state->bdev->bd_disk) << 9;
> > +
> > +   for (slot = 1, subpart = parts->subpart;
> > +        subpart && slot < state->limit;
> > +        subpart = subpart->next_subpart, slot++) {
> > +
> > +           unsigned label_max;
> > +           struct partition_meta_info *info;
> > +
> > +           if (subpart->from == OFFSET_CONTINUOUS)
> > +                   subpart->from = from;
> > +           else
> > +                   from = subpart->from;
> > +
> > +           if (from >= disk_size)
> > +                   break;
> > +
> > +           if (subpart->size > (disk_size - from))
> > +                   subpart->size = disk_size - from;
> > +
> > +           from += subpart->size;
> > +
> > +           put_partition(state, slot, le64_to_cpu(subpart->from >> 9),
> > +                         le64_to_cpu(subpart->size >> 9));
> 
>  Why le64_to_cpu()?
> 
>  I guess that memparse() does not return explicitly LE and it also
>  seems that your code  on another places uses ->size and ->from
>  without any extra care.

Right. I will remove.

> 
>     Karel
> 
> --
>  Karel Zak  <k...@redhat.com>
>  http://karelzak.blogspot.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to