00001 00020 #ifndef __QRES_INTERFACE_H__ 00021 #define __QRES_INTERFACE_H__ 00022 00023 #include "qres_gw.h" 00024 #include "qsup.h" 00025 #include <linux/aquosa/qos_debug.h> 00026 #include <linux/aquosa/rres_interface.h> 00027 #include <linux/aquosa/rres_kpi_protected.h> 00028 00041 typedef struct qres_server { 00042 server_t rres; 00043 #ifdef QRES_ENABLE_QSUP 00044 qsup_server_t qsup; 00045 #endif 00046 qres_params_t params; 00047 kal_uid_t owner_uid; 00048 kal_gid_t owner_gid; 00049 } qres_server_t; 00050 00051 static inline qres_server_t *qres_find_by_rres(server_t *srv) { 00052 qres_server_t *qres = (qres_server_t *) NULL; 00053 unsigned long rres_offset = ((unsigned long) &qres->rres) - ((unsigned long) qres); 00054 qos_chk((qres_server_t *) (((unsigned long) srv) - rres_offset) == (qres_server_t *) srv); 00055 return (qres_server_t *) (((unsigned long) srv) - rres_offset); 00056 } 00057 00058 /* 00059 * Synchronization management 00060 */ 00061 00071 static inline kal_lock_t *qres_get_lock(void) { 00072 return rres_get_spinlock(); 00073 } 00074 00075 /* 00076 * The QRES kernel API functions. 00077 */ 00078 00080 qos_rv qres_init(void); 00081 00083 qos_rv qres_cleanup(void); 00084 00089 qos_rv qres_create_server(qres_params_t *param, qres_sid_t *p_sid); 00090 00091 qos_rv qres_init_server(qres_server_t *srv, qres_params_t *param); 00092 00096 qos_rv qres_destroy_server(qres_server_t *srv); 00097 00099 qos_rv _qres_cleanup_server(server_t *srv); 00100 00102 qos_rv qres_attach_task(qres_server_t *qres, struct task_struct *tsk); 00103 00107 qos_rv qres_detach_task(qres_server_t *qres, struct task_struct *tsk); 00108 00111 qos_rv qres_set_params(qres_server_t *qres, qres_params_t *param); 00112 00122 qos_rv qres_get_params(qres_server_t *srv, qres_params_t *params); 00123 00125 qos_rv qres_get_exec_abs_time( 00126 qres_server_t *qres, qres_time_t *exec_time, qres_atime_t *abs_time 00127 ); 00128 00130 qres_time_t qres_get_curr_budget(qres_server_t *qres); 00131 00133 qres_time_t qres_get_next_budget(qres_server_t *qres); 00134 00145 qres_time_t qres_get_appr_budget(qres_server_t *qres); 00146 00148 qos_rv qres_get_deadline(qres_server_t *qres, struct timespec *p_deadline); 00149 00150 #ifdef QRES_ENABLE_QSUP 00151 00152 static inline qsup_server_t * qres_get_qsup(qres_server_t *qres) { 00153 return &qres->qsup; 00154 } 00155 #endif 00156 00162 kal_uid_t qres_get_owner_uid(qres_server_t *qres); 00163 00169 kal_gid_t qres_get_owner_gid(qres_server_t *qres); 00170 00171 static inline qres_server_t * qres_find_by_id(qres_sid_t sid) { 00172 return qres_find_by_rres(rres_find_by_id(sid)); 00173 } 00174 00177 #endif