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

1992/0808/port/devwren.c (diff list | history)

1992/0711/sys/src/9/port/devwren.c:37,431992/0808/sys/src/9/port/devwren.c:37,43 (short | long | prev | next)
1991/0823    
	ulong		bytes;			/* bytes per block */ 
	int		npart;			/* actual number of partitions */ 
	int		drive; 
1992/0301    
	int		ready;			/* true if ever ready */ 
1992/0808    
	int		readonly; 
1991/0823    
	Partition	p[Npart]; 
1991/0112    
}; 
1991/0110    
 
1992/0711/sys/src/9/port/devwren.c:96,1021992/0808/sys/src/9/port/devwren.c:96,102
1991/0823    
	name[NAMELEN] = 0; 
	qid.path = MKQID(drive, s); 
	l = (pp->end - pp->start) * dp->bytes; 
1991/1112    
	devdir(c, qid, name, l, eve, 0666, dirp); 
1992/0808    
	devdir(c, qid, name, l, eve, dp->readonly ? 0444 : 0666, dirp); 
1991/0110    
	return 1; 
} 
 
1992/0711/sys/src/9/port/devwren.c:111,1171992/0808/sys/src/9/port/devwren.c:111,117
1991/0823    
} 
1991/0110    
 
/* 
 *  param is #r<target>.<lun> 
1992/0808    
 *  param is #w<target>.<lun> 
1991/0110    
 */ 
Chan * 
wrenattach(char *param) 
1992/0711/sys/src/9/port/devwren.c:273,3001992/0808/sys/src/9/port/devwren.c:273,298
1992/0301    
		nexterror(); 
	} 
	qlock(dp); 
	if(!dp->ready){ 
		scsiready(dev); 
1992/0219    
		scsisense(dev, buf); 
1992/0301    
		if (scsicap(dev, buf)) 
			error(Eio); 
		dp->drive = dev; 
		dp->ready = 1; 
1992/0808    
	scsiready(dev); 
	scsisense(dev, buf); 
	if(scsicap(dev, buf)) 
		error(Eio); 
	dp->drive = dev; 
	dp->readonly = scsiwp(dev); 
1992/0301    
 
		/* 
		 *  we always have a partition for the whole disk 
		 *  and one for the partition table 
		 */ 
		dp->bytes = (buf[4]<<24)+(buf[5]<<16)+(buf[6]<<8)+(buf[7]); 
		pp = &dp->p[0]; 
		strcpy(pp->name, "disk"); 
		pp->start = 0; 
		pp->end = (buf[0]<<24)+(buf[1]<<16)+(buf[2]<<8)+(buf[3]) + 1; 
		pp++; 
		strcpy(pp->name, "partition"); 
		pp->start = dp->p[0].end - 1; 
		pp->end = dp->p[0].end; 
1992/0219    
	} 
1992/0808    
	/* 
	 *  we always have a partition for the whole disk 
	 *  and one for the partition table 
	 */ 
	dp->bytes = (buf[4]<<24)+(buf[5]<<16)+(buf[6]<<8)+(buf[7]); 
	pp = &dp->p[0]; 
	strcpy(pp->name, "disk"); 
	pp->start = 0; 
	pp->end = (buf[0]<<24)+(buf[1]<<16)+(buf[2]<<8)+(buf[3]) + 1; 
	pp++; 
	strcpy(pp->name, "partition"); 
	pp->start = dp->p[0].end - 1; 
	pp->end = dp->p[0].end; 
1991/0927    
 
1991/0823    
	/* 
	 *  read partition table from disk, null terminate 
1992/0711/sys/src/9/port/devwren.c:313,3191992/0808/sys/src/9/port/devwren.c:311,317
1991/0823    
	 */ 
1992/0301    
	pp = &dp->p[2]; 
1991/0927    
	n = getfields(rawpart, line, Npart+1, '\n'); 
1992/0219    
	if(strncmp(line[0], MAGIC, sizeof(MAGIC)-1) == 0){ 
1992/0808    
	if(n > 0 && strncmp(line[0], MAGIC, sizeof(MAGIC)-1) == 0){ 
1991/0927    
		for(i = 1; i < n; i++){ 
1992/0219    
			if(getfields(line[i], field, 3, ' ') != 3) 
1991/0927    
				break; 


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