[v3,4/7] y2038: alpha: Rename valid_timeval64_to_timeval to valid_timeval_to_timeval32

Message ID 20200129125914.11221-4-lukma@denx.de
State Committed
Commit ebc2368121bf1932e530ef126b5a0765953e77ad
Headers

Commit Message

Lukasz Majewski Jan. 29, 2020, 12:59 p.m. UTC
  The name 'valid_timeval64_to_timeval' suggest conversion of struct
__timeval64 to struct timeval (as in ./include/time.h).

As on the alpha the struct timeval supports 64 bit time, it seems more
feasible to emphasis struct timeval32 in the conversion function name.

Hence the helper function naming change to 'valid_timeval_to_timeval32'.

Build tests:
./src/scripts/build-many-glibcs.py glibcs

---
Changes for v3:
- New patch
---
 sysdeps/unix/sysv/linux/alpha/osf_adjtime.c   | 4 ++--
 sysdeps/unix/sysv/linux/alpha/osf_getitimer.c | 4 ++--
 sysdeps/unix/sysv/linux/alpha/osf_setitimer.c | 4 ++--
 sysdeps/unix/sysv/linux/alpha/tv32-compat.h   | 6 +++---
 4 files changed, 9 insertions(+), 9 deletions(-)
  

Comments

Alistair Francis Jan. 30, 2020, 5:54 p.m. UTC | #1
On Wed, Jan 29, 2020 at 4:59 AM Lukasz Majewski <lukma@denx.de> wrote:
>
> The name 'valid_timeval64_to_timeval' suggest conversion of struct
> __timeval64 to struct timeval (as in ./include/time.h).
>
> As on the alpha the struct timeval supports 64 bit time, it seems more
> feasible to emphasis struct timeval32 in the conversion function name.
>
> Hence the helper function naming change to 'valid_timeval_to_timeval32'.
>
> Build tests:
> ./src/scripts/build-many-glibcs.py glibcs

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>

Alistair

>
> ---
> Changes for v3:
> - New patch
> ---
>  sysdeps/unix/sysv/linux/alpha/osf_adjtime.c   | 4 ++--
>  sysdeps/unix/sysv/linux/alpha/osf_getitimer.c | 4 ++--
>  sysdeps/unix/sysv/linux/alpha/osf_setitimer.c | 4 ++--
>  sysdeps/unix/sysv/linux/alpha/tv32-compat.h   | 6 +++---
>  4 files changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/sysdeps/unix/sysv/linux/alpha/osf_adjtime.c b/sysdeps/unix/sysv/linux/alpha/osf_adjtime.c
> index 5ac72e252f..9825a4734d 100644
> --- a/sysdeps/unix/sysv/linux/alpha/osf_adjtime.c
> +++ b/sysdeps/unix/sysv/linux/alpha/osf_adjtime.c
> @@ -63,7 +63,7 @@ __adjtime_tv32 (const struct timeval32 *itv, struct timeval32 *otv)
>    if (__adjtime (&itv64, &otv64) == -1)
>      return -1;
>
> -  *otv = valid_timeval64_to_timeval (otv64);
> +  *otv = valid_timeval_to_timeval32 (otv64);
>    return 0;
>  }
>
> @@ -116,7 +116,7 @@ __adjtimex_tv32 (struct timex32 *tx)
>    tx->calcnt    = tx64.calcnt;
>    tx->errcnt    = tx64.errcnt;
>    tx->stbcnt    = tx64.stbcnt;
> -  tx->time      = valid_timeval64_to_timeval (tx64.time);
> +  tx->time      = valid_timeval_to_timeval32 (tx64.time);
>
>    return status;
>  }
> diff --git a/sysdeps/unix/sysv/linux/alpha/osf_getitimer.c b/sysdeps/unix/sysv/linux/alpha/osf_getitimer.c
> index 1da3d72411..e9de2b287b 100644
> --- a/sysdeps/unix/sysv/linux/alpha/osf_getitimer.c
> +++ b/sysdeps/unix/sysv/linux/alpha/osf_getitimer.c
> @@ -33,9 +33,9 @@ __getitimer_tv32 (int which, struct itimerval32 *curr_value)
>
>    /* Write all fields of 'curr_value' regardless of overflow.  */
>    curr_value->it_interval
> -    = valid_timeval64_to_timeval (curr_value_64.it_interval);
> +    = valid_timeval_to_timeval32 (curr_value_64.it_interval);
>    curr_value->it_value
> -    = valid_timeval64_to_timeval (curr_value_64.it_value);
> +    = valid_timeval_to_timeval32 (curr_value_64.it_value);
>    return 0;
>  }
>
> diff --git a/sysdeps/unix/sysv/linux/alpha/osf_setitimer.c b/sysdeps/unix/sysv/linux/alpha/osf_setitimer.c
> index 3935d1cfb5..7df2d1b71c 100644
> --- a/sysdeps/unix/sysv/linux/alpha/osf_setitimer.c
> +++ b/sysdeps/unix/sysv/linux/alpha/osf_setitimer.c
> @@ -43,9 +43,9 @@ __setitimer_tv32 (int which, const struct itimerval32 *restrict new_value,
>
>    /* Write all fields of 'old_value' regardless of overflow.  */
>    old_value->it_interval
> -     = valid_timeval64_to_timeval (old_value_64.it_interval);
> +     = valid_timeval_to_timeval32 (old_value_64.it_interval);
>    old_value->it_value
> -     = valid_timeval64_to_timeval (old_value_64.it_value);
> +     = valid_timeval_to_timeval32 (old_value_64.it_value);
>    return 0;
>  }
>
> diff --git a/sysdeps/unix/sysv/linux/alpha/tv32-compat.h b/sysdeps/unix/sysv/linux/alpha/tv32-compat.h
> index 7169909259..8e34ed1c1b 100644
> --- a/sysdeps/unix/sysv/linux/alpha/tv32-compat.h
> +++ b/sysdeps/unix/sysv/linux/alpha/tv32-compat.h
> @@ -76,7 +76,7 @@ valid_timeval32_to_timeval (const struct timeval32 tv)
>  }
>
>  static inline struct timeval32
> -valid_timeval64_to_timeval (const struct timeval tv64)
> +valid_timeval_to_timeval32 (const struct timeval tv64)
>  {
>    if (__glibc_unlikely (tv64.tv_sec > (time_t) INT32_MAX))
>      return (struct timeval32) { INT32_MAX, TV_USEC_MAX};
> @@ -103,8 +103,8 @@ rusage64_to_rusage32 (struct rusage32 *restrict r32,
>       padding and reserved fields.  */
>    memset (r32, 0, sizeof *r32);
>
> -  r32->ru_utime    = valid_timeval64_to_timeval (r64->ru_utime);
> -  r32->ru_stime    = valid_timeval64_to_timeval (r64->ru_stime);
> +  r32->ru_utime    = valid_timeval_to_timeval32 (r64->ru_utime);
> +  r32->ru_stime    = valid_timeval_to_timeval32 (r64->ru_stime);
>    r32->ru_maxrss   = r64->ru_maxrss;
>    r32->ru_ixrss    = r64->ru_ixrss;
>    r32->ru_idrss    = r64->ru_idrss;
> --
> 2.20.1
>
  
Adhemerval Zanella Feb. 4, 2020, 6:43 p.m. UTC | #2
On 29/01/2020 09:59, Lukasz Majewski wrote:
> The name 'valid_timeval64_to_timeval' suggest conversion of struct
> __timeval64 to struct timeval (as in ./include/time.h).
> 
> As on the alpha the struct timeval supports 64 bit time, it seems more
> feasible to emphasis struct timeval32 in the conversion function name.
> 
> Hence the helper function naming change to 'valid_timeval_to_timeval32'.
> 
> Build tests:
> ./src/scripts/build-many-glibcs.py glibcs

As for the 3/7 patch of this set, I don't see much gain in such changes but
it is ok.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>

> 
> ---
> Changes for v3:
> - New patch
> ---
>  sysdeps/unix/sysv/linux/alpha/osf_adjtime.c   | 4 ++--
>  sysdeps/unix/sysv/linux/alpha/osf_getitimer.c | 4 ++--
>  sysdeps/unix/sysv/linux/alpha/osf_setitimer.c | 4 ++--
>  sysdeps/unix/sysv/linux/alpha/tv32-compat.h   | 6 +++---
>  4 files changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/sysdeps/unix/sysv/linux/alpha/osf_adjtime.c b/sysdeps/unix/sysv/linux/alpha/osf_adjtime.c
> index 5ac72e252f..9825a4734d 100644
> --- a/sysdeps/unix/sysv/linux/alpha/osf_adjtime.c
> +++ b/sysdeps/unix/sysv/linux/alpha/osf_adjtime.c
> @@ -63,7 +63,7 @@ __adjtime_tv32 (const struct timeval32 *itv, struct timeval32 *otv)
>    if (__adjtime (&itv64, &otv64) == -1)
>      return -1;
>  
> -  *otv = valid_timeval64_to_timeval (otv64);
> +  *otv = valid_timeval_to_timeval32 (otv64);
>    return 0;
>  }
> 

 
Ok.

> @@ -116,7 +116,7 @@ __adjtimex_tv32 (struct timex32 *tx)
>    tx->calcnt    = tx64.calcnt;
>    tx->errcnt    = tx64.errcnt;
>    tx->stbcnt    = tx64.stbcnt;
> -  tx->time      = valid_timeval64_to_timeval (tx64.time);
> +  tx->time      = valid_timeval_to_timeval32 (tx64.time);
>  
>    return status;
>  }

Ok.

> diff --git a/sysdeps/unix/sysv/linux/alpha/osf_getitimer.c b/sysdeps/unix/sysv/linux/alpha/osf_getitimer.c
> index 1da3d72411..e9de2b287b 100644
> --- a/sysdeps/unix/sysv/linux/alpha/osf_getitimer.c
> +++ b/sysdeps/unix/sysv/linux/alpha/osf_getitimer.c
> @@ -33,9 +33,9 @@ __getitimer_tv32 (int which, struct itimerval32 *curr_value)
>  
>    /* Write all fields of 'curr_value' regardless of overflow.  */
>    curr_value->it_interval
> -    = valid_timeval64_to_timeval (curr_value_64.it_interval);
> +    = valid_timeval_to_timeval32 (curr_value_64.it_interval);
>    curr_value->it_value
> -    = valid_timeval64_to_timeval (curr_value_64.it_value);
> +    = valid_timeval_to_timeval32 (curr_value_64.it_value);
>    return 0;
>  }
>  

Ok.

> diff --git a/sysdeps/unix/sysv/linux/alpha/osf_setitimer.c b/sysdeps/unix/sysv/linux/alpha/osf_setitimer.c
> index 3935d1cfb5..7df2d1b71c 100644
> --- a/sysdeps/unix/sysv/linux/alpha/osf_setitimer.c
> +++ b/sysdeps/unix/sysv/linux/alpha/osf_setitimer.c
> @@ -43,9 +43,9 @@ __setitimer_tv32 (int which, const struct itimerval32 *restrict new_value,
>  
>    /* Write all fields of 'old_value' regardless of overflow.  */
>    old_value->it_interval
> -     = valid_timeval64_to_timeval (old_value_64.it_interval);
> +     = valid_timeval_to_timeval32 (old_value_64.it_interval);
>    old_value->it_value
> -     = valid_timeval64_to_timeval (old_value_64.it_value);
> +     = valid_timeval_to_timeval32 (old_value_64.it_value);
>    return 0;
>  }
>  

Ok.

> diff --git a/sysdeps/unix/sysv/linux/alpha/tv32-compat.h b/sysdeps/unix/sysv/linux/alpha/tv32-compat.h
> index 7169909259..8e34ed1c1b 100644
> --- a/sysdeps/unix/sysv/linux/alpha/tv32-compat.h
> +++ b/sysdeps/unix/sysv/linux/alpha/tv32-compat.h
> @@ -76,7 +76,7 @@ valid_timeval32_to_timeval (const struct timeval32 tv)
>  }
>  
>  static inline struct timeval32
> -valid_timeval64_to_timeval (const struct timeval tv64)
> +valid_timeval_to_timeval32 (const struct timeval tv64)
>  {
>    if (__glibc_unlikely (tv64.tv_sec > (time_t) INT32_MAX))
>      return (struct timeval32) { INT32_MAX, TV_USEC_MAX};
> @@ -103,8 +103,8 @@ rusage64_to_rusage32 (struct rusage32 *restrict r32,
>       padding and reserved fields.  */
>    memset (r32, 0, sizeof *r32);
>  
> -  r32->ru_utime    = valid_timeval64_to_timeval (r64->ru_utime);
> -  r32->ru_stime    = valid_timeval64_to_timeval (r64->ru_stime);
> +  r32->ru_utime    = valid_timeval_to_timeval32 (r64->ru_utime);
> +  r32->ru_stime    = valid_timeval_to_timeval32 (r64->ru_stime);
>    r32->ru_maxrss   = r64->ru_maxrss;
>    r32->ru_ixrss    = r64->ru_ixrss;
>    r32->ru_idrss    = r64->ru_idrss;
> 

Ok.
  

Patch

diff --git a/sysdeps/unix/sysv/linux/alpha/osf_adjtime.c b/sysdeps/unix/sysv/linux/alpha/osf_adjtime.c
index 5ac72e252f..9825a4734d 100644
--- a/sysdeps/unix/sysv/linux/alpha/osf_adjtime.c
+++ b/sysdeps/unix/sysv/linux/alpha/osf_adjtime.c
@@ -63,7 +63,7 @@  __adjtime_tv32 (const struct timeval32 *itv, struct timeval32 *otv)
   if (__adjtime (&itv64, &otv64) == -1)
     return -1;
 
-  *otv = valid_timeval64_to_timeval (otv64);
+  *otv = valid_timeval_to_timeval32 (otv64);
   return 0;
 }
 
@@ -116,7 +116,7 @@  __adjtimex_tv32 (struct timex32 *tx)
   tx->calcnt    = tx64.calcnt;
   tx->errcnt    = tx64.errcnt;
   tx->stbcnt    = tx64.stbcnt;
-  tx->time      = valid_timeval64_to_timeval (tx64.time);
+  tx->time      = valid_timeval_to_timeval32 (tx64.time);
 
   return status;
 }
diff --git a/sysdeps/unix/sysv/linux/alpha/osf_getitimer.c b/sysdeps/unix/sysv/linux/alpha/osf_getitimer.c
index 1da3d72411..e9de2b287b 100644
--- a/sysdeps/unix/sysv/linux/alpha/osf_getitimer.c
+++ b/sysdeps/unix/sysv/linux/alpha/osf_getitimer.c
@@ -33,9 +33,9 @@  __getitimer_tv32 (int which, struct itimerval32 *curr_value)
 
   /* Write all fields of 'curr_value' regardless of overflow.  */
   curr_value->it_interval
-    = valid_timeval64_to_timeval (curr_value_64.it_interval);
+    = valid_timeval_to_timeval32 (curr_value_64.it_interval);
   curr_value->it_value
-    = valid_timeval64_to_timeval (curr_value_64.it_value);
+    = valid_timeval_to_timeval32 (curr_value_64.it_value);
   return 0;
 }
 
diff --git a/sysdeps/unix/sysv/linux/alpha/osf_setitimer.c b/sysdeps/unix/sysv/linux/alpha/osf_setitimer.c
index 3935d1cfb5..7df2d1b71c 100644
--- a/sysdeps/unix/sysv/linux/alpha/osf_setitimer.c
+++ b/sysdeps/unix/sysv/linux/alpha/osf_setitimer.c
@@ -43,9 +43,9 @@  __setitimer_tv32 (int which, const struct itimerval32 *restrict new_value,
 
   /* Write all fields of 'old_value' regardless of overflow.  */
   old_value->it_interval
-     = valid_timeval64_to_timeval (old_value_64.it_interval);
+     = valid_timeval_to_timeval32 (old_value_64.it_interval);
   old_value->it_value
-     = valid_timeval64_to_timeval (old_value_64.it_value);
+     = valid_timeval_to_timeval32 (old_value_64.it_value);
   return 0;
 }
 
diff --git a/sysdeps/unix/sysv/linux/alpha/tv32-compat.h b/sysdeps/unix/sysv/linux/alpha/tv32-compat.h
index 7169909259..8e34ed1c1b 100644
--- a/sysdeps/unix/sysv/linux/alpha/tv32-compat.h
+++ b/sysdeps/unix/sysv/linux/alpha/tv32-compat.h
@@ -76,7 +76,7 @@  valid_timeval32_to_timeval (const struct timeval32 tv)
 }
 
 static inline struct timeval32
-valid_timeval64_to_timeval (const struct timeval tv64)
+valid_timeval_to_timeval32 (const struct timeval tv64)
 {
   if (__glibc_unlikely (tv64.tv_sec > (time_t) INT32_MAX))
     return (struct timeval32) { INT32_MAX, TV_USEC_MAX};
@@ -103,8 +103,8 @@  rusage64_to_rusage32 (struct rusage32 *restrict r32,
      padding and reserved fields.  */
   memset (r32, 0, sizeof *r32);
 
-  r32->ru_utime    = valid_timeval64_to_timeval (r64->ru_utime);
-  r32->ru_stime    = valid_timeval64_to_timeval (r64->ru_stime);
+  r32->ru_utime    = valid_timeval_to_timeval32 (r64->ru_utime);
+  r32->ru_stime    = valid_timeval_to_timeval32 (r64->ru_stime);
   r32->ru_maxrss   = r64->ru_maxrss;
   r32->ru_ixrss    = r64->ru_ixrss;
   r32->ru_idrss    = r64->ru_idrss;