Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Functions
est.c File Reference
#include <linux/spinlock.h>
#include <linux/slab.h>
#include <linux/export.h>
#include "uwb-internal.h"

Go to the source code of this file.

Data Structures

struct  uwb_est
 

Functions

int uwb_est_create (void)
 
void uwb_est_destroy (void)
 
int uwb_est_register (u8 type, u8 event_high, u16 vendor, u16 product, const struct uwb_est_entry *entry, size_t entries)
 
 EXPORT_SYMBOL_GPL (uwb_est_register)
 
int uwb_est_unregister (u8 type, u8 event_high, u16 vendor, u16 product, const struct uwb_est_entry *entry, size_t entries)
 
 EXPORT_SYMBOL_GPL (uwb_est_unregister)
 
ssize_t uwb_est_find_size (struct uwb_rc *rc, const struct uwb_rceb *rceb, size_t rceb_size)
 
 EXPORT_SYMBOL_GPL (uwb_est_find_size)
 

Function Documentation

EXPORT_SYMBOL_GPL ( uwb_est_register  )
EXPORT_SYMBOL_GPL ( uwb_est_unregister  )
EXPORT_SYMBOL_GPL ( uwb_est_find_size  )
int uwb_est_create ( void  )

Initialize the EST subsystem

Register the standard tables also.

FIXME: tag init

Definition at line 181 of file est.c.

void uwb_est_destroy ( void  )

Clean it up

Definition at line 203 of file est.c.

ssize_t uwb_est_find_size ( struct uwb_rc rc,
const struct uwb_rceb rceb,
size_t  rceb_size 
)

Guesses the size of a WA event

: pointer to the buffer with the event : size of the area pointed to by in bytes.

Returns
: > 0 Size of the event -ENOSPC An area big enough was not provided to look ahead into the event's guts and guess the size. -EINVAL Unknown event code (wEvent).

This will look at the received RCEB and guess what is the total size by checking all the tables registered with uwb_est_register(). For variable sized events, it will look further ahead into their length field to see how much data should be read.

Note this size is not final–the neh (Notification/Event Handle) might specificy an extra size to add or replace.

Definition at line 430 of file est.c.

int uwb_est_register ( u8  type,
u8  event_high,
u16  vendor,
u16  product,
const struct uwb_est_entry entry,
size_t  entries 
)

Register an event size table

Makes room for it if the table is full, and then inserts it in the right position (entries are sorted by type, event_high, vendor and then product).

: vendor code for matching against the device (0x0000 and 0xffff mean any); use 0x0000 to force all to match without checking possible vendor specific ones, 0xfffff to match after checking vendor specific ones.

: product code from that vendor; same matching rules, use 0x0000 for not allowing vendor specific matches, 0xffff for allowing.

This arragement just makes the tables sort differenty. Because the table is sorted by growing type-event_high-vendor-product, a zero vendor will match before than a 0x456a vendor, that will match before a 0xfffff vendor.

Returns
0 if ok, < 0 errno on error (-ENOENT if not found).

Definition at line 256 of file est.c.

int uwb_est_unregister ( u8  type,
u8  event_high,
u16  vendor,
u16  product,
const struct uwb_est_entry entry,
size_t  entries 
)

Unregister an event size table

This just removes the specified entry and moves the ones after it to fill in the gap. This is needed to keep the list sorted; no reallocation is done to reduce the size of the table.

We unregister by all the data we used to register instead of by pointer to the array because we might have used the same table for a bunch of IDs (for example).

Returns
0 if ok, < 0 errno on error (-ENOENT if not found).

Definition at line 307 of file est.c.