@@ -800,6 +800,16 @@ pub enum FcntlArg<'a> {
800
800
/// Issue an advisory read async with no copy to user
801
801
#[ cfg( apple_targets) ]
802
802
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) ,
803
813
// TODO: Rest of flags
804
814
}
805
815
@@ -911,6 +921,23 @@ pub fn fcntl<Fd: std::os::fd::AsFd>(fd: Fd, arg: FcntlArg) -> Result<c_int> {
911
921
#[ cfg( apple_targets) ]
912
922
F_RDADVISE ( rad) => {
913
923
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)
914
941
}
915
942
}
916
943
} ;
0 commit comments