Re: [PATCH 2/3] systemd: Add virSystemdGetMachineNameByPID

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Feb 03, 2016 at 02:28:03PM +0100, Pavel Hrdina wrote:
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.


The rule is more to be consistent than using two lines.  So I'm usually
picking whatever is used the most in that file.  In this one I'd say
it's about 50/50

+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.


That makes it the second function in that file to be formatted like
that, yay! =)

+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.


They are here already, you just removed the line in the reply.

ACK with the formatting fixed.

I didn't necessarily agree, but I want this pushed, so I "fixed" what
you said so I don't need to engage in a discussion about that.  And
pushed the first two patches, I'll send a v2 for the third one.

Attachment: signature.asc
Description: Digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]