sysdep.c 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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 inode *dir, const struct qstr *name,
  14. struct dentry *dentry, unsigned int flags)
  15. {
  16. struct inode *inode;
  17. int diff;
  18. if (flags & LOOKUP_RCU)
  19. return -ECHILD;
  20. inode = d_inode(dentry);
  21. if(!inode)
  22. return 1;
  23. /* fix up inode on a timezone change */
  24. diff = sys_tz.tz_minuteswest * 60 - HFS_I(inode)->tz_secondswest;
  25. if (diff) {
  26. struct timespec64 ts = inode_get_ctime(inode);
  27. inode_set_ctime(inode, ts.tv_sec + diff, ts.tv_nsec);
  28. ts = inode_get_atime(inode);
  29. inode_set_atime(inode, ts.tv_sec + diff, ts.tv_nsec);
  30. ts = inode_get_mtime(inode);
  31. inode_set_mtime(inode, ts.tv_sec + diff, ts.tv_nsec);
  32. HFS_I(inode)->tz_secondswest += diff;
  33. }
  34. return 1;
  35. }
  36. const struct dentry_operations hfs_dentry_operations =
  37. {
  38. .d_revalidate = hfs_revalidate_dentry,
  39. .d_hash = hfs_hash_dentry,
  40. .d_compare = hfs_compare_dentry,
  41. };