/*
 *	sefstructs.h - SAM-FS system error facility (_AML_SEF)  information.
 *      Description:
 *	Definitions for SAM-FS system error facility
 *
 */

/*
 *    SAM-QFS_notice_begin
 *
 *      Solaris 2.x Sun Storage & Archiving Management File System
 *
 *		Copyright (c) 2007 Sun Microsystems, Inc. All Rights Reserved.
 *
 *		U.S. Government Rights - Commercial software. Government users are
 *	subject to the Sun Microsystems, Inc. standard license agreement and applicable
 *	provisions of the FAR and its supplements.
 *
 *      	Use is subject to license terms. Sun, Sun Microsystems and the Sun logo
 *	are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S.
 *	and other countries.
 *
 *    SAM-QFS_notice_end
 */

/*
 *	LGPL NOTICE
 *
 *	This library is free software; you can redistribute it and/or
 *	modify it under the terms of the GNU Lesser General Public
 *	License as published by the Free Software Foundation; either
 *	version 2.1 of the License, or (at your option) any later version.
 *
 *	This library is distributed in the hope that it will be useful,
 *	but WITHOUT ANY WARRANTY; without even the implied warranty of
 *	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *	Lesser General Public License for more details.
 *
 *	You should have received a copy of the GNU Lesser General Public
 *	License along with this library; if not, write to the Free Software
 *	Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */

#if !defined(_AML_SEFSTRUCTS_H)
#define	_AML_SEFSTRUCTS_H

#pragma ident "$Revision$"

/*
 * In the SCSI spec, the possible page codes returned in the "list of
 * supported pages" are 0 - 0x3F.
 */
#define	SEF_MAX_PAGES	(0x3F + 1)

struct sef_hdr {

	/* the following fields will be filled in once at open */
	uint_t		sef_magic;			/* magic # for app to sync file posn */
	uint_t		sef_version;			/* version number */
	uint_t		sef_size;			/* size of this record, excl. header */
	uint16_t	sef_eq;				/* equipment number of this device */
	char		sef_devname[128];		/* pathname of device */
	uchar_t		sef_vendor_id[9];		/* vendor id from inquiry */
	uchar_t		sef_product_id[17];		/* product id from inquiry */
	uchar_t		sef_revision[5];		/* revision level from inquiry */
	uchar_t		sef_scsi_type;			/* device type from inquiry */

	/* the following fields must be filled in before each record is written */
	char		sef_vsn[32];			/* vsn of media that was mounted */
	time_t		sef_timestamp;			/* timestamp of this record */

};


struct sef_pginfo {
	ushort	pgcode;
	ushort	pglen;
};

/*
 * struct sef_devinfo contains the fields of sef information that are put in
 * the dev_ent_t structure--in the device table.
 */
struct sef_devinfo {
	struct sef_pginfo sef_pgs[SEF_MAX_PAGES];
	struct sef_hdr	*sef_hdr;	/* ptr to sef header for this device */
	uint8_t 	sef_inited;	/* indicates sef has been initialized for this dev */
};


/*
 * Structure of a scsi-standard log sense page header
 */
struct sef_pg_hdr {
	uchar_t		page_code;
	uchar_t		reserved;
	ushort		page_len;
};

/*
 * Structure of "supported pages" log sense page
 */
struct sef_supp_pgs {
	struct sef_pg_hdr	hdr;
	uchar_t			supp_pgs[SEF_MAX_PAGES];
};

#endif /* !defined(_AML_SEFSTRUCTS_H) */
