code: mafs

ref: a6e9ab0ced8523fb8099afa4547dc27793e27462
dir: /custom.acid/

View raw version
include("mafs.acid");
include("extents.acid");

defn
Qid9p1(addr) {
	complex Qid9p1 addr;
	print("	version	", addr.version\X, "\n");
	print("	path	", addr.path\Z, "\n");
};

defn
Dentry1(addr) {
	complex Dentry1 addr;
	local i;

	i = 0;
	print("Qid9p1 qid {\n");
	Qid9p1(addr.qid);
	print("}\n");
	print("	size	", addr.size\Z, "\n");
	print("	pdblkno	", addr.pdblkno\Z, "\n");
	print("	pqpath	", addr.pqpath\Z, "\n");
	print("	mtime	", addr.mtime\Z, "\n");
	print("	mode	", addr.mode\O, "\n");
	print("	uid	", addr.uid\d, "\n");
	print("	gid	", addr.gid\d, "\n");
	print("	muid	", addr.muid\d, "\n");
	print("	dblocks	", addr.dblocks, "\n");
	loop 1, Ndblock do {
		print(i\d, ": ", addr.dblocks[i]\Z , "\n");
		i = i+1;
	}
	print("	iblocks	", addr.iblocks, "\n");
	loop 1, Niblock do {
		print(i\d, ": ", addr.iblocks[i]\Z , "\n");
		i = i+1;
	}
};

defn
Dentry(addr) {
	complex Dentry addr;
	print("Dentry1 {\n");
		Dentry1(addr+0);
	print("}\n");
	print("	name	", *(addr.name\s), "\n");
};

defn
Showextentpointers(addr) {
	complex Extent addr;
	local start, len;

	start = addr.start\Z;
	len = addr.len\Z;
	print(start\Z, "	", (start+len-1)\Z,"	", len\Z,
			"	", addr\Y, "\n");
	print("	", addr.prev\Y, " lru   ", addr.next\Y, "\n");
	print("	", addr.low\Y,  " start ", addr.high\Y,"\n");
	print("	", addr.small\Y," len   ", addr.big\Y, "\n");
};

defn
Showextentspointers(addr) {
	complex Extents addr;
	complex Extent eaddr;

	print(*(addr.name\s), " n ", addr.n\Z,
			" lowest ", addr.lowest\Y,
			" lru ", addr.lru\Y,
			" nlru ", addr.nlru\b, "\n");
	eaddr = addr.lowest;
	while eaddr != 0 do {
		Showextentpointers(eaddr);
		eaddr = eaddr.high;
	}
};

defn
Showextent(addr) {
	complex Extent addr;
	local start, len;

	start = addr.start\Z;
	len = addr.len\Z;
	print(start\Z, " ", (start+len-1)\Z," ", len\Z, " ", addr\Y);
};

defn
Showextents(addr) {
	complex Extents addr;
	complex Extent eaddr;
	complex Extent lru;
	complex Extent elow;

	print(*(addr.name\s), " n ", addr.n\Z,
			" lowest (", Showextent(addr.lowest),
			") lru (", Showextent(addr.lru),
			") nlru ", addr.nlru\b, "\n");
	print("by blkno:\n");
	eaddr = addr.lowest;
	while eaddr != 0 do {
		Showextent(eaddr);
		print("\n");
		eaddr = eaddr.high;
	}
	print("by size:\n");
	eaddr = addr.lowest;
	while eaddr != 0 do {
		elow = eaddr;
		eaddr = eaddr.small;
	}
	eaddr = elow;
	while eaddr != 0 do {
		Showextent(eaddr);
		print("\n");
		eaddr = eaddr.big;
	}
	print("lru:\n");
	eaddr = addr.lru;
	if eaddr != 0 then {
		Showextent(eaddr);
		print("\n");
		eaddr = eaddr.next;
		while eaddr != addr.lru do {
			Showextent(eaddr);
			print("\n");
			eaddr = eaddr.next;
		}
	}
};

defn
Es(addr) {
	Showextents(addr);
};