/* dat.h: include file for vblade AoE target */ #define nil ((void *)0) /* * tunable variables */ enum { FWV = 0x4000, // Firmware version }; #undef major #undef minor #undef makedev #define major(x) ((x) >> 24 & 0xFF) #define minor(x) ((x) & 0xffffff) #define makedev(x, y) ((x) << 24 | (y)) typedef unsigned char uchar; //typedef unsigned short ushort; //typedef unsigned long ulong; typedef long long vlong; typedef struct Aoehdr Aoehdr; typedef struct Ata Ata; typedef struct Conf Conf; typedef struct Ataregs Ataregs; struct Ataregs { vlong lba; uchar cmd; uchar status; uchar err; uchar feature; uchar sectors; }; struct Aoehdr { uchar dst[6]; uchar src[6]; ushort type; uchar flags; uchar error; ushort maj; uchar min; uchar cmd; uchar tag[4]; }; struct Ata { Aoehdr h; uchar aflag; uchar err; uchar sectors; uchar cmd; uchar lba[6]; uchar resvd[2]; uchar data[1024]; }; struct Conf { Aoehdr h; ushort bufcnt; ushort firmware; uchar filler; uchar vercmd; ushort len; uchar data[1024]; }; enum { AoEver = 1, ATAcmd = 0, // command codes Config, Resp = (1<<3), // flags Error = (1<<2), BadCmd = 1, BadArg, DevUnavailable, ConfigErr, BadVersion, Write = (1<<0), Async = (1<<1), Device = (1<<4), Extend = (1<<6), Qread = 0, Qtest, Qprefix, Qset, Qfset, Nretries = 3, Bufcount = 32, }; int shelf, slot; ulong aoetag; uchar mac[6]; int bfd; // block file descriptor int sfd; // socket file descriptor vlong size; // size of vblade char *progname;