210-mini_fo_2.6.25_fixes.patch 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. --- a/fs/mini_fo/main.c
  2. +++ b/fs/mini_fo/main.c
  3. @@ -79,6 +79,7 @@ mini_fo_tri_interpose(dentry_t *hidden_d
  4. * of the new inode's fields
  5. */
  6. +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25)
  7. /*
  8. * original: inode = iget(sb, hidden_inode->i_ino);
  9. */
  10. @@ -87,6 +88,13 @@ mini_fo_tri_interpose(dentry_t *hidden_d
  11. err = -EACCES; /* should be impossible??? */
  12. goto out;
  13. }
  14. +#else
  15. + inode = mini_fo_iget(sb, iunique(sb, 25));
  16. + if (IS_ERR(inode)) {
  17. + err = PTR_ERR(inode);
  18. + goto out;
  19. + }
  20. +#endif
  21. /*
  22. * interpose the inode if not already interposed
  23. @@ -184,9 +192,9 @@ mini_fo_parse_options(super_block_t *sb,
  24. hidden_root = ERR_PTR(err);
  25. goto out;
  26. }
  27. - hidden_root = nd.dentry;
  28. - stopd(sb)->base_dir_dentry = nd.dentry;
  29. - stopd(sb)->hidden_mnt = nd.mnt;
  30. + hidden_root = nd_get_dentry(&nd);
  31. + stopd(sb)->base_dir_dentry = nd_get_dentry(&nd);
  32. + stopd(sb)->hidden_mnt = nd_get_mnt(&nd);
  33. } else if(!strncmp("sto=", options, 4)) {
  34. /* parse the storage dir */
  35. @@ -204,9 +212,9 @@ mini_fo_parse_options(super_block_t *sb,
  36. hidden_root2 = ERR_PTR(err);
  37. goto out;
  38. }
  39. - hidden_root2 = nd2.dentry;
  40. - stopd(sb)->storage_dir_dentry = nd2.dentry;
  41. - stopd(sb)->hidden_mnt2 = nd2.mnt;
  42. + hidden_root2 = nd_get_dentry(&nd2);
  43. + stopd(sb)->storage_dir_dentry = nd_get_dentry(&nd2);
  44. + stopd(sb)->hidden_mnt2 = nd_get_mnt(&nd2);
  45. stohs2(sb) = hidden_root2->d_sb;
  46. /* validate storage dir, this is done in
  47. --- a/fs/mini_fo/mini_fo.h
  48. +++ b/fs/mini_fo/mini_fo.h
  49. @@ -302,6 +302,10 @@ extern int mini_fo_tri_interpose(dentry_
  50. extern int mini_fo_cp_cont(dentry_t *tgt_dentry, struct vfsmount *tgt_mnt,
  51. dentry_t *src_dentry, struct vfsmount *src_mnt);
  52. +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25)
  53. +extern struct inode *mini_fo_iget(struct super_block *sb, unsigned long ino);
  54. +#endif
  55. +
  56. #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
  57. extern int mini_fo_create(inode_t *dir, dentry_t *dentry, int mode, struct nameidata *nd);
  58. @@ -501,6 +505,29 @@ static inline void double_unlock(struct
  59. #endif /* if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) */
  60. #endif /* __KERNEL__ */
  61. +
  62. +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25)
  63. +static inline dentry_t *nd_get_dentry(struct nameidata *nd)
  64. +{
  65. + return (nd->path.dentry);
  66. +}
  67. +
  68. +static inline struct vfsmount *nd_get_mnt(struct nameidata *nd)
  69. +{
  70. + return (nd->path.mnt);
  71. +}
  72. +#else
  73. +static inline dentry_t *nd_get_dentry(struct nameidata *nd)
  74. +{
  75. + return (nd->dentry);
  76. +}
  77. +
  78. +static inline struct vfsmount *nd_get_mnt(struct nameidata *nd)
  79. +{
  80. + return (nd->mnt);
  81. +}
  82. +#endif
  83. +
  84. /*
  85. * Definitions for user and kernel code
  86. */
  87. --- a/fs/mini_fo/super.c
  88. +++ b/fs/mini_fo/super.c
  89. @@ -266,10 +266,31 @@ mini_fo_umount_begin(super_block_t *sb)
  90. }
  91. #endif
  92. +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25)
  93. +struct inode *
  94. +mini_fo_iget(struct super_block *sb, unsigned long ino)
  95. +{
  96. + struct inode *inode;
  97. +
  98. + inode = iget_locked(sb, ino);
  99. + if (!inode)
  100. + return ERR_PTR(-ENOMEM);
  101. +
  102. + if (!(inode->i_state & I_NEW))
  103. + return inode;
  104. +
  105. + mini_fo_read_inode(inode);
  106. +
  107. + unlock_new_inode(inode);
  108. + return inode;
  109. +}
  110. +#endif /* if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25) */
  111. struct super_operations mini_fo_sops =
  112. {
  113. +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25)
  114. read_inode: mini_fo_read_inode,
  115. +#endif
  116. #if defined(FIST_DEBUG) || defined(FIST_FILTER_SCA)
  117. write_inode: mini_fo_write_inode,
  118. #endif /* defined(FIST_DEBUG) || defined(FIST_FILTER_SCA) */
  119. --- a/fs/mini_fo/aux.c
  120. +++ b/fs/mini_fo/aux.c
  121. @@ -164,11 +164,11 @@ dentry_t *bpath_walk(super_block_t *sb,
  122. err = vfs_path_lookup(mnt->mnt_root, mnt, bpath+1, 0, &nd);
  123. /* validate */
  124. - if (err || !nd.dentry || !nd.dentry->d_inode) {
  125. + if (err || !nd_get_dentry(&nd) || !nd_get_dentry(&nd)->d_inode) {
  126. printk(KERN_CRIT "mini_fo: bpath_walk: path_walk failed.\n");
  127. return NULL;
  128. }
  129. - return nd.dentry;
  130. + return nd_get_dentry(&nd);
  131. }