Re: [PATCH 4/6] libmpathpersist: fix byte swapping for big endian systems

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 06/22/18 16:27, Martin Wilck wrote:
On Fri, 2018-06-22 at 16:19 -0700, Bart Van Assche wrote:
On 06/22/18 16:16, Martin Wilck wrote:
-			sa_key = 0;
-			for (i = 0; i < 8; ++i){
-				if (i > 0)
-					sa_key <<= 8;
-				sa_key |= paramp->sa_key[i];
-			}
+			sa_key = be64_to_cpu(*(uint64_t *)&paramp-
sa_key[0]);

Have you considered to use get_unaligned_be64() instead of the above
construct with casts?

Yes, I did. I opted for this construct for patch brevity (and
admittedly, lazyness), because get_unaligned_be64() doesn't exist yet.
I can change that of course if you insist.

Adding an implementation of get_unaligned_be64() and introducing it in the above code would be highly appreciated. I think that will improve readability.

Thanks,

Bart.

--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/dm-devel



[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux