Re: [PATCH v11 08/20] virt: sev-guest: Consolidate SNP guest messaging parameters to a struct

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

 




On 9/4/2024 8:01 PM, Borislav Petkov wrote:
> On Wed, Jul 31, 2024 at 08:37:59PM +0530, Nikunj A Dadhania wrote:
>> +static int handle_guest_request(struct snp_guest_dev *snp_dev, u64 exit_code,
>> +				struct snp_guest_request_ioctl *rio, u8 type,
>> +				void *req_buf, size_t req_sz, void *resp_buf,
>> +				u32 resp_sz)
>> +{
>> +	struct snp_guest_req req = {
>> +		.msg_version	= rio->msg_version,
>> +		.msg_type	= type,
>> +		.vmpck_id	= vmpck_id,
>> +		.req_buf	= req_buf,
>> +		.req_sz		= req_sz,
>> +		.resp_buf	= resp_buf,
>> +		.resp_sz	= resp_sz,
>> +		.exit_code	= exit_code,
>> +	};
>> +
>> +	return snp_send_guest_request(snp_dev, &req, rio);
>> +}
> 
> Right, except you don't need that silly routine copying stuff around either
> but simply do the right thing at each call site from the get-go.
> 
> using the following coding pattern:
> 
> 	struct snp_guest_req req = { };
> 
> 	/* assign all members required for the respective call: */
> 	req.<member> = ...;
> 	...
> 
> 	err = snp_send_guest_request(snp_dev, &req, rio);
> 	if (err)
> 		...

Sure, will update all the call sites.

Regards
Nikunj




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux