Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 03 Nov 2006 12:11:09 -0500
From:      Joe Marcus Clarke <marcus@FreeBSD.org>
To:        Jean-Yves Lefort <jylefort@FreeBSD.org>
Cc:        FreeBSD GNOME Users <gnome@FreeBSD.org>
Subject:   Re: HEADS UP: More HAL testers needed
Message-ID:  <1162573869.4927.1.camel@shumai.marcuscom.com>
In-Reply-To: <20061103110454.68b6a2c1.jylefort@FreeBSD.org>
References:  <1162508657.22424.57.camel@shumai.marcuscom.com> <20061103110454.68b6a2c1.jylefort@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--=-DlVcJo+K1ZhpBhG+n/PW
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

On Fri, 2006-11-03 at 11:04 +0100, Jean-Yves Lefort wrote:
> On Thu, 02 Nov 2006 18:04:17 -0500
> Joe Marcus Clarke <marcus@FreeBSD.org> wrote:
>=20
> > I am working to sync our HAL backend up with the latest HAL spec.  To
> > that end, I have added support for displaying more volume.partition
> > properties.  This patch will only affect HAL objects that have the
> > volume.is_partition property set to TRUE.  The only way you'd notice an=
y
> > difference is using lshal.  The old output looked something like:
> >
> > volume.partition.number =3D 3 (0x3) (int)
> > volume.msdos_part_table_type =3D 165 (0xa5) (int)
> >
> > The new style looks like this:
> >
> > volume.partition.start =3D 18268346880  (0x440e0da00)  (uint64)
> > volume.partition.media_size =3D 61730726400  (0xe5f702200)  (uint64)
> > volume.partition.type =3D '0xa5'  (string)
> > volume.partition.scheme =3D 'mbr'  (string)
> > volume.partition.number =3D 3  (0x3)  (int)
> >
> > I'd be particularly interested with feedback from those that have gpt o=
r
> > apple schemes, but feedback from mbr users is just as good (i.e. to let
> > me know it works on more that just my system).  Thanks.
> >
> > http://www.marcuscom.com/downloads/patch-hal_volume
>=20
> Useless elements underlined:
>=20
> +  if (geom_obj->uuid)
>    ^^^^^^^^^^^^^^^^^^^
> +    g_free(geom_obj->uuid);
> +
> +  if (geom_obj->apple_type)
>    ^^^^^^^^^^^^^^^^^^^^^^^^^
> +    g_free(geom_obj->apple_type);

I keep doing that!  I have a big problem freeing a NULL value.

>=20
> +  *mediasize =3D (guint64) hf_probe_volume_getenv_uintmax("HF_VOLUME_SIZ=
E");
>                 ^^^^^^^^^
> +  *offset =3D (guint64) hf_probe_volume_getenv_uintmax("HF_VOLUME_OFFSET=
");
>              ^^^^^^^^^
>=20
> +  if ((sscanf(partno + 1, "%i", number)) !=3D (int) (strlen(partno) - 1)=
)
>        ^                                ^    ^^^^^ ^                  ^
>=20
> Btw, that last construct breaks in two cases:
>=20
>   - "partno + 1" is empty: number is left undefined
>   - "partno + 1" is a number > 9: sscanf(...) =3D 1, strlen > 1
>=20
> Do this instead:
>=20
>   int len;
>   ...
>   len =3D strlen(partno) - 1;
>   if (len > 0 && strspn(partno + 1, "0123456789") =3D=3D len)
>     number =3D atoi(partno);
>   else
>     return FALSE;

Thanks.

Joe

--=20
Joe Marcus Clarke
FreeBSD GNOME Team      ::      gnome@FreeBSD.org
FreeNode / #freebsd-gnome
http://www.FreeBSD.org/gnome

--=-DlVcJo+K1ZhpBhG+n/PW
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (FreeBSD)

iD8DBQBFS3gtb2iPiv4Uz4cRAiUaAJ4xSSvI6SDrajDzxYiYUZi+YlAU8wCfU2lJ
uL9GCwDWKD4E5k9nSLWAmic=
=S5RJ
-----END PGP SIGNATURE-----

--=-DlVcJo+K1ZhpBhG+n/PW--




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1162573869.4927.1.camel>