@@ -1778,6 +1778,7 @@ pub(crate) fn sendfile(
1778
1778
1779
1779
/// Convert from a Linux `statx` value to rustix's `Stat`.
1780
1780
#[ cfg( all( linux_kernel, target_pointer_width = "32" ) ) ]
1781
+ #[ allow( deprecated) ] // for `st_[amc]time` u64->i64 transition
1781
1782
fn statx_to_stat ( x : crate :: fs:: Statx ) -> io:: Result < Stat > {
1782
1783
Ok ( Stat {
1783
1784
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> {
1789
1790
st_size : x. stx_size . try_into ( ) . map_err ( |_| io:: Errno :: OVERFLOW ) ?,
1790
1791
st_blksize : x. stx_blksize . into ( ) ,
1791
1792
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) ) ,
1797
1794
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) ) ,
1803
1796
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) ) ,
1809
1798
st_ctime_nsec : x. stx_ctime . tv_nsec as _ ,
1810
1799
st_ino : x. stx_ino . into ( ) ,
1811
1800
} )
@@ -1827,23 +1816,11 @@ fn statx_to_stat(x: crate::fs::Statx) -> io::Result<Stat> {
1827
1816
result. st_size = x. stx_size . try_into ( ) . map_err ( |_| io:: Errno :: OVERFLOW ) ?;
1828
1817
result. st_blksize = x. stx_blksize . into ( ) ;
1829
1818
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) ) ;
1835
1820
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) ) ;
1841
1822
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) ) ;
1847
1824
result. st_ctime_nsec = x. stx_ctime . tv_nsec as _ ;
1848
1825
result. st_ino = x. stx_ino . into ( ) ;
1849
1826
@@ -1852,6 +1829,7 @@ fn statx_to_stat(x: crate::fs::Statx) -> io::Result<Stat> {
1852
1829
1853
1830
/// Convert from a Linux `stat64` value to rustix's `Stat`.
1854
1831
#[ cfg( all( linux_kernel, target_pointer_width = "32" ) ) ]
1832
+ #[ allow( deprecated) ] // for `st_[amc]time` u64->i64 transition
1855
1833
fn stat64_to_stat ( s64 : c:: stat64 ) -> io:: Result < Stat > {
1856
1834
Ok ( Stat {
1857
1835
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> {
1863
1841
st_size : s64. st_size . try_into ( ) . map_err ( |_| io:: Errno :: OVERFLOW ) ?,
1864
1842
st_blksize : s64. st_blksize . try_into ( ) . map_err ( |_| io:: Errno :: OVERFLOW ) ?,
1865
1843
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) ) ,
1867
1845
st_atime_nsec : s64
1868
1846
. st_atime_nsec
1869
1847
. try_into ( )
1870
1848
. 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) ) ,
1872
1850
st_mtime_nsec : s64
1873
1851
. st_mtime_nsec
1874
1852
. try_into ( )
1875
1853
. 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) ) ,
1877
1855
st_ctime_nsec : s64
1878
1856
. st_ctime_nsec
1879
1857
. try_into ( )
@@ -1899,17 +1877,17 @@ fn stat64_to_stat(s64: c::stat64) -> io::Result<Stat> {
1899
1877
result. st_size = s64. st_size . try_into ( ) . map_err ( |_| io:: Errno :: OVERFLOW ) ?;
1900
1878
result. st_blksize = s64. st_blksize . try_into ( ) . map_err ( |_| io:: Errno :: OVERFLOW ) ?;
1901
1879
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 _ ;
1903
1881
result. st_atime_nsec = s64
1904
1882
. st_atime_nsec
1905
1883
. try_into ( )
1906
1884
. 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 _ ;
1908
1886
result. st_mtime_nsec = s64
1909
1887
. st_mtime_nsec
1910
1888
. try_into ( )
1911
1889
. 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 _ ;
1913
1891
result. st_ctime_nsec = s64
1914
1892
. st_ctime_nsec
1915
1893
. try_into ( )
0 commit comments