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)  

aoe-sancheck.c File Reference
#include <stdio.h>
#include <sched.h>
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>
#include <string.h>
#include <time.h>
#include <sys/ioctl.h>
#include <pthread.h>
#include <poll.h>
#include <errno.h>
#include <netpacket/packet.h>
#include <net/ethernet.h>
#include <sys/types.h>
#include <net/if.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/socket.h>
Include dependency graph for aoe-sancheck.c:

Go to the source code of this file.

Data Structures

struct  Aoe
 
struct  Qc
 
struct  Ata
 
struct  Lun
 
struct  Eth
 
struct  Targ
 
struct  Mac
 

Macros

#define nelem(x)   (sizeof(x)/sizeof((x)[0]))
 
#define nil   NULL
 
#define vprintf(...)   if (qflag) ; else fprintf(stderr, __VA_ARGS__)
 
#define mintu(x)   ((x) > 60 ? x : 60)
 

Typedefs

typedef unsigned char uchar
 
typedef unsigned long ulong
 
typedef struct Aoe Aoe
 
typedef struct Qc Qc
 
typedef struct Ata Ata
 
typedef struct Lun Lun
 
typedef struct Eth Eth
 
typedef struct Targ Targ
 
typedef struct Mac Mac
 

Enumerations

enum  {
  Neth = 16, Nstack = 16*1024, Nws = 5, Lnew = 0,
  Lprobe, Arsp = (1<<3), Aerr = (1<<2), Cata = 0,
  Cqc = 1, ETaoe = 0x88a2
}
 

Functions

int ethlist (char **, int)
 
int ethopen (Eth *)
 
void * jcheck (void *)
 
int jinput (Eth *)
 
Lunfindlun (Eth *e, Aoe *a)
 
void jprobe (Eth *e, Lun *lun)
 
void printlist (void)
 
void printsancheck (void)
 
ulong nhgetl (uchar *)
 
ushort nhgets (uchar *)
 
void hnputs (uchar *, ushort)
 
void hnputl (uchar *, ulong)
 
void * mallocz (int)
 
void inserttarg (int, int)
 
void insertmac (Mac **, char *)
 
void sancheck (int, int)
 
void ifsummary (void)
 
int ifup (char *)
 
void inserteth (char **, int, char *)
 
char * getpciid (char *, int, char *)
 
int main (int argc, char **argv)
 
char * cea (char *op, char *ea)
 
void timewait (int secs)
 
int discover (Eth *e)
 
void catch (int sig)
 
int getindx (int sfd, char *name)
 
int getmtu (Eth *e)
 

Variables

Eth eth [Neth]
 
int waitsecs = Nws
 
pthread_t threads [Neth]
 
Targtarglist
 

Macro Definition Documentation

◆ mintu

#define mintu (   x)    ((x) > 60 ? x : 60)

Definition at line 27 of file aoe-sancheck.c.

◆ nelem

#define nelem (   x)    (sizeof(x)/sizeof((x)[0]))

Definition at line 24 of file aoe-sancheck.c.

◆ nil

#define nil   NULL

Definition at line 25 of file aoe-sancheck.c.

◆ vprintf

#define vprintf (   ...)    if (qflag) ; else fprintf(stderr, __VA_ARGS__)

Definition at line 26 of file aoe-sancheck.c.

Typedef Documentation

◆ Aoe

typedef struct Aoe Aoe

Definition at line 32 of file aoe-sancheck.c.

◆ Ata

typedef struct Ata Ata

Definition at line 34 of file aoe-sancheck.c.

◆ Eth

typedef struct Eth Eth

Definition at line 36 of file aoe-sancheck.c.

◆ Lun

typedef struct Lun Lun

Definition at line 35 of file aoe-sancheck.c.

◆ Mac

typedef struct Mac Mac

Definition at line 38 of file aoe-sancheck.c.

◆ Qc

typedef struct Qc Qc

Definition at line 33 of file aoe-sancheck.c.

◆ Targ

typedef struct Targ Targ

Definition at line 37 of file aoe-sancheck.c.

◆ uchar

typedef unsigned char uchar

Definition at line 29 of file aoe-sancheck.c.

◆ ulong

typedef unsigned long ulong

Definition at line 30 of file aoe-sancheck.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
Neth 
Nstack 
Nws 
Lnew 
Lprobe 
Arsp 
Aerr 
Cata 
Cqc 
ETaoe 

Definition at line 105 of file aoe-sancheck.c.

Function Documentation

◆ catch()

void catch ( int  sig)

Definition at line 428 of file aoe-sancheck.c.

◆ cea()

char* cea ( char *  op,
char *  ea 
)

Definition at line 179 of file aoe-sancheck.c.

Referenced by printlist(), and sancheck().

◆ discover()

int discover ( Eth e)

◆ ethlist()

int ethlist ( char **  ifs,
int  nifs 
)

Definition at line 502 of file aoe-sancheck.c.

References inserteth().

Referenced by main().

◆ ethopen()

int ethopen ( Eth e)

Definition at line 461 of file aoe-sancheck.c.

References Eth::ea, ETaoe, Eth::fd, getindx(), getmtu(), Eth::mtu, Eth::name, and sfd.

Referenced by jcheck().

◆ findlun()

Lun * findlun ( Eth e,
Aoe a 
)

◆ getindx()

int getindx ( int  sfd,
char *  name 
)

Definition at line 433 of file aoe-sancheck.c.

References sfd.

Referenced by ethopen().

◆ getmtu()

int getmtu ( Eth e)

Definition at line 446 of file aoe-sancheck.c.

References Eth::fd, and Eth::name.

Referenced by ethopen().

◆ getpciid()

char * getpciid ( char *  b,
int  blen,
char *  n 
)

Definition at line 743 of file aoe-sancheck.c.

Referenced by ifsummary().

◆ hnputl()

void hnputl ( uchar p,
ulong  n 
)

Definition at line 319 of file aoe-sancheck.c.

Referenced by discover(), and jprobe().

◆ hnputs()

void hnputs ( uchar p,
ushort  s 
)

Definition at line 328 of file aoe-sancheck.c.

Referenced by discover(), and jprobe().

◆ ifsummary()

void ifsummary ( void  )

Definition at line 593 of file aoe-sancheck.c.

References eth, getpciid(), Eth::mtu, Eth::name, and Eth::up.

Referenced by printsancheck().

◆ ifup()

int ifup ( char *  ethname)

Definition at line 692 of file aoe-sancheck.c.

Referenced by main().

◆ inserteth()

void inserteth ( char **  ifs,
int  nifs,
char *  n 
)

Definition at line 712 of file aoe-sancheck.c.

Referenced by ethlist().

◆ insertmac()

void insertmac ( Mac **  ml,
char *  m 
)

Definition at line 676 of file aoe-sancheck.c.

References Mac::ea, mallocz(), and Mac::next.

Referenced by sancheck().

◆ inserttarg()

void inserttarg ( int  maj,
int  min 
)

Definition at line 536 of file aoe-sancheck.c.

References Targ::major, mallocz(), Targ::minor, Targ::next, and targlist.

Referenced by findlun().

◆ jcheck()

void * jcheck ( void *  v)

Definition at line 243 of file aoe-sancheck.c.

References discover(), ethopen(), Eth::fd, jinput(), Eth::name, Eth::pkt, and waitsecs.

Referenced by main().

◆ jinput()

◆ jprobe()

void jprobe ( Eth e,
Lun lun 
)

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 149 of file aoe-sancheck.c.

References eth, ethlist(), ifup(), jcheck(), Eth::name, nelem, Neth, printlist(), printsancheck(), threads, and Eth::up.

◆ mallocz()

void * mallocz ( int  sz)

Definition at line 526 of file aoe-sancheck.c.

Referenced by findlun(), insertmac(), and inserttarg().

◆ nhgetl()

ulong nhgetl ( uchar p)

Definition at line 346 of file aoe-sancheck.c.

Referenced by jinput().

◆ nhgets()

ushort nhgets ( uchar p)

Definition at line 335 of file aoe-sancheck.c.

Referenced by findlun().

◆ printlist()

void printlist ( void  )

Definition at line 194 of file aoe-sancheck.c.

References cea(), Lun::ea, eth, Eth::luns, mac, Lun::major, Lun::maxsect, Lun::minor, Eth::name, and Lun::next.

Referenced by main().

◆ printsancheck()

void printsancheck ( void  )

Definition at line 574 of file aoe-sancheck.c.

References ifsummary(), Targ::major, Targ::minor, Targ::next, sancheck(), and targlist.

Referenced by main().

◆ sancheck()

void sancheck ( int  maj,
int  min 
)

◆ timewait()

void timewait ( int  secs)

Definition at line 209 of file aoe-sancheck.c.

Variable Documentation

◆ eth

Eth eth[Neth]

Definition at line 143 of file aoe-sancheck.c.

Referenced by dial(), ifsummary(), main(), printlist(), and sancheck().

◆ targlist

Targ* targlist

Definition at line 146 of file aoe-sancheck.c.

Referenced by inserttarg(), and printsancheck().

◆ threads

pthread_t threads[Neth]

Definition at line 145 of file aoe-sancheck.c.

Referenced by main().

◆ waitsecs

int waitsecs = Nws

Definition at line 144 of file aoe-sancheck.c.

Referenced by jcheck().