This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: [PATCH 1/2] Trace code and documentation
- From: David Wilder <dwilder at us dot ibm dot com>
- To: Andrew Morton <akpm at linux-foundation dot org>
- Cc: linux-kernel at vger dot kernel dot org, SystemTAP <systemtap at sources dot redhat dot com>
- Date: Fri, 14 Sep 2007 21:47:32 -0700
- Subject: Re: [PATCH 1/2] Trace code and documentation
- References: <46E9CB14.7060000@us.ibm.com> <20070914180840.579627ab.akpm@linux-foundation.org>
Andrew Morton wrote:
+/*
+ * Based on blktrace code, Copyright (C) 2006 Jens Axboe <axboe@suse.de>
So can we migrate blktrace to using this?
Yes, a blktrace patch is comming.
+ int ret;
+
+ if (trace->flags & TRACE_DISABLE_STATE)
+ return -EINVAL;
+
+ if (count > sizeof(buf) - 1)
+ return -EINVAL;
+
+ if (copy_from_user(buf, buffer, count))
+ return -EFAULT;
+
+ buf[count] = '\0';
+
+ if (strncmp(buf, "start", strlen("start")) == 0 ) {
+ ret = trace_start(trace);
+ if (ret)
+ return ret;
+ } else if (strncmp(buffer, "stop", strlen("stop")) == 0)
+ trace_stop(trace);
+ else
+ return -EINVAL;
What's the above code doing? Trying to cope with trailing chars after
"start" or "stop"? Is that actually needed? It's the \n, I assume?
Yes, the typical usage is "echo start > state" and echo adds a \n.
Thanks for the comments, I will make the changes and resubmit.