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

2001/0907/port/devsd.c (diff list | history)

1994/0913/sys/src/9/port/devsd.c:11,171994/1228/sys/src/9/port/devsd.c:11,17 (short | long)
1994/0913    
 
enum 
{ 
	LogNpart	= 3, 
1994/1228    
	LogNpart	= 4, 
1994/0913    
	Npart		= 1<<LogNpart, 
	Ndisk		= 32, 
	Nlun		= 8, 
1994/0913/sys/src/9/port/devsd.c:145,1501994/1228/sys/src/9/port/devsd.c:145,151
1994/0913    
			break; 
		} 
	} 
1994/1228    
	print("sd out\n"); 
1994/0913    
} 
 
Chan* 
1994/0913/sys/src/9/port/devsd.c:276,2811994/1228/sys/src/9/port/devsd.c:277,284
1994/0913    
					strncpy(d->vol, field[1], NAMELEN); 
				break;	 
			case 3: 
1994/1228    
				if(p >= &d->table[Npart]) 
					break; 
1994/0913    
				strncpy(p->name, field[0], NAMELEN); 
				p->beg = strtoul(field[1], 0, 0); 
				p->end = strtoul(field[2], 0, 0); 
1994/1228/sys/src/9/port/devsd.c:145,1511994/1230/sys/src/9/port/devsd.c:145,150 (short | long)
1994/0913    
			break; 
		} 
	} 
1994/1228    
	print("sd out\n"); 
1994/0913    
} 
 
Chan* 
1994/1230/sys/src/9/port/devsd.c:229,2381995/0108/sys/src/9/port/devsd.c:229,250 (short | long)
1994/0913    
	return sdio(c, 0, a, n, offset); 
} 
 
1995/0108    
Block* 
sdbread(Chan *c, long n, ulong offset) 
{ 
	return devbread(c, n, offset); 
} 
 
1994/0913    
long 
sdwrite(Chan *c, char *a, long n, ulong offset) 
{ 
	return sdio(c, 1, a, n, offset); 
1995/0108    
} 
 
long 
sdbwrite(Chan *c, Block *bp, ulong offset) 
{ 
	return devbwrite(c, bp, offset); 
1994/0913    
} 
 
static void 
1995/0108/sys/src/9/port/devsd.c:279,2881995/0117/sys/src/9/port/devsd.c:279,288 (short | long)
1994/0913    
	/* 
	 *  parse partition table. 
	 */ 
	n = getfields(b, line, Npart+2, '\n'); 
1995/0117    
	n = getfields(b, line, Npart+2, "\n"); 
1994/0913    
	if(n > 0 && strncmp(line[0], MAGIC, sizeof(MAGIC)-1) == 0) { 
		for(i = 1; i < n; i++) { 
			switch(getfields(line[i], field, 3, ' ')) { 
1995/0117    
			switch(getfields(line[i], field, 3, " ")) { 
1994/0913    
			case 2: 
				if(strcmp(field[0], "unit") == 0) 
					strncpy(d->vol, field[1], NAMELEN); 
1995/0117/sys/src/9/port/devsd.c:212,2171995/0324/sys/src/9/port/devsd.c:212,218 (short | long)
1994/0913    
	if(c->mode != OWRITE && c->mode != ORDWR) 
		return; 
 
1995/0324    
print("sdclose: qid 0x%lux drive %d, part %d\n", c->qid, DRIVE(c->qid), PART(c->qid)); 
1994/0913    
	d = &disk[DRIVE(c->qid)]; 
	p = &d->table[PART(c->qid)]; 
	if(strcmp(p->name, "partition")) 
1995/0324/sys/src/9/port/devsd.c:52,581995/0325/sys/src/9/port/devsd.c:52,58 (short | long)
1994/0913    
static	long	sdio(Chan*, int, char*, ulong, ulong); 
 
static int 
sdgen(Chan *c, Dirtab *tab, long ntab, long s, Dir *dirp) 
1995/0325    
sdgen(Chan *c, Dirtab*, long, long s, Dir *dirp) 
1994/0913    
{ 
	Qid qid; 
	Disk *d; 
1995/0324/sys/src/9/port/devsd.c:60,671995/0325/sys/src/9/port/devsd.c:60,65
1994/0913    
	int unit; 
	char name[2*NAMELEN]; 
 
	USED(tab, ntab); 
                 
	d = disk; 
	while(s >= d->npart) { 
		s -= d->npart; 
1995/0324/sys/src/9/port/devsd.c:183,2051995/0325/sys/src/9/port/devsd.c:181,200
1994/0913    
} 
 
void 
sdcreate(Chan *c, char *name, int omode, ulong perm) 
1995/0325    
sdcreate(Chan*, char*, int, ulong) 
1994/0913    
{ 
	USED(c, name, omode, perm); 
	error(Eperm); 
} 
 
void 
sdremove(Chan *c) 
1995/0325    
sdremove(Chan*) 
1994/0913    
{ 
	USED(c); 
	error(Eperm); 
} 
 
void 
sdwstat(Chan *c, char *dp) 
1995/0325    
sdwstat(Chan*, char*) 
1994/0913    
{ 
	USED(c, dp); 
	error(Eperm); 
} 
 
1995/0324/sys/src/9/port/devsd.c:209,2301995/0325/sys/src/9/port/devsd.c:204,222
1994/0913    
	Disk *d; 
	Part *p; 
 
	if(c->mode != OWRITE && c->mode != ORDWR) 
1995/0325    
	if(c->qid.path & CHDIR) 
1994/0913    
		return; 
 
1995/0324    
print("sdclose: qid 0x%lux drive %d, part %d\n", c->qid, DRIVE(c->qid), PART(c->qid)); 
1994/0913    
	d = &disk[DRIVE(c->qid)]; 
	p = &d->table[PART(c->qid)]; 
	if(strcmp(p->name, "partition")) 
		return; 
                 
	sdrdpart(d); 
1995/0325    
	if((c->mode&3) != OREAD && strcmp(p->name, "partition") == 0) 
		sdrdpart(d); 
1994/0913    
} 
 
long 
sdread(Chan *c, void *a, long n, ulong offset) 
{ 
	if(c->qid.path == CHDIR) 
1995/0325    
	if(c->qid.path & CHDIR) 
1994/0913    
		return devdirread(c, a, n, 0, 0, sdgen); 
 
	return sdio(c, 0, a, n, offset); 
1995/0325/sys/src/9/port/devsd.c:87,931995/0329/sys/src/9/port/devsd.c:87,94 (short | long)
1994/0913    
{ 
	Disk *d; 
	ulong s, b; 
	int dev, i; 
1995/0329    
	uchar inq[255]; 
	int dev, i, nbytes; 
1994/0913    
 
	dev = 0; 
	for(;;) { 
1995/0325/sys/src/9/port/devsd.c:102,1081995/0329/sys/src/9/port/devsd.c:103,120
1994/0913    
		/* Search for other lun's */ 
		for(i = 0; i < Nlun; i++) { 
			d->lun = i; 
1995/0329    
 
1994/0913    
			scsireqsense(d->t, d->lun, 1); 
1995/0329    
 
			/* 
			 * A SCSI target does not support a lun if the 
			 * the peripheral device type and qualifier fields 
			 * in the response to an inquiry command are 0x7F. 
			 */ 
			memset(inq, 0, sizeof(inq)); 
			nbytes = sizeof(inq); 
			if(scsiinquiry(d->t, d->lun, inq, &nbytes) != STok || inq[0] == 0x7F) 
				continue; 
1994/0913    
 
			/* NCR Raid only seems to answer second capacity 
			 * command if lun != 0 
1995/0329/sys/src/9/port/devsd.c:9,141995/0403/sys/src/9/port/devsd.c:9,21 (short | long)
1994/0913    
#include	"../port/error.h" 
#include	"devtab.h" 
 
1995/0403    
enum { 
	TypeDA		= 0x00,		/* Direct Access */ 
	TypeWO		= 0x04,		/* Worm */ 
	TypeCD		= 0x05,		/* CD-ROM */ 
	TypeMO		= 0x07,		/* rewriteable Magneto-Optical */ 
}; 
 
1994/0913    
enum 
{ 
1994/1228    
	LogNpart	= 4, 
1995/0329/sys/src/9/port/devsd.c:51,561995/0403/sys/src/9/port/devsd.c:58,68
1994/0913    
static	void	sdrdpart(Disk*); 
static	long	sdio(Chan*, int, char*, ulong, ulong); 
 
1995/0403    
static int types[] = { 
	TypeDA, TypeWO, TypeCD, TypeMO, 
	-1, 
}; 
 
1994/0913    
static int 
1995/0325    
sdgen(Chan *c, Dirtab*, long, long s, Dir *dirp) 
1994/0913    
{ 
1995/0329/sys/src/9/port/devsd.c:93,991995/0403/sys/src/9/port/devsd.c:105,111
1994/0913    
	dev = 0; 
	for(;;) { 
		d = &disk[ndisk]; 
		dev = scsiinv(dev, 0, &d->t, &d->inquire, d->id); 
1995/0403    
		dev = scsiinv(dev, types, &d->t, &d->inquire, d->id); 
1994/0913    
		if(dev < 0) 
			break; 
 
1995/0329/sys/src/9/port/devsd.c:140,1471995/0403/sys/src/9/port/devsd.c:152,173
1994/0913    
 
			d->size = s; 
			d->bsize = b; 
			sprint(d->vol, "sd%d", ndisk); 
1995/0403    
			switch(d->inquire[0] & 0x1F){ 
1994/0913    
 
1995/0403    
			case TypeDA: 
			case TypeWO: 
			case TypeMO: 
				sprint(d->vol, "sd%d", ndisk); 
				break; 
 
			case TypeCD: 
				sprint(d->vol, "cd%d", ndisk); 
				break; 
 
			default: 
				continue; 
			} 
 
1994/0913    
			if(++ndisk >= Ndisk) 
				break; 
			d++; 
1995/0329/sys/src/9/port/devsd.c:278,2831995/0403/sys/src/9/port/devsd.c:304,315
1994/0913    
	p++; 
	d->npart = 2; 
 
1995/0403    
	if((d->inquire[0] & 0x1F) == TypeCD){ 
		scsifree(b); 
		qunlock(d); 
		return; 
	} 
 
1994/0913    
	scsibio(d->t, d->lun, SCSIread, b, 1, d->bsize, d->table[0].end-1); 
	b[d->bsize-1] = '\0'; 
 
1995/0329/sys/src/9/port/devsd.c:319,3241995/0403/sys/src/9/port/devsd.c:351,359
1994/0913    
 
	d = &disk[DRIVE(c->qid)]; 
	p = &d->table[PART(c->qid)]; 
1995/0403    
 
	if(write && (d->inquire[0] & 0x1F) == TypeCD) 
		error(Eperm); 
1994/0913    
 
	block = (offset / d->bsize) + p->beg; 
	n = (offset + len + d->bsize - 1) / d->bsize + p->beg - block; 
1995/0403/sys/src/9/port/devsd.c:11,191995/0404/sys/src/9/port/devsd.c:11,21 (short | long)
1994/0913    
 
1995/0403    
enum { 
	TypeDA		= 0x00,		/* Direct Access */ 
1995/0404    
	TypeSA		= 0x01,		/* Sequential Access */ 
1995/0403    
	TypeWO		= 0x04,		/* Worm */ 
	TypeCD		= 0x05,		/* CD-ROM */ 
	TypeMO		= 0x07,		/* rewriteable Magneto-Optical */ 
1995/0404    
	TYpeMC		= 0x08,		/* Medium Changer */ 
1995/0403    
}; 
 
1994/0913    
enum 
1995/0403/sys/src/9/port/devsd.c:59,651995/0404/sys/src/9/port/devsd.c:61,67
1994/0913    
static	long	sdio(Chan*, int, char*, ulong, ulong); 
 
1995/0403    
static int types[] = { 
	TypeDA, TypeWO, TypeCD, TypeMO, 
1995/0404    
	TypeDA, TypeCD, TypeMO, 
1995/0403    
	-1, 
}; 
 
1995/0403/sys/src/9/port/devsd.c:109,1231995/0404/sys/src/9/port/devsd.c:111,127
1994/0913    
		if(dev < 0) 
			break; 
 
		if(scsistart(d->t, 0, 1) != STok) 
			continue; 
1995/0404    
		if(scsitest(d->t, 0) < 0) 
			scsireqsense(d->t, 0, 0); 
		if(scsistart(d->t, 0, 1) < 0) 
			scsireqsense(d->t, 0, 0); 
print("sd1|"); 
1994/0913    
 
		/* Search for other lun's */ 
		for(i = 0; i < Nlun; i++) { 
			d->lun = i; 
1995/0404    
print("sd2|"); 
1995/0329    
 
1994/0913    
			scsireqsense(d->t, d->lun, 1); 
1995/0329    
                 
			/* 
			 * A SCSI target does not support a lun if the 
			 * the peripheral device type and qualifier fields 
1995/0403/sys/src/9/port/devsd.c:127,1541995/0404/sys/src/9/port/devsd.c:131,149
1995/0329    
			nbytes = sizeof(inq); 
			if(scsiinquiry(d->t, d->lun, inq, &nbytes) != STok || inq[0] == 0x7F) 
				continue; 
1995/0404    
print("sd3|"); 
1994/0913    
 
			/* NCR Raid only seems to answer second capacity 
			 * command if lun != 0 
			 */ 
			if(scsicap(d->t, d->lun, &s, &b) != STok) { 
				scsireqsense(d->t, 0, 1); 
				continue; 
			} 
			scsireqsense(d->t, 0, 1); 
                 
			s = 0; 
			b = 0; 
			if(scsicap(d->t, d->lun, &s, &b) != STok) { 
				scsireqsense(d->t, 0, 1); 
1995/0404    
				scsireqsense(d->t, 0, 0); 
1994/0913    
				continue; 
			} 
1995/0404    
print("sd4/%d/%d|", s, b); 
1994/0913    
 
			if(scsireqsense(d->t, d->lun, 1) != STok) 
				continue; 
                 
			if(s == 0 || b == 0) 
				continue; 
1995/0404    
print("sd5/0x%2.2ux|", d->inquire[0]); 
1994/0913    
 
			d->size = s; 
			d->bsize = b; 
1995/0403/sys/src/9/port/devsd.c:155,1611995/0404/sys/src/9/port/devsd.c:150,155
1995/0403    
			switch(d->inquire[0] & 0x1F){ 
1994/0913    
 
1995/0403    
			case TypeDA: 
			case TypeWO: 
			case TypeMO: 
				sprint(d->vol, "sd%d", ndisk); 
				break; 
1995/0403/sys/src/9/port/devsd.c:167,1721995/0404/sys/src/9/port/devsd.c:161,167
1995/0403    
			default: 
				continue; 
			} 
1995/0404    
print("sd6|"); 
1995/0403    
 
1994/0913    
			if(++ndisk >= Ndisk) 
				break; 
1995/0404/sys/src/9/port/devsd.c:100,1071995/0405/sys/src/9/port/devsd.c:100,106 (short | long)
1994/0913    
sdinit(void) 
{ 
	Disk *d; 
	ulong s, b; 
1995/0329    
	uchar inq[255]; 
1995/0405    
	uchar scratch[0xFF], type; 
1995/0329    
	int dev, i, nbytes; 
1994/0913    
 
	dev = 0; 
1995/0404/sys/src/9/port/devsd.c:111,1261995/0405/sys/src/9/port/devsd.c:110,120
1994/0913    
		if(dev < 0) 
			break; 
 
1995/0404    
		if(scsitest(d->t, 0) < 0) 
			scsireqsense(d->t, 0, 0); 
		if(scsistart(d->t, 0, 1) < 0) 
			scsireqsense(d->t, 0, 0); 
print("sd1|"); 
1994/0913    
                 
		/* Search for other lun's */ 
1995/0405    
		/* 
		 * Search for all the lun's. 
		 */ 
1994/0913    
		for(i = 0; i < Nlun; i++) { 
			d->lun = i; 
1995/0404    
print("sd2|"); 
1995/0329    
 
			/* 
			 * A SCSI target does not support a lun if the 
1995/0404/sys/src/9/port/devsd.c:127,1541995/0405/sys/src/9/port/devsd.c:121,158
1995/0329    
			 * the peripheral device type and qualifier fields 
			 * in the response to an inquiry command are 0x7F. 
			 */ 
			memset(inq, 0, sizeof(inq)); 
			nbytes = sizeof(inq); 
			if(scsiinquiry(d->t, d->lun, inq, &nbytes) != STok || inq[0] == 0x7F) 
1995/0405    
			nbytes = sizeof(scratch); 
			memset(scratch, 0, nbytes); 
			if(scsiinquiry(d->t, d->lun, scratch, &nbytes) != STok) 
1995/0329    
				continue; 
1995/0404    
print("sd3|"); 
1994/0913    
                 
			s = 0; 
			b = 0; 
			if(scsicap(d->t, d->lun, &s, &b) != STok) { 
1995/0404    
				scsireqsense(d->t, 0, 0); 
1995/0405    
			if(scratch[0] == 0x7F) 
1994/0913    
				continue; 
1995/0405    
			type = scratch[0] & 0x1F; 
 
			/* 
			 * Read-capacity is mandatory for TypeDA, TypeMO and TypeCD. 
			 * It may return 'not ready' if TypeDA is not spun up, 
			 * TypeMO or TypeCD are not loaded or just plain slow getting 
			 * their act together after a reset. 
			 * If 'not ready' comes back, try starting a TypeDA and punt 
			 * the get capacity until the drive is attached. 
			 * It might be possible to be smarter here, and look at the 
			 * response from a test-unit-ready which would show if the 
			 * target was in the process of becoming ready. 
			 */ 
			if(scsicap(d->t, d->lun, &d->size, &d->bsize) != STok) { 
				nbytes = sizeof(scratch); 
				memset(scratch, 0, nbytes); 
				scsireqsense(d->t, 0, scratch, &nbytes, 1); 
				if((scratch[2] & 0x0F) != 0x02) 
					continue; 
				if(type == TypeDA) 
					scsistart(d->t, d->lun, 0); 
				d->size = d->bsize = 0; 
1994/0913    
			} 
1995/0404    
print("sd4/%d/%d|", s, b); 
1994/0913    
 
			if(s == 0 || b == 0) 
				continue; 
1995/0404    
print("sd5/0x%2.2ux|", d->inquire[0]); 
1995/0405    
			switch(type){ 
1994/0913    
 
			d->size = s; 
			d->bsize = b; 
1995/0403    
			switch(d->inquire[0] & 0x1F){ 
1994/0913    
                 
1995/0403    
			case TypeDA: 
			case TypeMO: 
				sprint(d->vol, "sd%d", ndisk); 
1995/0404/sys/src/9/port/devsd.c:161,1671995/0405/sys/src/9/port/devsd.c:165,170
1995/0403    
			default: 
				continue; 
			} 
1995/0404    
print("sd6|"); 
1995/0403    
 
1994/0913    
			if(++ndisk >= Ndisk) 
				break; 
1995/0404/sys/src/9/port/devsd.c:281,2901995/0405/sys/src/9/port/devsd.c:284,306
1994/0913    
	char *b, *line[Npart+2], *field[3]; 
	static char MAGIC[] = "plan9 partitions"; 
 
1995/0405    
	/* 
	 * If the drive wasn't ready when we tried to do a 
	 * read-capacity earlier (in sdinit()), try again. 
	 * It might be possible to be smarter here, and look at the 
	 * response from a test-unit-ready which would show if the 
	 * target was in the process of becoming ready. 
	 */ 
	if(d->size == 0 || d->bsize == 0){ 
		if(scsicap(d->t, d->lun, &d->size, &d->bsize) != STok){ 
			d->size = d->bsize = 0; 
			error(Eio); 
		} 
	} 
 
1994/0913    
	b = scsialloc(d->bsize); 
	if(b == 0) 
		error(Enomem); 
                 
	qlock(d); 
	 
	p = d->table; 
1995/0405/sys/src/9/port/devsd.c:184,1941995/0416/sys/src/9/port/devsd.c:184,219 (short | long)
1994/0913    
Chan* 
sdattach(char *spec) 
{ 
	int i; 
1995/0416    
	int i, nfound; 
	Disk *d; 
1994/0913    
 
	for(i = 0; i < ndisk; i++) 
		sdrdpart(&disk[i]); 
	                 
1995/0416    
	/* 
	 * If the drive wasn't ready when we tried to do a 
	 * read-capacity earlier (in sdinit()), try again. 
	 * It might be possible to be smarter here, and look at the 
	 * response from a test-unit-ready which would show if the 
	 * target was in the process of becoming ready. 
	 */ 
	nfound = 0; 
	for(i = 0; i < ndisk; i++){	 
		d = &disk[i]; 
		if(waserror()){ 
			poperror(); 
			continue; 
		} 
		if(d->size == 0 || d->bsize == 0){ 
			if(scsicap(d->t, d->lun, &d->size, &d->bsize) != STok){ 
				d->size = d->bsize = 0; 
				continue; 
			} 
		} 
		sdrdpart(d); 
		nfound++; 
		poperror(); 
	} 
 
	if(nfound == 0) 
		return 0; 
1994/0913    
	return devattach('w', spec); 
} 
 
1995/0405/sys/src/9/port/devsd.c:284,3031995/0416/sys/src/9/port/devsd.c:309,314
1994/0913    
	char *b, *line[Npart+2], *field[3]; 
	static char MAGIC[] = "plan9 partitions"; 
 
1995/0405    
	/* 
	 * If the drive wasn't ready when we tried to do a 
	 * read-capacity earlier (in sdinit()), try again. 
	 * It might be possible to be smarter here, and look at the 
	 * response from a test-unit-ready which would show if the 
	 * target was in the process of becoming ready. 
	 */ 
	if(d->size == 0 || d->bsize == 0){ 
		if(scsicap(d->t, d->lun, &d->size, &d->bsize) != STok){ 
			d->size = d->bsize = 0; 
			error(Eio); 
		} 
	} 
                 
1994/0913    
	b = scsialloc(d->bsize); 
	if(b == 0) 
		error(Enomem); 
1995/0405/sys/src/9/port/devsd.c:362,3671995/0416/sys/src/9/port/devsd.c:373,381
1994/0913    
 
	d = &disk[DRIVE(c->qid)]; 
	p = &d->table[PART(c->qid)]; 
1995/0416    
 
	if(d->bsize == 0) 
		error(Eio); 
1995/0403    
 
	if(write && (d->inquire[0] & 0x1F) == TypeCD) 
		error(Eperm); 
1995/0416/sys/src/9/port/devsd.c:184,2191995/0417/sys/src/9/port/devsd.c:184,194 (short | long)
1994/0913    
Chan* 
sdattach(char *spec) 
{ 
1995/0416    
	int i, nfound; 
	Disk *d; 
1995/0417    
	int i; 
1994/0913    
 
1995/0416    
	/* 
	 * If the drive wasn't ready when we tried to do a 
	 * read-capacity earlier (in sdinit()), try again. 
	 * It might be possible to be smarter here, and look at the 
	 * response from a test-unit-ready which would show if the 
	 * target was in the process of becoming ready. 
	 */ 
	nfound = 0; 
	for(i = 0; i < ndisk; i++){	 
		d = &disk[i]; 
		if(waserror()){ 
			poperror(); 
			continue; 
		} 
		if(d->size == 0 || d->bsize == 0){ 
			if(scsicap(d->t, d->lun, &d->size, &d->bsize) != STok){ 
				d->size = d->bsize = 0; 
				continue; 
			} 
		} 
		sdrdpart(d); 
		nfound++; 
		poperror(); 
	} 
                 
	if(nfound == 0) 
		return 0; 
1995/0417    
	for(i = 0; i < ndisk; i++) 
		sdrdpart(&disk[i]); 
	 
1994/0913    
	return devattach('w', spec); 
} 
 
1995/0416/sys/src/9/port/devsd.c:309,3141995/0417/sys/src/9/port/devsd.c:284,303
1994/0913    
	char *b, *line[Npart+2], *field[3]; 
	static char MAGIC[] = "plan9 partitions"; 
 
1995/0417    
	/* 
	 * If the drive wasn't ready when we tried to do a 
	 * read-capacity earlier (in sdinit()), try again. 
	 * It might be possible to be smarter here, and look at the 
	 * response from a test-unit-ready which would show if the 
	 * target was in the process of becoming ready. 
	 */ 
	if(d->size == 0 || d->bsize == 0){ 
		if(scsicap(d->t, d->lun, &d->size, &d->bsize) != STok){ 
			d->size = d->bsize = 0; 
			error(Eio); 
		} 
	} 
 
1994/0913    
	b = scsialloc(d->bsize); 
	if(b == 0) 
		error(Enomem); 
1995/0416/sys/src/9/port/devsd.c:373,3811995/0417/sys/src/9/port/devsd.c:362,367
1994/0913    
 
	d = &disk[DRIVE(c->qid)]; 
	p = &d->table[PART(c->qid)]; 
1995/0416    
                 
	if(d->bsize == 0) 
		error(Eio); 
1995/0403    
 
	if(write && (d->inquire[0] & 0x1F) == TypeCD) 
		error(Eperm); 
1995/0417/sys/src/9/port/devsd.c:9,151995/0722/sys/src/9/port/devsd.c:9,16 (short | long)
1994/0913    
#include	"../port/error.h" 
#include	"devtab.h" 
 
1995/0403    
enum { 
1995/0722    
enum 
{ 
1995/0403    
	TypeDA		= 0x00,		/* Direct Access */ 
1995/0404    
	TypeSA		= 0x01,		/* Sequential Access */ 
1995/0403    
	TypeWO		= 0x04,		/* Worm */ 
1995/0417/sys/src/9/port/devsd.c:60,661995/0722/sys/src/9/port/devsd.c:61,68
1994/0913    
static	void	sdrdpart(Disk*); 
static	long	sdio(Chan*, int, char*, ulong, ulong); 
 
1995/0403    
static int types[] = { 
1995/0722    
static int types[] = 
{ 
1995/0404    
	TypeDA, TypeCD, TypeMO, 
1995/0403    
	-1, 
}; 
1995/0722/sys/src/9/port/devsd.c:146,1521995/0909/sys/src/9/port/devsd.c:146,152 (short | long)
1995/0405    
				nbytes = sizeof(scratch); 
				memset(scratch, 0, nbytes); 
				scsireqsense(d->t, 0, scratch, &nbytes, 1); 
				if((scratch[2] & 0x0F) != 0x02) 
1995/0909    
				if((scratch[2] & 0x0F) != 0x02 && (scratch[2] & 0x0F) != 0) 
1995/0405    
					continue; 
				if(type == TypeDA) 
					scsistart(d->t, d->lun, 0); 
1995/0909/sys/src/9/port/devsd.c:7,131996/0223/sys/src/9/port/devsd.c:7,12 (short | long)
1994/0913    
#include	"dat.h" 
#include	"fns.h" 
#include	"../port/error.h" 
#include	"devtab.h" 
 
1995/0722    
enum 
{ 
1996/0223/sys/src/9/port/devsd.c:328,3371996/0315/sys/src/9/port/devsd.c:328,337 (short | long)
1994/0913    
	/* 
	 *  parse partition table. 
	 */ 
1995/0117    
	n = getfields(b, line, Npart+2, "\n"); 
1996/0315    
	n = parsefields(b, line, Npart+2, "\n"); 
1994/0913    
	if(n > 0 && strncmp(line[0], MAGIC, sizeof(MAGIC)-1) == 0) { 
		for(i = 1; i < n; i++) { 
1995/0117    
			switch(getfields(line[i], field, 3, " ")) { 
1996/0315    
			switch(parsefields(line[i], field, 3, " ")) { 
1994/0913    
			case 2: 
				if(strcmp(field[0], "unit") == 0) 
					strncpy(d->vol, field[1], NAMELEN); 
1996/0315/sys/src/9/port/devsd.c:47,521996/0607/sys/src/9/port/devsd.c:47,54 (short | long)
1994/0913    
	char	vol[NAMELEN]; 
 
	uchar*	inquire; 
1996/0607    
	int	partok; 
	ulong	version; 
1994/0913    
	ulong	size; 
	ulong	bsize; 
 
1996/0315/sys/src/9/port/devsd.c:57,631996/0607/sys/src/9/port/devsd.c:59,65
1994/0913    
int	ndisk; 
Disk	disk[Ndisk]; 
 
static	void	sdrdpart(Disk*); 
1996/0607    
static	int	sdrdpart(Disk*); 
1994/0913    
static	long	sdio(Chan*, int, char*, ulong, ulong); 
 
1995/0722    
static int types[] = 
1996/0315/sys/src/9/port/devsd.c:137,1451996/0607/sys/src/9/port/devsd.c:139,144
1995/0405    
			 * their act together after a reset. 
			 * If 'not ready' comes back, try starting a TypeDA and punt 
			 * the get capacity until the drive is attached. 
			 * It might be possible to be smarter here, and look at the 
			 * response from a test-unit-ready which would show if the 
			 * target was in the process of becoming ready. 
			 */ 
			if(scsicap(d->t, d->lun, &d->size, &d->bsize) != STok) { 
				nbytes = sizeof(scratch); 
1996/0315/sys/src/9/port/devsd.c:187,1941996/0607/sys/src/9/port/devsd.c:186,197
1994/0913    
{ 
1995/0417    
	int i; 
1994/0913    
 
1995/0417    
	for(i = 0; i < ndisk; i++) 
		sdrdpart(&disk[i]); 
1996/0607    
	for(i = 0; i < ndisk; i++){ 
		qlock(&disk[i]); 
		if(disk[i].partok == 0) 
			sdrdpart(&disk[i]); 
		qunlock(&disk[i]); 
	} 
1995/0417    
	 
1994/0913    
	return devattach('w', spec); 
} 
1996/0315/sys/src/9/port/devsd.c:246,2531996/0607/sys/src/9/port/devsd.c:249,260
1994/0913    
 
	d = &disk[DRIVE(c->qid)]; 
	p = &d->table[PART(c->qid)]; 
1995/0325    
	if((c->mode&3) != OREAD && strcmp(p->name, "partition") == 0) 
1996/0607    
	if((c->mode&3) != OREAD && strcmp(p->name, "partition") == 0){ 
		qlock(d); 
		d->partok = 0; 
1995/0325    
		sdrdpart(d); 
1996/0607    
		qunlock(d); 
	} 
1994/0913    
} 
 
long 
1996/0315/sys/src/9/port/devsd.c:268,2731996/0607/sys/src/9/port/devsd.c:275,286
1994/0913    
long 
sdwrite(Chan *c, char *a, long n, ulong offset) 
{ 
1996/0607    
	Disk *d; 
 
	d = &disk[DRIVE(c->qid)]; 
 
	if((d->inquire[0] & 0x1F) == TypeCD) 
		error(Eperm); 
1994/0913    
	return sdio(c, 1, a, n, offset); 
1995/0108    
} 
 
1996/0315/sys/src/9/port/devsd.c:277,2831996/0607/sys/src/9/port/devsd.c:290,296
1995/0108    
	return devbwrite(c, bp, offset); 
1994/0913    
} 
 
static void 
1996/0607    
static int 
1994/0913    
sdrdpart(Disk *d) 
{ 
	Part *p; 
1996/0315/sys/src/9/port/devsd.c:285,3141996/0607/sys/src/9/port/devsd.c:298,333
1994/0913    
	char *b, *line[Npart+2], *field[3]; 
	static char MAGIC[] = "plan9 partitions"; 
 
1996/0607    
	if(d->partok) 
		return STok; 
 
	p = d->table; 
	strcpy(p->name, "disk"); 
	p->beg = 0; 
	p->end = 0; 
	d->npart = 1; 
 
1995/0417    
	/* 
	 * If the drive wasn't ready when we tried to do a 
	 * read-capacity earlier (in sdinit()), try again. 
	 * It might be possible to be smarter here, and look at the 
	 * response from a test-unit-ready which would show if the 
	 * target was in the process of becoming ready. 
1996/0607    
	 * If the drive wasn't ready when a read-capacity was tried 
	 * earlier (in sdinit()), try again. 
1995/0417    
	 */ 
	if(d->size == 0 || d->bsize == 0){ 
		if(scsicap(d->t, d->lun, &d->size, &d->bsize) != STok){ 
1996/0607    
		n = scsicap(d->t, d->lun, &d->size, &d->bsize); 
		if(n != STok){ 
1995/0417    
			d->size = d->bsize = 0; 
			error(Eio); 
1996/0607    
			return scsierrstr(n); 
1995/0417    
		} 
	} 
 
1996/0607    
	p->end = d->size + 1; 
 
	if((d->inquire[0] & 0x1F) == TypeCD) 
		return STok; 
 
1994/0913    
	b = scsialloc(d->bsize); 
	if(b == 0) 
		error(Enomem); 
	qlock(d); 
	                 
	p = d->table; 
1996/0607    
		return scsierrstr(STnomem); 
1994/0913    
 
	strcpy(p->name, "disk"); 
	p->beg = 0; 
	p->end = d->size + 1; 
	p++; 
	strcpy(p->name, "partition"); 
	p->beg = d->table[0].end - 1; 
1996/0315/sys/src/9/port/devsd.c:316,3271996/0607/sys/src/9/port/devsd.c:335,340
1994/0913    
	p++; 
	d->npart = 2; 
 
1995/0403    
	if((d->inquire[0] & 0x1F) == TypeCD){ 
		scsifree(b); 
		qunlock(d); 
		return; 
	} 
                 
1994/0913    
	scsibio(d->t, d->lun, SCSIread, b, 1, d->bsize, d->table[0].end-1); 
	b[d->bsize-1] = '\0'; 
 
1996/0315/sys/src/9/port/devsd.c:331,3561996/0607/sys/src/9/port/devsd.c:344,367
1996/0315    
	n = parsefields(b, line, Npart+2, "\n"); 
1994/0913    
	if(n > 0 && strncmp(line[0], MAGIC, sizeof(MAGIC)-1) == 0) { 
		for(i = 1; i < n; i++) { 
1996/0315    
			switch(parsefields(line[i], field, 3, " ")) { 
1994/0913    
			case 2: 
				if(strcmp(field[0], "unit") == 0) 
					strncpy(d->vol, field[1], NAMELEN); 
				break;	 
			case 3: 
1994/1228    
				if(p >= &d->table[Npart]) 
					break; 
1994/0913    
				strncpy(p->name, field[0], NAMELEN); 
				p->beg = strtoul(field[1], 0, 0); 
				p->end = strtoul(field[2], 0, 0); 
				if(p->beg > p->end || p->beg >= d->table[0].end) 
					break; 
				p++; 
			} 
1996/0607    
			if(parsefields(line[i], field, 3, " ") != 3) 
				break; 
			if(p >= &d->table[Npart]) 
				break; 
			strncpy(p->name, field[0], NAMELEN); 
			p->beg = strtoul(field[1], 0, 0); 
			p->end = strtoul(field[2], 0, 0); 
			if(p->beg > p->end || p->beg >= d->table[0].end) 
				break; 
			p++; 
1994/0913    
		} 
	} 
	d->npart = p - d->table; 
	scsifree(b); 
	qunlock(d); 
1996/0607    
 
	d->partok = 1; 
 
	return STok; 
1994/0913    
} 
 
static long 
1996/0315/sys/src/9/port/devsd.c:364,3721996/0607/sys/src/9/port/devsd.c:375,380
1994/0913    
	d = &disk[DRIVE(c->qid)]; 
	p = &d->table[PART(c->qid)]; 
1995/0403    
 
	if(write && (d->inquire[0] & 0x1F) == TypeCD) 
		error(Eperm); 
1994/0913    
                 
	block = (offset / d->bsize) + p->beg; 
	n = (offset + len + d->bsize - 1) / d->bsize + p->beg - block; 
	max = SCSImaxxfer / d->bsize; 
1996/0315/sys/src/9/port/devsd.c:379,3931996/0607/sys/src/9/port/devsd.c:387,402
1994/0913    
 
	b = scsialloc(n*d->bsize); 
	if(b == 0) 
		error(Enomem); 
	if(waserror()) { 
		scsifree(b); 
		nexterror(); 
	} 
1996/0607    
		return scsierrstr(STnomem); 
 
1994/0913    
	offset %= d->bsize; 
	if(write) { 
		if(offset || len % d->bsize) { 
			x = scsibio(d->t, d->lun, SCSIread, b, n, d->bsize, block); 
1996/0607    
			if(x < 0){ 
				len = -1; 
				goto buggery; 
			} 
1994/0913    
			if(x < n * d->bsize) { 
				n = x / d->bsize; 
				x = n * d->bsize - offset; 
1996/0315/sys/src/9/port/devsd.c:397,4021996/0607/sys/src/9/port/devsd.c:406,415
1994/0913    
		} 
		memmove(b + offset, a, len); 
		x = scsibio(d->t, d->lun, SCSIwrite, b, n, d->bsize, block); 
1996/0607    
		if(x < 0){ 
			len = -1; 
			goto buggery; 
		} 
1994/0913    
		if(x < offset) 
			len = 0; 
		else 
1996/0315/sys/src/9/port/devsd.c:405,4101996/0607/sys/src/9/port/devsd.c:418,427
1994/0913    
	} 
	else { 
		x = scsibio(d->t, d->lun, SCSIread, b, n, d->bsize, block); 
1996/0607    
		if(x < 0){ 
			len = -1; 
			goto buggery; 
		} 
1994/0913    
		if(x < offset) 
			len = 0; 
		else 
1996/0315/sys/src/9/port/devsd.c:412,4181996/0607/sys/src/9/port/devsd.c:429,436
1994/0913    
			len = x - offset; 
		memmove(a, b+offset, len); 
	} 
	poperror(); 
1996/0607    
 
buggery: 
1994/0913    
	scsifree(b); 
	return len; 
} 
1996/0607/sys/src/9/port/devsd.c:103,1121996/0710/sys/src/9/port/devsd.c:103,113 (short | long)
1994/0913    
sdinit(void) 
{ 
	Disk *d; 
1995/0405    
	uchar scratch[0xFF], type; 
1996/0710    
	uchar *scratch, type; 
1995/0329    
	int dev, i, nbytes; 
1994/0913    
 
	dev = 0; 
1996/0710    
	scratch = scsialloc(0xFF); 
1994/0913    
	for(;;) { 
		d = &disk[ndisk]; 
1995/0403    
		dev = scsiinv(dev, types, &d->t, &d->inquire, d->id); 
1996/0607/sys/src/9/port/devsd.c:124,1301996/0710/sys/src/9/port/devsd.c:125,131
1995/0329    
			 * the peripheral device type and qualifier fields 
			 * in the response to an inquiry command are 0x7F. 
			 */ 
1995/0405    
			nbytes = sizeof(scratch); 
1996/0710    
			nbytes = 0xFF; 
1995/0405    
			memset(scratch, 0, nbytes); 
			if(scsiinquiry(d->t, d->lun, scratch, &nbytes) != STok) 
1995/0329    
				continue; 
1996/0607/sys/src/9/port/devsd.c:179,1841996/0710/sys/src/9/port/devsd.c:180,186
1994/0913    
			break; 
		} 
	} 
1996/0710    
	scsifree(scratch); 
1994/0913    
} 
 
Chan* 
1996/0710/sys/src/9/port/devsd.c:69,751996/1225/sys/src/9/port/devsd.c:69,75 (short | long)
1995/0403    
}; 
 
1994/0913    
static int 
1995/0325    
sdgen(Chan *c, Dirtab*, long, long s, Dir *dirp) 
1996/1225    
sdgen(Chan *c, Dirtab*, int, int s, Dir *dirp) 
1994/0913    
{ 
	Qid qid; 
	Disk *d; 
1996/1225/sys/src/9/port/devsd.c:94,1051997/0327/sys/src/9/port/devsd.c:94,100 (short | long)
1994/0913    
	return 1; 
} 
 
void 
sdreset(void) 
{ 
} 
                 
void 
1997/0327    
static void 
1994/0913    
sdinit(void) 
{ 
	Disk *d; 
1996/1225/sys/src/9/port/devsd.c:142,1481997/0327/sys/src/9/port/devsd.c:137,143
1995/0405    
			 * the get capacity until the drive is attached. 
			 */ 
			if(scsicap(d->t, d->lun, &d->size, &d->bsize) != STok) { 
				nbytes = sizeof(scratch); 
1997/0327    
				nbytes = 0xFF; 
1995/0405    
				memset(scratch, 0, nbytes); 
				scsireqsense(d->t, 0, scratch, &nbytes, 1); 
1995/0909    
				if((scratch[2] & 0x0F) != 0x02 && (scratch[2] & 0x0F) != 0) 
1996/1225/sys/src/9/port/devsd.c:183,1891997/0327/sys/src/9/port/devsd.c:178,184
1996/0710    
	scsifree(scratch); 
1994/0913    
} 
 
Chan* 
1997/0327    
static Chan* 
1994/0913    
sdattach(char *spec) 
{ 
1995/0417    
	int i; 
1996/1225/sys/src/9/port/devsd.c:198,2461997/0327/sys/src/9/port/devsd.c:193,217
1994/0913    
	return devattach('w', spec); 
} 
 
Chan * 
sdclone(Chan *c, Chan *nc) 
{ 
	return devclone(c, nc); 
} 
                 
int 
1997/0327    
static int 
1994/0913    
sdwalk(Chan *c, char *name) 
{ 
	return devwalk(c, name, 0, 0, sdgen); 
} 
 
void 
1997/0327    
static void 
1994/0913    
sdstat(Chan *c, char *db) 
{ 
	devstat(c, db, 0, 0, sdgen); 
} 
 
Chan * 
1997/0327    
static Chan* 
1994/0913    
sdopen(Chan *c, int omode) 
{ 
	return devopen(c, omode, 0, 0, sdgen); 
} 
 
void 
1995/0325    
sdcreate(Chan*, char*, int, ulong) 
1994/0913    
{ 
	error(Eperm); 
} 
                 
void 
1995/0325    
sdremove(Chan*) 
1994/0913    
{ 
	error(Eperm); 
} 
                 
void 
1995/0325    
sdwstat(Chan*, char*) 
1994/0913    
{ 
	error(Eperm); 
} 
                 
void 
1997/0327    
static void 
1994/0913    
sdclose(Chan *c) 
{ 
	Disk *d; 
1996/1225/sys/src/9/port/devsd.c:259,2651997/0327/sys/src/9/port/devsd.c:230,236
1996/0607    
	} 
1994/0913    
} 
 
long 
1997/0327    
static long 
1994/0913    
sdread(Chan *c, void *a, long n, ulong offset) 
{ 
1995/0325    
	if(c->qid.path & CHDIR) 
1996/1225/sys/src/9/port/devsd.c:268,2801997/0327/sys/src/9/port/devsd.c:239,245
1994/0913    
	return sdio(c, 0, a, n, offset); 
} 
 
1995/0108    
Block* 
sdbread(Chan *c, long n, ulong offset) 
{ 
	return devbread(c, n, offset); 
} 
                 
1994/0913    
long 
1997/0327    
static long 
1994/0913    
sdwrite(Chan *c, char *a, long n, ulong offset) 
{ 
1996/0607    
	Disk *d; 
1996/1225/sys/src/9/port/devsd.c:286,2961997/0327/sys/src/9/port/devsd.c:251,273
1994/0913    
	return sdio(c, 1, a, n, offset); 
1995/0108    
} 
 
long 
sdbwrite(Chan *c, Block *bp, ulong offset) 
{ 
	return devbwrite(c, bp, offset); 
1994/0913    
} 
1997/0327    
Dev sddevtab = { 
	devreset, 
	sdinit, 
	sdattach, 
	devclone, 
	sdwalk, 
	sdstat, 
	sdopen, 
	devcreate, 
	sdclose, 
	sdread, 
	devbread, 
	sdwrite, 
	devbwrite, 
	devremove, 
	devwstat, 
}; 
1994/0913    
 
1996/0607    
static int 
1994/0913    
sdrdpart(Disk *d) 
1996/1225/sys/src/9/port/devsd.c:343,3521997/0327/sys/src/9/port/devsd.c:320,329
1994/0913    
	/* 
	 *  parse partition table. 
	 */ 
1996/0315    
	n = parsefields(b, line, Npart+2, "\n"); 
1997/0327    
	n = parsefields(b, line, nelem(line), "\n"); 
1994/0913    
	if(n > 0 && strncmp(line[0], MAGIC, sizeof(MAGIC)-1) == 0) { 
		for(i = 1; i < n; i++) { 
1996/0607    
			if(parsefields(line[i], field, 3, " ") != 3) 
1997/0327    
			if(parsefields(line[i], field, nelem(field), " ") != 3) 
1996/0607    
				break; 
			if(p >= &d->table[Npart]) 
				break; 
1997/0327/sys/src/9/port/devsd.c:252,2571997/0408/sys/src/9/port/devsd.c:252,260 (short | long)
1995/0108    
} 
 
1997/0327    
Dev sddevtab = { 
1997/0408    
	'w', 
	"sd", 
 
1997/0327    
	devreset, 
	sdinit, 
	sdattach, 
1997/0408/sys/src/9/port/devsd.c:231,2381998/0319/sys/src/9/port/devsd.c:231,240 (short | long)
Change dev read and write to use vlong offset.
rsc Fri Mar 4 12:44:25 2005
1994/0913    
} 
 
1997/0327    
static long 
1994/0913    
sdread(Chan *c, void *a, long n, ulong offset) 
1998/0319    
sdread(Chan *c, void *a, long n, vlong off) 
1994/0913    
{ 
1998/0319    
	ulong offset = off; 
 
1995/0325    
	if(c->qid.path & CHDIR) 
1994/0913    
		return devdirread(c, a, n, 0, 0, sdgen); 
 
1997/0408/sys/src/9/port/devsd.c:240,2481998/0319/sys/src/9/port/devsd.c:242,251
1994/0913    
} 
 
1997/0327    
static long 
1994/0913    
sdwrite(Chan *c, char *a, long n, ulong offset) 
1998/0319    
sdwrite(Chan *c, char *a, long n, vlong off) 
1994/0913    
{ 
1996/0607    
	Disk *d; 
1998/0319    
	ulong offset = off; 
1996/0607    
 
	d = &disk[DRIVE(c->qid)]; 
 
1998/0319/sys/src/9/port/devsd.c:60,661998/0325/sys/src/9/port/devsd.c:60,66 (short | long)
Change dev read and write to use vlong.
rsc Fri Mar 4 12:44:25 2005
1994/0913    
Disk	disk[Ndisk]; 
 
1996/0607    
static	int	sdrdpart(Disk*); 
1994/0913    
static	long	sdio(Chan*, int, char*, ulong, ulong); 
1998/0325    
static	long	sdio(Chan*, int, char*, ulong, vlong); 
1994/0913    
 
1995/0722    
static int types[] = 
{ 
1998/0319/sys/src/9/port/devsd.c:231,2391998/0325/sys/src/9/port/devsd.c:231,238
1994/0913    
} 
 
1997/0327    
static long 
1998/0319    
sdread(Chan *c, void *a, long n, vlong off) 
1998/0325    
sdread(Chan *c, void *a, long n, vlong offset) 
1994/0913    
{ 
1998/0319    
	ulong offset = off; 
 
1995/0325    
	if(c->qid.path & CHDIR) 
1994/0913    
		return devdirread(c, a, n, 0, 0, sdgen); 
1998/0319/sys/src/9/port/devsd.c:242,2511998/0325/sys/src/9/port/devsd.c:241,249
1994/0913    
} 
 
1997/0327    
static long 
1998/0319    
sdwrite(Chan *c, char *a, long n, vlong off) 
1998/0325    
sdwrite(Chan *c, char *a, long n, vlong offset) 
1994/0913    
{ 
1996/0607    
	Disk *d; 
1998/0319    
	ulong offset = off; 
1996/0607    
 
	d = &disk[DRIVE(c->qid)]; 
 
1998/0319/sys/src/9/port/devsd.c:350,3611998/0325/sys/src/9/port/devsd.c:348,360
1994/0913    
} 
 
static long 
sdio(Chan *c, int write, char *a, ulong len, ulong offset) 
1998/0325    
sdio(Chan *c, int write, char *a, ulong len, vlong off) 
1994/0913    
{ 
	Disk *d; 
	Part *p; 
	uchar *b; 
	ulong block, n, max, x; 
1998/0325    
	ulong offset = off; 
1994/0913    
 
	d = &disk[DRIVE(c->qid)]; 
	p = &d->table[PART(c->qid)]; 
1998/0325/sys/src/9/port/devsd.c:231,2471998/0327/sys/src/9/port/devsd.c:231,247 (short | long)
Change dev read and write to use vlong.
rsc Fri Mar 4 12:44:25 2005
1994/0913    
} 
 
1997/0327    
static long 
1998/0325    
sdread(Chan *c, void *a, long n, vlong offset) 
1998/0327    
sdread(Chan *c, void *a, long n, vlong off) 
1994/0913    
{ 
1998/0319    
 
1995/0325    
	if(c->qid.path & CHDIR) 
1994/0913    
		return devdirread(c, a, n, 0, 0, sdgen); 
 
	return sdio(c, 0, a, n, offset); 
1998/0327    
	return sdio(c, 0, a, n, off); 
1994/0913    
} 
 
1997/0327    
static long 
1998/0325    
sdwrite(Chan *c, char *a, long n, vlong offset) 
1998/0327    
sdwrite(Chan *c, char *a, long n, vlong off) 
1994/0913    
{ 
1996/0607    
	Disk *d; 
 
1998/0325/sys/src/9/port/devsd.c:249,2551998/0327/sys/src/9/port/devsd.c:249,255
1996/0607    
 
	if((d->inquire[0] & 0x1F) == TypeCD) 
		error(Eperm); 
1994/0913    
	return sdio(c, 1, a, n, offset); 
1998/0327    
	return sdio(c, 1, a, n, off); 
1995/0108    
} 
 
1997/0327    
Dev sddevtab = { 
1998/0325/sys/src/9/port/devsd.c:354,3661998/0327/sys/src/9/port/devsd.c:354,366
1994/0913    
	Part *p; 
	uchar *b; 
	ulong block, n, max, x; 
1998/0325    
	ulong offset = off; 
1998/0327    
	ulong offset; 
1994/0913    
 
	d = &disk[DRIVE(c->qid)]; 
	p = &d->table[PART(c->qid)]; 
1995/0403    
 
1994/0913    
	block = (offset / d->bsize) + p->beg; 
	n = (offset + len + d->bsize - 1) / d->bsize + p->beg - block; 
1998/0327    
	block = (off / d->bsize) + p->beg; 
	n = (off + len + d->bsize - 1) / d->bsize + p->beg - block; 
1994/0913    
	max = SCSImaxxfer / d->bsize; 
	if(n > max) 
		n = max; 
1998/0325/sys/src/9/port/devsd.c:373,3791998/0327/sys/src/9/port/devsd.c:373,379
1994/0913    
	if(b == 0) 
1996/0607    
		return scsierrstr(STnomem); 
 
1994/0913    
	offset %= d->bsize; 
1998/0327    
	offset = off % d->bsize; 
1994/0913    
	if(write) { 
		if(offset || len % d->bsize) { 
			x = scsibio(d->t, d->lun, SCSIread, b, n, d->bsize, block); 
1998/0327/sys/src/9/port/devsd.c:189,1951998/0512/sys/src/9/port/devsd.c:189,195 (short | long)
Whitespace edit.
rsc Fri Mar 4 12:44:25 2005
1996/0607    
			sdrdpart(&disk[i]); 
		qunlock(&disk[i]); 
	} 
1995/0417    
	                 
1998/0512    
 
1994/0913    
	return devattach('w', spec); 
} 
 
Too many diffs (26 > 25). Stopping.


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