QRES kernel module and device initialisation and cleanup. More...
#include "qres_config.h"
#include <linux/aquosa/qos_debug.h>
#include "qsup_gw_ks.h"
#include "qres_proc_fs.h"
#include <linux/aquosa/qres_config.h>
#include <linux/aquosa/qos_prof.h>
#include <linux/init.h>
#include <linux/fs.h>
#include <asm/uaccess.h>
#include <asm/processor.h>
#include "qres_gw_ks.h"
#include <linux/aquosa/qos_kernel_dep.h>
Go to the source code of this file.
Defines | |
#define | QOS_DEBUG_LEVEL QRES_MOD_DEBUG_LEVEL |
#define | SUCCESS 0 |
#define | BUF_LEN 80 |
#define | DEBUG |
Functions | |
static int | device_open (struct inode *inode, struct file *file) |
static int | device_release (struct inode *inode, struct file *file) |
Called when device is closed by a process. | |
static ssize_t | device_read (struct file *file, char __user *buffer, size_t length, loff_t *offset) |
static ssize_t | device_write (struct file *file, const char __user *buffer, size_t length, loff_t *offset) |
int | device_ioctl (struct inode *inode, struct file *file, unsigned int ioctl_num, unsigned long ioctl_param) |
static int | qres_init_module (void) |
Initialize the module - Register the character device. | |
static void | qres_cleanup_module (void) |
Cleanup - unregister the appropriate file from /proc. | |
module_init (qres_init_module) | |
module_exit (qres_cleanup_module) | |
MODULE_LICENSE ("GPL") | |
MODULE_AUTHOR ("ReTiS Lab") | |
MODULE_DESCRIPTION ("AQuoSA Resource Reservation - Support for user-space library and supervisor") | |
MODULE_SUPPORTED_DEVICE ("qosres") | |
Variables | |
static int | Device_Open = 0 |
Is the device open right now? Used to prevent concurent access into the same device. | |
static char | Message [BUF_LEN] |
static char * | Message_Ptr |
struct file_operations | Fops |
Handlers for the various operation requests on the device. | |
static qos_dev_info_t | qres_dev_info |
QRES kernel module and device initialisation and cleanup.
Definition in file qres_mod.c.
#define BUF_LEN 80 |
Definition at line 27 of file qres_mod.c.
Referenced by device_write().
#define DEBUG |
Definition at line 28 of file qres_mod.c.
#define QOS_DEBUG_LEVEL QRES_MOD_DEBUG_LEVEL |
Definition at line 6 of file qres_mod.c.
#define SUCCESS 0 |
Definition at line 26 of file qres_mod.c.
Referenced by device_open(), device_release(), qsup_device_open(), and qsup_device_release().
int device_ioctl | ( | struct inode * | inode, | |
struct file * | file, | |||
unsigned int | ioctl_num, | |||
unsigned long | ioctl_param | |||
) |
Definition at line 165 of file qres_mod.c.
References qos_log_debug, qos_rv_int, qos_strerror(), and qres_gw_ks().
static int device_open | ( | struct inode * | inode, | |
struct file * | file | |||
) | [static] |
Definition at line 51 of file qres_mod.c.
References Device_Open, KERN_INCREMENT, Message, Message_Ptr, qos_log_debug, and SUCCESS.
static ssize_t device_read | ( | struct file * | file, | |
char __user * | buffer, | |||
size_t | length, | |||
loff_t * | offset | |||
) | [static] |
Definition at line 87 of file qres_mod.c.
References Message_Ptr, and qos_log_debug.
static int device_release | ( | struct inode * | inode, | |
struct file * | file | |||
) | [static] |
Called when device is closed by a process.
Definition at line 70 of file qres_mod.c.
References Device_Open, KERN_DECREMENT, qos_log_debug, and SUCCESS.
static ssize_t device_write | ( | struct file * | file, | |
const char __user * | buffer, | |||
size_t | length, | |||
loff_t * | offset | |||
) | [static] |
Definition at line 138 of file qres_mod.c.
References BUF_LEN, Message, Message_Ptr, and qos_log_debug.
MODULE_AUTHOR | ( | "ReTiS Lab" | ) |
MODULE_DESCRIPTION | ( | "AQuoSA Resource Reservation - Support for user-space library and supervisor" | ) |
module_exit | ( | qres_cleanup_module | ) |
module_init | ( | qres_init_module | ) |
MODULE_LICENSE | ( | "GPL" | ) |
MODULE_SUPPORTED_DEVICE | ( | "qosres" | ) |
static void qres_cleanup_module | ( | void | ) | [static] |
Cleanup - unregister the appropriate file from /proc.
Definition at line 327 of file qres_mod.c.
References block_hook, continue_hook, hook_lock, qos_dev_unregister(), qos_log_crit, QOS_OK, qos_strerror(), qres_cleanup(), qres_proc_unregister(), qsup_cleanup(), qsup_dev_unregister(), rres_get_spinlock(), stop_hook, and unblock_hook.
static int qres_init_module | ( | void | ) | [static] |
Initialize the module - Register the character device.
ProcFS-related functions may sleep, so no spinlock should be held
Definition at line 265 of file qres_mod.c.
References block_hook, continue_hook, qos_dev_info_t::dev_num, Fops, hook_lock, qos_dev_register(), qos_log_crit, qos_log_debug, qos_log_err, qos_log_info, QOS_OK, qos_strerror(), qres_cleanup(), QRES_DEV_NAME, qres_init(), QRES_MAJOR_NUM, qres_proc_register(), qsup_dev_register(), qsup_init_ks(), rres_get_spinlock(), stop_hook, and unblock_hook.
int Device_Open = 0 [static] |
Is the device open right now? Used to prevent concurent access into the same device.
Definition at line 34 of file qres_mod.c.
Referenced by device_open(), and device_release().
struct file_operations Fops |
{ .read = device_read, .write = device_write, .ioctl = device_ioctl, .open = device_open, .release = device_release, }
Handlers for the various operation requests on the device.
This structure will hold the functions to be called when a process does something to the device we created. Since a pointer to this structure is kept in the devices table, it can't be local to init_module. NULL is for unimplemented functions.
Definition at line 188 of file qres_mod.c.
Referenced by qres_init_module().
char Message[BUF_LEN] [static] |
Definition at line 39 of file qres_mod.c.
Referenced by device_open(), and device_write().
char* Message_Ptr [static] |
Definition at line 46 of file qres_mod.c.
Referenced by device_open(), device_read(), and device_write().
qos_dev_info_t qres_dev_info [static] |
Definition at line 196 of file qres_mod.c.