File tree Expand file tree Collapse file tree 4 files changed +38
-5
lines changed Expand file tree Collapse file tree 4 files changed +38
-5
lines changed Original file line number Diff line number Diff line change @@ -450,7 +450,7 @@ pub fn init() -> ApicType {
450
450
451
451
log:: debug!( "apic: detected APIC (addr={address_phys:?}, type={apic_type:?})" ) ;
452
452
453
- let address_virt = unsafe { PHYSICAL_MEMORY_OFFSET } + address_phys. as_u64 ( ) ;
453
+ let address_virt = address_phys. as_hhdm_virt ( ) ;
454
454
let mut local_apic = LocalApic :: new ( address_virt, apic_type) ;
455
455
456
456
local_apic. init ( ) ;
Original file line number Diff line number Diff line change 15
15
// You should have received a copy of the GNU General Public License
16
16
// along with Aero. If not, see <https://www.gnu.org/licenses/>.
17
17
18
+ use core:: time:: Duration ;
19
+
18
20
use bit_field:: BitField ;
19
21
20
22
use crate :: fs:: inode;
@@ -199,10 +201,10 @@ impl From<FileType> for inode::FileType {
199
201
pub struct INode {
200
202
type_and_perm : u16 ,
201
203
pub user_id : u16 ,
202
- pub size_lower : u32 ,
203
- pub last_access : u32 ,
204
+ size_lower : u32 ,
205
+ last_access : u32 ,
204
206
pub creation_time : u32 ,
205
- pub last_modification : u32 ,
207
+ last_modification : u32 ,
206
208
pub deletion_time : u32 ,
207
209
pub group_id : u16 ,
208
210
pub hl_count : u16 ,
@@ -253,6 +255,21 @@ impl INode {
253
255
_ => FileType :: Unknown ,
254
256
}
255
257
}
258
+
259
+ #[ inline]
260
+ pub fn last_access ( & self ) -> Duration {
261
+ Duration :: from_secs ( self . last_access as u64 )
262
+ }
263
+
264
+ #[ inline]
265
+ pub fn last_modification ( & self ) -> Duration {
266
+ Duration :: from_secs ( self . last_modification as u64 )
267
+ }
268
+
269
+ #[ inline]
270
+ pub fn creation_time ( & self ) -> Duration {
271
+ Duration :: from_secs ( self . creation_time as u64 )
272
+ }
256
273
}
257
274
258
275
const_assert_eq ! ( core:: mem:: size_of:: <INode >( ) , 128 ) ;
Original file line number Diff line number Diff line change @@ -380,7 +380,7 @@ impl INodeInterface for INode {
380
380
let inode = self . inode . read ( ) ;
381
381
382
382
let filesystem = self . fs . upgrade ( ) . unwrap ( ) ;
383
- let filetype = self . metadata ( ) ? . file_type ( ) ;
383
+ let filetype = inode . file_type ( ) . into ( ) ;
384
384
385
385
let mut mode = Mode :: empty ( ) ;
386
386
@@ -401,6 +401,10 @@ impl INodeInterface for INode {
401
401
st_size : inode. size ( ) as _ ,
402
402
st_mode : mode,
403
403
404
+ st_atim : inode. last_access ( ) . into ( ) ,
405
+ st_mtim : inode. last_modification ( ) . into ( ) ,
406
+ st_ctim : inode. creation_time ( ) . into ( ) ,
407
+
404
408
..Default :: default ( )
405
409
} )
406
410
}
Original file line number Diff line number Diff line change @@ -32,6 +32,8 @@ pub mod time;
32
32
33
33
pub type Result < T > = core:: result:: Result < T , SyscallError > ;
34
34
35
+ use core:: time:: Duration ;
36
+
35
37
use byte_endian:: BigEndian ;
36
38
37
39
pub use crate :: syscall:: * ;
@@ -272,6 +274,16 @@ pub struct TimeSpec {
272
274
pub tv_nsec : isize ,
273
275
}
274
276
277
+ impl From < Duration > for TimeSpec {
278
+ #[ inline]
279
+ fn from ( value : Duration ) -> Self {
280
+ TimeSpec {
281
+ tv_sec : value. as_secs ( ) as isize ,
282
+ tv_nsec : value. subsec_nanos ( ) as isize ,
283
+ }
284
+ }
285
+ }
286
+
275
287
#[ repr( usize ) ]
276
288
#[ derive( Debug , Copy , Clone ) ]
277
289
pub enum SeekWhence {
You can’t perform that action at this time.
0 commit comments