Voxia OS v0.0.1
Hobby Project Operating System Targeting x86-64
Loading...
Searching...
No Matches
notify.h File Reference
#include "spinlock.h"
#include "string.h"
#include <type.h>

Go to the source code of this file.

Data Structures

struct  notifier
 
struct  notify_chain
 
struct  notify_dev_table
 
struct  notify_dev
 

Macros

#define NOTIFY_OK   1
 
#define NOTIFY_STOP   -1
 
#define NOTIFY_BAD   -2
 
#define NOTIFIER_FLAG_ONCE   (1 << 0)
 
#define NOTIFIER_FLAG_ATOMIC   (1 << 1)
 
#define NOTIFIER_FLAG_DISABLED   (1 << 2)
 
#define NOTIFY_HIGHT   1000
 
#define NOTIFY_MEDIUM   500
 
#define NOTIFY_NORMAL   100
 
#define NOTIFY_LOW   50
 
#define NOTIFY_DEV_HASH_SIZE   64
 
#define NOTIFY_DEV_HASH_MASK   (NOTIFY_DEV_HASH_SIZE - 1)
 

Typedefs

typedef void(* notify_callback_t) (uint32_t event, void *data, void *context)
 

Functions

void notify_dev_create (kstring name)
 
int notify_dev_destroy (kstring name)
 
int notify_register (char *name, struct notifier *n)
 
int notify_unregister (kstring name, struct notifier *n)
 
int wait_until_receive_notify (const char *name, uint64_t timeout)
 
int notify_call (char *name, uint32_t event, void *data)
 

Macro Definition Documentation

◆ NOTIFIER_FLAG_ATOMIC

#define NOTIFIER_FLAG_ATOMIC   (1 << 1)

Definition at line 19 of file notify.h.

◆ NOTIFIER_FLAG_DISABLED

#define NOTIFIER_FLAG_DISABLED   (1 << 2)

Definition at line 20 of file notify.h.

◆ NOTIFIER_FLAG_ONCE

#define NOTIFIER_FLAG_ONCE   (1 << 0)

Definition at line 18 of file notify.h.

◆ NOTIFY_BAD

#define NOTIFY_BAD   -2

Definition at line 15 of file notify.h.

◆ NOTIFY_DEV_HASH_MASK

#define NOTIFY_DEV_HASH_MASK   (NOTIFY_DEV_HASH_SIZE - 1)

Definition at line 44 of file notify.h.

Referenced by find_dev(), and notify_dev_create().

◆ NOTIFY_DEV_HASH_SIZE

#define NOTIFY_DEV_HASH_SIZE   64

Definition at line 43 of file notify.h.

Referenced by find_dev(), and notify_dev_create().

◆ NOTIFY_HIGHT

#define NOTIFY_HIGHT   1000

Definition at line 22 of file notify.h.

Referenced by INIT(), and INIT().

◆ NOTIFY_LOW

#define NOTIFY_LOW   50

Definition at line 25 of file notify.h.

◆ NOTIFY_MEDIUM

#define NOTIFY_MEDIUM   500

Definition at line 23 of file notify.h.

◆ NOTIFY_NORMAL

#define NOTIFY_NORMAL   100

Definition at line 24 of file notify.h.

◆ NOTIFY_OK

#define NOTIFY_OK   1

Definition at line 13 of file notify.h.

◆ NOTIFY_STOP

#define NOTIFY_STOP   -1

Definition at line 14 of file notify.h.

Typedef Documentation

◆ notify_callback_t

typedef void(* notify_callback_t) (uint32_t event, void *data, void *context)

Definition at line 27 of file notify.h.

Function Documentation

◆ notify_call()

int notify_call ( char * name,
uint32_t event,
void * data )

◆ notify_dev_create()

◆ notify_dev_destroy()

int notify_dev_destroy ( kstring name)

References name.

◆ notify_register()

int notify_register ( char * name,
struct notifier * n )

◆ notify_unregister()

int notify_unregister ( kstring name,
struct notifier * n )

References data, and name.

◆ wait_until_receive_notify()

int wait_until_receive_notify ( const char * name,
uint64_t timeout )

Definition at line 140 of file notify.c.

References notify_dev::event_received, find_dev(), ms2ns, name, notify_dev_put(), and usleep().

Referenced by __attribute__().