Skip to content

Commit 776797f

Browse files
andy-shevpmladek
authored andcommitted
nilfs2: Switch to use %ptTs
Use %ptTs instead of open coded variant to print contents of time64_t type in human readable form. Use sysfs_emit() at the same time in the changed functions. Cc: Ryusuke Konishi <[email protected]> Cc: [email protected] Signed-off-by: Andy Shevchenko <[email protected]> Reviewed-by: Petr Mladek <[email protected]> Signed-off-by: Petr Mladek <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 126ac4d commit 776797f

File tree

1 file changed

+3
-16
lines changed

1 file changed

+3
-16
lines changed

fs/nilfs2/sysfs.c

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,6 @@
1919
/* /sys/fs/<nilfs>/ */
2020
static struct kset *nilfs_kset;
2121

22-
#define NILFS_SHOW_TIME(time_t_val, buf) ({ \
23-
struct tm res; \
24-
int count = 0; \
25-
time64_to_tm(time_t_val, 0, &res); \
26-
res.tm_year += 1900; \
27-
res.tm_mon += 1; \
28-
count = scnprintf(buf, PAGE_SIZE, \
29-
"%ld-%.2d-%.2d %.2d:%.2d:%.2d\n", \
30-
res.tm_year, res.tm_mon, res.tm_mday, \
31-
res.tm_hour, res.tm_min, res.tm_sec);\
32-
count; \
33-
})
34-
3522
#define NILFS_DEV_INT_GROUP_OPS(name, parent_name) \
3623
static ssize_t nilfs_##name##_attr_show(struct kobject *kobj, \
3724
struct attribute *attr, char *buf) \
@@ -576,7 +563,7 @@ nilfs_segctor_last_seg_write_time_show(struct nilfs_segctor_attr *attr,
576563
ctime = nilfs->ns_ctime;
577564
up_read(&nilfs->ns_segctor_sem);
578565

579-
return NILFS_SHOW_TIME(ctime, buf);
566+
return sysfs_emit(buf, "%ptTs\n", &ctime);
580567
}
581568

582569
static ssize_t
@@ -604,7 +591,7 @@ nilfs_segctor_last_nongc_write_time_show(struct nilfs_segctor_attr *attr,
604591
nongc_ctime = nilfs->ns_nongc_ctime;
605592
up_read(&nilfs->ns_segctor_sem);
606593

607-
return NILFS_SHOW_TIME(nongc_ctime, buf);
594+
return sysfs_emit(buf, "%ptTs\n", &nongc_ctime);
608595
}
609596

610597
static ssize_t
@@ -724,7 +711,7 @@ nilfs_superblock_sb_write_time_show(struct nilfs_superblock_attr *attr,
724711
sbwtime = nilfs->ns_sbwtime;
725712
up_read(&nilfs->ns_sem);
726713

727-
return NILFS_SHOW_TIME(sbwtime, buf);
714+
return sysfs_emit(buf, "%ptTs\n", &sbwtime);
728715
}
729716

730717
static ssize_t

0 commit comments

Comments
 (0)