@@ -808,6 +808,17 @@ pub enum FcntlArg<'a> {
808808 /// fstore_t field fst_bytesalloc.
809809 #[ cfg( apple_targets) ]
810810 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+ /// The difference with F_LOG2PHYS is the struct passed
819+ /// is used as both IN/OUT as both its l2p_devoffset and
820+ /// l2p_contigbytes can be used for more specific queries.
821+ F_LOG2PHYS_EXT ( & ' a mut libc:: log2phys) ,
811822 // TODO: Rest of flags
812823}
813824
@@ -919,6 +930,18 @@ pub fn fcntl<Fd: std::os::fd::AsFd>(fd: Fd, arg: FcntlArg) -> Result<c_int> {
919930 #[ cfg( apple_targets) ]
920931 F_RDADVISE ( rad) => {
921932 libc:: fcntl( fd, libc:: F_RDADVISE , & rad)
933+ } ,
934+ #[ cfg( apple_targets) ]
935+ F_LOG2PHYS ( offset) => {
936+ let mut info: libc:: log2phys = std:: mem:: zeroed( ) ;
937+ let res = libc:: fcntl( fd, libc:: F_LOG2PHYS , & mut info) ;
938+ let ok_res = Errno :: result( res) ?;
939+ * offset = info. l2p_devoffset;
940+ return Ok ( ok_res)
941+ }
942+ #[ cfg( apple_targets) ]
943+ F_LOG2PHYS_EXT ( info) => {
944+ libc:: fcntl( fd, libc:: F_LOG2PHYS_EXT , info)
922945 }
923946 #[ cfg( apple_targets) ]
924947 F_RDAHEAD ( on) => {
0 commit comments