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

1990/0430/power/bboot.c (diff list | history)

1990/0427/sys/src/9/power/bboot.c:313,3191990/0430/sys/src/9/power/bboot.c:313,318 (short | long | prev | next)
1990/0427    
readseg(int in, int out, long inoff, long outoff, int len) 
{ 
	long	n, i; 
	ulong sum = 0; 
 
	if(seek(in, inoff, 0) < 0){ 
		prerror("seeking bootfile"); 
1990/0427/sys/src/9/power/bboot.c:328,3431990/0430/sys/src/9/power/bboot.c:327,337
1990/0427    
			prerror("reading bootfile"); 
			return -1; 
		} 
		for(i = 0; i < n; i++) 
			sum += buf[i]; 
		if(sum & 0xf0000000) 
			sum = (sum & 0xfffffff) + ((sum & 0xf0000000) >> 28); 
		if(write(out, buf, n) != n){ 
			prerror("writing #b/mem"); 
			return -1; 
		} 
	} 
	print("[%ux]", sum); 
	return 0; 
} 
 


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