David Howells | 9bc61ab | 2018-11-04 03:19:03 -0500 | [diff] [blame] | 1 | /* Filesystem superblock creation and reconfiguration context. |
| 2 | * |
| 3 | * Copyright (C) 2018 Red Hat, Inc. All Rights Reserved. |
| 4 | * Written by David Howells (dhowells@redhat.com) |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU General Public Licence |
| 8 | * as published by the Free Software Foundation; either version |
| 9 | * 2 of the Licence, or (at your option) any later version. |
| 10 | */ |
| 11 | |
| 12 | #ifndef _LINUX_FS_CONTEXT_H |
| 13 | #define _LINUX_FS_CONTEXT_H |
| 14 | |
| 15 | #include <linux/kernel.h> |
| 16 | #include <linux/errno.h> |
| 17 | #include <linux/security.h> |
| 18 | |
| 19 | struct cred; |
| 20 | struct dentry; |
| 21 | struct file_operations; |
| 22 | struct file_system_type; |
| 23 | struct net; |
| 24 | struct user_namespace; |
| 25 | |
| 26 | enum fs_context_purpose { |
| 27 | FS_CONTEXT_FOR_MOUNT, /* New superblock for explicit mount */ |
David Howells | 8d0347f | 2018-11-04 09:28:36 -0500 | [diff] [blame^] | 28 | FS_CONTEXT_FOR_RECONFIGURE, /* Superblock reconfiguration (remount) */ |
David Howells | 9bc61ab | 2018-11-04 03:19:03 -0500 | [diff] [blame] | 29 | }; |
| 30 | |
| 31 | /* |
| 32 | * Filesystem context for holding the parameters used in the creation or |
| 33 | * reconfiguration of a superblock. |
| 34 | * |
| 35 | * Superblock creation fills in ->root whereas reconfiguration begins with this |
| 36 | * already set. |
| 37 | * |
| 38 | * See Documentation/filesystems/mounting.txt |
| 39 | */ |
| 40 | struct fs_context { |
| 41 | struct file_system_type *fs_type; |
| 42 | void *fs_private; /* The filesystem's context */ |
| 43 | struct dentry *root; /* The root and superblock */ |
| 44 | struct user_namespace *user_ns; /* The user namespace for this mount */ |
| 45 | struct net *net_ns; /* The network namespace for this mount */ |
| 46 | const struct cred *cred; /* The mounter's credentials */ |
| 47 | const char *source; /* The source name (eg. dev path) */ |
| 48 | const char *subtype; /* The subtype to set on the superblock */ |
| 49 | void *security; /* Linux S&M options */ |
| 50 | unsigned int sb_flags; /* Proposed superblock flags (SB_*) */ |
| 51 | unsigned int sb_flags_mask; /* Superblock flags that were changed */ |
| 52 | enum fs_context_purpose purpose:8; |
| 53 | bool need_free:1; /* Need to call ops->free() */ |
| 54 | }; |
| 55 | |
| 56 | /* |
| 57 | * fs_context manipulation functions. |
| 58 | */ |
| 59 | extern struct fs_context *fs_context_for_mount(struct file_system_type *fs_type, |
| 60 | unsigned int sb_flags); |
David Howells | 8d0347f | 2018-11-04 09:28:36 -0500 | [diff] [blame^] | 61 | extern struct fs_context *fs_context_for_reconfigure(struct dentry *dentry, |
| 62 | unsigned int sb_flags, |
| 63 | unsigned int sb_flags_mask); |
David Howells | 9bc61ab | 2018-11-04 03:19:03 -0500 | [diff] [blame] | 64 | |
| 65 | extern int vfs_get_tree(struct fs_context *fc); |
| 66 | extern void put_fs_context(struct fs_context *fc); |
| 67 | |
| 68 | #endif /* _LINUX_FS_CONTEXT_H */ |