XenevaOS
Loading...
Searching...
No Matches
shmem_fs.h
Go to the documentation of this file.
1#ifndef __LINUX_SHMEM_FS_H__
2#define __LINUX_SHMEM_FS_H__
3
4#include <linux/kernel.h> /* gfp_t, pgoff_t, loff_t */
5#include <linux/mm.h> /* vma_flags_t -- shmem_file_setup()'s flag word */
6
7/*
8 * DCL <linux/shmem_fs.h> -- the two shmem entry points mem.c's /dev/zero mmap
9 * arms call. Xeneva has no tmpfs-backed shmem object yet and devfs does not
10 * route ->mmap, so the shims answer "unsupported"; they are declared here so
11 * the vendored source compiles unchanged. Bodies: DCL/linux_mm_shim.c.
12 */
13
14#include <linux/mm.h> /* struct vm_area_desc */
15
17
18/*
19 * struct address_space -- mainline keeps this in <linux/fs.h>, which this
20 * tree must not edit. What the drm core does to a mapping is read or set
21 * its gfp mask and flip the unevictable bit (drm_gem.c:691-716,
22 * drm_gem_shmem_helper.c:88), so those fields and the helpers over them are
23 * the whole of it; the shmem stubs ignore both.
24 */
26 unsigned long flags;
28};
29
30static inline void mapping_set_unevictable(struct address_space *mapping)
31{
32 mapping->flags |= 1UL;
33}
34
35static inline void mapping_clear_unevictable(struct address_space *mapping)
36{
37 mapping->flags &= ~1UL;
38}
39
40static inline gfp_t mapping_gfp_mask(const struct address_space *mapping)
41{
42 return mapping->gfp_mask;
43}
44
45static inline void mapping_set_gfp_mask(struct address_space *mapping,
46 gfp_t mask)
47{
48 mapping->gfp_mask = mask;
49}
50
51static inline gfp_t mapping_gfp_constraint(const struct address_space *mapping,
52 gfp_t constraint)
53{
54 return mapping->gfp_mask & constraint;
55}
56
57struct vfsmount;
58struct folio;
59struct page;
60
61/*
62 * The shmem entry points drm_gem.c and drm_gem_shmem_helper.c call. They
63 * are declared so the vendored source compiles unchanged; the bodies
64 * (DCL/drm_stubs.c) answer ERR_PTR(-ENOSYS), which drm_gem_object_init()
65 * and the read paths both turn into a checked failure. Stage 2 replaces
66 * them with a real shmem-backed GEM allocator.
67 */
68struct file *shmem_file_setup(const char *name, loff_t size,
69 vma_flags_t vm_flags);
70struct file *shmem_file_setup_with_mnt(struct vfsmount *mnt, const char *name,
71 loff_t size, vma_flags_t vm_flags);
73 gfp_t gfp);
75 pgoff_t index, gfp_t gfp);
76
77unsigned long shmem_get_unmapped_area(struct file* file, unsigned long addr,
78 unsigned long len, unsigned long pgoff,
79 unsigned long flags);
80
81#endif /* __LINUX_SHMEM_FS_H__ */
uint8_t flags
Definition virtio.h:0
#define index(str, chr)
Definition string.h:66
size_t size
Definition drm_bridge.h:1299
struct drm_crtc struct drm_plane struct drm_plane const struct drm_crtc_funcs const char * name
Definition drm_crtc.h:1242
size_t len
Definition initial.c:23
uint64_t loff_t
Definition kernel.h:49
unsigned long pgoff_t
Definition kernel.h:74
unsigned int gfp_t
Definition kernel.h:56
t t typedef unsigned long vma_flags_t
Definition mm.h:38
unsigned long shmem_get_unmapped_area(struct file *file, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags)
struct folio * shmem_read_folio_gfp(struct address_space *mapping, pgoff_t index, gfp_t gfp)
struct file * shmem_file_setup(const char *name, loff_t size, vma_flags_t vm_flags)
int shmem_zero_setup_desc(struct vm_area_desc *desc)
struct page * shmem_read_mapping_page_gfp(struct address_space *mapping, pgoff_t index, gfp_t gfp)
struct file * shmem_file_setup_with_mnt(struct vfsmount *mnt, const char *name, loff_t size, vma_flags_t vm_flags)
Definition shmem_fs.h:25
unsigned long flags
Definition shmem_fs.h:26
gfp_t gfp_mask
Definition shmem_fs.h:27
Definition fs.h:142
Definition mm_types.h:16
Definition pagemap.h:38
Definition mount.h:53
Definition mm.h:353