The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: Bakul Shah <bakul@iitbombay.org>
To: tuhs@minnie.tuhs.org
Subject: [TUHS] FreeBSD disk devices (Re: Choice of Unix for 11/03 and 11/23+ Systems
Date: Mon, 12 Oct 2020 10:46:33 -0700	[thread overview]
Message-ID: <35E93126-1C37-471B-82E6-FEA71A062307@iitbombay.org> (raw)
In-Reply-To: <faab01ad-bbe9-6b50-3592-e526224863bf@kilonet.net>

On Oct 12, 2020, at 9:57 AM, Arthur Krewat <krewat@kilonet.net> wrote:
> 
> On 10/11/2020 9:56 PM, Warner Losh wrote:
>> unaligned I/O on the block device
> Sorry, I have to laugh... isn't that an oxymoron? ;)

Actually there are no *block* devices in FreeBSD.
And while raw device files such as /dev/r<blkdev>
no longer exist, it is the block devices (with
their buffering etc.) that are gone. Only raw devices
exist now.

And FreeBSD raw disk device drivers don't allow
unaligned I/O access. Nor should they paper over
what is not allowed by the underlying device. Try

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

unsigned char buf[1024];

int main(int c, char**v) {
        char* a = c > 1? v[1] : "1";
        off_t off = (off_t)strtoull(a, 0, 0);
        ssize_t r = pread(0, buf, sizeof buf, off);
        if (r < 0) { perror("read"); return 1; }
        for (int i = 0; i < 4; i++) printf(" %02x", buf[i]);
        printf("\n");
        return 0;
}


  reply	other threads:[~2020-10-12 17:47 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-10 23:29 [TUHS] Fwd: " Noel Chiappa
2020-10-11  2:30 ` Jay Logue
2020-10-11 23:24 ` Paul Riley
2020-10-12  0:53   ` Dave Horsfall
2020-10-12  1:56     ` Warner Losh
2020-10-12  2:09       ` Andrew Warkentin
2020-10-12 16:57       ` Arthur Krewat
2020-10-12 17:46         ` Bakul Shah [this message]
2020-10-12 17:54           ` [TUHS] FreeBSD disk devices (Re: " Warner Losh
2020-10-18 20:42     ` [TUHS] Fwd: " Michael Huff

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=35E93126-1C37-471B-82E6-FEA71A062307@iitbombay.org \
    --to=bakul@iitbombay.org \
    --cc=tuhs@minnie.tuhs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).