XenevaOS
Loading...
Searching...
No Matches
mount.h
Go to the documentation of this file.
1/*
2 * DCL mount.h -- the pseudo-mount surface drm_drv.c uses for its internal
3 * inode pool (drm_fs_inode_new/free), plus the unmap helper.
4 *
5 * simple_pin_fs() serves one shared fake vfsmount (there is only the one
6 * drm pseudo-fs on Xeneva); alloc_anon_inode()/iput() are provided by
7 * linux/pseudo_fs.h's side of the split, and the unmap helper below is the
8 * one that must not type-check its operand.
9 */
10#ifndef _LINUX_MOUNT_H
11#define _LINUX_MOUNT_H
12
13#include <linux/fs.h>
14
15/*
16 * Two mainline headers, neither of which mainline's own mount.h carries. They
17 * come in here because this file is where drm_drv.c already reaches the
18 * mainline fs.h surface that DCL's pinned <linux/fs.h> cannot hold --
19 * simple_pin_fs(), simple_release_fs() and unmap_mapping_range() below are all
20 * mainline fs.h functions, and the pinned fs.h is an ABI blob of struct
21 * layouts with no room to declare them.
22 *
23 * drm_drv.c names this header directly (drm_drv.c:36) and that is the only
24 * route into it in the whole drm set: drm_device.h includes it too, but
25 * behind `#ifdef CONFIG_TRANSPARENT_HUGEPAGE` (drm_device.h:5), which is off.
26 * So a symbol put here is visible to drm_drv.c and to nobody else, which is
27 * why the two below are here and O_CLOEXEC is not.
28 *
29 * <linux/kernel.h> comes first and is not a mainline mount.h include either --
30 * it is here for what this file now defines. noop_llseek() returns loff_t and
31 * kdev_t.h's helpers take dev_t, and both types live in kernel.h; fs.h carries
32 * neither (it defines the file and inode *layouts* and nothing else), so
33 * without this include the header depends on its includer having pulled
34 * kernel.h already, which is true of mm.h and untrue of drm_drv.c.
35 *
36 * <linux/kdev_t.h> MINORBITS, for DRM_EXTENDED_MINOR_LIMIT (drm_drv.c:141).
37 * mainline reaches it because fs.h includes kdev_t.h; the
38 * pinned fs.h defines MKDEV/MAJOR/MINOR with the bit count
39 * spelled inline and never names the macro.
40 * <linux/sizes.h> SZ_8, for the bits-to-bytes pitch rounding in
41 * drm_dumb_buffers.c:180.
42 *
43 * noop_llseek() comes from further down this file rather than <linux/mm.h>,
44 * where it used to be: mm.h includes mount.h (for the VFS block below), so
45 * including mm.h back would be a cycle.
46 */
47#include <linux/kernel.h>
48#include <linux/kdev_t.h>
49#include <linux/sizes.h>
50
51struct file_system_type;
52
53struct vfsmount {
54 struct super_block *mnt_sb;
55};
56
57int simple_pin_fs(struct file_system_type *type, struct vfsmount **mnt, int *count);
58void simple_release_fs(struct vfsmount **mnt, int *count);
59
60/* ── VFS helpers mainline pulls through its own fs.h ───────────────────── */
61
62/*
63 * These five lived in <linux/mm.h>, which is where drivers/char ports reach
64 * them, and moved here for the reason the three includes above give: mainline
65 * has them in fs.h, DCL's fs.h is pinned and cannot, and mount.h is the file
66 * that has taken that surface over. mm.h includes this header, so a port that
67 * reaches them through mm.h as before is unaffected.
68 */
69#define file_inode(f) ((struct inode*)((f)->f_inode))
70#define iminor(inode) (MINOR((inode)->i_rdev))
71#define inode_lock(i) ((void)(i))
72#define inode_unlock(i) ((void)(i))
73
74/*
75 * noop_llseek() is mainline's "seeking does nothing and the position moves
76 * anyway", which is what a stream-like node wants. Returning @offset (rather
77 * than the current position) is what mainline's does for a regular file, and
78 * every caller here is a character device whose f_pos is never read back.
79 */
80static inline loff_t noop_llseek(struct file* f, loff_t offset, int whence) {
81 (void)f;
82 (void)whence;
83 return offset;
84}
85
86/*
87 * unmap_mapping_range() is a macro so drm_drv.c:500's whole call --
88 * holebegin and holelen included -- disappears: the mapping operand there
89 * is `dev->anon_inode->i_mapping`, a member the pinned <linux/fs.h> struct
90 * inode does not carry, so the expansion must not touch any of the four
91 * arguments. The anon inode has no mappings to unmap.
92 */
93#define unmap_mapping_range(mapping, holebegin, holelen, even_cows) \
94 do { } while (0)
95
96#define mntget(m) (m)
97#define mntput(m) do { (void)(m); } while (0)
98
99#endif /* _LINUX_MOUNT_H */
size_t size_t offset
Definition drm_bridge.h:1299
const char * f
Definition drm_print.h:205
uint64_t loff_t
Definition kernel.h:49
void simple_release_fs(struct vfsmount **mnt, int *count)
int simple_pin_fs(struct file_system_type *type, struct vfsmount **mnt, int *count)
Definition pseudo_fs.h:20
Definition fs.h:142
Definition mount.h:53
struct super_block * mnt_sb
Definition mount.h:54