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

next in thread | previous in thread | raw e-mail | index | archive | help
--Signature=_Fri__3_Nov_2006_11_04_54_+0100_YP_hp_rP/+I96PRU
Content-Type: text/plain; charset=US-ASCII
Content-Disposition: inline
Content-Transfer-Encoding: 7bit

On Thu, 02 Nov 2006 18:04:17 -0500
Joe Marcus Clarke <marcus@FreeBSD.org> wrote:

> 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 any
> difference is using lshal.  The old output looked something like:
>
> volume.partition.number = 3 (0x3) (int)
> volume.msdos_part_table_type = 165 (0xa5) (int)
>
> The new style looks like this:
>
> volume.partition.start = 18268346880  (0x440e0da00)  (uint64)
> volume.partition.media_size = 61730726400  (0xe5f702200)  (uint64)
> volume.partition.type = '0xa5'  (string)
> volume.partition.scheme = 'mbr'  (string)
> volume.partition.number = 3  (0x3)  (int)
>
> I'd be particularly interested with feedback from those that have gpt or
> 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

Useless elements underlined:

+  if (geom_obj->uuid)
   ^^^^^^^^^^^^^^^^^^^
+    g_free(geom_obj->uuid);
+
+  if (geom_obj->apple_type)
   ^^^^^^^^^^^^^^^^^^^^^^^^^
+    g_free(geom_obj->apple_type);

+  *mediasize = (guint64) hf_probe_volume_getenv_uintmax("HF_VOLUME_SIZE");
                ^^^^^^^^^
+  *offset = (guint64) hf_probe_volume_getenv_uintmax("HF_VOLUME_OFFSET");
             ^^^^^^^^^

+  if ((sscanf(partno + 1, "%i", number)) != (int) (strlen(partno) - 1))
       ^                                ^    ^^^^^ ^                  ^

Btw, that last construct breaks in two cases:

  - "partno + 1" is empty: number is left undefined
  - "partno + 1" is a number > 9: sscanf(...) = 1, strlen > 1

Do this instead:

  int len;
  ...
  len = strlen(partno) - 1;
  if (len > 0 && strspn(partno + 1, "0123456789") == len)
    number = atoi(partno);
  else
    return FALSE;

--
Jean-Yves Lefort

jylefort@FreeBSD.org
http://lefort.be.eu.org/

--Signature=_Fri__3_Nov_2006_11_04_54_+0100_YP_hp_rP/+I96PRU
Content-Type: application/pgp-signature

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

iD8DBQFFSxRHyzD7UaO4AGoRAgl4AJsEw8gYzK6rpl8kv0HwQze1azx9WQCfZJKV
ndhFghTJDRxxrRpO3JWLFps=
=7EIu
-----END PGP SIGNATURE-----

--Signature=_Fri__3_Nov_2006_11_04_54_+0100_YP_hp_rP/+I96PRU--




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