diff options
author | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2011-01-26 20:36:49 -0500 |
---|---|---|
committer | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2011-01-30 14:31:56 -0500 |
commit | 3d8eb93db513bd9caa982f27fee8156405fac754 (patch) | |
tree | ca0c9b8b343049956c91104544c6828b877c65b8 /include | |
parent | 7dbc4a842d3bcfa755ba82cae46171d0098d4c2c (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')
-rw-r--r-- | include/litmus/litmus_proc.h | 6 |
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 | */ |
18 | void remove_plugin_proc_dir(struct sched_plugin* plugin); | 18 | void 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. */ | ||
24 | int copy_and_chomp(char *kbuf, unsigned long ksize, | ||
25 | __user const char* ubuf, unsigned long ulength); | ||