[systemd-devel] [PATCH v2 ] hostnamectl: correct IDs for remote hosts

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Sun Jun 29 04:33:39 PDT 2014


Ping?

On Tue, Jun 03, 2014 at 08:47:37PM +0200, Lennart Poettering wrote:
> On Sun, 01.06.14 20:53, Rico Sagner (sagner at b1-systems.de) wrote:
> 
> >  
> > +static int property_get_machineid(
> > +                sd_bus *bus,
> > +                const char *path,
> > +                const char *interface,
> > +                const char *property,
> > +                sd_bus_message *reply,
> > +                void *userdata,
> > +                sd_bus_error *error) {
> > +
> > +        Manager *m = userdata;
> > +
> > +        assert(bus);
> > +        assert(reply);
> > +        assert(m);
> > +
> > +        return sd_bus_message_append_array(reply, 'y', &m->machineid, 16);
> > +}
> 
> As discussed elsewhere in this thread, we can get rid of this property
> as sd_bus_get_owner_machine_id() already can be used from the client
> side, and we should just use that... Hence we only need the boot id
> property, the machine id property is redundant...
> 
> > +static int property_get_bootid(
> > +                sd_bus *bus,
> > +                const char *path,
> > +                const char *interface,
> > +                const char *property,
> > +                sd_bus_message *reply,
> > +                void *userdata,
> > +                sd_bus_error *error) {
> > +
> > +        Manager *m = userdata;
> > +
> > +        assert(bus);
> > +        assert(reply);
> > +        assert(m);
> > +
> > +        return sd_bus_message_append_array(reply, 'y', &m->bootid, 16);
> > +}
> 
> Please don't cache the boot id. There's no need for that, as
> sd_id128_get_boot() already caches internally... Just call it
> directly here and return what it returns.
> 
> Lennart
> 
> -- 
> Lennart Poettering, Red Hat
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel
> 


More information about the systemd-devel mailing list