Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions | Variables
relay.h File Reference
#include <linux/types.h>
#include <linux/sched.h>
#include <linux/timer.h>
#include <linux/wait.h>
#include <linux/list.h>
#include <linux/bug.h>
#include <linux/fs.h>
#include <linux/poll.h>
#include <linux/kref.h>

Go to the source code of this file.

Data Structures

struct  rchan_buf
 
struct  rchan
 
struct  rchan_callbacks
 

Macros

#define FIX_SIZE(x)   ((((x) - 1) & PAGE_MASK) + PAGE_SIZE)
 
#define RELAYFS_CHANNEL_VERSION   7
 

Functions

struct rchanrelay_open (const char *base_filename, struct dentry *parent, size_t subbuf_size, size_t n_subbufs, struct rchan_callbacks *cb, void *private_data)
 
int relay_late_setup_files (struct rchan *chan, const char *base_filename, struct dentry *parent)
 
void relay_close (struct rchan *chan)
 
void relay_flush (struct rchan *chan)
 
void relay_subbufs_consumed (struct rchan *chan, unsigned int cpu, size_t consumed)
 
void relay_reset (struct rchan *chan)
 
int relay_buf_full (struct rchan_buf *buf)
 
size_t relay_switch_subbuf (struct rchan_buf *buf, size_t length)
 

Variables

struct rchan_buf ____cacheline_aligned
 
struct file_operations relay_file_operations
 

Macro Definition Documentation

#define FIX_SIZE (   x)    ((((x) - 1) & PAGE_MASK) + PAGE_SIZE)

Definition at line 24 of file relay.h.

#define RELAYFS_CHANNEL_VERSION   7

Definition at line 29 of file relay.h.

Function Documentation

int relay_buf_full ( struct rchan_buf buf)

relay_buf_full - boolean, is the channel buffer full? : channel buffer

Returns 1 if the buffer is full, 0 otherwise.

Definition at line 258 of file relay.c.

void relay_close ( struct rchan chan)

relay_close - close the channel : the channel

Closes all channel buffers and frees the channel.

Definition at line 815 of file relay.c.

void relay_flush ( struct rchan chan)

relay_flush - close the channel : the channel

Flushes all channel buffers, i.e. forces buffer switch.

Definition at line 847 of file relay.c.

int relay_late_setup_files ( struct rchan chan,
const char base_filename,
struct dentry parent 
)

relay_late_setup_files - triggers file creation : channel to operate on : base name of files to create : dentry of parent directory, NULL for root directory

Returns 0 if successful, non-zero otherwise.

Use to setup files for a previously buffer-only channel. Useful to do early tracing in kernel, before VFS is up, for example.

Definition at line 648 of file relay.c.

struct rchan* relay_open ( const char base_filename,
struct dentry parent,
size_t  subbuf_size,
size_t  n_subbufs,
struct rchan_callbacks cb,
void private_data 
)
read

relay_open - create a new relay channel : base name of files to create, NULL for buffering only : dentry of parent directory, NULL for root directory or buffer : size of sub-buffers : number of sub-buffers : client callback functions : user-defined data

Returns channel pointer if successful, NULL otherwise.

Creates a channel buffer for each cpu using the sizes and attributes specified. The created channel buffer files will be named base_filename0...base_filenameN-1. File permissions will be S_IRUSR.

Definition at line 569 of file relay.c.

void relay_reset ( struct rchan chan)

relay_reset - reset the channel : the channel

This has the effect of erasing all data from all channel buffers and restarting the channel in its initial state. The buffers are not freed, so any mappings are still in effect.

NOTE. Care should be taken that the channel isn't actually being used by anything when this call is made.

Definition at line 387 of file relay.c.

void relay_subbufs_consumed ( struct rchan chan,
unsigned int  cpu,
size_t  subbufs_consumed 
)

relay_subbufs_consumed - update the buffer's sub-buffers-consumed count : the channel : the cpu associated with the channel buffer to update : number of sub-buffers to add to current buf's count

Adds to the channel buffer's consumed sub-buffer count. subbufs_consumed should be the number of sub-buffers newly consumed, not the total consumed.

NOTE. Kernel clients don't need to call this function if the channel mode is 'overwrite'.

Definition at line 788 of file relay.c.

size_t relay_switch_subbuf ( struct rchan_buf buf,
size_t  length 
)

relay_switch_subbuf - switch to a new sub-buffer : channel buffer : size of current event

Returns either the length passed in or 0 if full.

Performs sub-buffer-switch tasks such as invoking callbacks, updating padding counts, waking up readers, etc.

Definition at line 722 of file relay.c.

Variable Documentation

struct file_operations relay_file_operations

Definition at line 1348 of file relay.c.