[Linux-hls-cvs] hls/linux bottom.h,NONE,1.1 procfs.h,NONE,1.1 bottom.c,1.8,1.9 hls_ctl.c,1.7,1.8 hls
Status: Pre-Alpha
Brought to you by:
lucabe
|
From: <lu...@us...> - 2003-11-08 10:34:36
|
Update of /cvsroot/linux-hls/hls/linux
In directory sc8-pr-cvs1:/tmp/cvs-serv6094/linux
Modified Files:
bottom.c hls_ctl.c hls_timers.c init.c procfs.c
Added Files:
bottom.h procfs.h
Log Message:
Lot of changes....
- Unbreak the debugging stuff
- Some random cleanups
- Fixes in the RR scheduler (I hope... MAXIMUM_PRIORITY does not seem to be
a valid priority)
- Allow the RES scheduler to be scheduled (there's a fixme: some functions
still have to be properly implemented)
- change Q e T from long long to long in the RES scheduler
- Implement the "rt scheduler" stuff
--- NEW FILE: bottom.h ---
#ifndef __BOTTOM_H__
#define __BOTTOM_H__
extern void hls_bottom_vp_request(struct task_struct *t);
extern void hls_bottom_vp_release(struct task_struct *t);
extern void hls_bottom_vp_register(struct task_struct *t);
extern void hls_bottom_vp_unregister(struct task_struct *t);
#endif /* __BOTTOM_H__ */
--- NEW FILE: procfs.h ---
#ifndef __PROCFS_H__
#define __PROCFS_H__
int hls_proc_init(void);
void hls_proc_cleanup(void);
#endif /* __PROCFS_H__ */
Index: bottom.c
===================================================================
RCS file: /cvsroot/linux-hls/hls/linux/bottom.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** bottom.c 28 Aug 2003 19:52:23 -0000 1.8
--- bottom.c 8 Nov 2003 10:34:32 -0000 1.9
***************
*** 16,21 ****
#include <linux/sched.h>
! #include <hls.h>
! #include <interface-data.h>
#ifndef CONFIG_GENERIC_SCHEDULER
--- 16,24 ----
#include <linux/sched.h>
! #include "data.h"
! #include "interface-data.h"
! #include "hls_hooks.h"
! #include "bottom.h"
! #include "hls_internal.h"
#ifndef CONFIG_GENERIC_SCHEDULER
***************
*** 25,39 ****
/* #define VERBOSE1 */
- struct hls_sched_param {
- struct sched_param sp;
- int size;
- void *p;
- };
-
- extern void HLSCreateThreadHook (struct task_struct *thread, long state);
- extern void HLSExitThreadHook (struct task_struct *thread);
- extern void HLSUnblockThreadHook (struct task_struct *thread);
- extern void HLSBlockThreadHook (struct task_struct *thread);
- extern int hls_ctl(struct task_struct *t, struct hls_param *p, int hls_priority);
struct HLS_PROC {
void *CurrentThread;
--- 28,31 ----
***************
*** 46,52 ****
--- 38,50 ----
spinlock_t hls_lock __cacheline_aligned = SPIN_LOCK_UNLOCKED; /* inner */
+ static int wup, lastt;
+ extern int whereami;
+
void show_tasks(void);
void HLSScheduleThread(struct task_struct *t, unsigned long proc)
{
+ int sched_non_running;
+
+ sched_non_running = 0;
if (my_current[proc] != NULL) {
struct task_struct *c;
***************
*** 74,77 ****
--- 72,76 ----
/* Do we have a new task to schedule? */
if (t != NULL) {
+ sched_non_running = (t->state != TASK_RUNNING);
if(t->policy != SCHED_FIFO) {
printk("HLS ERROR: Scheduling an HLS task with policy != SCHED_FIFO...\n");
***************
*** 83,88 ****
--- 82,89 ----
t->rt_priority = HLS_SCHEDULING_PRIORITY;
HLSProc[proc].CurrentThread = t->private_data;
+ wup = t->pid;
} else {
HLSProc[proc].CurrentThread = NULL;
+ wup = -1;
}
***************
*** 90,93 ****
--- 91,100 ----
show_tasks();
+ lastt = wup;
+
+ if (sched_non_running) {
+ printk("HLS ERROR: Trying to schedule %d with state = %ld\n",
+ t->pid, t->state);
+ }
}
***************
*** 225,230 ****
if (t->rt_priority == HLS_SCHEDULING_PRIORITY) {
if (t->state != TASK_RUNNING) {
! printk("HLS ERROR: Task %d has rt_priority = %ld and state = %ld\n",
! t->pid, t->rt_priority, t->state);
hls_printk("HLS ERROR: Task %d has rt_priority = %ld and state = %ld\n",
t->pid, t->rt_priority, t->state);
--- 232,238 ----
if (t->rt_priority == HLS_SCHEDULING_PRIORITY) {
if (t->state != TASK_RUNNING) {
! printk("HLS ERROR: Task %d has rt_priority = %ld and state = %ld --- WAI = %d WUP = %d Last = %d\n",
! t->pid, t->rt_priority, t->state,
! whereami, wup, lastt);
hls_printk("HLS ERROR: Task %d has rt_priority = %ld and state = %ld\n",
t->pid, t->rt_priority, t->state);
***************
*** 280,371 ****
}
#endif
- }
-
- static inline struct task_struct *find_process_by_pid(pid_t pid)
- {
- struct task_struct *tsk = current;
-
- if (pid) {
- tsk = find_task_by_pid(pid);
- }
-
- return tsk;
- }
-
-
- /* Return value:
- * < 0 ---> Failure
- * = 0 ---> Success
- * > 0 ---> do the regular Linux thing...
- */
- int hls_setsched(pid_t pid, int policy, struct sched_param *param)
- {
- struct task_struct *p;
- struct hls_param hls_p;
- struct hls_sched_param sched_p;
- unsigned long flags;
- int res;
-
- spin_lock_irqsave(&hls_lock, flags);
- p = find_process_by_pid(pid);
- if (p == NULL) {
- spin_unlock_irqrestore(&hls_lock, flags);
- return -ESRCH;
- }
- if (policy != SCHED_HLS) {
- if (p->private_data != NULL) {
- #ifdef NOLINUX_TASKS
- printk("Policy %d != SCHED_HLS. Doing nothing...\n", policy);
- #else
- HLSExitThreadHook(p);
- p->policy = SCHED_OTHER;
- p->private_data = NULL;
- #endif
- }
-
- spin_unlock_irqrestore(&hls_lock, flags);
-
- return 1;
- }
-
- if (copy_from_user(&sched_p, param, sizeof(struct hls_sched_param)) < 0) {
- spin_unlock_irqrestore(&hls_lock, flags);
-
- return -EFAULT;
- }
- if (sizeof(struct hls_param) != sched_p.size) {
- spin_unlock_irqrestore(&hls_lock, flags);
-
- return -EFAULT;
- }
- if (copy_from_user(&hls_p, sched_p.p, sizeof(struct hls_param)) < 0) {
- spin_unlock_irqrestore(&hls_lock, flags);
-
- return -EFAULT;
- }
- /* Extra consinstency check... */
- if (hls_p.signature != HLS_SIGNATURE) {
- spin_unlock_irqrestore(&hls_lock, flags);
-
- return -EFAULT;
- }
-
- if (p->private_data == NULL) {
- printk("HLS Error: %d has private_data = NULL???\n", p->pid);
- #ifdef NOLINUX_TASKS
- spin_unlock_irqrestore(&hls_lock, flags);
-
- return -EINVAL;
- #else
- p->policy = SCHED_FIFO;
- p->rt_priority = HLS_IDLE_PRIORITY;
- HLSCreateThreadHook(p, p->state);
- #endif
- }
-
- res = hls_ctl(p, &hls_p, sched_p.sp.sched_priority);
-
- spin_unlock_irqrestore(&hls_lock, flags);
-
- return res;
}
--- 288,290 ----
Index: hls_ctl.c
===================================================================
RCS file: /cvsroot/linux-hls/hls/linux/hls_ctl.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** hls_ctl.c 27 Aug 2003 17:52:00 -0000 1.7
--- hls_ctl.c 8 Nov 2003 10:34:32 -0000 1.8
***************
*** 15,18 ****
--- 15,35 ----
#include "thr.h"
#include "hls.h"
+ #include "hls_hooks.h"
+
+
+ #define NOLINUX_TASKS
+
+ #define HLS_NAME_SIZE 256
+ #define HLS_PARMS_SIZE 256
+
+ struct hls_sched_param {
+ struct sched_param sp;
+ int size;
+ void *p;
+ };
+
+ extern spinlock_t hls_lock;
+
+
static int hls_setparam(struct HLS_VPROC *vp, void *sched_params, int prio)
***************
*** 23,28 ****
NewMsg.ObjType = RRMsgValue;
#endif
- NewMsg.type = MSG_SETPARAMS;
NewMsg.body = sched_params;
NewMsg.Pri = prio;
--- 40,49 ----
NewMsg.ObjType = RRMsgValue;
#endif
NewMsg.body = sched_params;
+ if (sched_params == NULL) {
+ NewMsg.type = MSG_SETPRI;
+ } else {
+ NewMsg.type = MSG_SETPARAMS;
+ }
NewMsg.Pri = prio;
***************
*** 138,176 ****
!
! int hls_ctl(PRKTHREAD t, struct hls_param *p, int hls_priority)
{
int status;
! char sched_name[255];
! char sched_param[255];
void *s_p;
struct HLS_SCHED_INSTANCE *target_sched;
struct TH_INSTANCE_DATA *th;
int state;
if (p->command == HLS_CMD_NULL_MSG) {
return hls_null_msg(t);
}
! if (p->sched_data_size > 255) {
! return -EFAULT;
! }
! if ((p->sched_data_size == 0)) {
! s_p = NULL;
! } else {
! if (copy_from_user(sched_param, p->sched_data, p->sched_data_size) < 0) {
!
! return -EFAULT;
! }
! s_p = &sched_param;
! }
!
! /* Find the scheduler */
! memset(sched_name, 0, 255);
! if (copy_from_user(sched_name, p->scheduler, strlen(p->scheduler)) < 0) {
!
! return -EFAULT;
! }
!
target_sched = HLSFindInstByName(sched_name);
if (!target_sched) {
--- 159,183 ----
! /* TODO:
! * - in hls_ctl, Change hls_param *p ---> void *sp, HLS_SCHED_INSTANCE *target_sched
! * - add an hls_do_something_to_user_parms to get those vales...
! */
! int hls_ctl(PRKTHREAD t, struct HLS_SCHED_INSTANCE *target_sched, void *s_p, int hls_priority)
{
int status;
! /*
void *s_p;
struct HLS_SCHED_INSTANCE *target_sched;
+ */
struct TH_INSTANCE_DATA *th;
int state;
+ #if 0
if (p->command == HLS_CMD_NULL_MSG) {
return hls_null_msg(t);
}
+ #endif
! #if 0
target_sched = HLSFindInstByName(sched_name);
if (!target_sched) {
***************
*** 178,181 ****
--- 185,189 ----
return -EINVAL;
}
+ #endif
/* Find the task instance */
***************
*** 190,194 ****
/* Yes: We simply do a setparm */
HLSDbgPrint (9, ("(infr) hls_ctl: %s is already scheduled by %s; trying to update params\n",
! ThreadStr(t), sched_name));
status = hls_setparam(th->vp, s_p, hls_priority);
if (status == HLS_SUCCESS) {
--- 198,202 ----
/* Yes: We simply do a setparm */
HLSDbgPrint (9, ("(infr) hls_ctl: %s is already scheduled by %s; trying to update params\n",
! ThreadStr(t), target_sched->Name));
status = hls_setparam(th->vp, s_p, hls_priority);
if (status == HLS_SUCCESS) {
***************
*** 200,209 ****
/* We have to move to the new scheduler... */
! hls_printk("hls_ctl: Moving to %s\n", sched_name);
state = hls_thread_move(t, target_sched);
if (state < 0) {
return -EINVAL;
}
hls_printk(" ...and setting the parameters!\n");
status = hls_setparam(th->vp, s_p, hls_priority);
if (status == HLS_SUCCESS) {
--- 208,221 ----
/* We have to move to the new scheduler... */
! #ifdef HLS_DEBUG
! hls_printk("hls_ctl: Moving to %s\n", target_sched->Name);
! #endif
state = hls_thread_move(t, target_sched);
if (state < 0) {
return -EINVAL;
}
+ #ifdef HLS_DEBUG
hls_printk(" ...and setting the parameters!\n");
+ #endif
status = hls_setparam(th->vp, s_p, hls_priority);
if (status == HLS_SUCCESS) {
***************
*** 222,223 ****
--- 234,423 ----
return 0;
}
+
+ static int hls_parse_param(void *p, struct HLS_SCHED_INSTANCE **sched, void *parms)
+ {
+ struct hls_sched_param sched_p;
+ struct hls_param hls_p;
+ static char sched_name[HLS_NAME_SIZE];
+
+ if (copy_from_user(&sched_p, p, sizeof(struct hls_sched_param)) < 0) {
+
+ return -EFAULT;
+ }
+ if (sizeof(struct hls_param) != sched_p.size) {
+
+ return -EFAULT;
+ }
+ if (copy_from_user(&hls_p, sched_p.p, sizeof(struct hls_param)) < 0) {
+
+ return -EFAULT;
+ }
+ /* Extra consinstency check... */
+ if (hls_p.signature != HLS_SIGNATURE) {
+
+ return -EFAULT;
+ }
+
+ if (hls_p.sched_data_size > HLS_PARMS_SIZE) {
+ return -EFAULT;
+ }
+ if (hls_p.sched_data_size == 0) {
+ memset(parms, 0, HLS_PARMS_SIZE);
+ } else {
+ if (copy_from_user(parms, hls_p.sched_data, hls_p.sched_data_size) < 0) {
+
+ return -EFAULT;
+ }
+ }
+
+ /* Check if there is room for the scheduler's name... */
+ if (strlen(hls_p.scheduler) > HLS_NAME_SIZE) {
+ return -EINVAL;
+ }
+
+ /* ...And get it!!! */
+ memset(sched_name, 0, HLS_NAME_SIZE);
+ if (copy_from_user(sched_name, hls_p.scheduler, strlen(hls_p.scheduler)) < 0) {
+
+ return -EFAULT;
+ }
+ *sched = HLSFindInstByName(sched_name);
+ if (!*sched) {
+ printk("Cannot find scheduler %s\n", sched_name);
+
+ return -EINVAL;
+ }
+
+ return sched_p.sp.sched_priority;
+ }
+
+ static int hls_parse_priority(void *p)
+ {
+ struct hls_sched_param sched_p;
+
+ if (copy_from_user(&sched_p, p, sizeof(struct hls_sched_param)) < 0) {
+
+ return -EFAULT;
+ }
+
+ return sched_p.sp.sched_priority;
+ }
+
+ static inline struct task_struct *find_process_by_pid(pid_t pid)
+ {
+ struct task_struct *tsk = current;
+
+ if (pid) {
+ tsk = find_task_by_pid(pid);
+ }
+
+ return tsk;
+ }
+
+
+ /* Return value:
+ * < 0 ---> Failure
+ * = 0 ---> Success
+ * > 0 ---> do the regular Linux thing...
+ */
+ int hls_setsched(pid_t pid, int policy, struct sched_param *param)
+ {
+ struct task_struct *p;
+ unsigned long flags;
+ char sp[HLS_PARMS_SIZE];
+ char *sched_param = NULL;
+ struct HLS_SCHED_INSTANCE *s;
+ int res;
+ int priority = HLS_DEFAULT_PRIORITY;
+ int return_to_linux;
+
+ spin_lock_irqsave(&hls_lock, flags);
+ p = find_process_by_pid(pid);
+ if (p == NULL) {
+ spin_unlock_irqrestore(&hls_lock, flags);
+ return -ESRCH;
+ }
+
+ return_to_linux = -1;
+ if (policy != SCHED_HLS) {
+ if (policy == SCHED_OTHER) {
+ if (p->private_data != NULL) {
+ #ifdef NOLINUX_TASKS
+ s = HLSDefaultSched;
+ priority = HLS_DEFAULT_PRIORITY;
+ #else
+ HLSExitThreadHook(p);
+ p->policy = SCHED_OTHER;
+ p->private_data = NULL;
+ /* We return to use the linux scheduler...
+ * No need to set s & sched_param
+ */
+ return_to_linux = 1;
+ #endif
+ } else {
+ /* Private data == NULL...
+ * - If NOLINUX_TASKS, transform in HLS
+ * - Otherwise, do nothing
+ */
+ #ifdef NOLINUX_TASKS
+ p->policy = SCHED_FIFO;
+ p->rt_priority = HLS_IDLE_PRIORITY;
+ HLSCreateThreadHook(p, p->state);
+ #else
+ printk("Policy %d != SCHED_HLS. Doing nothing... (already non-hls)\n", policy);
+ #endif
+ /* We do not need to call hls_ctl...
+ * No need to set s & sched_param
+ */
+ return_to_linux = 0;
+ }
+ } else {
+ if (p->private_data == NULL) {
+ /* Transform in HLS */
+ p->policy = SCHED_FIFO;
+ p->rt_priority = HLS_IDLE_PRIORITY;
+ HLSCreateThreadHook(p, p->state);
+ }
+ /* Change scheduler to rt_sched */
+ priority = hls_parse_priority(param);
+ s = hls_rt_sched;
+ if (priority >= HLS_MAXIMUM_PRIORITY) {
+ priority = HLS_MAXIMUM_PRIORITY - 1;
+ }
+ }
+
+ if (return_to_linux >= 0) {
+ spin_unlock_irqrestore(&hls_lock, flags);
+
+ return return_to_linux;
+ }
+ } else {
+ priority = hls_parse_param(param, &s, sp);
+ sched_param = sp;
+ if (priority < 0) {
+ spin_unlock_irqrestore(&hls_lock, flags);
+
+ return priority;
+ }
+ }
+
+ if (p->private_data == NULL) {
+ printk("HLS Error: %d has private_data = NULL???\n", p->pid);
+ #ifdef NOLINUX_TASKS
+ spin_unlock_irqrestore(&hls_lock, flags);
+
+ return -EINVAL;
+ #else
+ p->policy = SCHED_FIFO;
+ p->rt_priority = HLS_IDLE_PRIORITY;
+ HLSCreateThreadHook(p, p->state);
+ #endif
+ }
+
+ res = hls_ctl(p, s, sched_param, priority);
+
+ spin_unlock_irqrestore(&hls_lock, flags);
+
+ return res;
+ }
+
Index: hls_timers.c
===================================================================
RCS file: /cvsroot/linux-hls/hls/linux/hls_timers.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** hls_timers.c 25 Feb 2003 09:18:55 -0000 1.5
--- hls_timers.c 8 Nov 2003 10:34:32 -0000 1.6
***************
*** 2,6 ****
* Copyright (c) 2002 Luca Abeni & John Regehr
*
! * Module Name: hls_ctl.c
* Abstract: Kernel-dependent part of the timers mechanism.
* Author: Luca Abeni 2002, John Regehr 2000
--- 2,6 ----
* Copyright (c) 2002 Luca Abeni & John Regehr
*
! * Module Name: hls_timers.c
* Abstract: Kernel-dependent part of the timers mechanism.
* Author: Luca Abeni 2002, John Regehr 2000
***************
*** 20,28 ****
struct HLS_SCHED_INSTANCE *Sched;
! /*
! #ifdef __DO_CLI__
spin_lock_irqsave(&hls_lock, flags);
#endif
- */
Sched = (struct HLS_SCHED_INSTANCE *) arg;
--- 20,26 ----
struct HLS_SCHED_INSTANCE *Sched;
! #ifdef __DO_CLI1__
spin_lock_irqsave(&hls_lock, flags);
#endif
Sched = (struct HLS_SCHED_INSTANCE *) arg;
***************
*** 32,40 ****
Sched->CB->I_TimerCallback(Sched);
! /*
! #ifdef __DO_CLI__
spin_unlock_irqrestore(&hls_lock, flags);
#endif
- */
}
--- 30,36 ----
Sched->CB->I_TimerCallback(Sched);
! #ifdef __DO_CLI1__
spin_unlock_irqrestore(&hls_lock, flags);
#endif
}
***************
*** 48,51 ****
--- 44,56 ----
_int64 T;
+ /* Timer debugging stuff... */
+ if (timer_pending(&Sched->HLSTimer)) {
+ /* ERROR!!! Timer Posted twice! */
+ extern int whereami;
+ hls_hard_printk("HLS ERROR: Scheduler %s posted a timer twice!!! WAI = %d\n",
+ Sched->Name, whereami);
+ return;
+ }
+
T = -T1;
if (T < 0) {
Index: init.c
===================================================================
RCS file: /cvsroot/linux-hls/hls/linux/init.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** init.c 25 Feb 2003 09:18:55 -0000 1.6
--- init.c 8 Nov 2003 10:34:32 -0000 1.7
***************
*** 20,24 ****
#include <linux/sched.h>
! #include <hls.h>
#ifndef CONFIG_GENERIC_SCHEDULER
--- 20,28 ----
#include <linux/sched.h>
! #include <data.h>
!
! #include "hls_hooks.h"
! #include "bottom.h"
! #include "procfs.h"
#ifndef CONFIG_GENERIC_SCHEDULER
***************
*** 35,48 ****
MODULE_LICENSE("GPL");
- extern void hls_bottom_vp_request(struct task_struct *t);
- extern void hls_bottom_vp_release(struct task_struct *t);
- extern void hls_bottom_vp_register(struct task_struct *t);
- extern void hls_bottom_vp_unregister(struct task_struct *t);
int hls_setsched(pid_t pid, int policy, struct sched_param *param);
- extern void HLSCreateThreadHook (struct task_struct *Thread, long int State);
- extern void HLSExitThreadHook (struct task_struct *Thread);
- extern void HLSUnblockThreadHook (struct task_struct *Thread);
-
extern void HLSInit(void);
--- 39,44 ----
***************
*** 51,55 ****
extern spinlock_t hls_lock;
! void convert_tasks(void)
{
struct task_struct *t;
--- 47,51 ----
extern spinlock_t hls_lock;
! void hls_convert_tasks(void)
{
struct task_struct *t;
***************
*** 163,167 ****
*/
#ifdef __CREATE_HIERARCHY__
! convert_tasks();
#endif
--- 159,163 ----
*/
#ifdef __CREATE_HIERARCHY__
! hls_convert_tasks();
#endif
Index: procfs.c
===================================================================
RCS file: /cvsroot/linux-hls/hls/linux/procfs.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** procfs.c 25 Feb 2003 09:18:55 -0000 1.6
--- procfs.c 8 Nov 2003 10:34:32 -0000 1.7
***************
*** 22,27 ****
#include <linux/slab.h>
static struct proc_dir_entry *hls_dir, *schedulers_file,
! *instances_file, *tasks_file, *default_file;
extern char *hls_scheduler_name(int i);
--- 22,33 ----
#include <linux/slab.h>
+ #include "data.h"
+ #include "interface-data.h"
+ #include <hls_internal.h>
+
+ #include "procfs.h"
+
static struct proc_dir_entry *hls_dir, *schedulers_file,
! *instances_file, *tasks_file, *default_file, *rt_file;
extern char *hls_scheduler_name(int i);
***************
*** 29,40 ****
extern char *hls_instance_scheduler(int i);
extern char *hls_instance_father(int i);
- extern char *hls_default_name(void);
extern struct HLS_SCHED_INSTANCE *HLSFindInstByName (char *Name);
extern struct HLS_SCHED_INSTANCE *HLSNewSchedInstance(char *SchedName,
char *InstName, struct HLS_SCHED_INSTANCE *Parent);
- extern void hls_setdefault(void *p);
extern void SetDefPriForSched(char Pri, struct HLS_SCHED_INSTANCE *Inst);
extern int hls_setparam_ascii(struct HLS_SCHED_INSTANCE *inst, char *param);
static int hls_proc_read_default(char *p, char **s, off_t o,
int c, int *eof, void *dummy)
--- 35,81 ----
extern char *hls_instance_scheduler(int i);
extern char *hls_instance_father(int i);
extern struct HLS_SCHED_INSTANCE *HLSFindInstByName (char *Name);
extern struct HLS_SCHED_INSTANCE *HLSNewSchedInstance(char *SchedName,
char *InstName, struct HLS_SCHED_INSTANCE *Parent);
extern void SetDefPriForSched(char Pri, struct HLS_SCHED_INSTANCE *Inst);
extern int hls_setparam_ascii(struct HLS_SCHED_INSTANCE *inst, char *param);
+ static int hls_proc_read_rt(char *p, char **s, off_t o,
+ int c, int *eof, void *dummy)
+ {
+ char *name;
+ int len;
+
+ name = hls_rt_name();
+ #if (HLS_DEBUG > 0)
+ printk("Read %s (%d)\n", name, strlen(name));
+ #endif
+ len = strlen(name) + 1;
+ strcpy(p, name);
+
+ return len;
+ }
+ static int hls_proc_write_rt(struct file *f, const char *b,
+ unsigned long c, void *dummy)
+ {
+ void *sched;
+ char schedname[16];
+
+ memcpy(schedname, b, c);
+ schedname[c - 1] = 0;
+
+ sched = HLSFindInstByName(schedname);
+
+ if (sched == NULL) {
+ printk("Cannot find %s\n", schedname);
+
+ return c;
+ }
+
+ hls_setrt(sched);
+
+ return c;
+ }
+
static int hls_proc_read_default(char *p, char **s, off_t o,
int c, int *eof, void *dummy)
***************
*** 44,48 ****
--- 85,91 ----
name = hls_default_name();
+ #if (HLS_DEBUG > 0)
printk("Read %s (%d)\n", name, strlen(name));
+ #endif
len = strlen(name) + 1;
strcpy(p, name);
***************
*** 103,111 ****
memcpy(mybuff, b, c);
mybuff[c - 1] = 0;
printk("ProcFSed %s\n", mybuff);
sscanf(mybuff, "%s %s %s %n", instname, schedname, fathername, &len);
printk("Creating %s of type %s and father %s\n", instname, schedname, fathername);
!
father_sched = HLSFindInstByName(fathername);
if (father_sched == NULL) {
--- 146,158 ----
memcpy(mybuff, b, c);
mybuff[c - 1] = 0;
+ #if (HLS_DEBUG > 0)
printk("ProcFSed %s\n", mybuff);
+ #endif
sscanf(mybuff, "%s %s %s %n", instname, schedname, fathername, &len);
+ #if (HLS_DEBUG > 0)
printk("Creating %s of type %s and father %s\n", instname, schedname, fathername);
! #endif
!
father_sched = HLSFindInstByName(fathername);
if (father_sched == NULL) {
***************
*** 125,129 ****
--- 172,178 ----
if ((len > 0) && (len < c)) {
+ #if (HLS_DEBUG > 0)
printk("Read %d: remains %s\n", len, mybuff + len);
+ #endif
res = hls_setparam_ascii(new_instance, mybuff + len);
if (res < 0) {
***************
*** 225,228 ****
--- 274,292 ----
default_file->owner = THIS_MODULE;
+ rt_file = create_proc_entry("rt", 0644, hls_dir);
+ if(rt_file == NULL) {
+ remove_proc_entry("default", hls_dir);
+ remove_proc_entry("tasks", hls_dir);
+ remove_proc_entry("instances", hls_dir);
+ remove_proc_entry("schedulers", hls_dir);
+ remove_proc_entry("HLS", NULL);
+
+ return -ENOMEM;
+ }
+ rt_file->data = NULL;
+ rt_file->read_proc = hls_proc_read_rt;
+ rt_file->write_proc = hls_proc_write_rt;
+ rt_file->owner = THIS_MODULE;
+
return 0;
}
***************
*** 230,233 ****
--- 294,298 ----
void hls_proc_cleanup(void)
{
+ remove_proc_entry("rt", hls_dir);
remove_proc_entry("default", hls_dir);
remove_proc_entry("tasks", hls_dir);
|