fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / include / linux / shmem_fs.h
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 #define TMPFS_SUPER_MAGIC       0x01021994
12
13
14 struct shmem_inode_info {
15         spinlock_t              lock;
16         unsigned long           flags;
17         unsigned long           alloced;        /* data pages alloced to file */
18         unsigned long           swapped;        /* subtotal assigned to swap */
19         unsigned long           next_index;     /* highest alloced index + 1 */
20         struct shared_policy    policy;         /* NUMA memory alloc policy */
21         struct page             *i_indirect;    /* top indirect blocks page */
22         swp_entry_t             i_direct[SHMEM_NR_DIRECT]; /* first blocks */
23         struct list_head        swaplist;       /* chain of maybes on swap */
24         struct inode            vfs_inode;
25 #ifdef CONFIG_TMPFS_POSIX_ACL
26         struct posix_acl        *i_acl;
27         struct posix_acl        *i_default_acl;
28 #endif
29 };
30
31 struct shmem_sb_info {
32         unsigned long max_blocks;   /* How many blocks are allowed */
33         unsigned long free_blocks;  /* How many are left for allocation */
34         unsigned long max_inodes;   /* How many inodes are allowed */
35         unsigned long free_inodes;  /* How many are left for allocation */
36         int policy;                 /* Default NUMA memory alloc policy */
37         nodemask_t policy_nodes;    /* nodemask for preferred and bind */
38         spinlock_t    stat_lock;
39 };
40
41 static inline struct shmem_inode_info *SHMEM_I(struct inode *inode)
42 {
43         return container_of(inode, struct shmem_inode_info, vfs_inode);
44 }
45
46 #ifdef CONFIG_TMPFS_POSIX_ACL
47 int shmem_permission(struct inode *, int, struct nameidata *);
48 int shmem_acl_init(struct inode *, struct inode *);
49 void shmem_acl_destroy_inode(struct inode *);
50
51 extern struct xattr_handler shmem_xattr_acl_access_handler;
52 extern struct xattr_handler shmem_xattr_acl_default_handler;
53
54 extern struct generic_acl_operations shmem_acl_ops;
55
56 #else
57 static inline int shmem_acl_init(struct inode *inode, struct inode *dir)
58 {
59         return 0;
60 }
61 static inline void shmem_acl_destroy_inode(struct inode *inode)
62 {
63 }
64 #endif  /* CONFIG_TMPFS_POSIX_ACL */
65
66 #endif