Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #68528 > unrolled thread

Re: Controlling buffer alignment in file.read()

Started byDan Stromberg <drsalists@gmail.com>
First post2014-03-18 18:01 -0700
Last post2014-03-18 18:01 -0700
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Controlling buffer alignment in file.read() Dan Stromberg <drsalists@gmail.com> - 2014-03-18 18:01 -0700

#68528 — Re: Controlling buffer alignment in file.read()

FromDan Stromberg <drsalists@gmail.com>
Date2014-03-18 18:01 -0700
SubjectRe: Controlling buffer alignment in file.read()
Message-ID<mailman.8266.1395190928.18130.python-list@python.org>
On Tue, Mar 18, 2014 at 1:23 PM, Haralanov, Mitko
<mitko.haralanov@intel.com> wrote:
> Hi all,
>
> I am using Python to read from a binary device file which requires that all read sizes are in 8byte multiples and the user's buffer is 8byte aligned.
>
> I am currently using a file object and the file.read() method. However, the issue is that the file.read() method allocates the buffer passed to C function under the covers and, therefore, the alignment is arbitrary.
>
> Is there a way that I can get file.read() to use an 8byte aligned buffer?

This is a lot like what my odirect project does:
http://stromberg.dnsalias.org/~strombrg/odirect/

It does buffer alignment, because O_DIRECT requires buffer alignment.
It's a Python-callable SWIG wrapper for some C code.

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web