smserver.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2001-2002 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SMSERVER_H_
#define _SMSERVER_H_
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
#include <door.h>
#include <thread.h>
#include <synch.h>
#define RQ_LEN 18
#define MAX_RQ_LEN 32
#define MAX_CDB_LEN 32
#define smedia_service "/var/run/smedia_svc"
#define DEFAULT_SMEDIAD_DEVDIR "/usr/lib/smedia"
#define INIT_NOT_DONE 0
#define INIT_DONE 1
#define INIT_IN_PROGRESS 2
/* SCSI FORMAT UNIT cdb[1] #defines */
#define FMTDATA 0x10
#define CMPLIST 0x08
/* Defect list header data[1] #defines */
#define VS 0x1
#define IMMED 0x2
#define DSP 0x4
#define IP 0x8
#define STPF 0x10
#define DCRT 0x20
#define DPRY 0x40
#define FOV 0x80
#define DEFERRED_ERROR 0x71
#define AWRE 0x80
#define MODE_SENSE_PARAM_HDR_LEN 4
#define MODE_PARAM_BLOCK_LEN 8
#define SKSV_FIELD 0x80
#define SKSV_OFFSET 15
#define FORMAT_PROGRESS_INDICATOR_OFFSET_0 16
#define FORMAT_PROGRESS_INDICATOR_OFFSET_1 17
/* #defines for protect medode field */
#define UNLOCK_MODE 0x0
#define WRITE_PROTECT_MODE 0x2
#define PASSWD_WRITE_PROTECT_MODE 0x3
#define READ_WRITE_PROTECT_MODE 0x5
#define TEMP_UNLOCK_MODE 0x8
/* #defines for CARTRIDGE STATUS PAGE */
#define CARTRIDGE_STATUS_PAGE 2
#define NON_SENSE_HDR_LEN 0x2
#define PROTECT_MODE_OFFSET 19
#define DISK_STATUS_OFFSET 1
/* error reporting mechanism */
void fatal(const char *, ...);
void info(const char *, ...);
void warning(const char *, ...);
void setlog(const char *);
void flushlog();
void quit(const char *, ...);
void noise(const char *, ...);
typedef struct server_data {
char sd_init_state;
int sd_door;
int sd_fd;
typedef enum {
SMEDIA_SUCCESS = 0x0,
SMEDIA_FAILURE /* general failure */
typedef struct door_data {
/* and death door decriptor */
void *dd_buf; /* mmapped buffer of client */
int audit_na; /* 0 if event is attributable */
int audit_sorf; /* success or failure of audit_event */
char *audit_user; /* text version of audit_uid */
char *audit_path; /* path token */
int audit_policy; /* kernel audit policy */
struct auditpinfo_addr audit_ap;
char audit_text[128];
char audit_text1[128];
} door_data_t;
typedef enum {
SMEDIA_CNUM_OPEN_FD = 0x1,
typedef struct {
} smedia_req_t;
typedef struct {
} smedia_ret_t;
typedef struct smedia_reqping {
typedef struct smedia_retping {
/*
* SMEDIA open device
*/
typedef struct smedia_reqopen {
int oflag;
int omode;
typedef struct smedia_retopen {
typedef struct smedia_requscsi_cmd {
short uscsi_timeout;
char uscsi_cdb[MAX_CDB_LEN];
typedef struct smedia_retuscsi_cmd {
short uscsi_status;
char uscsi_rqbuf[MAX_RQ_LEN];
typedef struct smedia_reqget_device_info {
typedef struct smedia_reqset_shfd {
typedef struct smedia_retget_device_info {
char sm_vendor_name[32];
char sm_product_name[32];
char sm_firmware_version[32];
typedef struct smedia_reqget_medium_property {
typedef struct smedia_retget_medium_property {
typedef struct smedia_reqget_protection_status {
typedef struct smedia_retget_protection_status {
typedef struct smedia_reqset_protection_status {
typedef struct smedia_retset_protection_status {
typedef struct smedia_reqraw_read {
typedef struct smedia_retraw_read {
typedef struct smedia_reqraw_write {
typedef struct smedia_retraw_write {
typedef struct smedia_reqformat {
typedef struct smedia_retformat {
typedef struct smedia_reqcheck_format_status {
typedef struct smedia_retcheck_format_status {
int percent_complete;
typedef struct smedia_reqreassign_block {
typedef struct smedia_retreassign_block {
typedef struct {
typedef union {
#define SCSI_GENERIC 1
#define SCSI_IOMEGA 2
#define SCSI_FLOPPY 3
/*
* Crude algorithm for calculating format timeout.
* 30min + 5min/100MB =>
* 35min for 100MB ZIP
* 42.5 min for 250MB ZIP
* 127 min for 2GB Jaz
* It is OK for now as this is just an upper limit by which the
* format should complete.
*/
/*
* Non sense data length for catridge status page.
* Should be 63, but IDE driver panics with a non-aligned
* data transfer.
*/
#define ND_LENGTH 64
/*
* Vendor specific commands from Iomega
*/
#define IOMEGA_NONSENSE_CMD 0x6
#define IOMEGA_CATRIDGE_PROTECT 0xC
#ifdef __cplusplus
}
#endif
#endif /* _SMSERVER_H_ */