Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions | Variables
op-msg.c File Reference
#include <linux/device.h>
#include <linux/slab.h>
#include <net/genetlink.h>
#include <linux/netdevice.h>
#include <linux/wimax.h>
#include <linux/security.h>
#include <linux/export.h>
#include "wimax-internal.h"
#include "debug-levels.h"

Go to the source code of this file.

Macros

#define D_SUBMODULE   op_msg
 

Functions

struct sk_buffwimax_msg_alloc (struct wimax_dev *wimax_dev, const char *pipe_name, const void *msg, size_t size, gfp_t gfp_flags)
 
 EXPORT_SYMBOL_GPL (wimax_msg_alloc)
 
const voidwimax_msg_data_len (struct sk_buff *msg, size_t *size)
 
 EXPORT_SYMBOL_GPL (wimax_msg_data_len)
 
const voidwimax_msg_data (struct sk_buff *msg)
 
 EXPORT_SYMBOL_GPL (wimax_msg_data)
 
ssize_t wimax_msg_len (struct sk_buff *msg)
 
 EXPORT_SYMBOL_GPL (wimax_msg_len)
 
int wimax_msg_send (struct wimax_dev *wimax_dev, struct sk_buff *skb)
 
 EXPORT_SYMBOL_GPL (wimax_msg_send)
 
int wimax_msg (struct wimax_dev *wimax_dev, const char *pipe_name, const void *buf, size_t size, gfp_t gfp_flags)
 
 EXPORT_SYMBOL_GPL (wimax_msg)
 

Variables

struct genl_ops wimax_gnl_msg_from_user
 

Macro Definition Documentation

#define D_SUBMODULE   op_msg

Definition at line 84 of file op-msg.c.

Function Documentation

EXPORT_SYMBOL_GPL ( wimax_msg_alloc  )
EXPORT_SYMBOL_GPL ( wimax_msg_data_len  )
EXPORT_SYMBOL_GPL ( wimax_msg_data  )
EXPORT_SYMBOL_GPL ( wimax_msg_len  )
EXPORT_SYMBOL_GPL ( wimax_msg_send  )
EXPORT_SYMBOL_GPL ( wimax_msg  )
int wimax_msg ( struct wimax_dev wimax_dev,
const char pipe_name,
const void buf,
size_t  size,
gfp_t  gfp_flags 
)

wimax_msg - Send a message to user space

: WiMAX device descriptor (properly referenced) : "named pipe" the message will be sent to : pointer to the message to send. : size of the buffer pointed to by (in bytes). : flags for memory allocation.

Returns: %0 if ok, negative errno code on error.

Description:

Sends a free-form message to user space on the device .

NOTES:

Once the is given to this function, who will own it and will release it when done (unless it returns error).

Definition at line 309 of file op-msg.c.

struct sk_buff* wimax_msg_alloc ( struct wimax_dev wimax_dev,
const char pipe_name,
const void msg,
size_t  size,
gfp_t  gfp_flags 
)
read

wimax_msg_alloc - Create a new skb for sending a message to userspace

: WiMAX device descriptor : "named pipe" the message will be sent to : pointer to the message data to send : size of the message to send (in bytes), including the header. : flags for memory allocation.

Returns: %0 if ok, negative errno code on error

Description:

Allocates an skb that will contain the message to send to user space over the messaging pipe and initializes it, copying the payload.

Once this call is done, you can deliver it with wimax_msg_send().

IMPORTANT:

Don't use skb_push()/skb_pull()/skb_reserve() on the skb, as wimax_msg_send() depends on skb->data being placed at the beginning of the user message.

Unlike other WiMAX stack calls, this call can be used way early, even before wimax_dev_add() is called, as long as the wimax_dev->net_dev pointer is set to point to a proper net_dev. This is so that drivers can use it early in case they need to send stuff around or communicate with user space.

Definition at line 120 of file op-msg.c.

const void* wimax_msg_data ( struct sk_buff msg)

wimax_msg_data - Return a pointer to a message's payload

: Pointer to a message created with wimax_msg_alloc()

Definition at line 206 of file op-msg.c.

const void* wimax_msg_data_len ( struct sk_buff msg,
size_t size 
)

wimax_msg_data_len - Return a pointer and size of a message's payload

: Pointer to a message created with wimax_msg_alloc() : Pointer to where to store the message's size

Returns the pointer to the message data.

Definition at line 184 of file op-msg.c.

ssize_t wimax_msg_len ( struct sk_buff msg)

wimax_msg_len - Return a message's payload length

: Pointer to a message created with wimax_msg_alloc()

Definition at line 227 of file op-msg.c.

int wimax_msg_send ( struct wimax_dev wimax_dev,
struct sk_buff skb 
)

wimax_msg_send - Send a pre-allocated message to user space

: WiMAX device descriptor

: &struct sk_buff returned by wimax_msg_alloc(). Note the ownership of is transferred to this function.

Returns: 0 if ok, < 0 errno code on error

Description:

Sends a free-form message that was preallocated with wimax_msg_alloc() and filled up.

Assumes that once you pass an skb to this function for sending, it owns it and will release it when done (on success).

IMPORTANT:

Don't use skb_push()/skb_pull()/skb_reserve() on the skb, as wimax_msg_send() depends on skb->data being placed at the beginning of the user message.

Unlike other WiMAX stack calls, this call can be used way early, even before wimax_dev_add() is called, as long as the wimax_dev->net_dev pointer is set to point to a proper net_dev. This is so that drivers can use it early in case they need to send stuff around or communicate with user space.

Definition at line 273 of file op-msg.c.

Variable Documentation

struct genl_ops wimax_gnl_msg_from_user
Initial value:
= {
.flags = GENL_ADMIN_PERM,
.policy = wimax_gnl_msg_policy,
.doit = wimax_gnl_doit_msg_from_user,
.dumpit = NULL,
}

Definition at line 426 of file op-msg.c.