shmem_fs.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. #ifdef CONFIG_TMPFS_POSIX_ACL
  19. struct posix_acl *i_acl;
  20. struct posix_acl *i_default_acl;
  21. #endif
  22. };
  23. struct shmem_sb_info {
  24. unsigned long max_blocks; /* How many blocks are allowed */
  25. unsigned long free_blocks; /* How many are left for allocation */
  26. unsigned long max_inodes; /* How many inodes are allowed */
  27. unsigned long free_inodes; /* How many are left for allocation */
  28. spinlock_t stat_lock; /* Serialize shmem_sb_info changes */
  29. uid_t uid; /* Mount uid for root directory */
  30. gid_t gid; /* Mount gid for root directory */
  31. mode_t mode; /* Mount mode for root directory */
  32. unsigned short policy; /* Default NUMA memory alloc policy */
  33. unsigned short flags; /* Optional mempolicy flags */
  34. nodemask_t policy_nodes; /* nodemask for preferred and bind */
  35. };
  36. static inline struct shmem_inode_info *SHMEM_I(struct inode *inode)
  37. {
  38. return container_of(inode, struct shmem_inode_info, vfs_inode);
  39. }
  40. #ifdef CONFIG_TMPFS_POSIX_ACL
  41. int shmem_permission(struct inode *, int, struct nameidata *);
  42. int shmem_acl_init(struct inode *, struct inode *);
  43. void shmem_acl_destroy_inode(struct inode *);
  44. extern struct xattr_handler shmem_xattr_acl_access_handler;
  45. extern struct xattr_handler shmem_xattr_acl_default_handler;
  46. extern struct generic_acl_operations shmem_acl_ops;
  47. #else
  48. static inline int shmem_acl_init(struct inode *inode, struct inode *dir)
  49. {
  50. return 0;
  51. }
  52. static inline void shmem_acl_destroy_inode(struct inode *inode)
  53. {
  54. }
  55. #endif /* CONFIG_TMPFS_POSIX_ACL */
  56. #endif