Re: [PATCH v2 2/6] conf: Format thread IDs optionally

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

 



On Mon, Apr 15, 2019 at 03:58:05PM +0200, Ján Tomko wrote:
On Mon, Apr 15, 2019 at 03:14:23PM +0200, Martin Kletzander wrote:
This will be used later when we want to format emulator scheduler parameters
which don't apply for multiple threads.

Signed-off-by: Martin Kletzander <mkletzan@xxxxxxxxxx>

squash! conf: Do not format negative thread IDs

Signed-off-by: Martin Kletzander <mkletzan@xxxxxxxxxx>

Rebase artifacts.


Yep, thanks, fixed locally.

---
src/conf/domain_conf.c | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 15838c2a23f5..e7b8b51aad0e 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -27205,22 +27205,25 @@ static void
virDomainSchedulerFormat(virBufferPtr buf,
                         const char *name,
                         virDomainThreadSchedParamPtr sched,
-                         size_t id)
+                         size_t id,
+                         bool multiple_threads)
{
    switch (sched->policy) {
        case VIR_PROC_POLICY_BATCH:
        case VIR_PROC_POLICY_IDLE:
-            virBufferAsprintf(buf, "<%ssched "
-                              "%ss='%zu' scheduler='%s'/>\n",
-                              name, name, id,
+            virBufferAsprintf(buf, "<%ssched", name);
+            if (multiple_threads)
+                virBufferAsprintf(buf, " %ss='%zu'", name, id);
+            virBufferAsprintf(buf, " scheduler='%s'/>\n",
                              virProcessSchedPolicyTypeToString(sched->policy));
            break;

        case VIR_PROC_POLICY_RR:
        case VIR_PROC_POLICY_FIFO:
-            virBufferAsprintf(buf, "<%ssched "
-                              "%ss='%zu' scheduler='%s' priority='%d'/>\n",
-                              name, name, id,
+            virBufferAsprintf(buf, "<%ssched", name);
+            if (multiple_threads)
+                virBufferAsprintf(buf, " %ss='%zu'", name, id);
+            virBufferAsprintf(buf, " scheduler='%s' priority='%d'/>\n",
                              virProcessSchedPolicyTypeToString(sched->policy),
                              sched->priority);

This function would look nicer with a temporary attrBuf and a virXMLFormatElement
at the end.


Would it? I don't really see how.  If you do, please show me.

Jano

            break;


Attachment: signature.asc
Description: PGP 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]

  Powered by Linux