Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | #ifndef _LINUX_SHM_H_ |
| 3 | #define _LINUX_SHM_H_ |
| 4 | |
Jack Miller | ab602f7 | 2014-08-08 14:23:19 -0700 | [diff] [blame] | 5 | #include <linux/list.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6 | #include <asm/page.h> |
David Howells | 607ca46 | 2012-10-13 10:46:48 +0100 | [diff] [blame] | 7 | #include <uapi/linux/shm.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | #include <asm/shmparam.h> |
Manfred Spraul | 060028b | 2014-06-06 14:37:42 -0700 | [diff] [blame] | 9 | |
Stephen Rothwell | 8ecd295 | 2018-03-28 18:41:25 +1100 | [diff] [blame] | 10 | struct file; |
| 11 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 12 | #ifdef CONFIG_SYSVIPC |
Jack Miller | ab602f7 | 2014-08-08 14:23:19 -0700 | [diff] [blame] | 13 | struct sysv_shm { |
| 14 | struct list_head shm_clist; |
| 15 | }; |
| 16 | |
Will Deacon | 079a96a | 2012-07-30 14:42:38 -0700 | [diff] [blame] | 17 | long do_shmat(int shmid, char __user *shmaddr, int shmflg, unsigned long *addr, |
| 18 | unsigned long shmlba); |
Yaowei Bai | 2954e440 | 2016-01-20 15:01:11 -0800 | [diff] [blame] | 19 | bool is_file_shm_hugepages(struct file *file); |
Jack Miller | ab602f7 | 2014-08-08 14:23:19 -0700 | [diff] [blame] | 20 | void exit_shm(struct task_struct *task); |
| 21 | #define shm_init_task(task) INIT_LIST_HEAD(&(task)->sysvshm.shm_clist) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 22 | #else |
Jack Miller | ab602f7 | 2014-08-08 14:23:19 -0700 | [diff] [blame] | 23 | struct sysv_shm { |
| 24 | /* empty */ |
| 25 | }; |
| 26 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 27 | static inline long do_shmat(int shmid, char __user *shmaddr, |
Will Deacon | 079a96a | 2012-07-30 14:42:38 -0700 | [diff] [blame] | 28 | int shmflg, unsigned long *addr, |
| 29 | unsigned long shmlba) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 30 | { |
| 31 | return -ENOSYS; |
| 32 | } |
Yaowei Bai | 2954e440 | 2016-01-20 15:01:11 -0800 | [diff] [blame] | 33 | static inline bool is_file_shm_hugepages(struct file *file) |
Adam Litke | 516dffd | 2007-03-01 15:46:08 -0800 | [diff] [blame] | 34 | { |
Yaowei Bai | 2954e440 | 2016-01-20 15:01:11 -0800 | [diff] [blame] | 35 | return false; |
Adam Litke | 516dffd | 2007-03-01 15:46:08 -0800 | [diff] [blame] | 36 | } |
Vasiliy Kulikov | b34a6b1 | 2011-07-26 16:08:48 -0700 | [diff] [blame] | 37 | static inline void exit_shm(struct task_struct *task) |
| 38 | { |
| 39 | } |
Jack Miller | ab602f7 | 2014-08-08 14:23:19 -0700 | [diff] [blame] | 40 | static inline void shm_init_task(struct task_struct *task) |
| 41 | { |
| 42 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | #endif |
| 44 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 45 | #endif /* _LINUX_SHM_H_ */ |