sysdep.c 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * linux/fs/hfs/sysdep.c
  3. *
  4. * Copyright (C) 1996 Paul H. Hargrove
  5. * (C) 2003 Ardis Technologies <roman@ardistech.com>
  6. * This file may be distributed under the terms of the GNU General Public License.
  7. *
  8. * This file contains the code to do various system dependent things.
  9. */
  10. #include <linux/namei.h>
  11. #include "hfs_fs.h"
  12. /* dentry case-handling: just lowercase everything */
  13. static int hfs_revalidate_dentry(struct dentry *dentry, unsigned int flags)
  14. {
  15. struct inode *inode;
  16. int diff;
  17. if (flags & LOOKUP_RCU)
  18. return -ECHILD;
  19. inode = d_inode(dentry);
  20. if(!inode)
  21. return 1;
  22. /* fix up inode on a timezone change */
  23. diff = sys_tz.tz_minuteswest * 60 - HFS_I(inode)->tz_secondswest;
  24. if (diff) {
  25. struct timespec64 ts = inode_get_ctime(inode);
  26. inode_set_ctime(inode, ts.tv_sec + diff, ts.tv_nsec);
  27. ts = inode_get_atime(inode);
  28. inode_set_atime(inode, ts.tv_sec + diff, ts.tv_nsec);
  29. ts = inode_get_mtime(inode);
  30. inode_set_mtime(inode, ts.tv_sec + diff, ts.tv_nsec);
  31. HFS_I(inode)->tz_secondswest += diff;
  32. }
  33. return 1;
  34. }
  35. const struct dentry_operations hfs_dentry_operations =
  36. {
  37. .d_revalidate = hfs_revalidate_dentry,
  38. .d_hash = hfs_hash_dentry,
  39. .d_compare = hfs_compare_dentry,
  40. };