User-space API to inquire block alignment requirements for open file descriptor?

Poul-Henning Kamp phk at phk.freebsd.dk
Mon Sep 12 07:12:58 UTC 2016


--------
In message <c9063edd-a3c1-fce4-483c-a192addc6b86 at FreeBSD.org>, Matthias Andree 
writes:
>Greetings,
>
>given an open file descriptor, do we have a system interface to inquire
>about the block size of the underlying devices? In the past, we used to
>deal with 512-byte blocks, but how about drives using 4096-byte blocks?

DIOCGSECTORSIZE in sys/disk.h

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.


More information about the freebsd-hackers mailing list