cloudnet: print proper cluster size.
Add persistent network objects (cloudnet/oofs)

	SUMMARY

	> mkfs hda0

		Initializes an object-oriented file system.

			WARNING: does not prompt - be sure it is
				 an empty partition!

	> mount hda0 /net	# optional

		Loads the root sector as class oofs (which possibly
		reloads itself if it's size is multiple sectors).

	> cloud init

		Accesses the filesystem to find an object of class
		cluster_node containing persistent node data relevant
		in the cluster context.

	Note that cloudnet initializes itself automatically, and
	will still work if /net is not mounted and cannot be
	automounted. The daemon (task) continues to run the network.
	The init command triggers another attempt to load the
	cluster_node object if it was not loaded.

DOC/CloudNet.txt:
	some notes on existing protocols

kernel/Makefile:
	make fs/fs_oofs.s dependent upon fs/oofs/export.h

kernel/fs/oofs/Makefile:
	remove obj.o (obj.s never committed).

	add export.h: generate an include file using 'nm' and a regular
	expression write all 'A'bsolute symbols as constant assignments.

		This is needed, because GAS does not support using
		an external symbol in the calculation of absolute
		addresses.

kernel/fs.s:
	add global mtab_get_fs: given a mountpoint, returns the class_fs
	instance.

	make cmd_mount$ global - for now (better: implement fs_mount).

kernel/fs/fs_oofs.s:
	add global oofs_root - referenced by cloudnet.s.
	preserve more registers.

	fs_oofs_mount: after mounting, load entry 1, given class oofs_table.
	The class here is required, as the oofs root object itself does not
	dictate the contents of the partition besides the first sector. It
	maintains a list of regions (dynamic sub-partitions), each implemented
	in their own class. It only knows entry 0 to be itself. fs_oofs,
	as the first driver of OOFS, specifies a single class that is required
	to have at least access to one region - oofs_table.
	This class/region (oofs_table) will contain the information necessary
	to load the rest of the regions: it requires a list of pointers or
	strings - classnames - which can be dynamically instantiated.
	The oofs_table then is simple data storage - an asciz stringtable.
	Region loading, as implemented by the base class oofs and applying
	to the first region (starting at sector 0) is expected to maintain
	a small array of values - enough to dereference the first few sectors.
	This is because an object oriented design applies the concept of
	extension and thus maximal efficiency in re-use. Therefore, each
	succeeding region will be more complex, extending a previous one.
	This means that at some point, a region will emerge which is complex
	enough to handle the need for any further extension. This final
	region will be by far the largest, and will contain within it
	sub-regions that are not present in the root sector, but rather
	maintained at the regional level - much like a subdirectory.

	As said, the first region to be declared as an extension of the root
	region, must be a type table, holding symbolic references to the
	implementation for the region.

kernel/fs/oofs/oofs.s:
	declare globals oofs_api_load_entry and oofs_api_lookup.

	Load entry takes a classdef pointer and a region number to instantiate
	a loaded object. The class maintains an volatile object array
	(oofs_children) associated with it's region array, thereby providing a
	listing of which classes belong to which region.

	Lookup scans this object array for instances of a given class, but does
	not load.

	Add field oofs_persistence, which will always be the root of the
	object reference hierarchy (as far as oofs is concerned): fs_oofs,
	which exports the functions fs_obj_api_read/write. The value of
	oofs_persistence is passed along by being dereferenced in the
	constructor, thereby avoiding having to traverse a linked list.
	In essence, this field is for speed, as it contains redundant data.

		oofs_load/save:
			* use oofs_persistence for fs_obj_api_(read|write)
		oofs_load:
			* initialize object array oofs_children

		oofs_add:
			* verifies the given class extends class_oofs.
			* use OOFS_EL_STRUCT_SIZE and OOFS_IDX_TO_EL for dynamic
			  size.
			* associates the instantiated object with the region
			  (oofs_children[obj] -> oofs_array[lba,sectors])

		oofs_load_entry:
			* similar to oofs_add, except there is no space allocation
			  as the region/index is provided.

		oofs_get_obj:	(array access)
XXX			* basically: return this.children[ebx]

		oofs_lookup:	(filtered iteration)
			* iterates using oofs_get_obj, and yields the object
			  if it extends the given class. Can be continued
			  by preserving ebx so that multiple instances of the
			  given class are provided for.

		oofs_entries_print:
			updated to print object instance/class if known,

kernel/fs/oofs_table.s:
	oofs_table_init:
		* initialize oofs_persistence
		* initialize oofs_count to 0
		* initialize oofs_lba, oofs_size as given: the region space.
		* initialize the parent (region space can be inferred by
		  passing along the index of the child from the parent).

	oofs_table_save:
		fix: the method overrides oofs_api_load which constitutes recursion;
		instead, call the super method directly (using the global symbol).

kernel/oo.s:
	declare globals class_deleteinstance, class_extends.

	class_resolve: refactor: extract class_resolve_internal$ and make
	class_resolve a wrapper, preserving ebx, and initially checking
	whether the given class def ptr is indeed pointing to a class.
	The refactor is done so as to only do the class_is_class check once.

	add class_is_class: iterative check through the class_data_start...end.
	This method can be used to verify if a class ptr argument is valid.

	class_ref_inc: unused - first attempt at object reference counting,
	to automatically delete unused objects.

	class_ref_dec: unimplemented.

	class_instanceof: verify object not null; also return CF (though ZF
	is preferred as CF means exception/error).

	class_extends: also set CF according to ZF.

	cmd_classes: add argument parser: the first argument is taken to be
	a classname to filter against; list only subclasses of given class.

	macros: add globals (exports) for constants needed at runtime to
	construct subclasses:
		- class_{name}
		- {name}_STRUCT_SIZE
		- {name}_vptr
		- {name}_decl_vptr
		- {name}_decl_vptr_count

kernel/net/cloudnet:
	declare and define class netobj (extends oofs), which implements
	something similar to oofs in netobj_send: being able to send part
	of it's object data as a packet. Subclasses will put the contents
	of the packet first in their object, and pass on the offset to
	the end of the packet (relative to 'this' (eax)).

	declare and define class cluster_node.
		cluster_node_init:
			* fetches the instance of fs_oofs mounted at /net,
			  automounting it (hda0) nothing is mounted there.
			* fetches the oofs instance for direct access,
			  bypassing the filesystem API.
			* looks up oofs_table, which is initialized during
			  mount by fs_oofs. The idea is that this table
			  will contain class names associated with entries
			  in the oofs instance (first sector).
			* looks up cluster_node in oofs_table. This step
			  will instantiate a cluster_node, and initialize
			  it's contents from persistent storage.
		cluster_node_send: sets the end of packet and delegates
			to netobj. (check recursion).

	cloudnet_daemon: initialize a cluster_node instance.

	add alias cluster_packet_send to cloud_packet_send (different
	destination scope, possibly).

	cmd_cloud: add command 'init', which initializes a singleton
	cluster_node instance.
Debugger: export symbols

kernel/debugger/export.s:
	export debug_regstore/regdiff and breakpoint for use
	in other object files.
KAPI counter export; ata elevation wrapper.

	SUMMARY

		Automate exporting _KAPI_COUNTER to objects that
		would define more KAPI methods dynamically by
		counting the symbols starting with KAPI_.

		Add elevation wrapper for ata (disk_read/write).

.tcshrc:
	update alias qemu

kernel/Makefile:
	create file kapi/export.h containing accurate _KAPI_COUNTER
	for kernel.
	Objects should include kapi/export.h instead of kapi/kapi.s.

kernel/ring2.s:
	remove _KAPI_COUNTER as it is defined in kapi/export.h,
	which is now included instead of kapi.s.

kernel/partition.s:
	add ad-hoc proxy 'disk_read' and 'disk_write' proxying
	for ata_read/write, using direct call if possible,
	and KAPI_CALL otherwise.

	disk_get_partition: fix error label when the disk is unknown.

kernel/fs.s:
	declare KAPI method fs_mount, at current an alias for
	cmd_mount.

	fs_obj_read/write: call disk_read/write instead of ata_read/write,
	(as defined in partition.s).

kernel/fs/fs_oofs:
	check the calls to oofs_api_load, load_entry, and delete the object
	instances on failure.

kernel/fs/oofs/oofs.s:
	add oofs_api_verify_load event method to check check partition magic.

kernel/fs/oofs/oofs_table.s:
	override verify_load to nop.

kernel/net/cloudnet.s:
	make auto-mounting optional.

	use KAPI_CALL fs_mount instead of direct call.
OO delete: mfree print proper caller.

kernel/oo.s:
	class_resolve: print classname if vptr+mptr doesn't add up.

	class_deleteinstance: call mfree_ instead of mfree to print
	more useful caller on error.

kernel/mem.s:
	rename mfree to mfree_ and have it use [ebp] for caller;
	add mfree which sets up [ebp].
Cluster: persistence!

.tcshrc:
	update alias 'w' (where) to also match .h files in the kernel tree.

kernel/Makefile:
	make oofs.o dependent on kapi/export.h and export.h

	add rule to make export.h:
		* greps gdt.s for selector constants (since not all of them
		  are in the symbol table)

		  	NOTE that GAS does not support external symbols for
			selector names, as they must be absolute constants.
			Therefore these are redefined in an include file.

		* uses GIT to fetch the branch and kernel revision
		  (the number of commits) and appends these to export.h.

			NOTE that GAS does not support string constants,
			therefore a hack is used to get the git branch
			accessible to the source, by declaring a macro
			which calls LOAD_TXT.

kernel/ring2.s:
	include kernel's export.h for GDT selector constants (KAPI call).

kernel/fs/oofs/Makefile:
	include path workaround: add -I ../../ to AS: it includes
	"../../kapi/export.s" which includes "kapi/export.s", since
	'.include "./something"' is not relative to including file' path.

kernel/fs/oofs/extern.h:
	include kernel export.h for SEL_kapi in KAPI_CALL.
	include kapi export.h for KAPI_CALL - the reason for the -I hack
	above.

kernel/debugger/hwdebug.s:
	declare KAPI breakpoint_memwrite_dword.

kernel/oo.s:
	make class_is_class global
	class_newinstance: set obj_size.
	class_instance_resize: adjust object ptr if compact vptr.
	make _vptr_\name global (for method overrides).

	add macros DEBUG_CLASS, which prints the class (for eax),
	and DEBUG_METHOD, which calls debug_printsymbol. Both ad hoc,
	and not space efficient.

kernel/print.s:
	printf:
		make global, preserve ebx
		implement "%Nd" for positive N.

kernel/fs.s:
	add globals for mtab; have mtab struct be declared if !DEFINE.

	fs_obj_(read|write): add conditional debug to trace all reads/writes,
	and make edx parameter official: classdef ptr of caller.

kernel/fs/fs_oofs.s:
	fs_oofs_mkfs: preserve registers; add specific error messages.

XXX	add SHELL_COMMAND 'oofs' - which seems not be listed.
	add cmd_oofs: calls oofs_entries_print$ for each mounted OOFS.

kernel/fs/oofs/oofs.s:
	declare globals oofs_*: lba, persistence,persistent,size,onload,
	get_obj,print.

	move oofs.oofs_size field to before persistence, so children
	inherit the lba and size.

	rename oofs_(api_)verify_load to ..onload.

	add method oofs_api_print/oofs_print.

	move most of the code in oofs_load to oofs_onload, as it is
	object specific. This is temporary - will refactor.

	oofs_load: use class_instance_resize rather than mreallocz.

	oofs_add: initialize parameters for oofs_api_init call (LBA,size).

	oofs_load_entry: fix index into oofs_array; add error messages.

	oofs_lookup: preserve eax in case of error.

	oofs_entries_print$: verify class_is_class before print obj classname.
	(oofs_print is alias for oofs_entries_print$)

kernel/fs/oofs/oofs_table.s
	truncate parent object size in inherit to the persistent label.
	adjust persistent format: store content size (oofs_table_size).

	adjust .org to make object size at least 1 sector.

	override add, onload, get_obj, print and lookup.

	oofs_table_init: add classnames for entry 0 and 1 (parent and self)
	to stringtable. It expects to be entry 1 itself, and does not check.

	add private method addstring$: appends string to persistent area,
	but does not save. Uses oofs_table_size as append location.

	oofs_table_save: don't call super, save persistent data.
	oofs_table_load: don't call super, but load data directly.

	oofs_table_add: adds the classname to the stringtable,
	adds the region to the parent, and if all is well, saves itself
	(i.e. the string table).

	override oofs_api_get_obj: nop
	override oofs_api_lookup: returns the string index number,
	which correlates to the index of the associated (parent) instance:
	the volume descriptor, class_oofs. Contrary to oofs.lookup,
	which returns the object instance if any, any caller should
	call oofs.load_entry after calling lookup (preferrably first
	checking if it's already loaded using oofs_api_get_obj).

	oofs_table_print: override oofs_api_print, to print the string
	table.

kernel/net/cloudnet.s
	store the nic's ip in a static field for faster access.

	add cluster_era and node_age in the node struct (peer tracking),
	and send/parse these in the hello packet. Remove packet_hello_nr$.

	register self in the node list; shown by '*' in cmd_cloud.

	cmd_cloud: print cluster_node fields.

	cluster_node_init: rework exceptions (errors); set size to 1 sector
	when adding cluster_node to oofs_table.
	when got cluster node: print fields, increment age.

	cluster_node now is a proper extension of oofs, overriding and
	implementing (most) all needed methods, and properly maintains
	it's persistent state.

	add two methods that dump information in a given buffer, called
	(at current) by httpd's www_expr handler:

		* cluster_get_kernel_revision: combines kernel's export.h
		  values for the KERNEL_VERSION ("branch-revision") with
		  the cluster era, node age, and the node's age in the
		  era.

		* cluster_get_status: prints the number of nodes in the
		  cluster, aswell as the node age for all nodes, showing
		  the current node in bold.

		Accessing http://vm-ip/ now shows these values.

root/www/index.html:
	add a box displaying the kernel revision and cluster status info, using
	* ${kernel.revision} (nr of commits)
	* ${cluster.status} : nr of nodes, age of each node
	* ${cluster.kernel.revision}: ${kernel.revision}.${cluster.age}
		.${node.era_age}.${node.age}.
		(era_age is the node age in the current era, i.e., node_age
		minus the node's age when the cluster era changed: how many
		reboots it has had in the current cluster era).

	add a header anchor section "cluster" with some key phrases (OOFS etc).

kernel/net/httpd.s:
	have http_parse_header return CF on error and send 400 if so.
	have http_parse_header_line$ do the same.
	add nicer debug printing and checks in parsing header.

	add minor doc on www expression handling.
	add new data type string (2) - currently only works with expression
	type 'call'.
	add new data type decimal32 (3).
	add expression "${kernel.revision}" of type decimal32.
	add expression "${cluster.kernel.revision}" and "${cluster.status}"
	of type string.
httpd: fix 400 on referrer header.

kernel/net/httpd.s:
	the referrer check fell through into an error handler; add jmp.
	add some colors.