[Libosinfo] [PATCHv2 01/11] media: API to get/set ISO9660 volume size

Christophe Fergeau cfergeau at redhat.com
Tue Mar 17 15:44:20 UTC 2015


On Tue, Mar 17, 2015 at 02:43:51PM +0000, Zeeshan Ali (Khattak) wrote:
> ---
>  osinfo/libosinfo.syms |  5 +++++
>  osinfo/osinfo_media.c | 43 +++++++++++++++++++++++++++++++++++++++++++
>  osinfo/osinfo_media.h |  2 ++
>  3 files changed, 50 insertions(+)
> 
> diff --git a/osinfo/libosinfo.syms b/osinfo/libosinfo.syms
> index 5c423b9..2dba411 100644
> --- a/osinfo/libosinfo.syms
> +++ b/osinfo/libosinfo.syms
> @@ -505,6 +505,11 @@ LIBOSINFO_0.2.11 {
>  	osinfo_install_script_get_needs_internet;
>  } LIBOSINFO_0.2.10;
>  
> +LIBOSINFO_0.2.12 {
> +    global:
> +	osinfo_media_get_volume_size;
> +} LIBOSINFO_0.2.11;
> +
>  /* Symbols in next release...
>  
>    LIBOSINFO_0.0.2 {
> diff --git a/osinfo/osinfo_media.c b/osinfo/osinfo_media.c
> index 96f9603..86bfe58 100644
> --- a/osinfo/osinfo_media.c
> +++ b/osinfo/osinfo_media.c
> @@ -156,6 +156,7 @@ enum {
>      PROP_INSTALLER_REBOOTS,
>      PROP_OS,
>      PROP_LANGUAGES,
> +    PROP_VOLUME_SIZE
>  };
>  
>  static void
> @@ -230,6 +231,11 @@ osinfo_media_get_property(GObject    *object,
>          g_value_set_pointer(value, osinfo_media_get_languages(media));
>          break;
>  
> +    case PROP_VOLUME_SIZE:
> +        g_value_set_int64(value,
> +                          osinfo_media_get_volume_size(media));
> +        break;
> +
>      default:
>          /* We don't have any other property... */
>          G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
> @@ -320,6 +326,12 @@ osinfo_media_set_property(GObject      *object,
>          osinfo_media_set_languages(media, g_value_get_pointer(value));
>          break;
>  
> +    case PROP_VOLUME_SIZE:
> +        osinfo_entity_set_param_int64(OSINFO_ENTITY(media),
> +                                      OSINFO_MEDIA_PROP_VOLUME_SIZE,
> +                                      g_value_get_int64(value));
> +        break;
> +
>      default:
>          /* We don't have any other property... */
>          G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
> @@ -547,6 +559,21 @@ osinfo_media_class_init(OsinfoMediaClass *klass)
>                                   G_PARAM_READABLE |
>                                   G_PARAM_STATIC_STRINGS);
>      g_object_class_install_property(g_klass, PROP_LANGUAGES, pspec);
> +
> +    /**
> +     * OsinfoMedia:volume-size:
> +     *
> +     * Expected volume size, in bytes for ISO9660 image/device.
> +     */
> +    pspec = g_param_spec_int64("volume-size",
> +                               "VolumeSize",
> +                               _("Expected ISO9660 volume size, in bytes"),
> +                               G_MININT,
> +                               G_MAXINT64,
> +                               -1 /* default value */,
> +                               G_PARAM_READWRITE |
> +                               G_PARAM_STATIC_STRINGS);
> +    g_object_class_install_property(g_klass, PROP_VOLUME_SIZE, pspec);
>  }
>  
>  static void
> @@ -1217,6 +1244,22 @@ void osinfo_media_set_languages(OsinfoMedia *media, GList *languages)
>                                  OSINFO_MEDIA_PROP_LANG,
>                                  it->data);
>  }
> +
> +/**
> + * osinfo_media_get_volume_size:
> + * @media: an #OsinfoMedia instance
> + *
> + * Returns: (transfer none): the ISO9660 volume size, in bytes or -1 if size is
> + * unknown or media is not a ISO9660 device/image.


Nit: an ISO9660 device/image.

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libosinfo/attachments/20150317/b6cbb90a/attachment.sig>


More information about the Libosinfo mailing list