I have my glue code for NBD working to the point where I can implement a simple RAM disk in about 40 lines of Python. Have I mentioned that NBD is one of the most egregiously bad pieces of code I have ever seen? Here’s a particularly heinous example – a “computed goto” in C:

	#define NBD_PROC_LABEL(n) 
		next_label = &&label_##n; 
		label_##n:
	...
	if (next_label) {
		void * label = next_label;
		goto *label;
	}

Some lines have been elided to highlight the awful meaning of the original code. What’s happening is that the macro – used about 20-some times in one routine – creates a goto label and stores a pointer to it in “next_label”. I’m not sure that the “&&label” construct is even legal C; I suspect it’s some gcc-specific abomination. In any case, the “goto” in the lower fragment jumps to a target that changes as the function executes. Ick. The purpose of these gyrations is to do some fairly simple error recovery. In another place the author uses almost the same trick to implement a very simple state machine. In either case the same effect can be had more cleanly and portably in about a half-dozen other ways with no loss of efficiency, but apparently Dr. Breuer wanted to be “clever”.

Yes, that’s Doctor Breuer. This bozo, who uses 400 explicit gotos in 24K lines of code plus more hidden by tricks like that described above, who has written not one line of documentation describing the protocols or interfaces he uses, whose kernel code fails to check array bounds and thus dereferences a null pointer contained in element -1 of an array…teaches computer science at the university level. My condolences to the poor students at Universidad Carlos III de Madrid.