plan 9 kernel history: overview | file list | diff list

2000/1129/alphapc/sd.h (diff list | history)

2000/0809/sys/src/9/alphapc/sd.h:1,1212000/1129/sys/src/9/alphapc/sd.h:0 (short | long | prev)
Deleted.
rsc Mon Mar 7 10:20:29 2005
2000/0515    
/* 
 * Storage Device. 
 */ 
typedef struct SDev SDev; 
typedef struct SDifc SDifc; 
typedef struct SDpart SDpart; 
2000/0706    
typedef struct SDperm SDperm; 
2000/0515    
typedef struct SDreq SDreq; 
typedef struct SDunit SDunit; 
                 
2000/0706    
typedef struct SDperm { 
2000/0515    
	char	name[NAMELEN]; 
	char	user[NAMELEN]; 
	ulong	perm; 
2000/0706    
} SDperm; 
                 
typedef struct SDpart { 
	ulong	start; 
	ulong	end; 
	SDperm; 
2000/0515    
	int	valid; 
2000/0618    
	ulong	vers; 
2000/0515    
} SDpart; 
                 
typedef struct SDunit { 
	SDev*	dev; 
	int	subno; 
	uchar	inquiry[256];		/* format follows SCSI spec */ 
2000/0706    
	SDperm; 
2000/0515    
	Rendez	rendez; 
                 
	QLock	ctl; 
	ulong	sectors; 
	ulong	secsize; 
2000/0809    
	SDpart*	part;			/* nil or array of size npart */ 
	int	npart; 
2000/0618    
	ulong	vers; 
2000/0706    
	SDperm	ctlperm; 
2000/0515    
                 
2000/0607    
	Lock	rawinuse;		/* really just a test-and-set */ 
2000/0515    
	int	state; 
	SDreq*	req; 
2000/0706    
	SDperm	rawperm; 
2000/0515    
} SDunit; 
                 
typedef struct SDev { 
	SDifc*	ifc;			/* pnp/legacy */ 
	void	*ctlr; 
	int	idno; 
	char	name[NAMELEN]; 
	int	index;			/* into unit space */ 
	int	nunit; 
	SDev*	next; 
                 
	QLock;				/* enable/disable */ 
	int	enabled; 
} SDev; 
                 
typedef struct SDifc { 
	char*	name; 
                 
	SDev*	(*pnp)(void); 
	SDev*	(*legacy)(int, int); 
	SDev*	(*id)(SDev*); 
	int	(*enable)(SDev*); 
	int	(*disable)(SDev*); 
                 
	int	(*verify)(SDunit*); 
	int	(*online)(SDunit*); 
	int	(*rio)(SDreq*); 
	int	(*rctl)(SDunit*, char*, int); 
	int	(*wctl)(SDunit*, Cmdbuf*); 
                 
	long	(*bio)(SDunit*, int, int, void*, long, long); 
} SDifc; 
                 
typedef struct SDreq { 
	SDunit*	unit; 
	int	lun; 
	int	write; 
	uchar	cmd[16]; 
	int	clen; 
	void*	data; 
	int	dlen; 
                 
	int	flags; 
                 
	int	status; 
	long	rlen; 
	uchar	sense[256]; 
} SDreq; 
                 
enum { 
	SDnosense	= 0x00000001, 
	SDvalidsense	= 0x00010000, 
}; 
                 
enum { 
2000/0607    
	SDretry		= -5,		/* internal to controllers */ 
2000/0515    
	SDmalloc	= -4, 
	SDeio		= -3, 
	SDtimeout	= -2, 
	SDnostatus	= -1, 
                 
	SDok		= 0, 
                 
	SDcheck		= 0x02,		/* check condition */ 
	SDbusy		= 0x08,		/* busy */ 
                 
	SDmaxio		= 2048*1024, 
	SDnpart		= 16, 
}; 
                 
#define sdmalloc(n)	malloc(n) 
#define sdfree(p)	free(p) 
                 
/* sdscsi.c */ 
extern int scsiverify(SDunit*); 
extern int scsionline(SDunit*); 
extern long scsibio(SDunit*, int, int, void*, long, long); 
extern SDev* scsiid(SDev*, SDifc*); 


source code copyright © 1990-2005 Lucent Technologies; see license
Plan 9 distribution
comments to russ cox (rsc@swtch.com)