Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Typedefs | Functions | Variables
relay.c File Reference
#include <linux/errno.h>
#include <linux/stddef.h>
#include <linux/slab.h>
#include <linux/export.h>
#include <linux/string.h>
#include <linux/relay.h>
#include <linux/vmalloc.h>
#include <linux/mm.h>
#include <linux/cpu.h>
#include <linux/splice.h>

Go to the source code of this file.

Data Structures

struct  rchan_percpu_buf_dispatcher
 

Typedefs

typedef int(* subbuf_actor_t )(size_t read_start, struct rchan_buf *buf, size_t avail, read_descriptor_t *desc, read_actor_t actor)
 

Functions

int relay_buf_full (struct rchan_buf *buf)
 
 EXPORT_SYMBOL_GPL (relay_buf_full)
 
void relay_reset (struct rchan *chan)
 
 EXPORT_SYMBOL_GPL (relay_reset)
 
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)
 
 EXPORT_SYMBOL_GPL (relay_open)
 
int relay_late_setup_files (struct rchan *chan, const char *base_filename, struct dentry *parent)
 
size_t relay_switch_subbuf (struct rchan_buf *buf, size_t length)
 
 EXPORT_SYMBOL_GPL (relay_switch_subbuf)
 
void relay_subbufs_consumed (struct rchan *chan, unsigned int cpu, size_t subbufs_consumed)
 
 EXPORT_SYMBOL_GPL (relay_subbufs_consumed)
 
void relay_close (struct rchan *chan)
 
 EXPORT_SYMBOL_GPL (relay_close)
 
void relay_flush (struct rchan *chan)
 
 EXPORT_SYMBOL_GPL (relay_flush)
 
 EXPORT_SYMBOL_GPL (relay_file_operations)
 
 early_initcall (relay_init)
 

Variables

struct file_operations relay_file_operations
 

Typedef Documentation

typedef int(* subbuf_actor_t)(size_t read_start, struct rchan_buf *buf, size_t avail, read_descriptor_t *desc, read_actor_t actor)

Definition at line 1121 of file relay.c.

Function Documentation

early_initcall ( relay_init  )
EXPORT_SYMBOL_GPL ( relay_buf_full  )
EXPORT_SYMBOL_GPL ( relay_reset  )
EXPORT_SYMBOL_GPL ( relay_open  )
EXPORT_SYMBOL_GPL ( relay_switch_subbuf  )
EXPORT_SYMBOL_GPL ( relay_subbufs_consumed  )
EXPORT_SYMBOL_GPL ( relay_close  )
EXPORT_SYMBOL_GPL ( relay_flush  )
EXPORT_SYMBOL_GPL ( relay_file_operations  )
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
Initial value:
= {
.open = relay_file_open,
.poll = relay_file_poll,
.mmap = relay_file_mmap,
.read = relay_file_read,
.llseek = no_llseek,
.release = relay_file_release,
.splice_read = relay_file_splice_read,
}

Definition at line 1348 of file relay.c.