RE: [PATCH v2 09/13] exfat: add misc operations

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> On Tue, Nov 19, 2019 at 8:16 AM Namjae Jeon <namjae.jeon@xxxxxxxxxxx>
> wrote:
> 
> > +/* <linux/time.h> externs sys_tz
> > + * extern struct timezone sys_tz;
> > + */
> > +#define UNIX_SECS_1980    315532800L
> > +
> > +#if BITS_PER_LONG == 64
> > +#define UNIX_SECS_2108    4354819200L
> > +#endif
> > +
> > +/* days between 1970/01/01 and 1980/01/01 (2 leap days) */
> > +#define DAYS_DELTA_DECADE    (365 * 10 + 2)
> > +/* 120 (2100 - 1980) isn't leap year */
> > +#define NO_LEAP_YEAR_2100    (120)
> > +#define IS_LEAP_YEAR(y)    (!((y) & 0x3) && (y) != NO_LEAP_YEAR_2100)
> > +
> > +#define SECS_PER_MIN    (60)
> > +#define SECS_PER_HOUR   (60 * SECS_PER_MIN)
> > +#define SECS_PER_DAY    (24 * SECS_PER_HOUR)
> 
> None of this code should exist, just use time64_to_tm() and tm_to_time64()
Okay, Will use them.
> 
> > +       if (!sbi->options.tz_utc)
> > +               ts->tv_sec += sys_tz.tz_minuteswest * SECS_PER_MIN;
> 
> I would make tz_utc the default here. Not sure what windows uses or what
> the specification says, but sys_tz is a rather unreliable interface, and
> it's better to not use that at all if it can be avoided.
> 
> It may be useful to have a mount option for the time zone offset instead.
Okay, Will add a time_zone_offset mount option.
> 
> > +       ts->tv_nsec = 0;
> > +}
> > +
> > +/* Convert linear UNIX date to a FAT time/date pair. */ void
> > +exfat_time_unix2fat(struct exfat_sb_info *sbi, struct timespec64 *ts,
> > +               struct exfat_date_time *tp)
> 
> This is basically time64_to_tm(), just be careful about to check whether
> months are counted from 1 or 0.
Okay.

Thanks for your review!
> 
>        Arnd




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux