Plan 9 from Bell Labs’s /usr/web/sources/extra/9hist/port/sd.h

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


## diffname port/sd.h 2000/0506
## diff -e /dev/null /n/emeliedump/2000/0506/sys/src/9/pc/sd.h
0a
/*
 * Storage Device.
 */
typedef struct SDev SDev;
typedef struct SDifc SDifc;
typedef struct SDpart SDpart;
typedef struct SDreq SDreq;
typedef struct SDunit SDunit;

typedef struct SDpart {
	ulong	start;
	ulong	end;
	char	name[NAMELEN];
	char	user[NAMELEN];
	ulong	perm;
	int	valid;
	int	nopen;			/* of this partition */
} SDpart;

typedef struct SDunit {
	SDev*	dev;
	int	subno;
	uchar	inquiry[256];		/* format follows SCSI spec */
	char	name[NAMELEN];
	Rendez	rendez;

	QLock	ctl;
	ulong	sectors;
	ulong	secsize;
	SDpart*	part;
	int	npart;			/* of valid partitions */
	int	nopen;			/* of partitions on this unit */
	int	changed;

	QLock	raw;
	int	state;
	ulong	pid;
	SDreq*	req;
} 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 {
	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*);
.
## diffname port/sd.h 2000/0526
## diff -e /n/emeliedump/2000/0506/sys/src/9/pc/sd.h /n/emeliedump/2000/0526/sys/src/9/pc/sd.h
37d
35c
	Lock	rawinuse;
.
## diffname port/sd.h 2000/0531
## diff -e /n/emeliedump/2000/0526/sys/src/9/pc/sd.h /n/emeliedump/2000/0531/sys/src/9/pc/sd.h
35c
	Lock	rawinuse;		/* really just a test-and-set */
.
## diffname port/sd.h 2000/0607
## diff -e /n/emeliedump/2000/0531/sys/src/9/pc/sd.h /n/emeliedump/2000/0607/sys/src/9/pc/sd.h
92a
	SDretry		= -5,		/* internal to controllers */
.
## diffname port/sd.h 2000/0617
## diff -e /n/emeliedump/2000/0607/sys/src/9/pc/sd.h /n/emeliedump/2000/0617/sys/src/9/pc/sd.h
30,33c
	SDpart*	part;		/* either nil or points at array of size SDnpart */
	ulong	vers;
.
17c
	ulong	vers;
.
## diffname port/sd.h 2000/0706
## diff -e /n/emeliedump/2000/0617/sys/src/9/pc/sd.h /n/emeliedump/2000/0706/sys/src/9/pc/sd.h
35a
	SDperm	rawperm;
.
31a
	SDperm	ctlperm;
.
30c
	SDpart*	part;			/* nil or array of size SDnpart */
.
24c
	SDperm;
.
15a
} SDperm;

typedef struct SDpart {
	ulong	start;
	ulong	end;
	SDperm;
.
10,12c
typedef struct SDperm {
.
6a
typedef struct SDperm SDperm;
.
## diffname port/sd.h 2000/0809
## diff -e /n/emeliedump/2000/0706/sys/src/9/pc/sd.h /n/emeliedump/2000/0809/sys/src/9/pc/sd.h
35c
	SDpart*	part;			/* nil or array of size npart */
	int	npart;
.
## diffname port/sd.h 2000/1129
## diff -e /n/emeliedump/2000/1129/sys/src/9/pc/sd.h /n/emeliedump/2000/1129/sys/src/9/port/sd.h
43a

	Log log;
.
39a
	QLock	raw;		/* raw read or write in progress */
.
## diffname port/sd.h 2001/0527
## diff -e /n/emeliedump/2000/1129/sys/src/9/port/sd.h /n/emeliedump/2001/0527/sys/src/9/port/sd.h
53c
	char	*name;
.
12,13c
	char	*name;
	char	*user;
.
## diffname port/sd.h 2001/0905
## diff -e /n/emeliedump/2001/0527/sys/src/9/port/sd.h /n/emeliedump/2001/0905/sys/src/9/port/sd.h
77a
	SDev*	(*probe)(DevConf *);
	void		(*clear)(SDev *);
	char*	(*stat)(SDev*, char*, char*);
.
59a
	int		nunit;		/* Number of units */
	QLock	unitlock;		/* `Loading' of units */
	int		*unitflg;		/* Unit flags */
	SDunit	**unit;		/* Each controller has at least one unit */
.
54,55d
49a
	Ref		r;			/* Number of callers using device */
.
48a
/* 
  * Each controller is represented by a SDev, each controller is responsible
  * for allocating its unit structures.
  */ 
.
## diffname port/sd.h 2001/1022
## diff -e /n/emeliedump/2001/0905/sys/src/9/port/sd.h /n/emeliedump/2001/1022/sys/src/9/port/sd.h
85,86c
	SDev*	(*probe)(DevConf*);
	void	(*clear)(SDev*);
.
65,66c
	int*	unitflg;		/* Unit flags */
	SDunit**unit;
.
63c
	int	nunit;			/* Number of units */
.
58c
	char*	name;
.
56c
	void*	ctlr;
.
54c
	Ref	r;			/* Number of callers using device */
.
50,52c
 * Each controller is represented by a SDev.
 * Each controller is responsible for allocating its unit structures.
 * Each controller has at least one unit.
 */ 
.
46c
	Log	log;
.
40c
	QLock	raw;			/* raw read or write in progress */
.
12,13c
	char*	name;
	char*	user;
.
## diffname port/sd.h 2002/0402
## diff -e /n/emeliedump/2001/1022/sys/src/9/port/sd.h /n/emeliedump/2002/0402/sys/src/9/port/sd.h
41c
	ulong	rawinuse;		/* really just a test-and-set */
.
## diffname port/sd.h 2002/0404
## diff -e /n/emeliedump/2002/0402/sys/src/9/port/sd.h /n/emeliedump/2002/0404/sys/src/9/port/sd.h
45,46d
## diffname port/sd.h 2002/0406
## diff -e /n/emeliedump/2002/0404/sys/src/9/port/sd.h /n/emeliedump/2002/0406/sys/src/9/port/sd.h
103c
};
.
89c
struct SDreq {
.
87c
};
.
68c
struct SDifc {
.
66c
};
.
52c
struct SDev {
.
46a
	int	wpunit;			/* whole unit is write protected */
	SDwp	*wp;			/* block level write prtection */
};

.
45d
25c
struct SDcache {
	ulong age;
	ulong bn;
	uchar *data;
};

struct SDwp {
	QLock;
	ulong age;
	ulong start;
	ulong end;
	SDcache cache[SDcachesize];
};

struct SDunit {
.
23c
};
.
17c
struct SDpart {
.
15c
};
.
11c
enum {
	SDcachesize = 20,
};

struct SDperm {
.
9a
typedef struct SDwp SDwp;
typedef struct SDcache SDcache;
.
## diffname port/sd.h 2003/0407
## diff -e /n/emeliedump/2002/0406/sys/src/9/port/sd.h /n/emeliedump/2003/0407/sys/src/9/port/sd.h
50d

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].