Plan 9 from Bell Labs’s /usr/web/sources/contrib/blstuart/θfs/aoe.h

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


/*
 * Copyright (c) 2013, Coraid, Inc.
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *     * Redistributions of source code must retain the above copyright
 *       notice, this list of conditions and the following disclaimer.
 *     * Redistributions in binary form must reproduce the above copyright
 *       notice, this list of conditions and the following disclaimer in the
 *       documentation and/or other materials provided with the distribution.
 *     * Neither the name of Coraid nor the
 *       names of its contributors may be used to endorse or promote products
 *       derived from this software without specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL CORAID BE LIABLE FOR ANY
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

enum {
	ACata,
	ACconfig,
	ACmask,
	ACres,
	ACkey,
	ACosd,
};

enum {
	AQCread,
	AQCtest,
	AQCprefix,
	AQCset,
	AQCfset,
};

enum {
	AOCformat = 0x01,
	AOCcreate,
	AOClist,
	AOCread = 0x05,
	AOCwrite,
	AOCappend,
	AOCflush,
	AOCremove = 0x0a,
	AOCpcreate,
	AOCpremove,
	AOCgetattr = 0x0e,
	AOCsetattr,
	AOCccreate = 0x15,
	AOCcremove,
	AOCclist,
};

enum {
	AEunk,
	AEcmd,				/* bad command */
	AEarg,				/* bad argument */
	AEoff,				/* device offline */
	AEcfg,				/* config string already set */
	AEver,				/* unsupported version */
	AEres,				/* target reserved */
};

enum {
	/* mask commands */
	Mread		= 0,
	Medit,

	/* mask directives */
	MDnop		= 0,
	MDadd,
	MDdel,

	/* mask errors */
	MEunk		= 1,
	MEbad,
	MEfull,

	/* reserve / release */
	Rrread		= 0,
	Rrset,
	Rrforce,
};

enum {
	Aoetype		= 0x88a2,
	Aoesectsz 	= 512,
	Aoemaxcfg	= 1024,

	Aoehsz		= 24,
	Aoeatasz	= 12,
	Aoecfgsz		= 8,
	Aoerrsz		= 2,
	Aoemsz		= 4,
	Aoemdsz	= 8,

	Aoever		= 1,

	AFerr		= 1<<2,
	AFrsp		= 1<<3,

	AAFwrite	= 1,
	AAFext		= 1<<6,
};

typedef	struct	Aoehdr	Aoehdr;
typedef	struct	Aoeata	Aoeata;
typedef	struct	Aoecfg	Aoecfg;
typedef	struct	Aoemd	Aoemd;
typedef	struct	Aoem	Aoem;
typedef	struct	Aoerr	Aoerr;
typedef	struct	Aoeosd	Aoeosd;

struct Aoehdr {
	uchar	dst[Eaddrlen];
	uchar	src[Eaddrlen];
	uchar	type[2];
	uchar	verflag;
	uchar	error;
	uchar	major[2];
	uchar	minor;
	uchar	cmd;
	uchar	tag[4];
};

struct Aoeata {
	uchar	aflag;
	uchar	errfeat;
	uchar	scnt;
	uchar	cmdstat;
	uchar	lba[6];
	uchar	res[2];
};

struct Aoecfg {
	uchar	bufcnt[2];
	uchar	fwver[2];
	uchar	scnt;
	uchar	verccmd;
	uchar	cslen[2];
};

struct Aoemd {
	uchar	dres;
	uchar	dcmd;
	uchar	ea[Eaddrlen];
};

struct Aoem {
	uchar	mres;
	uchar	mcmd;
	uchar	merr;
	uchar	mcnt;
};

struct Aoerr {
	uchar	rcmd;
	uchar	nea;
	uchar	ea0[];
};

struct Aoeosd {
	uchar	ocmd;
	uchar	oflag;
	uchar	olen[2];
	uchar	opid[8];
	uchar	ooid[8];
	uchar	oaddr[8];
};

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].