aoe  87
About: AoE (ATA over Ethernet) Protocol Driver (Linux kernel 4.8.x and greater are not supported).
  Fossies Dox: aoe-87.tar.gz  ("inofficial" and yet experimental doxygen-generated source code documentation)  

aoechr.c File Reference
#include <linux/hdreg.h>
#include <linux/blkdev.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/slab.h>
#include <linux/mutex.h>
#include <linux/export.h>
#include "aoe.h"
Include dependency graph for aoechr.c:

Go to the source code of this file.

Data Structures

struct  aoe_chardev
 
struct  ErrMsg
 

Enumerations

enum  {
  MINOR_ERR = 2, MINOR_DISCOVER, MINOR_INTERFACES, MINOR_REVALIDATE,
  MINOR_FLUSH, MSGSZ = 2048, NMSG = 100
}
 
enum  { EMFL_VALID = 1 }
 

Functions

static DEFINE_MUTEX (aoechr_mutex)
 
static int discover (void)
 
static int interfaces (const char __user *str, size_t size)
 
static int revalidate (const char __user *str, size_t size)
 
void aoechr_error (char *msg)
 
static ssize_t aoechr_write (struct file *filp, const char __user *buf, size_t cnt, loff_t *offp)
 
static int aoechr_open (struct inode *inode, struct file *filp)
 
static int aoechr_rel (struct inode *inode, struct file *filp)
 
static ssize_t aoechr_read (struct file *filp, char __user *buf, size_t cnt, loff_t *off)
 
int __init aoechr_init (void)
 
void aoechr_exit (void)
 

Variables

static struct ErrMsg emsgs [NMSG]
 
static int emsgs_head_idx
 
static int emsgs_tail_idx
 
static struct semaphore emsgs_sema
 
static spinlock_t emsgs_lock
 
static int nblocked_emsgs_readers
 
static struct class * aoe_class
 
static struct aoe_chardev chardevs []
 
static const struct file_operations aoe_fops
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
MINOR_ERR 
MINOR_DISCOVER 
MINOR_INTERFACES 
MINOR_REVALIDATE 
MINOR_FLUSH 
MSGSZ 
NMSG 

Definition at line 16 of file aoechr.c.

◆ anonymous enum

anonymous enum
Enumerator
EMFL_VALID 

Definition at line 32 of file aoechr.c.

Function Documentation

◆ aoechr_error()

void aoechr_error ( char *  msg)

◆ aoechr_exit()

void aoechr_exit ( void  )

Definition at line 297 of file aoechr.c.

References aoe_class, AOE_MAJOR, and chardevs.

Referenced by aoe_exit(), and aoe_init().

◆ aoechr_init()

int __init aoechr_init ( void  )

◆ aoechr_open()

static int aoechr_open ( struct inode *  inode,
struct file *  filp 
)
static

Definition at line 183 of file aoechr.c.

References chardevs.

◆ aoechr_read()

static ssize_t aoechr_read ( struct file *  filp,
char __user *  buf,
size_t  cnt,
loff_t *  off 
)
static

◆ aoechr_rel()

static int aoechr_rel ( struct inode *  inode,
struct file *  filp 
)
static

Definition at line 201 of file aoechr.c.

◆ aoechr_write()

static ssize_t aoechr_write ( struct file *  filp,
const char __user *  buf,
size_t  cnt,
loff_t *  offp 
)
static

◆ DEFINE_MUTEX()

static DEFINE_MUTEX ( aoechr_mutex  )
static

◆ discover()

static int discover ( void  )
static

Definition at line 60 of file aoechr.c.

References aoecmd_cfg().

Referenced by aoechr_write().

◆ interfaces()

static int interfaces ( const char __user *  str,
size_t  size 
)
static

Definition at line 67 of file aoechr.c.

References set_aoe_iflist().

Referenced by aoechr_write().

◆ revalidate()

static int revalidate ( const char __user *  str,
size_t  size 
)
static

Variable Documentation

◆ aoe_class

struct class* aoe_class
static

Definition at line 49 of file aoechr.c.

Referenced by aoechr_exit(), and aoechr_init().

◆ aoe_fops

const struct file_operations aoe_fops
static
Initial value:
= {
.write = aoechr_write,
.read = aoechr_read,
.open = aoechr_open,
.release = aoechr_rel,
.owner = THIS_MODULE,
}

Definition at line 263 of file aoechr.c.

Referenced by aoechr_init().

◆ chardevs

struct aoe_chardev chardevs[]
static
Initial value:
= {
{ MINOR_ERR, "etherd" "/err" },
{ MINOR_DISCOVER, "etherd" "/discover" },
{ MINOR_INTERFACES, "etherd" "/interfaces" },
{ MINOR_REVALIDATE, "etherd" "/revalidate" },
{ MINOR_FLUSH, "etherd" "/flush" },
}

Definition at line 50 of file aoechr.c.

Referenced by aoechr_exit(), aoechr_init(), and aoechr_open().

◆ emsgs

struct ErrMsg emsgs[NMSG]
static

Definition at line 44 of file aoechr.c.

Referenced by aoechr_error(), and aoechr_read().

◆ emsgs_head_idx

int emsgs_head_idx
static

Definition at line 45 of file aoechr.c.

Referenced by aoechr_read().

◆ emsgs_lock

spinlock_t emsgs_lock
static

Definition at line 47 of file aoechr.c.

Referenced by aoechr_error(), aoechr_init(), and aoechr_read().

◆ emsgs_sema

struct semaphore emsgs_sema
static

Definition at line 46 of file aoechr.c.

Referenced by aoechr_error(), aoechr_init(), and aoechr_read().

◆ emsgs_tail_idx

int emsgs_tail_idx
static

Definition at line 45 of file aoechr.c.

Referenced by aoechr_error().

◆ nblocked_emsgs_readers

int nblocked_emsgs_readers
static

Definition at line 48 of file aoechr.c.

Referenced by aoechr_error(), and aoechr_read().

aoechr_rel
static int aoechr_rel(struct inode *inode, struct file *filp)
Definition: aoechr.c:201
MINOR_DISCOVER
Definition: aoechr.c:19
aoechr_open
static int aoechr_open(struct inode *inode, struct file *filp)
Definition: aoechr.c:183
MINOR_REVALIDATE
Definition: aoechr.c:21
MINOR_ERR
Definition: aoechr.c:18
MINOR_INTERFACES
Definition: aoechr.c:20
aoechr_write
static ssize_t aoechr_write(struct file *filp, const char __user *buf, size_t cnt, loff_t *offp)
Definition: aoechr.c:156
aoechr_read
static ssize_t aoechr_read(struct file *filp, char __user *buf, size_t cnt, loff_t *off)
Definition: aoechr.c:207
MINOR_FLUSH
Definition: aoechr.c:22