svn commit: r274661 - in head/sys: conf geom/part modules/geom/geom_part/geom_part_bsd

Warner Losh imp at bsdimp.com
Wed Nov 19 16:20:36 UTC 2014


On Nov 19, 2014, at 9:16 AM, Andrey V. Elsukov <ae at 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 842 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.freebsd.org/pipermail/svn-src-all/attachments/20141119/6ebbbf90/attachment.sig>


More information about the svn-src-all mailing list