Date: Sun, 11 Sep 2016 16:55:56 -0600 From: Alan Somers <asomers@freebsd.org> To: Matthias Andree <mandree@freebsd.org> Cc: "freebsd-hackers@freebsd.org" <freebsd-hackers@freebsd.org> Subject: Re: User-space API to inquire block alignment requirements for open file descriptor? Message-ID: <CAOtMX2hjrabixE=Zk7RaVdsne-0s0mNqH-sDQhNQWAT0hEZLgg@mail.gmail.com> In-Reply-To: <c9063edd-a3c1-fce4-483c-a192addc6b86@FreeBSD.org> References: <c9063edd-a3c1-fce4-483c-a192addc6b86@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Sep 11, 2016 at 4:34 PM, Matthias Andree <mandree@freebsd.org> wrote: > 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? > > Thanks, > Matthias Does DIOCGSECTORSIZE do what you want? From the command line, you can see the result of this ioctl using "diskinfo -v <filename>". int fd; unsigned sectorsize; int error = ioctl(fd, DIOCGSECTORSIZE, §orsize); -Alan
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAOtMX2hjrabixE=Zk7RaVdsne-0s0mNqH-sDQhNQWAT0hEZLgg>