ovl_entry.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. *
  3. * Copyright (C) 2011 Novell Inc.
  4. * Copyright (C) 2016 Red Hat, Inc.
  5. *
  6. * This program is free software; you can redistribute it and/or modify it
  7. * under the terms of the GNU General Public License version 2 as published by
  8. * the Free Software Foundation.
  9. */
  10. struct ovl_config {
  11. char *lowerdir;
  12. char *upperdir;
  13. char *workdir;
  14. bool default_permissions;
  15. bool redirect_dir;
  16. bool index;
  17. };
  18. /* private information held for overlayfs's superblock */
  19. struct ovl_fs {
  20. struct vfsmount *upper_mnt;
  21. unsigned numlower;
  22. struct vfsmount **lower_mnt;
  23. /* workbasedir is the path at workdir= mount option */
  24. struct dentry *workbasedir;
  25. /* workdir is the 'work' directory under workbasedir */
  26. struct dentry *workdir;
  27. /* index directory listing overlay inodes by origin file handle */
  28. struct dentry *indexdir;
  29. long namelen;
  30. /* pathnames of lower and upper dirs, for show_options */
  31. struct ovl_config config;
  32. /* creds of process who forced instantiation of super block */
  33. const struct cred *creator_cred;
  34. bool tmpfile;
  35. bool noxattr;
  36. /* sb common to all layers */
  37. struct super_block *same_sb;
  38. };
  39. /* private information held for every overlayfs dentry */
  40. struct ovl_entry {
  41. union {
  42. struct {
  43. unsigned long has_upper;
  44. bool opaque;
  45. };
  46. struct rcu_head rcu;
  47. };
  48. unsigned numlower;
  49. struct path lowerstack[];
  50. };
  51. struct ovl_entry *ovl_alloc_entry(unsigned int numlower);
  52. struct ovl_inode {
  53. struct ovl_dir_cache *cache;
  54. const char *redirect;
  55. u64 version;
  56. unsigned long flags;
  57. struct inode vfs_inode;
  58. struct dentry *__upperdentry;
  59. struct inode *lower;
  60. /* synchronize copy up and more */
  61. struct mutex lock;
  62. };
  63. static inline struct ovl_inode *OVL_I(struct inode *inode)
  64. {
  65. return container_of(inode, struct ovl_inode, vfs_inode);
  66. }
  67. static inline struct dentry *ovl_upperdentry_dereference(struct ovl_inode *oi)
  68. {
  69. return lockless_dereference(oi->__upperdentry);
  70. }