aboutsummaryrefslogtreecommitdiffstats
path: root/include/litmus
diff options
context:
space:
mode:
authorBjoern B. Brandenburg <bbb@cs.unc.edu>2011-01-26 20:36:49 -0500
committerBjoern B. Brandenburg <bbb@cs.unc.edu>2011-01-30 14:31:56 -0500
commit3d8eb93db513bd9caa982f27fee8156405fac754 (patch)
treeca0c9b8b343049956c91104544c6828b877c65b8 /include/litmus
parent7dbc4a842d3bcfa755ba82cae46171d0098d4c2c (diff)
Litmus core: add copy_and_chomp() helper
We read in a line from userspace and remove the trailing newline in a number of places. This function extracts the common code to avoid future duplication.
Diffstat (limited to 'include/litmus')
-rw-r--r--include/litmus/litmus_proc.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/litmus/litmus_proc.h b/include/litmus/litmus_proc.h
index fbc0082b2d21..6800e725d48c 100644
--- a/include/litmus/litmus_proc.h
+++ b/include/litmus/litmus_proc.h
@@ -17,3 +17,9 @@ long make_plugin_proc_dir(struct sched_plugin* plugin,
17 */ 17 */
18void remove_plugin_proc_dir(struct sched_plugin* plugin); 18void remove_plugin_proc_dir(struct sched_plugin* plugin);
19 19
20
21/* Copy at most size-1 bytes from ubuf into kbuf, null-terminate buf, and
22 * remove a '\n' if present. Returns the number of bytes that were read or
23 * -EFAULT. */
24int copy_and_chomp(char *kbuf, unsigned long ksize,
25 __user const char* ubuf, unsigned long ulength);