提交 74e2f334 编写于 作者: T Török Edwin 提交者: Ingo Molnar

vfs, seqfile: make mangle_path() global

Impact: expose new VFS API

make mangle_path() available, as per the suggestions of Christoph Hellwig
and Al Viro:

  http://lkml.org/lkml/2008/11/4/338Signed-off-by: NTörök Edwin <edwintorok@gmail.com>
Signed-off-by: NIngo Molnar <mingo@elte.hu>
上级 02b67518
...@@ -357,7 +357,18 @@ int seq_printf(struct seq_file *m, const char *f, ...) ...@@ -357,7 +357,18 @@ int seq_printf(struct seq_file *m, const char *f, ...)
} }
EXPORT_SYMBOL(seq_printf); EXPORT_SYMBOL(seq_printf);
static char *mangle_path(char *s, char *p, char *esc) /**
* mangle_path - mangle and copy path to buffer beginning
* @s - buffer start
* @p - beginning of path in above buffer
* @esc - set of characters that need escaping
*
* Copy the path from @p to @s, replacing each occurrence of character from
* @esc with usual octal escape.
* Returns pointer past last written character in @s, or NULL in case of
* failure.
*/
char *mangle_path(char *s, char *p, char *esc)
{ {
while (s <= p) { while (s <= p) {
char c = *p++; char c = *p++;
...@@ -376,6 +387,7 @@ static char *mangle_path(char *s, char *p, char *esc) ...@@ -376,6 +387,7 @@ static char *mangle_path(char *s, char *p, char *esc)
} }
return NULL; return NULL;
} }
EXPORT_SYMBOL_GPL(mangle_path);
/* /*
* return the absolute path of 'dentry' residing in mount 'mnt'. * return the absolute path of 'dentry' residing in mount 'mnt'.
......
...@@ -34,6 +34,7 @@ struct seq_operations { ...@@ -34,6 +34,7 @@ struct seq_operations {
#define SEQ_SKIP 1 #define SEQ_SKIP 1
char *mangle_path(char *s, char *p, char *esc);
int seq_open(struct file *, const struct seq_operations *); int seq_open(struct file *, const struct seq_operations *);
ssize_t seq_read(struct file *, char __user *, size_t, loff_t *); ssize_t seq_read(struct file *, char __user *, size_t, loff_t *);
loff_t seq_lseek(struct file *, loff_t, int); loff_t seq_lseek(struct file *, loff_t, int);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册