1 /* SPDX-License-Identifier: MIT */
2 /*
3  * Copyright © 2020 Intel Corporation
4  */
5 
6 #ifndef SHMEM_UTILS_H
7 #define SHMEM_UTILS_H
8 
9 #include <linux/types.h>
10 
11 struct iosys_map;
12 struct drm_i915_gem_object;
13 struct file;
14 
15 struct file *shmem_create_from_data(const char *name, void *data, size_t len);
16 struct file *shmem_create_from_object(struct drm_i915_gem_object *obj);
17 
18 void *shmem_pin_map(struct file *file);
19 void shmem_unpin_map(struct file *file, void *ptr);
20 
21 int shmem_read_to_iosys_map(struct file *file, loff_t off,
22 			    struct iosys_map *map, size_t map_off, size_t len);
23 int shmem_read(struct file *file, loff_t off, void *dst, size_t len);
24 int shmem_write(struct file *file, loff_t off, void *src, size_t len);
25 
26 #endif /* SHMEM_UTILS_H */
27