Re: Alignment of disk-I/O from userland.

From: Garrett Wollman (wollman_at_khavrinen.lcs.mit.edu)
Date: 10/06/03

  • Next message: Poul-Henning Kamp: "Re: Alignment of disk-I/O from userland."
    Date: Mon, 6 Oct 2003 17:46:51 -0400 (EDT)
    To: phk@phk.freebsd.dk
    
    

    PHK writes:

    >Most code which does disk I/O from userland uses malloc'ed buffers for
    >the sectors and the alignment comes for free, but we currently have
    >no requirement that it be so.

    I believe that the Standard allows practically arbitrary restrictions
    on what may be done with devices (since most devices, aside from ttys,
    are outside the scope of the Standard anyway). It says that read()
    may fail if:

    [ENXIO] A request was made of a nonexistent device, or the request
               was outside the capabilities of the device.

    (I'm assuming you're talking about reads from devices, as opposed to
    reads from files.)

    I think that gives us plenary authority to require appropriate
    alignment of data buffers used to access disk devices directly.

    -GAWollman

    _______________________________________________
    freebsd-arch@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-arch
    To unsubscribe, send any mail to "freebsd-arch-unsubscribe@freebsd.org"


  • Next message: Poul-Henning Kamp: "Re: Alignment of disk-I/O from userland."

    Relevant Pages

    • Re: realloc() implicit free() ?
      ... a zero block size as a request for one byte, and let the alignment mechanisms raise it as they will. ... but the Standard does not require the allocated object to ... The compiler system does. ...
      (comp.lang.c)
    • Re: [JW] alignment problem for structures
      ... When the standard says "a pointer to ... >> alignment restriction for the pointer or for the referred-to type? ... > the alignment requirements of pointers to void and pointers to character ... > have addresses that are particular multiples of one?... ...
      (comp.std.c)
    • Re: Translating from C with extensions to standard C
      ... includes the packing and alignment extensions of GCC for struct objects: ... The standard does not specify the *precise* memory layout of 'struct' ...
      (comp.lang.c)
    • Re: Alignment
      ... mallocreturn addresses that satisfy whatever alignment ... Ain't it good enough to say that malloc returns an address good for storing any data type? ... Perhaps the Standard could have avoided talking about ... alignment if it instead imposed an "assignable to any pointer" ...
      (comp.lang.c)
    • Re: Translating from C with extensions to standard C
      ... includes the packing and alignment extensions of GCC for struct objects: ... The standard does not specify the *precise* memory layout of 'struct' ...
      (comp.lang.c)