|
19 | 19 | /* /sys/fs/<nilfs>/ */
|
20 | 20 | static struct kset *nilfs_kset;
|
21 | 21 |
|
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 |
| - |
35 | 22 | #define NILFS_DEV_INT_GROUP_OPS(name, parent_name) \
|
36 | 23 | static ssize_t nilfs_##name##_attr_show(struct kobject *kobj, \
|
37 | 24 | struct attribute *attr, char *buf) \
|
@@ -576,7 +563,7 @@ nilfs_segctor_last_seg_write_time_show(struct nilfs_segctor_attr *attr,
|
576 | 563 | ctime = nilfs->ns_ctime;
|
577 | 564 | up_read(&nilfs->ns_segctor_sem);
|
578 | 565 |
|
579 |
| - return NILFS_SHOW_TIME(ctime, buf); |
| 566 | + return sysfs_emit(buf, "%ptTs\n", &ctime); |
580 | 567 | }
|
581 | 568 |
|
582 | 569 | static ssize_t
|
@@ -604,7 +591,7 @@ nilfs_segctor_last_nongc_write_time_show(struct nilfs_segctor_attr *attr,
|
604 | 591 | nongc_ctime = nilfs->ns_nongc_ctime;
|
605 | 592 | up_read(&nilfs->ns_segctor_sem);
|
606 | 593 |
|
607 |
| - return NILFS_SHOW_TIME(nongc_ctime, buf); |
| 594 | + return sysfs_emit(buf, "%ptTs\n", &nongc_ctime); |
608 | 595 | }
|
609 | 596 |
|
610 | 597 | static ssize_t
|
@@ -724,7 +711,7 @@ nilfs_superblock_sb_write_time_show(struct nilfs_superblock_attr *attr,
|
724 | 711 | sbwtime = nilfs->ns_sbwtime;
|
725 | 712 | up_read(&nilfs->ns_sem);
|
726 | 713 |
|
727 |
| - return NILFS_SHOW_TIME(sbwtime, buf); |
| 714 | + return sysfs_emit(buf, "%ptTs\n", &sbwtime); |
728 | 715 | }
|
729 | 716 |
|
730 | 717 | static ssize_t
|
|
0 commit comments