Re: [PATCH v3 2/4] staging: exfat: drop duplicate date_time_t struct

From: Valentin VidiÄ
Date: Sun Sep 08 2019 - 15:40:35 EST


On Sun, Sep 08, 2019 at 07:50:31PM +0100, Greg Kroah-Hartman wrote:
> Wait, how are these "duplicate"? The fields are in different order,
> don't these refer to things on-disk?

On-disk combines the values from these structures in a different form:

offset bits
DoubleSeconds 0 5
Minute 5 6
Hour 11 5
Day 16 5
Month 21 4
Year 25 7

> Did you test this?

Just compile tested for now.

> > -struct date_time_t {
> > - u16 Year;
> > - u16 Month;
> > - u16 Day;
> > - u16 Hour;
> > - u16 Minute;
> > - u16 Second;
> > - u16 MilliSecond;
> > -};
> > -
> > struct part_info_t {
> > u32 Offset; /* start sector number of the partition */
> > u32 Size; /* in sectors */
> > @@ -289,6 +279,16 @@ struct file_id_t {
> > u32 hint_last_clu;
> > };
> >
> > +struct timestamp_t {
> > + u16 millisec; /* 0 ~ 999 */
> > + u16 sec; /* 0 ~ 59 */
> > + u16 min; /* 0 ~ 59 */
> > + u16 hour; /* 0 ~ 23 */
> > + u16 day; /* 1 ~ 31 */
> > + u16 mon; /* 1 ~ 12 */
> > + u16 year; /* 0 ~ 127 (since 1980) */
> > +};
>
> They really look "backwards" to me, how are these the same? What am I
> missing?

date_time_t was only used in a few functions and there was a lot of
copying of the same fields between the two structs. Also some code was
duplicated to do the same thing for each of the structs.

--
Valentin