xref: /freebsd/sys/compat/linuxkpi/common/include/linux/shmem_fs.h (revision 1bce29bcf121c1e16205fabb100f798d88f757c1)
11179b649SEmmanuel Vadot /*-
21179b649SEmmanuel Vadot  * Copyright (c) 2010 Isilon Systems, Inc.
31179b649SEmmanuel Vadot  * Copyright (c) 2010 iX Systems, Inc.
41179b649SEmmanuel Vadot  * Copyright (c) 2010 Panasas, Inc.
51179b649SEmmanuel Vadot  * Copyright (c) 2013-2018 Mellanox Technologies, Ltd.
61179b649SEmmanuel Vadot  * All rights reserved.
71179b649SEmmanuel Vadot  *
81179b649SEmmanuel Vadot  * Redistribution and use in source and binary forms, with or without
91179b649SEmmanuel Vadot  * modification, are permitted provided that the following conditions
101179b649SEmmanuel Vadot  * are met:
111179b649SEmmanuel Vadot  * 1. Redistributions of source code must retain the above copyright
121179b649SEmmanuel Vadot  *    notice unmodified, this list of conditions, and the following
131179b649SEmmanuel Vadot  *    disclaimer.
141179b649SEmmanuel Vadot  * 2. Redistributions in binary form must reproduce the above copyright
151179b649SEmmanuel Vadot  *    notice, this list of conditions and the following disclaimer in the
161179b649SEmmanuel Vadot  *    documentation and/or other materials provided with the distribution.
171179b649SEmmanuel Vadot  *
181179b649SEmmanuel Vadot  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
191179b649SEmmanuel Vadot  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
201179b649SEmmanuel Vadot  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
211179b649SEmmanuel Vadot  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
221179b649SEmmanuel Vadot  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
231179b649SEmmanuel Vadot  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
241179b649SEmmanuel Vadot  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
251179b649SEmmanuel Vadot  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
261179b649SEmmanuel Vadot  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
271179b649SEmmanuel Vadot  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
281179b649SEmmanuel Vadot  */
29307f78f3SVladimir Kondratyev #ifndef	_LINUXKPI_LINUX_SHMEM_FS_H_
30307f78f3SVladimir Kondratyev #define	_LINUXKPI_LINUX_SHMEM_FS_H_
311179b649SEmmanuel Vadot 
32*1bce29bcSVladimir Kondratyev #include <linux/file.h>
33*1bce29bcSVladimir Kondratyev #include <linux/mempolicy.h>
344e0d3f7bSJean-Sébastien Pédron #include <linux/pagemap.h>
35*1bce29bcSVladimir Kondratyev #include <linux/swap.h>
361179b649SEmmanuel Vadot 
374e0d3f7bSJean-Sébastien Pédron /* Shared memory support */
384e0d3f7bSJean-Sébastien Pédron struct page *linux_shmem_read_mapping_page_gfp(vm_object_t obj, int pindex,
394e0d3f7bSJean-Sébastien Pédron     gfp_t gfp);
404e0d3f7bSJean-Sébastien Pédron struct linux_file *linux_shmem_file_setup(const char *name, loff_t size,
414e0d3f7bSJean-Sébastien Pédron     unsigned long flags);
424e0d3f7bSJean-Sébastien Pédron void linux_shmem_truncate_range(vm_object_t obj, loff_t lstart,
434e0d3f7bSJean-Sébastien Pédron     loff_t lend);
441179b649SEmmanuel Vadot 
451179b649SEmmanuel Vadot #define	shmem_read_mapping_page(...) \
461179b649SEmmanuel Vadot   linux_shmem_read_mapping_page_gfp(__VA_ARGS__, 0)
471179b649SEmmanuel Vadot 
481179b649SEmmanuel Vadot #define	shmem_read_mapping_page_gfp(...) \
491179b649SEmmanuel Vadot   linux_shmem_read_mapping_page_gfp(__VA_ARGS__)
501179b649SEmmanuel Vadot 
511179b649SEmmanuel Vadot #define	shmem_file_setup(...) \
521179b649SEmmanuel Vadot   linux_shmem_file_setup(__VA_ARGS__)
531179b649SEmmanuel Vadot 
541179b649SEmmanuel Vadot #define	shmem_truncate_range(...) \
551179b649SEmmanuel Vadot   linux_shmem_truncate_range(__VA_ARGS__)
561179b649SEmmanuel Vadot 
57307f78f3SVladimir Kondratyev #endif /* _LINUXKPI_LINUX_SHMEM_FS_H_ */
58