aboutsummaryrefslogtreecommitdiffstats
path: root/fs/namespace.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/namespace.c')
-rw-r--r--fs/namespace.c49
1 files changed, 44 insertions, 5 deletions
diff --git a/fs/namespace.c b/fs/namespace.c
index e9c10cd01e13..db51ddc9b671 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -320,6 +320,50 @@ void mnt_unpin(struct vfsmount *mnt)
320 320
321EXPORT_SYMBOL(mnt_unpin); 321EXPORT_SYMBOL(mnt_unpin);
322 322
323static inline void mangle(struct seq_file *m, const char *s)
324{
325 seq_escape(m, s, " \t\n\\");
326}
327
328/*
329 * Simple .show_options callback for filesystems which don't want to
330 * implement more complex mount option showing.
331 *
332 * See also save_mount_options().
333 */
334int generic_show_options(struct seq_file *m, struct vfsmount *mnt)
335{
336 const char *options = mnt->mnt_sb->s_options;
337
338 if (options != NULL && options[0]) {
339 seq_putc(m, ',');
340 mangle(m, options);
341 }
342
343 return 0;
344}
345EXPORT_SYMBOL(generic_show_options);
346
347/*
348 * If filesystem uses generic_show_options(), this function should be
349 * called from the fill_super() callback.
350 *
351 * The .remount_fs callback usually needs to be handled in a special
352 * way, to make sure, that previous options are not overwritten if the
353 * remount fails.
354 *
355 * Also note, that if the filesystem's .remount_fs function doesn't
356 * reset all options to their default value, but changes only newly
357 * given options, then the displayed options will not reflect reality
358 * any more.
359 */
360void save_mount_options(struct super_block *sb, char *options)
361{
362 kfree(sb->s_options);
363 sb->s_options = kstrdup(options, GFP_KERNEL);
364}
365EXPORT_SYMBOL(save_mount_options);
366
323/* iterator */ 367/* iterator */
324static void *m_start(struct seq_file *m, loff_t *pos) 368static void *m_start(struct seq_file *m, loff_t *pos)
325{ 369{
@@ -341,11 +385,6 @@ static void m_stop(struct seq_file *m, void *v)
341 up_read(&namespace_sem); 385 up_read(&namespace_sem);
342} 386}
343 387
344static inline void mangle(struct seq_file *m, const char *s)
345{
346 seq_escape(m, s, " \t\n\\");
347}
348
349static int show_vfsmnt(struct seq_file *m, void *v) 388static int show_vfsmnt(struct seq_file *m, void *v)
350{ 389{
351 struct vfsmount *mnt = list_entry(v, struct vfsmount, mnt_list); 390 struct vfsmount *mnt = list_entry(v, struct vfsmount, mnt_list);