nvr.c

来自「这是一个同样来自贝尔实验室的和UNIX有着渊源的操作系统, 其简洁的设计和实现易」· C语言 代码 · 共 55 行

C
55
字号
#include "all.h"#include "mem.h"#include "io.h"#include "ureg.h"#include "dosfs.h"static Dosfile file;static int opened;char nvrfile[128] = "plan9.nvr";static voidnvopen(void){	int s;	Dosfile *fp;	if(opened)		return;	opened = 1;	s = spllo();	fp = dosopen(&dos, nvrfile, &file);	splx(s);	if(fp == 0)		panic("can't open %s\n", nvrfile);}intnvread(int offset, void *a, int n){	int r, s;	nvopen();	s = spllo();	file.offset = offset;	r = dosread(&file, a, n);	splx(s);	return r;}intnvwrite(int offset, void *a, int n){	int r, s;	nvopen();	s = spllo();	file.offset = offset;	r = doswrite(&file, a, n);	splx(s);	return r;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?