⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 walk.c

📁 这是一个同样来自贝尔实验室的和UNIX有着渊源的操作系统, 其简洁的设计和实现易于我们学习和理解
💻 C
字号:
/* * Generic traversal routines. */#include "stdinc.h"#include "dat.h"#include "fns.h"static uintetype(Entry *e){	uint t;	if(e->flags&VtEntryDir)		t = BtDir;	else		t = BtData;	return t+e->depth;}voidinitWalk(WalkPtr *w, Block *b, uint size){	memset(w, 0, sizeof *w);	switch(b->l.type){	case BtData:		return;	case BtDir:		w->data = b->data;		w->m = size / VtEntrySize;		w->isEntry = 1;		return;	default:		w->data = b->data;		w->m = size / VtScoreSize;		w->type = b->l.type;		w->tag = b->l.tag;		return;	}}intnextWalk(WalkPtr *w, uchar score[VtScoreSize], uchar *type, u32int *tag, Entry **e){	if(w->n >= w->m)		return 0;	if(w->isEntry){		*e = &w->e;		entryUnpack(&w->e, w->data, w->n);		memmove(score, w->e.score, VtScoreSize);		*type = etype(&w->e);		*tag = w->e.tag;	}else{		*e = nil;		memmove(score, w->data+w->n*VtScoreSize, VtScoreSize);		*type = w->type-1;		*tag = w->tag;	}	w->n++;	return 1;}

⌨️ 快捷键说明

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