shmem_fs.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #ifndef __SHMEM_FS_H
  2. #define __SHMEM_FS_H
  3. #include <linux/swap.h>
  4. #include <linux/mempolicy.h>
  5. /* inode in-kernel data */
  6. #define SHMEM_NR_DIRECT 16
  7. struct shmem_inode_info {
  8. spinlock_t lock;
  9. unsigned long flags;
  10. unsigned long alloced; /* data pages alloced to file */
  11. unsigned long swapped; /* subtotal assigned to swap */
  12. unsigned long next_index; /* highest alloced index + 1 */
  13. struct shared_policy policy; /* NUMA memory alloc policy */
  14. struct page *i_indirect; /* top indirect blocks page */
  15. swp_entry_t i_direct[SHMEM_NR_DIRECT]; /* first blocks */
  16. struct list_head swaplist; /* chain of maybes on swap */
  17. struct inode vfs_inode;
  18. };
  19. struct shmem_sb_info {
  20. unsigned long max_blocks; /* How many blocks are allowed */
  21. unsigned long free_blocks; /* How many are left for allocation */
  22. unsigned long max_inodes; /* How many inodes are allowed */
  23. unsigned long free_inodes; /* How many are left for allocation */
  24. spinlock_t stat_lock; /* Serialize shmem_sb_info changes */
  25. uid_t uid; /* Mount uid for root directory */
  26. gid_t gid; /* Mount gid for root directory */
  27. mode_t mode; /* Mount mode for root directory */
  28. struct mempolicy *mpol; /* default memory policy for mappings */
  29. };
  30. static inline struct shmem_inode_info *SHMEM_I(struct inode *inode)
  31. {
  32. return container_of(inode, struct shmem_inode_info, vfs_inode);
  33. }
  34. #ifdef CONFIG_TMPFS_POSIX_ACL
  35. int shmem_check_acl(struct inode *, int);
  36. int shmem_acl_init(struct inode *, struct inode *);
  37. extern struct xattr_handler shmem_xattr_acl_access_handler;
  38. extern struct xattr_handler shmem_xattr_acl_default_handler;
  39. extern struct generic_acl_operations shmem_acl_ops;
  40. #else
  41. static inline int shmem_acl_init(struct inode *inode, struct inode *dir)
  42. {
  43. return 0;
  44. }
  45. #endif /* CONFIG_TMPFS_POSIX_ACL */
  46. #endif