File:  [Research Unix] / researchv9 / sys / construct / host / rdfs.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:21:59 2018 UTC (8 years, 3 months ago) by root
Branches: belllabs, MAIN
CVS tags: researchv9-SUN3_old, researchv9-SUN3, HEAD
researchv9-SUN3(old)

#include "/usr/include/stdio.h"
#include <sys/param.h>
#include <sys/ino.h>
#include <sys/inode.h>
#include <sys/filsys.h>
#include <sys/fblk.h>
#include <sys/dir.h>

int	fsi;
char	buf[BSIZE(0)];

main()
{
	short *s = (short *)buf;
	int i;

	fsi = open("/dev/rsd1a", 0);
	rdfs(1, buf);
	for(i = 0; i < sizeof(buf)/2; i++)
		if(*s++ != i)
			printf("%d is %d\n", i, *(s - 1));
}

rdfs(bno, bf)
daddr_t bno;
char *bf;
{
	int n;

	lseek(fsi, bno*BSIZE(0), 0);
	n = read(fsi, bf, BSIZE(0));
	if(n != BSIZE(0)) {
		printf("read error: %ld\n", bno);
		exit(1);
	}
}

wrfs(bno, bf)
daddr_t bno;
char *bf;
{
	int n;

	lseek(fsi, bno*BSIZE(0), 0);
	n = write(fsi, bf, BSIZE(0));
	if(n != BSIZE(0)) {
		printf("write error: %ld\n", bno);
		exit(1);
	}
}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.