at master 979 B view raw
1/* SPDX-License-Identifier: GPL-2.0 */ 2#ifndef __LINUX_MEMFD_H 3#define __LINUX_MEMFD_H 4 5#include <linux/file.h> 6 7#define MEMFD_ANON_NAME "[memfd]" 8 9#ifdef CONFIG_MEMFD_CREATE 10extern long memfd_fcntl(struct file *file, unsigned int cmd, unsigned int arg); 11struct folio *memfd_alloc_folio(struct file *memfd, pgoff_t idx); 12/* 13 * Check for any existing seals on mmap, return an error if access is denied due 14 * to sealing, or 0 otherwise. 15 * 16 * We also update VMA flags if appropriate by manipulating the VMA flags pointed 17 * to by vm_flags_ptr. 18 */ 19int memfd_check_seals_mmap(struct file *file, vm_flags_t *vm_flags_ptr); 20#else 21static inline long memfd_fcntl(struct file *f, unsigned int c, unsigned int a) 22{ 23 return -EINVAL; 24} 25static inline struct folio *memfd_alloc_folio(struct file *memfd, pgoff_t idx) 26{ 27 return ERR_PTR(-EINVAL); 28} 29static inline int memfd_check_seals_mmap(struct file *file, 30 vm_flags_t *vm_flags_ptr) 31{ 32 return 0; 33} 34#endif 35 36#endif /* __LINUX_MEMFD_H */