@@ -1778,6 +1778,7 @@ pub(crate) fn sendfile(
17781778
17791779/// Convert from a Linux `statx` value to rustix's `Stat`.
17801780#[ cfg( all( linux_kernel, target_pointer_width = "32" ) ) ]
1781+ #[ allow( deprecated) ] // for `st_[amc]time` u64->i64 transition
17811782fn statx_to_stat ( x : crate :: fs:: Statx ) -> io:: Result < Stat > {
17821783 Ok ( Stat {
17831784 st_dev : crate :: fs:: makedev ( x. stx_dev_major , x. stx_dev_minor ) . into ( ) ,
@@ -1789,23 +1790,11 @@ fn statx_to_stat(x: crate::fs::Statx) -> io::Result<Stat> {
17891790 st_size : x. stx_size . try_into ( ) . map_err ( |_| io:: Errno :: OVERFLOW ) ?,
17901791 st_blksize : x. stx_blksize . into ( ) ,
17911792 st_blocks : x. stx_blocks . into ( ) ,
1792- st_atime : x
1793- . stx_atime
1794- . tv_sec
1795- . try_into ( )
1796- . map_err ( |_| io:: Errno :: OVERFLOW ) ?,
1793+ st_atime : bitcast ! ( i64 :: from( x. stx_atime. tv_sec) ) ,
17971794 st_atime_nsec : x. stx_atime . tv_nsec as _ ,
1798- st_mtime : x
1799- . stx_mtime
1800- . tv_sec
1801- . try_into ( )
1802- . map_err ( |_| io:: Errno :: OVERFLOW ) ?,
1795+ st_mtime : bitcast ! ( i64 :: from( x. stx_mtime. tv_sec) ) ,
18031796 st_mtime_nsec : x. stx_mtime . tv_nsec as _ ,
1804- st_ctime : x
1805- . stx_ctime
1806- . tv_sec
1807- . try_into ( )
1808- . map_err ( |_| io:: Errno :: OVERFLOW ) ?,
1797+ st_ctime : bitcast ! ( i64 :: from( x. stx_ctime. tv_sec) ) ,
18091798 st_ctime_nsec : x. stx_ctime . tv_nsec as _ ,
18101799 st_ino : x. stx_ino . into ( ) ,
18111800 } )
@@ -1827,23 +1816,11 @@ fn statx_to_stat(x: crate::fs::Statx) -> io::Result<Stat> {
18271816 result. st_size = x. stx_size . try_into ( ) . map_err ( |_| io:: Errno :: OVERFLOW ) ?;
18281817 result. st_blksize = x. stx_blksize . into ( ) ;
18291818 result. st_blocks = x. stx_blocks . try_into ( ) . map_err ( |_e| io:: Errno :: OVERFLOW ) ?;
1830- result. st_atime = x
1831- . stx_atime
1832- . tv_sec
1833- . try_into ( )
1834- . map_err ( |_| io:: Errno :: OVERFLOW ) ?;
1819+ result. st_atime = bitcast ! ( i64 :: from( x. stx_atime. tv_sec) ) ;
18351820 result. st_atime_nsec = x. stx_atime . tv_nsec as _ ;
1836- result. st_mtime = x
1837- . stx_mtime
1838- . tv_sec
1839- . try_into ( )
1840- . map_err ( |_| io:: Errno :: OVERFLOW ) ?;
1821+ result. st_mtime = bitcast ! ( i64 :: from( x. stx_mtime. tv_sec) ) ;
18411822 result. st_mtime_nsec = x. stx_mtime . tv_nsec as _ ;
1842- result. st_ctime = x
1843- . stx_ctime
1844- . tv_sec
1845- . try_into ( )
1846- . map_err ( |_| io:: Errno :: OVERFLOW ) ?;
1823+ result. st_ctime = bitcast ! ( i64 :: from( x. stx_ctime. tv_sec) ) ;
18471824 result. st_ctime_nsec = x. stx_ctime . tv_nsec as _ ;
18481825 result. st_ino = x. stx_ino . into ( ) ;
18491826
@@ -1852,6 +1829,7 @@ fn statx_to_stat(x: crate::fs::Statx) -> io::Result<Stat> {
18521829
18531830/// Convert from a Linux `stat64` value to rustix's `Stat`.
18541831#[ cfg( all( linux_kernel, target_pointer_width = "32" ) ) ]
1832+ #[ allow( deprecated) ] // for `st_[amc]time` u64->i64 transition
18551833fn stat64_to_stat ( s64 : c:: stat64 ) -> io:: Result < Stat > {
18561834 Ok ( Stat {
18571835 st_dev : s64. st_dev . try_into ( ) . map_err ( |_| io:: Errno :: OVERFLOW ) ?,
@@ -1863,17 +1841,17 @@ fn stat64_to_stat(s64: c::stat64) -> io::Result<Stat> {
18631841 st_size : s64. st_size . try_into ( ) . map_err ( |_| io:: Errno :: OVERFLOW ) ?,
18641842 st_blksize : s64. st_blksize . try_into ( ) . map_err ( |_| io:: Errno :: OVERFLOW ) ?,
18651843 st_blocks : s64. st_blocks . try_into ( ) . map_err ( |_| io:: Errno :: OVERFLOW ) ?,
1866- st_atime : s64. st_atime . try_into ( ) . map_err ( |_| io :: Errno :: OVERFLOW ) ? ,
1844+ st_atime : bitcast ! ( i64 :: from ( s64. st_atime) ) ,
18671845 st_atime_nsec : s64
18681846 . st_atime_nsec
18691847 . try_into ( )
18701848 . map_err ( |_| io:: Errno :: OVERFLOW ) ?,
1871- st_mtime : s64. st_mtime . try_into ( ) . map_err ( |_| io :: Errno :: OVERFLOW ) ? ,
1849+ st_mtime : bitcast ! ( i64 :: from ( s64. st_mtime) ) ,
18721850 st_mtime_nsec : s64
18731851 . st_mtime_nsec
18741852 . try_into ( )
18751853 . map_err ( |_| io:: Errno :: OVERFLOW ) ?,
1876- st_ctime : s64. st_ctime . try_into ( ) . map_err ( |_| io :: Errno :: OVERFLOW ) ? ,
1854+ st_ctime : bitcast ! ( i64 :: from ( s64. st_ctime) ) ,
18771855 st_ctime_nsec : s64
18781856 . st_ctime_nsec
18791857 . try_into ( )
@@ -1899,17 +1877,17 @@ fn stat64_to_stat(s64: c::stat64) -> io::Result<Stat> {
18991877 result. st_size = s64. st_size . try_into ( ) . map_err ( |_| io:: Errno :: OVERFLOW ) ?;
19001878 result. st_blksize = s64. st_blksize . try_into ( ) . map_err ( |_| io:: Errno :: OVERFLOW ) ?;
19011879 result. st_blocks = s64. st_blocks . try_into ( ) . map_err ( |_| io:: Errno :: OVERFLOW ) ?;
1902- result. st_atime = s64. st_atime . try_into ( ) . map_err ( |_| io :: Errno :: OVERFLOW ) ? ;
1880+ result. st_atime = i64 :: from ( s64. st_atime ) as _ ;
19031881 result. st_atime_nsec = s64
19041882 . st_atime_nsec
19051883 . try_into ( )
19061884 . map_err ( |_| io:: Errno :: OVERFLOW ) ?;
1907- result. st_mtime = s64. st_mtime . try_into ( ) . map_err ( |_| io :: Errno :: OVERFLOW ) ? ;
1885+ result. st_mtime = i64 :: from ( s64. st_mtime ) as _ ;
19081886 result. st_mtime_nsec = s64
19091887 . st_mtime_nsec
19101888 . try_into ( )
19111889 . map_err ( |_| io:: Errno :: OVERFLOW ) ?;
1912- result. st_ctime = s64. st_ctime . try_into ( ) . map_err ( |_| io :: Errno :: OVERFLOW ) ? ;
1890+ result. st_ctime = i64 :: from ( s64. st_ctime ) as _ ;
19131891 result. st_ctime_nsec = s64
19141892 . st_ctime_nsec
19151893 . try_into ( )
0 commit comments