@@ -808,6 +808,16 @@ pub enum FcntlArg<'a> {
808
808
/// fstore_t field fst_bytesalloc.
809
809
#[ cfg( apple_targets) ]
810
810
F_PREALLOCATE ( & ' a mut libc:: fstore_t) ,
811
+ #[ cfg( apple_targets) ]
812
+ /// Get disk device information. In practice,
813
+ /// only the file offset data is set.
814
+ F_LOG2PHYS ( & ' a mut libc:: off_t) ,
815
+ #[ cfg( apple_targets) ]
816
+ /// Get disk device information. In practice,
817
+ /// only the file offset data is set.
818
+ /// difference with F_LOG2PHYS is the struct passed
819
+ /// is used as both IN/OUT.
820
+ F_LOG2PHYS_EXT ( & ' a mut libc:: off_t) ,
811
821
// TODO: Rest of flags
812
822
}
813
823
@@ -919,6 +929,23 @@ pub fn fcntl<Fd: std::os::fd::AsFd>(fd: Fd, arg: FcntlArg) -> Result<c_int> {
919
929
#[ cfg( apple_targets) ]
920
930
F_RDADVISE ( rad) => {
921
931
libc:: fcntl( fd, libc:: F_RDADVISE , & rad)
932
+ } ,
933
+ #[ cfg( apple_targets) ]
934
+ F_LOG2PHYS ( offset) => {
935
+ let mut info: libc:: log2phys = std:: mem:: zeroed( ) ;
936
+ let res = libc:: fcntl( fd, libc:: F_LOG2PHYS , & mut info) ;
937
+ let ok_res = Errno :: result( res) ?;
938
+ * offset = info. l2p_devoffset;
939
+ return Ok ( ok_res)
940
+ }
941
+ #[ cfg( apple_targets) ]
942
+ F_LOG2PHYS_EXT ( offset) => {
943
+ let mut info: libc:: log2phys = std:: mem:: zeroed( ) ;
944
+ info. l2p_devoffset = * offset;
945
+ let res = libc:: fcntl( fd, libc:: F_LOG2PHYS_EXT , & mut info) ;
946
+ let ok_res = Errno :: result( res) ?;
947
+ * offset = info. l2p_devoffset;
948
+ return Ok ( ok_res)
922
949
}
923
950
#[ cfg( apple_targets) ]
924
951
F_RDAHEAD ( on) => {
0 commit comments