Thread Synch AOSV 2020  1.2
LKM for exchanging messages between threads
Data Structures | Macros | Functions | Variables
types.h File Reference

Defines all structures and global variables needed by the module. More...

#include <linux/types.h>
#include <linux/list.h>
#include <linux/rwsem.h>
#include <linux/workqueue.h>
#include <linux/cdev.h>
#include <linux/timer.h>
#include <linux/wait.h>
#include <linux/sched.h>
Include dependency graph for types.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  msg_t
 Basic structure to represent a message. More...
 
struct  t_group_members
 Threads that are members of the group device. More...
 
struct  t_message_deliver
 Contains a 'msg_t' structure and the relative delivery info. More...
 
struct  t_message_delayed_deliver
 Contains a 'msg_t' structure and the timer needed to delay the delivery. More...
 
struct  t_group_sysfs
 Contains all the 'sysfs' attrubutes and the group's kobject. More...
 
struct  msg_manager_t
 Manage the message sub-system. More...
 
struct  group_t
 System-wide descriptor of a group. More...
 
struct  group_flags_t
 Contains the various flags that represent the status of the module. More...
 
struct  t_garbage_collector
 Garbage Collector structure. More...
 
struct  group_data
 Group device data structure. More...
 

Macros

#define DEVICE_NAME_SIZE   64
 
#define DEBUG
 

Functions

struct group_flags_t __attribute__ ((packed)) g_flags_t
 Contains the various flags that represent the status of the module. More...
 

Variables

unsigned int initialized
 
unsigned int thread_barrier_loaded
 
unsigned int wake_up_flag
 
unsigned int sysfs_loaded
 
unsigned int strict_mode
 
unsigned int garbage_collector_disabled
 
unsigned int gc_include_struct
 

Detailed Description

Defines all structures and global variables needed by the module.

Macro Definition Documentation

◆ DEVICE_NAME_SIZE

#define DEVICE_NAME_SIZE   64

Maximum device name lenght

Function Documentation

◆ __attribute__()

struct group_flags_t __attribute__ ( (packed)  )

Contains the various flags that represent the status of the module.

Those flags are useful since it indicates if a module was correctly initialized, in this way when the module must be unloaded, no deallocation is performed on modules that failed.

  • initialized: indicates that a group has loaded all of its structures
  • thread_barrier_loaded: indicate that the 'thread barrier' submodule is initialized
  • wake_up_flag: to implement
  • sysfs_loaded: indicate that the 'sysfs' interface is initialized
  • garbage_collector_disabled: specifies the status of the garbage collector
  • sysfs_loaded: indicate that the 'sysfs' interface is initialized
  • strict_mode: 1 if the strict security mode is enabled, 0 otherwise
    Todo:
    Check the performace impact of "packing" the structure

Variable Documentation

◆ garbage_collector_disabled

unsigned int garbage_collector_disabled

1 if the garbage collector is disabled, zero otherwise

◆ gc_include_struct

unsigned int gc_include_struct

1 if the structure related to a message should be included in the size count

◆ initialized

unsigned int initialized

Set to 1 when the device driver is fully loaded

◆ sysfs_loaded

unsigned int sysfs_loaded

1 if the sysfs submodule is initialized correctly

◆ thread_barrier_loaded

unsigned int thread_barrier_loaded

1 if the 'thread_barrier' submodule is initialized

◆ wake_up_flag

unsigned int wake_up_flag

Flag used to wake-up all thread which slept on barrier