qres.c File Reference

Main QRES server "class" implementation file. More...

#include <linux/aquosa/rres_config.h>
#include "qres_config.h"
#include <linux/aquosa/qos_debug.h>
#include <linux/posix-timers.h>
#include <linux/time.h>
#include <linux/aquosa/qos_prof.h>
#include <linux/aquosa/qos_types.h>
#include "qres_gw.h"
#include <linux/aquosa/rres_interface.h>
#include <linux/aquosa/rres_kpi_protected.h>
#include <linux/aquosa/qos_kernel_dep.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <asm/uaccess.h>
#include <linux/sched.h>
#include "qsup_gw.h"
#include "qsup.h"
#include <linux/aquosa/kal_sched.h>
#include "qres_interface.h"
#include <linux/aquosa/qos_memory.h>
#include <linux/aquosa/qos_func.h>
#include <linux/aquosa/rres.h>

Go to the source code of this file.

Defines

#define QOS_DEBUG_LEVEL   QRES_MOD_DEBUG_LEVEL

Functions

qos_rv qres_init (void)
 Static QRES constructor.
qos_rv qres_cleanup (void)
 Static QRES destructor.
static qos_bool_t authorize_for_task (struct task_struct *tsk)
 Check authorizations for operations affecting a task.
static qos_bool_t authorize_for_server (qres_server_t *qres)
 Check authorizations for operations affecting an existing server.
 qos_func_define (qos_rv, qres_create_server, qres_params_t *param, qres_sid_t *p_sid)
 QRES Factory Method.
void qres_update_bandwidths (void)
 qos_func_define (qos_rv, qres_init_server, qres_server_t *qres, qres_params_t *param)
 QRES Server constructor.
 qos_func_define (qos_rv, qres_destroy_server, qres_server_t *qres)
 qos_func_define (qos_rv, _qres_cleanup_server, server_t *rres)
 Non-virtual QRES server destructor.
qos_bw_t _qres_get_bandwidth (server_t *srv)
 Non-virtual bandwidth getter.
 qos_func_define (qos_rv, qres_attach_task, qres_server_t *qres, struct task_struct *tsk)
 Attach to the server identified by srv_id the task identified by tsk.
 qos_func_define (qos_rv, qres_detach_task, qres_server_t *qres, struct task_struct *tsk)
 Asks the RRES to detach the current task from its server.
 qos_func_define (qos_rv, qres_set_params, qres_server_t *qres, qres_params_t *param)
 Set QRES server parameters Q, Q_min and P.
 qos_func_define (qos_rv, qres_get_params, qres_server_t *qres, qres_params_t *params)
 qos_func_define (qres_time_t, qres_get_curr_budget, qres_server_t *qres)
 qos_func_define (qres_time_t, qres_get_next_budget, qres_server_t *qres)
 qos_func_define (qres_time_t, qres_get_appr_budget, qres_server_t *qres)
 qos_func_define (qos_rv, qres_get_deadline, qres_server_t *qres, struct timespec *p_deadline)
 qos_func_define (qos_rv, qres_get_exec_abs_time, qres_server_t *qres, qres_time_t *exec_time, qres_atime_t *abs_time)
kal_uid_t qres_get_owner_uid (qres_server_t *qres)
 Return the user id of the owner of the server.
 EXPORT_SYMBOL_GPL (qres_get_owner_uid)
kal_gid_t qres_get_owner_gid (qres_server_t *qres)
 Return the group id of the owner of the server.
 EXPORT_SYMBOL_GPL (qres_get_owner_gid)
 EXPORT_SYMBOL_GPL (qres_create_server)
 EXPORT_SYMBOL_GPL (qres_destroy_server)
 EXPORT_SYMBOL_GPL (qres_attach_task)
 EXPORT_SYMBOL_GPL (qres_detach_task)
 EXPORT_SYMBOL_GPL (qres_set_params)
 EXPORT_SYMBOL_GPL (qres_get_params)
 EXPORT_SYMBOL_GPL (qres_get_exec_abs_time)
 EXPORT_SYMBOL_GPL (qres_get_deadline)
 EXPORT_SYMBOL_GPL (_qres_get_bandwidth)
 EXPORT_SYMBOL_GPL (_qres_cleanup_server)

Detailed Description

Main QRES server "class" implementation file.

Implements all operations defined for a QRES server.

Note:
All operations are supposed to be called with a global lock held. This lock may be obtained through the qres_get_lock() function.
Todo:
Add creation flag that, if set, allows to set required bandwidth to zero when the rres server has no activations (should be optional as it may introduce a latency in reclaiming back the given-away bandwidth when the server activates back).

Definition in file qresmod/qres.c.


Define Documentation

#define QOS_DEBUG_LEVEL   QRES_MOD_DEBUG_LEVEL

Definition at line 18 of file qresmod/qres.c.


Function Documentation

qos_bw_t _qres_get_bandwidth ( server_t srv  ) 

Non-virtual bandwidth getter.

Definition at line 257 of file qresmod/qres.c.

References _rres_get_bandwidth(), qres_find_by_rres(), qsup_get_approved_bw(), and qres_server::rres.

Referenced by qos_func_define().

static qos_bool_t authorize_for_server ( qres_server_t qres  )  [static]

Check authorizations for operations affecting an existing server.

Todo:
It is completely unimplemented, thus it represents a SECURITY FLAW

Definition at line 86 of file qresmod/qres.c.

References qres_get_owner_uid().

Referenced by qos_func_define().

static qos_bool_t authorize_for_task ( struct task_struct *  tsk  )  [static]

Check authorizations for operations affecting a task.

Operations on a process different from the current one are only allowed if the two processes have the same euid, or if the calling process is effectively-owned by the super-user.

Parameters:
tsk Pointer to the task_struct corresponding to process that is going to be affected by the operation.
Returns:
non-zero on success, 0 otherwise.

Definition at line 77 of file qresmod/qres.c.

Referenced by qos_func_define().

EXPORT_SYMBOL_GPL ( _qres_cleanup_server   ) 
EXPORT_SYMBOL_GPL ( _qres_get_bandwidth   ) 
EXPORT_SYMBOL_GPL ( qres_get_deadline   ) 
EXPORT_SYMBOL_GPL ( qres_get_exec_abs_time   ) 
EXPORT_SYMBOL_GPL ( qres_get_params   ) 
EXPORT_SYMBOL_GPL ( qres_set_params   ) 
EXPORT_SYMBOL_GPL ( qres_detach_task   ) 
EXPORT_SYMBOL_GPL ( qres_attach_task   ) 
EXPORT_SYMBOL_GPL ( qres_destroy_server   ) 
EXPORT_SYMBOL_GPL ( qres_create_server   ) 
EXPORT_SYMBOL_GPL ( qres_get_owner_gid   ) 
EXPORT_SYMBOL_GPL ( qres_get_owner_uid   ) 
qos_func_define ( qos_rv  ,
qres_get_exec_abs_time  ,
qres_server_t qres,
qres_time_t exec_time,
qres_atime_t abs_time 
)
qos_func_define ( qos_rv  ,
qres_get_deadline  ,
qres_server_t qres,
struct timespec *  p_deadline 
)

Definition at line 374 of file qresmod/qres.c.

References qres_server::rres, and rres_get_deadline().

qos_func_define ( qres_time_t  ,
qres_get_appr_budget  ,
qres_server_t qres 
)
qos_func_define ( qres_time_t  ,
qres_get_next_budget  ,
qres_server_t qres 
)
qos_func_define ( qres_time_t  ,
qres_get_curr_budget  ,
qres_server_t qres 
)

Definition at line 362 of file qresmod/qres.c.

References qres_server::rres, and rres_get_curr_budget().

qos_func_define ( qos_rv  ,
qres_get_params  ,
qres_server_t qres,
qres_params_t params 
)

Definition at line 356 of file qresmod/qres.c.

References qres_server::params, qos_chk_do, QOS_E_INTERNAL_ERROR, and QOS_OK.

qos_func_define ( qos_rv  ,
qres_set_params  ,
qres_server_t qres,
qres_params_t param 
)
qos_func_define ( qos_rv  ,
qres_detach_task  ,
qres_server_t qres,
struct task_struct *  tsk 
)

Asks the RRES to detach the current task from its server.

If the detached task was the last one attached to the server, then this function asks supervisor to destroy information associated to this server, and also asks the RRES to destroy the server related info.

Note:
When this function returns, the memory pointed to by the qres parameter could have been deallocated.

Definition at line 293 of file qresmod/qres.c.

References authorize_for_server(), authorize_for_task(), qos_chk_do, qos_chk_ok_ret, QOS_E_INTERNAL_ERROR, QOS_E_NOT_FOUND, QOS_E_UNAUTHORIZED, QOS_OK, qsup_set_required_bw(), qres_server::rres, rres_check_destroy(), rres_detach_task(), and rres_has_ready_tasks().

qos_func_define ( qos_rv  ,
qres_attach_task  ,
qres_server_t qres,
struct task_struct *  tsk 
)
qos_func_define ( qos_rv  ,
_qres_cleanup_server  ,
server_t rres 
)
qos_func_define ( qos_rv  ,
qres_destroy_server  ,
qres_server_t qres 
)
qos_func_define ( qos_rv  ,
qres_init_server  ,
qres_server_t qres,
qres_params_t param 
)
qos_func_define ( qos_rv  ,
qres_create_server  ,
qres_params_t param,
qres_sid_t p_sid 
)
void qres_update_bandwidths ( void   ) 

Definition at line 112 of file qresmod/qres.c.

References bw2Q(), for_each_server, q, rres_get_bandwidth(), rres_get_period(), rres_set_budget(), and srv.

Referenced by qos_func_define().

Generated on Mon Aug 2 22:39:17 2010 for qosres by  doxygen 1.6.3