On Nov 19, 2014, at 9:16 AM, Andrey V. Elsukov <a...@freebsd.org> wrote:

> On 18.11.2014 20:06, Warner Losh wrote:
>> Author: imp
>> Date: Tue Nov 18 17:06:40 2014
>> New Revision: 274661
>> URL: https://svnweb.freebsd.org/changeset/base/274661
>> 
>> Log:
>>  Implement the historic DIOCGDINFO ioctl for gpart on BSD
>>  partitions. Several utilities still use this interface and require
>>  additional information since gpart was activated than before. This
>>  allows fsck of a UFS partition without having to specify it is UFS,
>>  per historic behavior.
> 
>> + */
>> +static int
>> +g_part_bsd_ioctl(struct g_part_table *basetable, struct g_provider *pp,
>> +    u_long cmd, void *data, int fflag, struct thread *td)
>> +{
>> +
>> +    switch (cmd)
>> +    {
>> +    case DIOCGDINFO:
>> +    {
>> +            struct g_part_bsd_table *table;
>> +            u_char *p;
>> +
>> +            table = (struct g_part_bsd_table *)basetable;
>> +            p = table->bbarea + pp->sectorsize;
>> +            return (bsd_disklabel_le_dec(p, data, MAXPARTITIONS));
> 
> Probably you need to use basetable->gpt_entries here instead of
> MAXPARTITIONS.

I’m having trouble connecting the dots between GPT and BSDlabels. Why would 
this field be relevant? Is it just poorly named? MAXPARTITIONS is the number of 
partitions we support. It’s always a constant. While there are other BSD label 
formats that have differing numbers, I don’t think gpart supports those. But as 
always, I’m always on the lookout for code improvements.

Warner

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

Reply via email to