ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> ctypes-users
ctypes-users
Re: [ctypes-users] Re: Byte ordering
by Thomas Heller other posts by this author
Nov 10 2005 12:39PM messages near this date
Re: [ctypes-users] Re: Byte ordering | [ctypes-users] Byte ordering
[cc to ctypes-users, hope you don't mind.  And please keep the list on
the cc]

Nicolas Pinault <nicolasp@[...].com>  writes:

>  Yes, I'm writting a python package to be able to access ATA/SCSI
>  drives directly from python. I need this to create a disk analysis
>  tool written in python. So, I use ctypes to access WNASPI32.dll
>  functions. The structures used to access the aspi dll is standart to
>  ctypes (little endian). But aspi dll need scsi structures as input and
>  output. Scsi structures are byte reversed (big endian). Of course, I
>  could avoid bit fields by hard coding bit manipulation into bytes,
>  shorts and longs. But this makes code much less readable and
>  maintanaible.  As disks are very large today, performance is a
>  critical.

Sounds cool.  I'll try to implement the big endian structures, with
support for bit fields, in C and add it to ctypes.

As far is I have found out, the MS C compiler (with native == little
endian byte ordering) starts bit field definitions from LSB to MSB
inside an int: "Bit fields are allocated within an integer from
least-significant to most-significant bit."

And it seems that not only the byte order, but also the *bit order* in
the SCSI structures needs to change.  Can you confirm this?

Thomas




-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
ctypes-users mailing list
ctypes-users@[...].net
https://lists.sourceforge.net/lists/listinfo/ctypes-users
Thread:
Thomas Heller
Bob Ippolito
Thomas Heller

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved