aboutsummaryrefslogtreecommitdiff
path: root/fs/sdfat/misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/sdfat/misc.c')
-rw-r--r--fs/sdfat/misc.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/fs/sdfat/misc.c b/fs/sdfat/misc.c
index 9b07d1dea..6d76162f3 100644
--- a/fs/sdfat/misc.c
+++ b/fs/sdfat/misc.c
@@ -52,14 +52,6 @@
#define ST_LOG(fmt, ...)
#endif
-/*************************************************************************
- * FUNCTIONS WHICH HAS KERNEL VERSION DEPENDENCY
- *************************************************************************/
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
-#define CURRENT_TIME_SEC timespec_trunc(current_kernel_time(), NSEC_PER_SEC)
-#endif
-
-
/*
* sdfat_fs_error reports a file system problem that might indicate fa data
* corruption/inconsistency. Depending on 'errors' mount option the
@@ -83,7 +75,7 @@ void __sdfat_fs_error(struct super_block *sb, int report, const char *fmt, ...)
pr_err("[SDFAT](%s[%d:%d]):ERR: %pV\n",
sb->s_id, MAJOR(bd_dev), MINOR(bd_dev), &vaf);
#ifdef CONFIG_SDFAT_SUPPORT_STLOG
- if (opts->errors == SDFAT_ERRORS_RO && !(sb->s_flags & MS_RDONLY)) {
+ if (opts->errors == SDFAT_ERRORS_RO && !SDFAT_IS_SB_RDONLY(sb)) {
ST_LOG("[SDFAT](%s[%d:%d]):ERR: %pV\n",
sb->s_id, MAJOR(bd_dev), MINOR(bd_dev), &vaf);
}
@@ -94,8 +86,12 @@ void __sdfat_fs_error(struct super_block *sb, int report, const char *fmt, ...)
if (opts->errors == SDFAT_ERRORS_PANIC) {
panic("[SDFAT](%s[%d:%d]): fs panic from previous error\n",
sb->s_id, MAJOR(bd_dev), MINOR(bd_dev));
- } else if (opts->errors == SDFAT_ERRORS_RO && !(sb->s_flags & MS_RDONLY)) {
+ } else if (opts->errors == SDFAT_ERRORS_RO && !SDFAT_IS_SB_RDONLY(sb)) {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 0)
sb->s_flags |= MS_RDONLY;
+#else
+ sb->s_flags |= SB_RDONLY;
+#endif
sdfat_statistics_set_mnt_ro();
pr_err("[SDFAT](%s[%d:%d]): Filesystem has been set "
"read-only\n", sb->s_id, MAJOR(bd_dev), MINOR(bd_dev));
@@ -179,7 +175,7 @@ static time_t accum_days_in_year[] = {
};
/* Convert a FAT time/date pair to a UNIX date (seconds since 1 1 70). */
-void sdfat_time_fat2unix(struct sdfat_sb_info *sbi, struct timespec *ts,
+void sdfat_time_fat2unix(struct sdfat_sb_info *sbi, struct timespec_compat *ts,
DATE_TIME_T *tp)
{
time_t year = tp->Year;
@@ -202,7 +198,7 @@ void sdfat_time_fat2unix(struct sdfat_sb_info *sbi, struct timespec *ts,
}
/* Convert linear UNIX date to a FAT time/date pair. */
-void sdfat_time_unix2fat(struct sdfat_sb_info *sbi, struct timespec *ts,
+void sdfat_time_unix2fat(struct sdfat_sb_info *sbi, struct timespec_compat *ts,
DATE_TIME_T *tp)
{
time_t second = ts->tv_sec;
@@ -266,7 +262,7 @@ void sdfat_time_unix2fat(struct sdfat_sb_info *sbi, struct timespec *ts,
TIMESTAMP_T *tm_now(struct sdfat_sb_info *sbi, TIMESTAMP_T *tp)
{
- struct timespec ts = CURRENT_TIME_SEC;
+ struct timespec_compat ts = CURRENT_TIME_SEC;
DATE_TIME_T dt;
sdfat_time_unix2fat(sbi, &ts, &dt);