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

Re: [PATCH v4 5/6] tools: Use new byteswap helper


  • To: Lin Liu (刘林) <lin.liu@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 24 May 2022 08:58:08 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=UzPQLR2jxPKcOw2m44MccYVdL5mUZ6h1/S/n0FIIsro=; b=UJxbtDZ3a7x45bq1qJ0vebB789vofgrBEW6B2zEEI3tCkaas6Ins9VA1KEyhpe1+iOJtj1CGodCObqKMl1KUdTvuHJphV2YxSdQ4gHMKPg5kjDeyMrGoRsWBhMjnHg31S0Shj8we8bb3uz9H/cK806WTLQYYbuCQM+0KUNBVqjo1a54Vwie4RFCVn5C3ajUK/qaVoe57nE1QF9AhPPYD23ok6sygGQ+fe3gpAxJW+QLZcWiGZGRVaBkTjrP1g2DqPUx5v8vAXCA4onV5CdxAky+VnOrM+zl//9aPymXE+AwTUS4Ptkmyv+hwunknzwbJGAGF5zi5iN3YgJlD899fYA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MYh3a3TZM0+sliuyNdqpcdQ779YLQ6gID35Lx+IWKOwBKQKoz/3Uc+vgMI+teN2MAwEbV9cHPBzrXNJ2zYN9+fAu9j4uCTQhw7MvUqkyYK+Td8t3LAdFTQLK0t28E4Tnm7UoZ5lrPVQMyiXdCbSwlWijUHEvxZg7hm/5i+rY6n7+gUORisBFmnrP9/2q7oak0wZVjH3hg9eT3iieSj1OlwGcFVnIdD5odj+E67ZKmhl4c/oslaaGzwrMEJ0Ik5pTICc8khSqnlTB2ssdAhSZHiGh8Kpmi98FOSNEZhNrIQv4qjlPrQrLtek8UWcxvj1xmpea1fJfxwaqGiizpb58+w==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Wei Liu <wl@xxxxxxx>, Anthony Perard <anthony.perard@xxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Tue, 24 May 2022 07:41:46 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 24.05.2022 08:52, Lin Liu (刘林) wrote:
>>> On 23.05.2022 11:52, Lin Liu wrote:
>>>>> --- a/tools/libs/guest/xg_dom_decompress_unsafe_xz.c
>>>>> +++ b/tools/libs/guest/xg_dom_decompress_unsafe_xz.c
>>>>> @@ -34,6 +34,11 @@ static inline u32 le32_to_cpup(const u32 *p)
>>>>>        return cpu_to_le32(*p);
>>>>>  }
>>>>>
>>>>> +static inline u32 le32_to_cpu(u32 val)
>>>>> +{
>>>>> +   return le32_to_cpup((const u32 *)&val);
>>>>> +}
>>>>
>>>> Why the cast? And why not uint32_t?
>>>>
>>>> Jan
>>>
>>> le32_to_cpup has following prototye and definition
>>>
>>> static inline u32 le32_to_cpup(const u32 *p)
>>> {
>>>         return cpu_to_le32(*p);
>>> }
>>>
>>> xg_dom_decompress_unsafe_xz.c redefine and use u32, use u32 to keep 
>>> consistent
>>> typedef uint32_t u32;
>>
>> This answers neither part of my question. For u32 vs uint32_t, please
>> also see ./CODING_STYLE.
> 
> Type cast is unnecessary, will be removed in next version of patch
> CODING_STYLE encourage uint32_t instead of u32,
> However, Current xg_dom_decompress_unsafe_xz.c already use u32 instead of 
> unit32_t, so I
> use u32 to keep censistent, otherwise, the code look strange

Strange or not, that's the only way to phase out certain things without
using gigantic patches / series touching the entire tree at one time.
New code should not use these deprecated (for our purposes) types
anymore. Note how the file you adjust here already has to introduce
these type aliases for things to build. These typedefs really want to
go away, and any new use of those types is another hindrance in doing
so.

Jan




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.