[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PULL 00/11] Ide patches
From: |
Peter Maydell |
Subject: |
Re: [Qemu-devel] [PULL 00/11] Ide patches |
Date: |
Mon, 11 Jan 2016 17:36:35 +0000 |
On 11 January 2016 at 17:18, John Snow <address@hidden> wrote:
> On 01/11/2016 06:18 AM, Peter Maydell wrote:
>> On 9 January 2016 at 00:51, John Snow <address@hidden> wrote:
>> This kind of thing:
>>
>
> "This kind of thing" as one might say while holding up a rotting fish
> with just two fingers, held at arm's length.
Not the intended tone :-)
>> unsigned char *cbd = cmd->atapi_cmd;
>> uint32_t *lba32;
>>
>> lba32 = (uint32_t *)&(cbd[2]);
>> *lba32 = cpu_to_be32(lba);
>>
>> isn't valid. You probably want
>> stl_be_p(&cbd[2], lba);
> Thanks for the pointer. Out of curiosity, is there no standard way to
> perform this kind of operation in C? I want to adjust my bad habits. In
> QEMU I can remember to use these macros now that I know they're there,
> but not sure what I'd use in other projects. memcpy directly?
You can use memcpy, or you can hand-assemble values in and out
of byte arrays, I think. memcpy() is generally recommended, because
the compiler does a decent job with it.
thanks
-- PMM
- [Qemu-devel] [PULL 04/11] libqos/ahci: ATAPI support, (continued)
- [Qemu-devel] [PULL 04/11] libqos/ahci: ATAPI support, John Snow, 2016/01/08
- [Qemu-devel] [PULL 05/11] libqos/ahci: ATAPI identify, John Snow, 2016/01/08
- [Qemu-devel] [PULL 07/11] libqos: allow zero-size allocations, John Snow, 2016/01/08
- [Qemu-devel] [PULL 06/11] libqos/ahci: Switch to mutable properties, John Snow, 2016/01/08
- [Qemu-devel] [PULL 09/11] libqos/ahci: add ahci_exec, John Snow, 2016/01/08
- [Qemu-devel] [PULL 11/11] libqos/ahci: organize header, John Snow, 2016/01/08
- [Qemu-devel] [PULL 08/11] libqos/ahci: allow nondata commands for ahci_io variants, John Snow, 2016/01/08
- [Qemu-devel] [PULL 10/11] qtest/ahci: ATAPI data tests, John Snow, 2016/01/08
- Re: [Qemu-devel] [PULL 00/11] Ide patches, Peter Maydell, 2016/01/11