Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef __SHMEM_FS_H |
| 2 | #define __SHMEM_FS_H |
| 3 | |
| 4 | #include <linux/swap.h> |
| 5 | #include <linux/mempolicy.h> |
| 6 | |
| 7 | /* inode in-kernel data */ |
| 8 | |
| 9 | #define SHMEM_NR_DIRECT 16 |
| 10 | |
| 11 | struct shmem_inode_info { |
| 12 | spinlock_t lock; |
| 13 | unsigned long flags; |
| 14 | unsigned long alloced; /* data pages alloced to file */ |
| 15 | unsigned long swapped; /* subtotal assigned to swap */ |
| 16 | unsigned long next_index; /* highest alloced index + 1 */ |
| 17 | struct shared_policy policy; /* NUMA memory alloc policy */ |
| 18 | struct page *i_indirect; /* top indirect blocks page */ |
| 19 | swp_entry_t i_direct[SHMEM_NR_DIRECT]; /* first blocks */ |
| 20 | struct list_head swaplist; /* chain of maybes on swap */ |
| 21 | struct inode vfs_inode; |
Andreas Gruenbacher | 39f0247 | 2006-09-29 02:01:35 -0700 | [diff] [blame] | 22 | #ifdef CONFIG_TMPFS_POSIX_ACL |
| 23 | struct posix_acl *i_acl; |
| 24 | struct posix_acl *i_default_acl; |
| 25 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | }; |
| 27 | |
| 28 | struct shmem_sb_info { |
| 29 | unsigned long max_blocks; /* How many blocks are allowed */ |
| 30 | unsigned long free_blocks; /* How many are left for allocation */ |
| 31 | unsigned long max_inodes; /* How many inodes are allowed */ |
| 32 | unsigned long free_inodes; /* How many are left for allocation */ |
Robin Holt | 7339ff8 | 2006-01-14 13:20:48 -0800 | [diff] [blame] | 33 | int policy; /* Default NUMA memory alloc policy */ |
| 34 | nodemask_t policy_nodes; /* nodemask for preferred and bind */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 35 | spinlock_t stat_lock; |
| 36 | }; |
| 37 | |
| 38 | static inline struct shmem_inode_info *SHMEM_I(struct inode *inode) |
| 39 | { |
| 40 | return container_of(inode, struct shmem_inode_info, vfs_inode); |
| 41 | } |
| 42 | |
Andreas Gruenbacher | 39f0247 | 2006-09-29 02:01:35 -0700 | [diff] [blame] | 43 | #ifdef CONFIG_TMPFS_POSIX_ACL |
| 44 | int shmem_permission(struct inode *, int, struct nameidata *); |
| 45 | int shmem_acl_init(struct inode *, struct inode *); |
| 46 | void shmem_acl_destroy_inode(struct inode *); |
| 47 | |
| 48 | extern struct xattr_handler shmem_xattr_acl_access_handler; |
| 49 | extern struct xattr_handler shmem_xattr_acl_default_handler; |
| 50 | |
| 51 | extern struct generic_acl_operations shmem_acl_ops; |
| 52 | |
| 53 | #else |
| 54 | static inline int shmem_acl_init(struct inode *inode, struct inode *dir) |
| 55 | { |
| 56 | return 0; |
| 57 | } |
| 58 | static inline void shmem_acl_destroy_inode(struct inode *inode) |
| 59 | { |
| 60 | } |
| 61 | #endif /* CONFIG_TMPFS_POSIX_ACL */ |
| 62 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 63 | #endif |