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

Re: [Libvir] [PATCH][RFC] shows scheduler information



--- libvirt.orig/src/libvirt.c	2007-04-04 23:19:49.000000000 +0900
+++ libvirt.sched/src/libvirt.c	2007-04-06 14:06:08.000000000 +0900
@@ -1423,6 +1423,113 @@ virConnectGetCapabilities (virConnectPtr
     return NULL;
 }

+/**
+ * virDomainGetSchedulerType:
+ * @dom: pointer to the hypervisor connection
+ *
+ * Get the scheduler type.
+ *
+ * Returns NULL in case of error.
+ */
+const char *
+virDomainGetSchedulerType(virDomainPtr domain, int *nparams)

[...]

 /*
+ * xenHypervisorGetSchedulerType:
+ * @domain: pointer to the Xen Hypervisor block
+ *
+ * Do a low level hypercall to get scheduler type
+ *
+ * Returns scheduler name or NULL in case of failure
+ */
+const char *
+xenHypervisorGetSchedulerType(virDomainPtr domain, int *nparams)
+{
[...]
+        switch (op.u.getschedulerid.sched_id){
+        case XEN_SCHEDULER_SEDF:
+            schedulertype = "sedf";
+            *nparams = 6;
+            break;
+        case XEN_SCHEDULER_CREDIT:
+            schedulertype = "credit";
+            *nparams = 2;
+            break;

Please don't return static strings from functions. It does not work well in the remote case.

I don't like the dynamic typing going on in this patch altogether, but with the above statically allocated strings, I think this patch should not go in in its current form.

Rich.

--
Emerging Technologies, Red Hat  http://et.redhat.com/~rjones/
64 Baker Street, London, W1U 7DF     Mobile: +44 7866 314 421

Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire, SL4 1TE, United Kingdom.
Registered in England and Wales under Company Registration No. 3798903
Directors: Michael Cunningham (USA), Charlie Peters (USA) and David
Owens (Ireland)

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature


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