On Tue, Feb 02, 2016 at 09:22:48PM +0100, Martin Kletzander wrote: > Signed-off-by: Martin Kletzander <mkletzan@xxxxxxxxxx> > --- > src/libvirt_private.syms | 1 + > src/util/virsystemd.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++++ > src/util/virsystemd.h | 2 ++ > tests/virsystemdtest.c | 44 ++++++++++++++++++++++++++++++++++++++++ > 4 files changed, 100 insertions(+) > > diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms > index 3d0ec9d786b6..e2d552e0193d 100644 > --- a/src/libvirt_private.syms > +++ b/src/libvirt_private.syms > @@ -2273,6 +2273,7 @@ virSystemdCanHibernate; > virSystemdCanHybridSleep; > virSystemdCanSuspend; > virSystemdCreateMachine; > +virSystemdGetMachineNameByPID; > virSystemdMakeMachineName; > virSystemdMakeScopeName; > virSystemdMakeSliceName; > diff --git a/src/util/virsystemd.c b/src/util/virsystemd.c > index abd883c73844..3349d95a4597 100644 > --- a/src/util/virsystemd.c > +++ b/src/util/virsystemd.c > @@ -139,6 +139,59 @@ char *virSystemdMakeMachineName(const char *name, > return machinename; > } > I know that this file doesn't follow this unwritten rule, but we tend to place two empty lines between functions. > +char * > +virSystemdGetMachineNameByPID(pid_t pid) > +{ > + DBusConnection *conn; > + DBusMessage *reply; > + char *name = NULL, *object = NULL; [...] > + cleanup: > + VIR_FREE(object); > + dbus_message_unref(reply); > + > + return name; > +} > + Same here. [...] > @@ -337,6 +362,23 @@ static int testCreateNetwork(const void *opaque ATTRIBUTE_UNUSED) > return 0; > } > Here too, and also place the return type on separate line. > +static int testGetMachineName(const void *opaque ATTRIBUTE_UNUSED) > +{ > + char *tmp = virSystemdGetMachineNameByPID(1234); > + int ret = -1; > + > + if (!tmp) { > + fprintf(stderr, "%s", "Failed to create LXC machine\n"); > + return ret; > + } > + > + if (STREQ(tmp, "qemu-demo")) > + ret = 0; > + > + VIR_FREE(tmp); > + return ret; > +} > + And here. ACK with the formatting fixed. -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list