flinkLinux
flink Linux Kernel Modules
|
Core module for flink. More...
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/device.h>
#include <linux/cdev.h>
#include <linux/fs.h>
#include <asm/uaccess.h>
#include "flink.h"
Macros | |
#define | MODULE_NAME THIS_MODULE->name |
#define | SYSFS_CLASS_NAME "flink" |
#define | MAX_DEV_NAME_LENGTH 15 |
Functions | |
MODULE_AUTHOR ("Martin Zueger <martin@zueger.eu>") | |
MODULE_DESCRIPTION ("fLink core module") | |
MODULE_SUPPORTED_DEVICE ("none") | |
MODULE_LICENSE ("Dual BSD/GPL") | |
int | flink_open (struct inode *i, struct file *f) |
int | flink_relase (struct inode *i, struct file *f) |
ssize_t | flink_read (struct file *f, char __user *data, size_t size, loff_t *offset) |
ssize_t | flink_write (struct file *f, const char __user *data, size_t size, loff_t *offset) |
long | flink_ioctl (struct file *f, unsigned int cmd, unsigned long arg) |
loff_t | flink_llseek (struct file *f, loff_t off, int whence) |
module_init (flink_init) | |
module_exit (flink_exit) | |
struct flink_device * | flink_device_alloc (void) |
Allocate a flink_device structure. More... | |
void | flink_device_init (struct flink_device *fdev, struct flink_bus_ops *bus_ops, struct module *mod) |
Initialize a flink_device structure. More... | |
int | flink_device_add (struct flink_device *fdev) |
Add a flink device to the system, making it live immediately. More... | |
int | flink_device_remove (struct flink_device *fdev) |
Remove a flink device from the system. More... | |
int | flink_device_delete (struct flink_device *fdev) |
Deletes a flink device and frees the allocated memory. All subdevices will be deleted, using flink_subdevice_remove() and flink_subdevice_delete(). More... | |
struct flink_device * | flink_get_device_by_id (u8 id) |
Get a flink device by its id. More... | |
struct flink_device * | flink_get_device_by_cdev (struct cdev *char_device) |
Get a flink device by cdev. More... | |
struct list_head * | flink_get_device_list () |
Get a list with all devices. More... | |
struct flink_subdevice * | flink_subdevice_alloc (void) |
Allocate a flink_subdevice structure. More... | |
void | flink_subdevice_init (struct flink_subdevice *fsubdev) |
Initialize a flink_subdevice structure, making it ready to add to a flink_device with flink_subdevice_add() More... | |
int | flink_subdevice_add (struct flink_device *fdev, struct flink_subdevice *fsubdev) |
Add a flink subdevice to flink device. More... | |
int | flink_subdevice_remove (struct flink_subdevice *fsubdev) |
Remove a flink subdevice from the parent device. More... | |
int | flink_subdevice_delete (struct flink_subdevice *fsubdev) |
Deletes a flink subdevice and frees the allocated memory. More... | |
struct flink_subdevice * | flink_get_subdevice_by_id (struct flink_device *fdev, u8 id) |
Get a flink subdevice by its id. More... | |
struct class * | flink_get_sysfs_class (void) |
Get a flink sysfs class. More... | |
int | flink_select_subdevice (struct file *f, u8 subdevice, bool excl) |
Select a subdevice for exclusive access. More... | |
EXPORT_SYMBOL (flink_device_alloc) | |
EXPORT_SYMBOL (flink_device_init) | |
EXPORT_SYMBOL (flink_device_add) | |
EXPORT_SYMBOL (flink_device_remove) | |
EXPORT_SYMBOL (flink_device_delete) | |
EXPORT_SYMBOL (flink_get_device_by_id) | |
EXPORT_SYMBOL (flink_get_device_list) | |
EXPORT_SYMBOL (flink_subdevice_alloc) | |
EXPORT_SYMBOL (flink_subdevice_init) | |
EXPORT_SYMBOL (flink_subdevice_add) | |
EXPORT_SYMBOL (flink_subdevice_remove) | |
EXPORT_SYMBOL (flink_subdevice_delete) | |
EXPORT_SYMBOL (flink_get_subdevice_by_id) | |
EXPORT_SYMBOL (flink_select_subdevice) | |
EXPORT_SYMBOL (flink_get_sysfs_class) | |
Variables | |
struct file_operations | flink_fops |
Core module for flink.
Contains functions to initialize, add and remove flink devices and subdevices
#define MAX_DEV_NAME_LENGTH 15 |
#define MODULE_NAME THIS_MODULE->name |
#define SYSFS_CLASS_NAME "flink" |
EXPORT_SYMBOL | ( | flink_device_alloc | ) |
EXPORT_SYMBOL | ( | flink_device_init | ) |
EXPORT_SYMBOL | ( | flink_device_add | ) |
EXPORT_SYMBOL | ( | flink_device_remove | ) |
EXPORT_SYMBOL | ( | flink_device_delete | ) |
EXPORT_SYMBOL | ( | flink_get_device_by_id | ) |
EXPORT_SYMBOL | ( | flink_get_device_list | ) |
EXPORT_SYMBOL | ( | flink_subdevice_alloc | ) |
EXPORT_SYMBOL | ( | flink_subdevice_init | ) |
EXPORT_SYMBOL | ( | flink_subdevice_add | ) |
EXPORT_SYMBOL | ( | flink_subdevice_remove | ) |
EXPORT_SYMBOL | ( | flink_subdevice_delete | ) |
EXPORT_SYMBOL | ( | flink_get_subdevice_by_id | ) |
EXPORT_SYMBOL | ( | flink_select_subdevice | ) |
EXPORT_SYMBOL | ( | flink_get_sysfs_class | ) |
int flink_device_add | ( | struct flink_device * | fdev | ) |
Add a flink device to the system, making it live immediately.
fdev | The flink device to add. |
struct flink_device* flink_device_alloc | ( | void | ) |
Allocate a flink_device structure.
int flink_device_delete | ( | struct flink_device * | fdev | ) |
Deletes a flink device and frees the allocated memory. All subdevices will be deleted, using flink_subdevice_remove() and flink_subdevice_delete().
fdev | The flink_device structure to delete. |
void flink_device_init | ( | struct flink_device * | fdev, |
struct flink_bus_ops * | bus_ops, | ||
struct module * | mod | ||
) |
Initialize a flink_device structure.
fdev | The structure to initialize |
bus_ops | The flink_bus_ops for this device, remember them when adding them to system with flink_device_add(). |
mod | The kernel module this flink uses for hardware access. |
int flink_device_remove | ( | struct flink_device * | fdev | ) |
Remove a flink device from the system.
fdev | The flink device to remove. |
struct flink_device* flink_get_device_by_cdev | ( | struct cdev * | char_device | ) |
Get a flink device by cdev.
char_device | Pointer to the cdev struct of a flink device. |
struct flink_device* flink_get_device_by_id | ( | u8 | id | ) |
Get a flink device by its id.
id | The id of the flink device. |
struct list_head* flink_get_device_list | ( | void | ) |
Get a list with all devices.
struct flink_subdevice* flink_get_subdevice_by_id | ( | struct flink_device * | fdev, |
u8 | id | ||
) |
Get a flink subdevice by its id.
fdev | The flink device containing the desired flink_subdevice. |
id | The id of the flink device. |
struct class* flink_get_sysfs_class | ( | void | ) |
Get a flink sysfs class.
long flink_ioctl | ( | struct file * | f, |
unsigned int | cmd, | ||
unsigned long | arg | ||
) |
loff_t flink_llseek | ( | struct file * | f, |
loff_t | off, | ||
int | whence | ||
) |
int flink_open | ( | struct inode * | i, |
struct file * | f | ||
) |
ssize_t flink_read | ( | struct file * | f, |
char __user * | data, | ||
size_t | size, | ||
loff_t * | offset | ||
) |
int flink_relase | ( | struct inode * | i, |
struct file * | f | ||
) |
int flink_select_subdevice | ( | struct file * | f, |
u8 | subdevice, | ||
bool | excl | ||
) |
Select a subdevice for exclusive access.
f | |
subdevice | |
excl |
int flink_subdevice_add | ( | struct flink_device * | fdev, |
struct flink_subdevice * | fsubdev | ||
) |
Add a flink subdevice to flink device.
fdev | The flink device to which the subdevice is added. |
@fsubdev | The flink subdevice to add. |
struct flink_subdevice* flink_subdevice_alloc | ( | void | ) |
Allocate a flink_subdevice structure.
int flink_subdevice_delete | ( | struct flink_subdevice * | fsubdev | ) |
Deletes a flink subdevice and frees the allocated memory.
fsubdev | The flink_subdevice structure to delete. |
void flink_subdevice_init | ( | struct flink_subdevice * | fsubdev | ) |
Initialize a flink_subdevice structure, making it ready to add to a flink_device with flink_subdevice_add()
fsubdev | The structure to initialize |
int flink_subdevice_remove | ( | struct flink_subdevice * | fsubdev | ) |
Remove a flink subdevice from the parent device.
fsubdev | The flink subdevice to remove. |
ssize_t flink_write | ( | struct file * | f, |
const char __user * | data, | ||
size_t | size, | ||
loff_t * | offset | ||
) |
MODULE_AUTHOR | ( | "Martin Zueger <martin@zueger.eu>" | ) |
MODULE_DESCRIPTION | ( | "fLink core module" | ) |
module_exit | ( | flink_exit | ) |
module_init | ( | flink_init | ) |
MODULE_LICENSE | ( | "Dual BSD/GPL" | ) |
MODULE_SUPPORTED_DEVICE | ( | "none" | ) |
struct file_operations flink_fops |