[Disksim-users] code questions ...

Michael Meeks michael.meeks at novell.com
Wed Aug 1 12:36:47 EDT 2007


Hi guys,

	Reading through the disksim code, I have a few questions & comments to
add to my previous questions.

	* src/syssym_driver.c (main)
		+ int len = 8192000;
		+ why do we allocate a structure that is 8Mb large 
		  instead of sizeof (disksim_t) ?

	* src/disksim.c (disksim_initialize_disksim_structure):
		+ perhaps related, why do we initialize fields:
			disksim->startaddr = addr;
			disksim->curroffset = sizeof(disksim_t);
		+ when (apparently) both are unused
		+ (also why a 'rr' in curroffset ? ;-)

	* src/disksim.c:
		+ disksim_t *disksim = NULL;
		+ why use a global variable for state ?

	* src/disksim_global.h

/* remapping #defines for some of the variables in disksim_t */
#define warmuptime       (disksim->warmuptime)
#define simtime	         (disksim->simtime)
#define statdeffile      (disksim->statdeffile)

		+ I assume these were to help move from lots of
		  global variables, to just one which is a good
		  direction.
		+ OTOH - can we change the field names, to be different
		  to the macro names ? :-) that would make the more
		  readable:
			disksim->_simtime;
		  actually compile.
		+ cf. disksim_initialize_disksim_structure
			+ simtime = 0.0;	/* gets remapped to disksim->warmuptime */

	* What namespacing policy is in use ?
		+ eg. gtk+ would always use a gtk_ prefix for all
		  exported symbols, GTK_ for macros, and Gtk for types
		+ does disksim have a policy ?

	* src/syssim_driver.c (syssim_deschedule_callback)
		+ comment: "de-scehdule a callback." is jumbled.

	* src/disksim_interface.c (disksim_interface_request_arrive)
		+ looks like the end of this is a cut/paste of
			+ disksim_interface_internal_event
		+ code shrink & cleanup possible :-)

	* src/disksim_global.h (ioreq_event)
		+ the 'void *buf' pointer here appears to be some
		  user closure; thus is 'buf' a good name ?

	* src/disksim.c (disksim_setup_disksim)
		+ I'm intrigued by code such as:
		  disksim->tracepipes[0] = 8; 
		  disksim->tracepipes[1] = 9; 
		+ why 8 & 9 ? :-) is socketpair what is required ?
		+ also the great block of commented out code appears
		  to betray a lack of revision-control based 
		  confidence in recovering old code ? :-)

	I suppose I've managed to create a wrapper API I can use now to drive
my I/O simulation (and wrapped that with a pinvoke / C# API ;-) and life
is good.

	Is there a process for getting changes / fixes into DiskSim ?

	Thanks,

		Michael.

-- 
 michael.meeks at novell.com  <><, Pseudo Engineer, itinerant idiot





More information about the Disksim-users mailing list