2007-11-09  Masami Hiramatsu  <mhiramat@redhat.com>

	PR3858
	* transport.c (_stp_transport_init): Reduce relay buffer size to
	64KB*2 if -DRELAY_GUEST is specified.

2007-11-09  Martin Hunt  <hunt@redhat.com>
	PR 5281
	* transport.c (_stp_detach, _stp_attach): Call utt_set_overwrite()
	instead of setting a flag directly.
	* utt.c (utt_set_overwrite): New. Set overwrite mode.
	* relayfs.c (utt_set_overwrite): New. Set overwrite mode.
	* utt.h: Remove global utt_overwrite_flag.
	
2007-11-01  Martin Hunt  <hunt@redhat.com>

	* procfs.c, control.c, transport.c: Recognize when stapio 
	is detached and disable delayed work. Enable when attached.
	Cleanup code to destroy workqueue on exit.

2007-10-12  Martin Hunt  <hunt@redhat.com>

	* transport.c (_stp_ask_for_symbols): Don't ask for
	transport_info yet.  Need to wait until symbols are
	received.
	(_stp_work_queue): Rename _stp_ready_q to _stp_ctl_ready_q.
	* procfs.c: Create a ".symbols" channel and use it for
	STP_MODULE and STP_SYMBOLS. Rename "cmd" channel to ".cmd".
	* control.c: Ditto.

2007-09-21  Martin Hunt  <hunt@redhat.com>
	From Alan Brunelle
	* control.c (_stp_ctl_read_cmd): Cast count to an int before printing.

2007-09-20  Martin Hunt  <hunt@redhat.com>

	* transport.h: Increase default buffer size.
	* control.c (_stp_ctl_read_cmd): Check buffer size.

2007-09-10  Martin Hunt  <hunt@redhat.com>

	* procfs.c (_stp_register_ctl_channel): Call 
	_stp_mkdir_proc_module().
	(_stp_unregister_ctl_channel): Call _stp_rmdir_proc_module().
	* transport.c: Include ../procfs.c runtime procfs functions.
	
2007-08-17  Martin Hunt  <hunt@redhat.com>
	PR3857
	From Masami Hiramatsu
	* utt.c (utt_subbuf_start_callback): Use overwrite flag.
	* control.c (_stp_ctl_open_cmd): Set overwrite_flag off.
	(_stp_ctl_close_cmd): Set overwrite flag on.

2007-08-14  David Smith  <dsmith@redhat.com>

	Merge from setuid-branch.  Changes also by Martin Hunt
	<hunt@redhat.com>.

	* control.c (_stp_ctl_write): Make sure we don't overflow.
	(_stp_ctl_open_cmd): Do not allow multiple opens of the control
	file.
	(_stp_ctl_write_cmd): Once STP_START is received, ignore
	everything except STP_EXIT.  Create another state variable
	"initialized". Don't respond to STP_SYMBOLS or STP_MODULES unless
	initialized is 0. Also check that current pid is the same as the
	pid that did insmod.
	(_stp_register_ctl_channel): Bug fix - sets owner/group after
	checking for NULL.

	* procfs.c (_stp_ctl_write): Make sure we don't overflow.
	(_stp_ctl_open_cmd): Do not allow multiple opens of the control
	file.
	(_stp_ctl_write_cmd): Once STP_START is received, ignore
	everything except STP_EXIT.  Create another state variable
	"initialized". Don't respond to STP_SYMBOLS or STP_MODULES unless
	initialized is 0. Also check that current pid is the same as the
	pid that did insmod.
	(_stp_register_ctl_channel): Set ownership of cmd file and percpu
	files for bulkmode.

	* relayfs.c (utt_trace_setup): Set ownership of percpu files.
	Improved error handling.
	(utt_trace_remove): Improved error checking.

	* utt.c (utt_remove_tree): Improved error checking.
	(utt_trace_cleanup): Ditto.
	(utt_create_buf_file_callback): Set file ownership.
	(utt_create_global_buf_file_callback): Set file ownership.

	* transport.h: Delcare _stp_uid, _stp_gid, and _stp_init_pid.
	* transport.c (_stp_transport_init): Set _stp_uid, _stp_gid, and
	_stp_init_pid.

2007-07-26  Martin Hunt  <hunt@redhat.com>

	Spotted by Ming Chang.
	* procfs.c (_stp_register_ctl_channel): Fix iterator when removing
	proc entries when an error occurs.

2007-07-10  Michal Schmidt  <mschmidt@redhat.com>

	* symbols.c (_stp_del_module): Split freeing of module memory into
	a separate function _stp_free_module().
	(_stp_do_module): Free module memory if _stp_ins_module() fails.

2007-07-09  Martin Hunt  <hunt@redhat.com>

	* symbols.c (_stp_ins_module): Check for overflow of
	modules array.
	(_stp_do_module): If _stp_ins_module() fails, return an error.
	
2007-07-02  Martin Hunt  <hunt@redhat.com>

	* symbols.c (_stp_do_symbols): Set "data" pointer for kernel to _etext.
	(_stp_sort): New. sort function from the kernel.
	(_stp_load_module_symbols): Use _stp_sort().

2007-06-21  Martin Hunt  <hunt@redhat.com>

	* control.c (_stp_ctl_write_cmd): Add support for STP_BULK.
	* transport_msgs.h (enum): Add STP_BULK.

2007-06-18  Martin Hunt  <hunt@redhat.com>

	* control.c (_stp_register_ctl_channel): Fix mode of cmd file.

2007-05-16  Will Cohen  <wcohen@redhat.com>

	* control.c: Explicit type cast for picky compilers.

2007-05-15  Martin Hunt  <hunt@redhat.com>

	* control.c: Change default buffer number and size.
	 (_stp_ctl_write): Add debug statements. Check size of
	message to avoid overwriting buffer.

2007-04-27  Martin Hunt  <hunt@redhat.com>

	* utt.h (struct utt_trace): Remove sequence.
	* utt.c (utt_trace_cleanup): Remove free of utt->sequence.
	(utt_dropped_open): PR 4415. Use STAPCONF_INODE_PRIVATE to detect
	correct inode struct.
	(utt_trace_setup): Do not allocate utt->sequence.

2007-04-02  Martin Hunt  <hunt@redhat.com>

	* transport_msgs.h (struct _stp_msg_trans): Deleted.
	Transport parameters are now read from procfs.

	* transport.c (_stp_ask_for_symbols): STP_TRANSPORT
	message is empty.

	* procfs.c (_stp_ctl_open_cmd): New. Set _stp_	pid.
	(_stp_ctl_close_cmd): New. Unset _stp_pid.
	(_stp_proc_fops_cmd): Add pointers to above funcs.
	(_stp_ctl_read_bufsize): New.
	(_stp_register_ctl_channel): Create a proc read entry
	"bufsize" containing transport buffer sizes.

2007-03-28  Martin Hunt  <hunt@redhat.com>

	* control.c (_stp_ctl_open_cmd): Set _stp_pid.
	(stp_ctl_close_cmd): Clear _stp_pid.
	* transport.h: Declare _stp_pid;

2007-03-26  Frank Ch. Eigler  <fche@elastic.org>

	* transport.c: Add #include <linux/namei.h> for lookup_one_len.

2007-03-26  Martin Hunt  <hunt@redhat.com>

	* symbols.c (_stp_do_module): If a module has no symbols, just
	return NULL instead of an errorcode.

	* control.c, procfs.c, relayfs.c, transport.c, utt.c, utt.h:
	Revert back to using systemtap/modulename instead of systemtap_pid.

2007-03-21  Martin Hunt  <hunt@redhat.com>

	* symbols.c (_stp_del_module): Add a call to _stp_module_relocate
	to clear its cache.

2007-03-20  Frank Ch. Eigler  <fche@elastic.org>

	* symbols.c (_stp_do_symbols): Add cautionary blurb for important
	setup of _stp_modules[0]->text.

2007-03-20  Martin Hunt  <hunt@redhat.com>

	* symbols.c (_stp_alloc_module): Fix up error
	cleanup when malloc fails.

2007-03-14  Martin Hunt  <hunt@redhat.com>

	* transport_msgs.h: ifdef old messages as such.
	Add support for new transport.
	* relayfs.c: Simplify and add new interface to look
	like utt.
	* utt.[ch]: New files. Similar to the proposed utt interface.
	These setup and teardown relayfs on debugfs.
	* control.c: New file. Implements a simple control channel.
	A small subset of procfs.c.
	* procfs.c: This is now only used for old kernels lacking newer 
	relayfs. Change STP_RELAYFS to STP_BULKMODE. Use new
	messages from transport_msgs.h. Don't support 
	RELAYFS_CHANNEL_VERSION >= 4. CHanges all control channel functions
	to new names. Use pids instead of module names in /proc names.

2007-03-12  Frank Ch. Eigler  <fche@elastic.org>

	* procfs.c (_stp_register_procfs): Use /proc/MODULE rather than
	/proc/systemtap/MODULE.

2007-03-12  Frank Ch. Eigler  <fche@redhat.com>

	PR 4179.
	Based on patch from Vasily Averin <vvs@sw.ru>:
	* procfs.c (_stp_register_procfs): Recover from partial failures.
	* transport.c (_stp_transport_open): Ditto.

2007-01-30  Martin Hunt  <hunt@redhat.com>

	* symbols.c: Comment out many debug lines.

2007-01-29  Martin Hunt  <hunt@redhat.com>

	* procfs.c: Count allocated IO memory.
	* symbols.c: Use _stp_kmalloc() and _stp_kzalloc().
	* transport.c: Count allocated IO memory.
	
2007-01-09  Martin Hunt  <hunt@redhat.com>

	* symbols.c (_stp_del_module): Fix so memory allocated
	for module 0 (kernel) is freed.
	(_stp_free_modules): No need to lock module list.

2006-12-20  Martin Hunt  <hunt@redhat.com>

	* transport.c: Fixes to use the new 2.6.20 workqueue API.

2006-11-15  Martin Hunt  <hunt@redhat.com>

	* procfs.c (_stp_proc_write_cmd): For STP_SYMBOLS, 
	type field is a long to preserve alignment.
	Use STP_ALLOC_FLAGS.

	* symbols.c: Use STP_ALLOC_FLAGS.
	
2006-11-09  Martin Hunt  <hunt@redhat.com>

	* transport_msgs.h: Change all ints to int32_t. Prefix
	all struct names with "_stp".
	* transport.c: Use new struct names.
	(_stp_handle_start): Send pointer size and endianess.
	* procfs.c: Use new struct names.

2006-11-02  Martin Hunt  <hunt@redhat.com>
	* symbols.c (_stp_do_module): Fix error message.

2006-11-02  Martin Hunt  <hunt@redhat.com>	

	* symbols.c: New file. Get the STP_SYMBOLS and STP_MODULE
	messages, allocate memory and store the data.

	* procfs.c (_stp_proc_write_cmd): When STP_SYMBOLS or STP_MODULE
	request is received, call the appropriate functions.

	* transport.c (_stp_handle_start): If necessary, ask staprun for 
	symbols and modules.
	(_stp_cleanup_and_exit): Unregister module notifier.
	(_stp_transport_close): Unregister module notifier and free module
	memory.
	* transport_msgs.h (enum): Add STP_MODULE and STP_SYMBOLS.

2006-09-26  David Smith  <dsmith@redhat.com>

	* transport.c: Changed 'stpd' references to 'staprun'.
	* transport.txt: Ditto.

2006-09-26  Martin Hunt  <hunt@redhat.com>

	* transport.c (_stp_handle_start): Don't initialize timers here.
	(_stp_transport_init): Initialize timers here. 
	(_stp_cleanup_and_exit): Don't kill timers or free print buffers here.
	(_stp_transport_close): kill timers and free print buffers here.

2006-09-25  Tom Zanussi  <zanussi@us.ibm.com>
	
	* procfs.c (_stp_proc_read): Set buf_info flushing flag.
	* transport.c (_stp_cleanup_and_exit): Remove braces.
	* transport_msgs.h: Add flushing flag to buf_info.

2006-09-22  Martin Hunt  <hunt@redhat.com>

	* transport.c (_stp_work_queue): Reenable some cleanup
	code.

2006-09-21  Martin Hunt  <hunt@redhat.com>

	* transport.c (_stp_transport_init): Call _stp_print_init().
	(_stp_cleanup_and_exit): Call _stp_print_cleanup().

2006-09-21  Tom Zanussi  <zanussi@us.ibm.com>
	
	* relayfs.c (_stp_get_relay_root): Call new mutex lock/unlock
	wrappers instead.
	(_stp_lock_inode): New.
	(_stp_unlock_inode): New.

2006-09-19  Tom Zanussi  <zanussi@us.ibm.com>
	
	* procfs.c (_stp_get_proc_root): Removed.
	(_stp_force_dir_creation): Removed.
	(_stp_register_procfs): Remove unneeded procfs dentry code.  *
	relayfs.c (_stp_create_buf_file): Remove code to create relay
	files in procfs, add code to create in debugfs.
	(_stp_remove_buf_file): Remove code to delete relay files in
	procfs, add code to delete from debugfs.
	(_stp_create_relay_dir): New.
	(_stp_remove_relay_dir): New.
	(_stp_get_relay_root): New.
	(_stp_relayfs_close): Use new functions.
	(_stp_relayfs_open): Consolidate alternative versions and remove
	extraneous version.  * relayfs.h: Remove extraneous
	_stp_relayfs_open prototype.
	* transport.c (_stp_transport_open): Remove extraneous call to
	_stp_relayfs_open() and remove call to _stp_unregister_procfs() on
	failure - since it's called from cmd write, cmd can't be removed;
	it's removed in normal shutdown anyway.

2006-09-18  Martin Hunt  <hunt@redhat.com>

	* transport_msgs.h (struct transport_info): Add merge field.
	* transport.c (_stp_transport_open): Set merge field.

2006-06-21  Josh Stone  <joshua.i.stone@intel.com>

	PR 2525
	* transport.c (_stp_handle_start): Initialize timer functions.
	* transport.c (_stp_cleanup_and_exit): Teardown timer functions.

2006-06-13  Martin Hunt  <hunt@redhat.com>

	* transport.c (_stp_transport_close): Destroy workqueue when
	done.

2006-06-09  Martin Hunt  <hunt@redhat.com>

	* transport.c: Using the default workqueue was causing problems
	because of the long delays on probe_exit(). Created a new
	systemtap work queue and used that instead.

2006-06-05  Martin Hunt  <hunt@redhat.com>

	* procfs.c (_stp_write): Always use spin_lock_irqsave() because
	this function can sometimes be called with interrupts enabled.

2006-04-10  Martin Hunt  <hunt@redhat.com>

	* procfs.c (_stp_write): More fixes because buffers
	are no longer null-terminated.

2006-03-20  Martin Hunt  <hunt@redhat.com>

	* procfs.c (_stp_write): Combine buffers only for REALTIME_DATA.

2006-03-16  Tom Zanussi  <zanussi@us.ibm.com>

 	* procfs.c (_stp_proc_read): Change ifdef for relayfs version.
 	* relayfs.c: Change ifdefs for relayfs version.
 	* relayfs.h: Remove relayfs-config.h include.
 	* transport.c (_stp_handle_buf_info.c): Change ifdef for relayfs
	version.
 	* relayfs-config.h.in: Removed.

2006-03-15  Tom Zanussi  <zanussi@us.ibm.com>
 
 	* procfs.c (_stp_proc_read): Add ifdef for CONFIG_RELAY.
 	(_stp_get_proc_root): New function.
 	(_stp_force_dir_create): New function.
 	(_stp_register_procfs): Add support for CONFIG_RELAY files in
 	proc.
 
 	* relayfs.c (_stp_subbuf_start): Fix ppc64 compilation error
 	mentioned in bug #2406.
 	(_stp_create_buf_file): New function.
 	(_stp_remove_buf_file): New function.
 	(_stp_relayfs_close): Add support for CONFIG_RELAY.
 	(_stp_relayfs_open): Add support for CONFIG_RELAY.
 
 	* relayfs.h: Add support for CONFIG_RELAY and
 	RELAYFS_VERSION_GE_4.
 	* transport.c (_stp_handle_buf_info.c): Add support for
 	CONFIG_RELAY.
 	* transport (_stp_transport_open.c): Add support for CONFIG_RELAY.

 	* relayfs-config.h.in: New file.

2006-03-15  Martin Hunt  <hunt@redhat.com>

	* procfs.c (STP_DEFAULT_BUFFERS): Bump up to 256.

2006-03-06  Martin Hunt  <hunt@redhat.com>

	* transport_msgs.h (struct cmd_info): New message.

2006-02-25  Martin Hunt  <hunt@redhat.com>

	* procfs.c (_stp_proc_write_cmd): Check return code for
	_stp_transport_open().

	* transport.c (_stp_transport_write): This function 
	can now sleep because it is
	(_stp_handle_start): Don't use a mutex when a simple atomic 
	will do.
	(_stp_work_queue): Check atomic to see if probe_start()
	has finished before attempting exit.
	(_stp_transport_close): PR2391. Cancel work queue.
	(_stp_transport_init): If _stp_register_procfs() fails,
	return an error code.

	* transport.txt: New file. Documents transport initialization and 
	shutdown sequence.
	
2006-02-24  Martin Hunt  <hunt@redhat.com>

	* transport.c (_stp_transport_init): Fail if 
	_stp_register_procfs() fails.

2006-02-17  Martin Hunt  <hunt@redhat.com>

	* procfs.c (_stp_proc_read_cmd): Change spin_lock()
	to spin_lock_irqsave(). 

	* transport.c (_stp_work_queue): Ditto.
	
2005-12-02  Martin Hunt  <hunt@redhat.com>

	* procfs.c (_stp_set_buffers): kmalloc the buffers instead
	of vmalloc.
	(_stp_register_procfs): Ditto.
	(_stp_unregister_procfs): kfree the buffers.

2005-11-30  Martin Hunt  <hunt@redhat.com>

	* transport.h (STP_WORK_TIMER): Declare.
	* transport.c (_stp_work_queue): Wake up every STP_WORK_QUEUE
	jiffies and check IO and exit status.
	(_stp_handle_exit): Deleted.
	* procfs.c (_stp_proc_write_cmd): Just set exit flag on STP_EXIT.
	(_stp_write): Don't call wake_up_interruptible.

2005-10-17  Martin Hunt  <hunt@redhat.com>

	* transport.c (_stp_handle_start): Grab semaphore before
	calling probe_start() and release after it is done.
	(_stp_handle_exit): Ditto for exiting. This prevents
	exiting before probe_start() is finished.

2005-10-14  Tom Zanussi  <zanussi@us.ibm.com>

	* relayfs.h: Add ifdef'ed relayfs_fs.h include for mainline
	relayfs version.  If you're running a kernel with a version
	of relayfs >= 4 (the version # can be found in
	/include/linux/relayfs_fs.h) configured in, adding a
	#define RELAYFS_VERSION_GE_4 at the top of transport/relayfs.h
	will make systemtap use it instead of the packaged version.
	
	* relayfs.c: Add ifdef'ed relayfs callback functions for
	mainline relayfs version.
	(_stp_relayfs_open): Add ifdef'ed code for mainline
	relayfs version.
	* procfs.c (_stp_proc_read): Ditto.
	* transport.c (_handle_buf_info): Ditto.

2005-10-05  Tom Zanussi  <zanussi@us.ibm.com>

	* transport.c (_stp_transport_open): Add kbug message.
	* transport.h: Change default n_subbufs to 16.

2005-09-08  Martin Hunt  <hunt@redhat.com>

	* procfs.c (_stp_register_procfs): Change ifdefs to eliminate
	unused variable warnings.
	(_stp_unregister_procfs): Ditto.

2005-09-06  Martin Hunt  <hunt@redhat.com>

	* transport.c (_stp_handle_start): Always reply to
	a start message with STP_START.

2005-08-24  Martin Hunt  <hunt@redhat.com>

	* transport_msgs.h (enum): New type, STP_OOB_DATA.

2005-08-23  Martin Hunt  <hunt@redhat.com>

	* transport.c (_stp_cleanup_and_exit): Remove a 2 second sleep
	that should no longer be necessary.

	* procfs.c (_stp_write): If the ready queue is not empty
	then attempt to grab the last buffer in it and append our data 
	to it.

2005-08-22  Martin Hunt  <hunt@redhat.com>

	* transport.h: Don't define _stp_transport_write.
	* transport.c (_stp_transport_write): Use
	_stp_transport_send() when in probe_exit().

2005-08-19  Martin Hunt  <hunt@redhat.com>

	* transport.c (_stp_cmd_handler): Remove. This was used by 
	stp-control.

	* procfs.c (_stp_proc_write_cmd): Call schedule_work() instead
	of running _stp_exit_handler immediately. Fixes a problem where 
	the module couldn't exit if all the output buffers were full.
	Set .owner for the filesystem entries.

2005-08-19  Martin Hunt  <hunt@redhat.com>
	
	* transport.h: Remove netlink references.
	* transport.c: Remove netlink references. Ifdef relayfs code.
	* procfs.c: New file.
	* Makefile: Deleted.
	* control.c: Deleted.
	* control.h: Deleted.
	* netlink.c: Deleted.
	* netlink.h: Deleted.

2005-08-03  Martin Hunt  <hunt@redhat.com>

	* transport.c: Comment out a couple printks.

2005-08-01  Martin Hunt  <hunt@redhat.com>

	* control.h: Remove STP commands from here and put in
	transport_msgs.

	* transport_msgs.h: New file containing the structs and
	values for the messages exchanged between stpd and transport.

	* transport.h: Moved stuff shared with stpd to transport_msgs.h

	* transport.c: Complete rewrite to better handle complicated
	initialization involving exchanging data with stpd. Supports
	buffer size negotiation and more.
	
2005-07-18  Martin Hunt  <hunt@redhat.com>

	* transport.h (_stp_transport_write): Call _stp_relay_write().

	* transport.c (_stp_cleanup_and_exit): Print transport
	failure count.
	(_stp_relay_write): Like relay_write() except returns
	-1 on error.

2005-07-14  Tom Zanussi  <zanussi@us.ibm.com>

	* netlink.c (_stp_netlink_open): Add missing delayed_pkts
	initialization.
	
2005-07-08  Martin Hunt  <hunt@redhat.com>

	* transport.c: Rename pid to _stp_pid.
	Rename t to _stp_tport.
	(_stp_cleanup_and_exit): New internal function.
	(stp_exit_helper): Call _stp_cleanup_and_exit().
	(_stp_transport_cleanup): New function.
	(_stp_cmd_handler): Remove handler for STP_TRANSPORT_MODE.
	The transport now notifies the daemon of the transport.
	(_stp_transport_close): No longer calls _stp_exit_helper().
	That is done by _stp_transport_cleanup().
	(_stp_transport_open): When done, call _stp_handle_transport()
	to notify the daemon what our transport is.
	(_stp_transport_send): Put a retry limit on sends.

	* transport.h: Rename pid to _stp_pid.
	(_stp_transport_cleanup): Add prototype.
	
2005-06-23  Martin Hunt  <hunt@redhat.com>

	* transport.h: Move all the transport open stuff here
	and provide a convenient macro.

	* control.c: Replace macro DEFINE_SPINLOCK because
	some kernels don't have it.
	
2005-06-20  Tom Zanussi  <zanussi@us.ibm.com>

	* control.h: Added STP_TRANSPORT_MODE command.

	* transport.c: Lots of changes, most importantly
	added transport mode command, which also sends buffer
	sizes to daemon, added limit to number of attempts to
	sending STP_EXIT (in case there is no daemon), moved
	exit helper call.

	* transport.h: Added transport type enum and transport
	info struct for communication with userspace, changed and
	moved a couple functions to transport.c.

2005-05-17  Martin Hunt  <hunt@redhat.com>

	* transport.c (_stp_transport_close): Call stp_exit_helper()
	directly instead of using work queue.

2005-05-16  Martin Hunt  <hunt@redhat.com>

	* transport.c (_stp_cmd_handler): For STP_EXIT, schedule a 
	work queue to do the exit functions.
	(_stp_transport_close): Call work queue for STP_EXIT.
	(_stp_transport_send): Call _stp_ctrl_send() like before, except
	when in probe_exit().  In that case, keep retrying on send errors
	until we succeed. 

	* transport.h (_stp_transport_write): Change to call 
	_stp_transport_send() for NETLINK_ONLY.

	* Makefile (KDIR): set to /lib/modules/... instead of
	/usr/local/src/...

	

