OOFS: implement free, auto handle resize

	SUMMARY

		Reworked handle persist code: load uses the persisted
		initialized size of the handle, and save will reallocate
		the handle if the object is too large to fit in the
		handle space.

		The txtab HEAD (root dir) is updated if reallocated.

	NOTE
		Still experimental and buggy!

	NOTE
		The txtab update is the ONLY handle that gets this treatment;
		a general child-moved event for handles must be implemented.

	NOTE
		oofs_tree (holding the root dir) gets resized but this change
		is not recorded. The handle passed to the fs layer will then
		be out of date, resulting in problems quickly.

kernel/fs.s:
	add stacktraces for fs_obj read/write.

kernel/fs/fs_oofs.s:
	nextentry: fix copy fs_dirent.

kernel/fs/oofs/oofs_alloc.s:
	add free method.

kernel/fs/oofs/oofs_handle.s:
	change oofs_handle_persistent_start from label to value.

	save: reimplement to reallocate the diskspace handle and update
	the handle's persisted size.

	load: use handle's persisted initialized size to determine load size.

kernel/fs/oofs/oofs_persistent.s:
	minor debug/print adjustments.

	fix jump labels for errors in read.

kernel/fs/oofs/oofs_tree.s:
	remove load.
	reimplement save as a wrapper around handle_save; it first gets the
	old handle index and the txtab root dir handle index, then delegates
	to handle_save, and then updates txtab if the handles match.

	add: print tree after add (debug)

	implement print method.

kernel/fs/oofs/oofs_txtab.s:
	minor print fixes.

kernel/lib/handles.s:
	refactor handle_free_by_base: extract handle_free.
	export handle_free_by_base and handle_free.
OOFS: add hash to cache handle instances.

	SUMMARY

		implement a simple key-value hashtable in hash.s,
		using two arrays.

		oofs_handle registers with oofs_alloc, which maintains
		a hash connecting handle indices with object instances.

		Child moved events are handled.

kernel/Makefile:
	add lib/hash.s as kernel dependency.

kernel/fs/oofs/oofs_alloc.s:
	add hash<handle_idx, class_oofs_handle instance>,
	initialize it in init,
	and add oofs_alloc_handle_register to update the hash value
	(a 'package protected' or nonvirtual method).
	Update oofs_alloc_child_moved to scan the hash.

kernel/fs/oofs/oofs_handle.s:
	init: record instance with oofs_alloc.

kernel/fs/oofs/oofs_txtab.s:
	fix print stacktrace on error.

kernel/lib/hash.s:
	add ptr_hash 'class':
	- ptr_hash_new: return new double[] { new ptr_array, new ptr_array };
	- ptr_hash_put: update by key or add if key not found.
FS: create: fix label; OOFS: handle=idx,not obj

	SUMMARY

		OOFS now communicates the handle index (once more) to
		the FS layer rather than the object instance. See notes
		below at fs_oofs.s.

		Fixes handle leak on create/mkdir;
		Fixes null handle label on create.

kernel/fs.s:
	fs_handle_printinfo: print fix

	fs_create:
	- set handle label (full path);
	- optimize error printing.

	fs_close: remove checking label for null (is now fixed).

kernel/fs/fs_oofs.s:
	create, nextentry, open, close:
	use handle index 'outside' the method, and object pointer inside.

	This fixes the case where the object is resized and thus is an
	inconsistent handle.
	Still todo: return a consistent handle to the fs layer (client)
	that is immutable under both object reallocation and disk
	reallocation.

	Solution 1:

		cache the handle in a hash (done),
		and return the index in the hash

	Solution 2:

		maintain the disk handle consistently, either by:

		2.1: implementing a resize that updates the handle and thus
		     maintains the same handle index, even if
		     it will refer to other diskspace, or

		2.2: use the ll_fs (size) linked list, currently unused for
		     allocated handles, to create a linked list of handles
		     all belonging to the same file/directory.

kernel/fs/oofs/oofs_alloc.s:
	rename api method handle_get to handle_alloc.

	add api method handle_get, which retrieves the object using the
	handle index as key.

kernel/fs/oofs/oofs_handle.s:
	save: also save oofs_alloc if handles change.

kernel/fs/oofs/oofs_txtab.s:
	get: on error, also print the unallocated handle index.

kernel/lib/hash.s:
	add method ptr_hash_get (ebx->edx)

kernel/shell.s:
	touch/mkdir: call fs_close if there is no error.
Debug: regdiff improvement and fix.

kernel/debugger/export.s:
	macro REGDIFF:
	- fix esp adjustment: use COLOR_STACK_SIZE, not 2
	- mask segment registers (64k) to prevent printing them when
	  their effective value hasn't changed.
[WIP] OOFS: implement finding subdirectory entries.

	SUMMARY

		subdirectory or file entries are now resolved partially.
		As yet no handles are allocated when a file or directory
		is made, and thus they are not loaded upon opening.
		so, subdirectories cannot yet be truly opened and traversed,
		but creating entries with duplicate names is now effectively
		stopped.

kernel/fs/fs_oofs.s:
	remove old code;

	nextentry: allow CF for oofs_tree.next to indicate current entry
	doesnt exist.

	open: implement finding directory entries.

		TODO: for non-allocated (empty) handles, a value of -2
		is returned. Sub-root handles are not recorded/instantiated
		and thus oofs_alloc.handle_get will fail on them.
		What remains to be done is to add another layer of indirection
		by returning the cached entry index as the fs layer handle
		rather than the handle index itself.

	close: don't attempt to close handle -2.

kernel/fs/oofs/oofs_alloc.s:
	implement handle_remove.

kernel/fs/oofs/oofs_tree.s:
	declare TREE_ENTRY_SIZE and use it: it extends fs_dirent with a handle
	index.

	next: set CF.

	add: set the handle index of newly added entries to -1, indicating
	non-allocated.

	implement find_by_name.

kernel/lib/hash.s:
	add ptr_hash_remove: sets key/value to -1 and returns value.

	update ptr_hash_put: re-use entries with key -1.
write: add -s option.

Makefile:
	explicitly set -s option.

util/write.cpp:
	add -s option, specifying output size in sectors.
mem: fix printing kernel size

kernel/kernel.link:
	specify constant KERNEL_CODE_SIZE since arithmetic (+) on absolute
	symbols is unsupported in GNU binary formats.

kernel/lib/mem.s:
	mem -k:
		use different symbol for kerkel code size calculation;
		print missing ')'.
mem inspection: minor fixes

kernel/lib/mem.s:
	fix color on printing memory map (mem -m);
	fix stack calculation in mem -k [-a].
OOFS: rework api handle export; FIX oo resize

	SUMMARY

		Change the use of the ptr_hash hashtable to an array;
		this allows duplicate handles to be instantiated, and
		resolves problems where the same directory is opened
		multiple times where it can only be closed once.

		Fix serious bug in oo class_instance_resize which overwrote
		the wrong pointer;

		Add various (tested) ptr_hash methods, which are unused
		as I decided to use a simple array instead.

kernel/oo.s:

	class_instance_resize: fix updating instance pointer;

	class_deleteinstance: update error messages: print useful values;

	cmd_objects: use class_obj_print_classname and verify object's class
	is indeed a class.

	add method class_obj_print_classname: takes stackarg object pointer,
	and verifies whether it is null;

	update macro PRINT_CLASS (called by DEBUG_CLASS) to call
	class_obj_print_classname so that null objects can be printed.

kernel/print.s:
	add printfc, taking first argument to be color. Note that the caller
	must pop the color.

kernel/fs/fs_oofs.s:
	create:
	- fix typo in error message
	nextentry:
	- handle_get may return null object, handle it.
	- optimize register usage.
	open:
	- root: export alloc handle index as hash index.
	- subdir/file: idem; register handle index even if it is not allocated.
	- optimize error printing, using new printfc.
	close:
	- update checking for null (unallocated) handle.

kernel/fs/oofs/oofs_alloc.s:
	class:
	- remove globals - class declaration macros take care of exporting syms;
	- add doc for handle index translation;
	- change oofs_alloc_handles_hash to oofs_alloc_open_handles, an array;
	- make handle_register an api method;
	init:
	- allocate array rather than hash for open handles;
	handle_register:
	- replace with array put implementation;
	handle_get:
	- simply check array bounds and retrieve value from array
	handle_remove:
	- implement array remove, shrinking array used size if last entry;
	txtab_get:
	- call get_handle_instance$ setting up the object instance, and
	  register the object before calling load so that child_moved called
	  by persistent_resize can find the object;
	child_moved:
	- update scanning array for instances
	handle_load:
	- refactor out oofs_alloc_get_handle_instance$, transforming edx
	  to an initialized instance if it is a classdef ptr;
	print:
	- print the open handles

kernel/fs/oofs/oofs_handle.s:
	init:
	- invoke debugger if handle is -1 (just in case; hasn't happened)
	- change method signature to return ebx=fs handle index

kernel/fs/oofs/oofs_persistent.s:
	resize: don't clear CF after calling child moved.

kernel/lib/handles.s:
	handle_get_by_base:
	- print linked list indices on corrupt handle;
	- add stacktrace
	- on unknown pointer, print the value

kernel/lib/hash.s:
	upd ptr_hash_put: return index in ebx.
	add ptr_hash_getidx: key -> index
	add ptr_hash_getkey: index -> key
	add ptr_hash_remove_by_idx
	add ptr_hash_get_by_idx: index->(key,value).
	add ptr_hash_print
Cloudnet: disable arpwatch.

kernel/net/cloudnet.s:
	don't start arpwatch task (too much screen pollution), and it has
	served it's purpose - requests for the shared IP are seen, but
	unfortunately ARP responses are not broadcast, and so there is no
	easy way to detect a crashed node this way.
Web DOC Updates.

DOC/*.txt:
	fix layout for util/txt2html.pl, add minor notes here and there,
	add some links to local html docs where appropriate.

	Debugging.txt:
		add a few notes on current capabilities;

	Filesystem.txt:
		Add notes on scheduling optimization, handle ordering
		in both volatile and persistent memory, and a generic
		solution optimizing disk layout by OS usage;

	PersistentCluster.html:
		remove including style.css;

Makefile:
	Web-Document generation updates:

	Add TXTDOC: OOFS Security Fork Storage Paging Scheduling ITC
	GAS GitFS Debugging Architecture

	HTML generation: use new features of txt2html.pl to generate
	the html in one step (no intermediate file).

	add target root/www/doc/menu.xml (and dep in HTMLDOC),
	copying root/www/doc-menu.xml (as the doc/ directory is deleted
	on clean).

	doc.inc: don't include xml files;

	generate root/www/doc/index.html (including a modified version of
	doc.inc).

root/www/index.html:
	change tagline;
	update link to OOFS doc.

util/template.html:
	add <title> tag and <h1> for new ${TITLE}.
	add <h2> for TOC and new ${TOC}.

util/template.pl:
	add option --menuxml specifying a menu.xml override to pass to
	js/template.js template() function;

	add option --title to specify a document title;

	add option --tagline to specify a ${TAGLINE} value
	(not in any template as yet).

	Replace ${TOC} (with undefined $toc as yet), ${TITLE} and ${TAGLINE}.

util/txt2html.pl:
	recode option parsing;
	add options:
		--toc to prepend the TOC contents on raw output (-t none);

		--title to se the value for ${TITLE};

		--rawtitle which takes a DOC/FooBar.txt transforming
		it into "Foo Bar" (only the top level dir is stripped)
		and treats the result as --title;

		-p to set ${RP} (relative path for css/js) like template.pl;

		--onload to specify the entire onload javascript string to
		inject into ${ONLOAD};

		--tagline to replace ${TAGLINE}.

	generate a hierarchical TOC scanning all <h.> tags and replace ${TOC}
	in the template (--toc not needed).

	builtin template: add <title>, <h1>, and toc.