@@ -800,6 +800,16 @@ pub enum FcntlArg<'a> {
800800    /// Issue an advisory read async with no copy to user 
801801[ cfg( apple_targets) ] 
802802    F_RDADVISE ( libc:: radvisory) , 
803+     #[ cfg( apple_targets) ] 
804+     /// Get disk device information. In practice, 
805+ /// only the file offset data is set. 
806+ F_LOG2PHYS ( & ' a mut  libc:: off_t) , 
807+     #[ cfg( apple_targets) ] 
808+     /// Get disk device information. In practice, 
809+ /// only the file offset data is set. 
810+ /// difference with F_LOG2PHYS is the struct passed 
811+ /// is used as both IN/OUT. 
812+ F_LOG2PHYS_EXT ( & ' a mut  libc:: off_t) , 
803813    // TODO: Rest of flags 
804814} 
805815
@@ -911,6 +921,23 @@ pub fn fcntl<Fd: std::os::fd::AsFd>(fd: Fd, arg: FcntlArg) -> Result<c_int> {
911921            #[ cfg( apple_targets) ] 
912922            F_RDADVISE ( rad)  => { 
913923                libc:: fcntl( fd,  libc:: F_RDADVISE ,  & rad) 
924+             } , 
925+             #[ cfg( apple_targets) ] 
926+             F_LOG2PHYS ( offset)  => { 
927+                 let  mut  info:  libc:: log2phys = std:: mem:: zeroed( ) ; 
928+                 let  res = libc:: fcntl( fd,  libc:: F_LOG2PHYS ,  & mut  info) ; 
929+                 let  ok_res = Errno :: result( res) ?; 
930+                 * offset = info. l2p_devoffset; 
931+                 return  Ok ( ok_res) 
932+             } 
933+             #[ cfg( apple_targets) ] 
934+             F_LOG2PHYS_EXT ( offset)  => { 
935+                 let  mut  info:  libc:: log2phys = std:: mem:: zeroed( ) ; 
936+                 info. l2p_devoffset = * offset; 
937+                 let  res = libc:: fcntl( fd,  libc:: F_LOG2PHYS_EXT ,  & mut  info) ; 
938+                 let  ok_res = Errno :: result( res) ?; 
939+                 * offset = info. l2p_devoffset; 
940+                 return  Ok ( ok_res) 
914941            } 
915942        } 
916943    } ; 
0 commit comments