|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH 3/5] xen/sched: retrieve scheduler id by name
Add a public function to retrieve the scheduler id by the scheduler
name.
Signed-off-by: Luca Fancellu <luca.fancellu@xxxxxxx>
---
xen/common/sched/core.c | 11 +++++++++++
xen/include/xen/sched.h | 11 +++++++++++
2 files changed, 22 insertions(+)
diff --git a/xen/common/sched/core.c b/xen/common/sched/core.c
index 8f4b1ca10d1c..9696d3c1d769 100644
--- a/xen/common/sched/core.c
+++ b/xen/common/sched/core.c
@@ -2947,6 +2947,17 @@ void scheduler_enable(void)
scheduler_active = true;
}
+int __init sched_get_id_by_name(const char *sched_name)
+{
+ unsigned int i;
+
+ for ( i = 0; i < NUM_SCHEDULERS; i++ )
+ if ( schedulers[i] && !strcmp(schedulers[i]->opt_name, sched_name) )
+ return schedulers[i]->sched_id;
+
+ return -1;
+}
+
/* Initialise the data structures. */
void __init scheduler_init(void)
{
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index a50df1bccdc0..a67a9eb2fe9d 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -756,6 +756,17 @@ void sched_destroy_domain(struct domain *d);
long sched_adjust(struct domain *, struct xen_domctl_scheduler_op *);
long sched_adjust_global(struct xen_sysctl_scheduler_op *);
int sched_id(void);
+
+/*
+ * sched_get_id_by_name - retrieves a scheduler id given a scheduler name
+ * @sched_name: scheduler name as a string
+ *
+ * returns:
+ * positive value being the scheduler id, on success
+ * negative value if the scheduler name is not found.
+ */
+int sched_get_id_by_name(const char *sched_name);
+
void vcpu_wake(struct vcpu *v);
long vcpu_yield(void);
void vcpu_sleep_nosync(struct vcpu *v);
--
2.17.1
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |