Skip to content

Commit

Permalink
exfat: handle older kernels with different getattr() vfs interface
Browse files Browse the repository at this point in the history
Signed-off-by: Park Ju Hyung <[email protected]>
  • Loading branch information
arter97 committed Jun 26, 2020
1 parent 172ebff commit 78e2615
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
4 changes: 4 additions & 0 deletions exfat_fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -421,8 +421,12 @@ extern const struct file_operations exfat_file_operations;
int __exfat_truncate(struct inode *inode, loff_t new_size);
void exfat_truncate(struct inode *inode, loff_t size);
int exfat_setattr(struct dentry *dentry, struct iattr *attr);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
int exfat_getattr(const struct path *path, struct kstat *stat,
unsigned int request_mask, unsigned int query_flags);
#else
int exfat_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat);
#endif

/* namei.c */
extern const struct dentry_operations exfat_dentry_ops;
Expand Down
13 changes: 13 additions & 0 deletions file.c
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ void exfat_truncate(struct inode *inode, loff_t size)
mutex_unlock(&sbi->s_lock);
}

#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
int exfat_getattr(const struct path *path, struct kstat *stat,
unsigned int request_mask, unsigned int query_flags)
{
Expand All @@ -279,6 +280,18 @@ int exfat_getattr(const struct path *path, struct kstat *stat,
stat->blksize = EXFAT_SB(inode->i_sb)->cluster_size;
return 0;
}
#else
int exfat_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
{
struct inode *inode = dentry->d_inode;

generic_fillattr(inode, stat);
exfat_truncate_atime(&stat->atime);
stat->blksize = EXFAT_SB(inode->i_sb)->cluster_size;

return 0;
}
#endif

int exfat_setattr(struct dentry *dentry, struct iattr *attr)
{
Expand Down

0 comments on commit 78e2615

Please sign in to comment.