code: mafs

ref: 285644aadb1b58735651a5068703372f8fc9adac
dir: /custom.acid/

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

defn
Dentryhdr1(addr) {
	complex Dentryhdr addr;
	print("	tag	", addr.tag, "\n");
	print("	flags	", addr.flags, "\n");
	print("	uid	", addr.uid\d, "\n");
	print("	gid	", addr.gid\d, "\n");
	print("	muid	", addr.muid\d, "\n");
	print("	size	", addr.size\Z, "\n");
	print("	pdblkno	", addr.pdblkno\Z, "\n");
	print("	pqpath	", addr.pqpath\Z, "\n");
	print("	preli	", addr.preli\Z, "\n");
	print("	mtime	", addr.mtime\Z, "\n");
	print("	qpath	", addr.qpath\Z, "\n");
	print("	version	", addr.version\D, "\n");
	print("	mode	", addr.mode\O, " ", addr.mode\X, "\n");
};

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

	print("Dentryhdr {\n");
		Dentryhdr1(addr);
	print("}\n");

	i = 0;
	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;
	}
	print("	path	", addr.path\Z, "\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;

	if addr == 0 then {
		print("nil");
	}else{
		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 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 = ((Extent)eaddr).high;
	}
	print("by size:\n");
	eaddr = addr.lowest;
	elow = addr.lowest;
	while eaddr != 0 do {
		elow = ((Extent)eaddr);
		eaddr = ((Extent)eaddr).small;
	}
	eaddr = elow;
	while eaddr != 0 do {
		Showextent(eaddr);
		print("\n");
		eaddr = ((Extent)eaddr).big;
	}
	print("lru:\n");
	eaddr = addr.lru;
	if eaddr != 0 then {
		Showextent(eaddr);
		print("\n");
		eaddr = ((Extent)eaddr).next;
		while eaddr != addr.lru do {
			Showextent(eaddr);
			print("\n");
			eaddr = ((Extent)eaddr).next;
		}
	}
};

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

defn
E(addr) {
	Showextent(addr);
	print("\n");
};