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
11 #include <linux/namei.h>
12 #include "hfs_fs.h"
13
14 /* dentry case-handling: just lowercase everything */
15
hfs_revalidate_dentry(struct inode * dir,const struct qstr * name,struct dentry * dentry,unsigned int flags)16 static int hfs_revalidate_dentry(struct inode *dir, const struct qstr *name,
17 struct dentry *dentry, unsigned int flags)
18 {
19 struct inode *inode;
20 int diff;
21
22 if (flags & LOOKUP_RCU)
23 return -ECHILD;
24
25 inode = d_inode(dentry);
26 if(!inode)
27 return 1;
28
29 /* fix up inode on a timezone change */
30 diff = sys_tz.tz_minuteswest * 60 - HFS_I(inode)->tz_secondswest;
31 if (diff) {
32 struct timespec64 ts = inode_get_ctime(inode);
33
34 inode_set_ctime(inode, ts.tv_sec + diff, ts.tv_nsec);
35 ts = inode_get_atime(inode);
36 inode_set_atime(inode, ts.tv_sec + diff, ts.tv_nsec);
37 ts = inode_get_mtime(inode);
38 inode_set_mtime(inode, ts.tv_sec + diff, ts.tv_nsec);
39 HFS_I(inode)->tz_secondswest += diff;
40 }
41 return 1;
42 }
43
44 const struct dentry_operations hfs_dentry_operations =
45 {
46 .d_revalidate = hfs_revalidate_dentry,
47 .d_hash = hfs_hash_dentry,
48 .d_compare = hfs_compare_dentry,
49 };
50
51