Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
[sfrench/cifs-2.6.git] / include / linux / shm.h
1 #ifndef _LINUX_SHM_H_
2 #define _LINUX_SHM_H_
3
4 #include <linux/list.h>
5 #include <asm/page.h>
6 #include <uapi/linux/shm.h>
7 #include <asm/shmparam.h>
8
9 struct shmid_kernel /* private to the kernel */
10 {       
11         struct kern_ipc_perm    shm_perm;
12         struct file             *shm_file;
13         unsigned long           shm_nattch;
14         unsigned long           shm_segsz;
15         time_t                  shm_atim;
16         time_t                  shm_dtim;
17         time_t                  shm_ctim;
18         pid_t                   shm_cprid;
19         pid_t                   shm_lprid;
20         struct user_struct      *mlock_user;
21
22         /* The task created the shm object.  NULL if the task is dead. */
23         struct task_struct      *shm_creator;
24         struct list_head        shm_clist;      /* list by creator */
25 } __randomize_layout;
26
27 /* shm_mode upper byte flags */
28 #define SHM_DEST        01000   /* segment will be destroyed on last detach */
29 #define SHM_LOCKED      02000   /* segment will not be swapped */
30
31 #ifdef CONFIG_SYSVIPC
32 struct sysv_shm {
33         struct list_head shm_clist;
34 };
35
36 long do_shmat(int shmid, char __user *shmaddr, int shmflg, unsigned long *addr,
37               unsigned long shmlba);
38 bool is_file_shm_hugepages(struct file *file);
39 void exit_shm(struct task_struct *task);
40 #define shm_init_task(task) INIT_LIST_HEAD(&(task)->sysvshm.shm_clist)
41 #else
42 struct sysv_shm {
43         /* empty */
44 };
45
46 static inline long do_shmat(int shmid, char __user *shmaddr,
47                             int shmflg, unsigned long *addr,
48                             unsigned long shmlba)
49 {
50         return -ENOSYS;
51 }
52 static inline bool is_file_shm_hugepages(struct file *file)
53 {
54         return false;
55 }
56 static inline void exit_shm(struct task_struct *task)
57 {
58 }
59 static inline void shm_init_task(struct task_struct *task)
60 {
61 }
62 #endif
63
64 #endif /* _LINUX_SHM_H_ */