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 */ |
| 28 | }; |
| 29 | |
| 30 | /* |
| 31 | * Filesystem context for holding the parameters used in the creation or |
| 32 | * reconfiguration of a superblock. |
| 33 | * |
| 34 | * Superblock creation fills in ->root whereas reconfiguration begins with this |
| 35 | * already set. |
| 36 | * |
| 37 | * See Documentation/filesystems/mounting.txt |
| 38 | */ |
| 39 | struct fs_context { |
| 40 | struct file_system_type *fs_type; |
| 41 | void *fs_private; /* The filesystem's context */ |
| 42 | struct dentry *root; /* The root and superblock */ |
| 43 | struct user_namespace *user_ns; /* The user namespace for this mount */ |
| 44 | struct net *net_ns; /* The network namespace for this mount */ |
| 45 | const struct cred *cred; /* The mounter's credentials */ |
| 46 | const char *source; /* The source name (eg. dev path) */ |
| 47 | const char *subtype; /* The subtype to set on the superblock */ |
| 48 | void *security; /* Linux S&M options */ |
| 49 | unsigned int sb_flags; /* Proposed superblock flags (SB_*) */ |
| 50 | unsigned int sb_flags_mask; /* Superblock flags that were changed */ |
| 51 | enum fs_context_purpose purpose:8; |
| 52 | bool need_free:1; /* Need to call ops->free() */ |
| 53 | }; |
| 54 | |
| 55 | /* |
| 56 | * fs_context manipulation functions. |
| 57 | */ |
| 58 | extern struct fs_context *fs_context_for_mount(struct file_system_type *fs_type, |
| 59 | unsigned int sb_flags); |
| 60 | |
| 61 | extern int vfs_get_tree(struct fs_context *fc); |
| 62 | extern void put_fs_context(struct fs_context *fc); |
| 63 | |
| 64 | #endif /* _LINUX_FS_CONTEXT_H */ |