[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [edk2-devel] [PATCH 05/11] OvmfPkg/XenBusDxe: Construct paths without allocation
On 09/16/19 17:39, Laszlo Ersek wrote: > On 09/13/19 16:50, Anthony PERARD wrote: >> When doing an action with a path and subpath in the xenstore, >> XenStoreJoin is called to generate "$path/$subpath". But this function >> do an allocation of memory which isn't necessary. Instead we will >> construct the path with WRITE_REQUEST and data used to generate the >> path will be copied directly to the xenstore shared ring. >> >> Also change WRITE_REQUEST.Len type, it only contain sizes and doesn't >> need to be exactly 32bits. >> >> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2190 >> Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx> >> --- >> OvmfPkg/XenBusDxe/XenStore.c | 78 +++++++++++++++++++++--------------- >> 1 file changed, 46 insertions(+), 32 deletions(-) >> >> diff --git a/OvmfPkg/XenBusDxe/XenStore.c b/OvmfPkg/XenBusDxe/XenStore.c >> index 7b71dc156d..ca7be12d68 100644 >> --- a/OvmfPkg/XenBusDxe/XenStore.c >> +++ b/OvmfPkg/XenBusDxe/XenStore.c >> @@ -53,7 +53,7 @@ >> >> typedef struct { >> CONST VOID *Data; >> - UINT32 Len; >> + UINTN Len; >> } WRITE_REQUEST; >> >> /* Register callback to watch subtree (node) in the XenStore. */ >> @@ -260,6 +260,35 @@ XenStoreFindWatch ( >> return NULL; >> } >> >> +/** >> + Fill the first three slots of a WRITE_REQUEST array. >> + >> + When those three slots are concatenated to generate a string, the >> resulting >> + string will be "$Path\0" or "$Path/$SubPath\0" if SubPath is provided. >> +**/ >> +STATIC >> +VOID >> +XenStorePrepareWriteRequest ( >> + IN OUT WRITE_REQUEST *WriteRequest, (6) I think this could be just OUT -- we start by zeroing it out. >> + IN CONST CHAR8 *Path, >> + IN CONST CHAR8 *SubPath OPTIONAL >> + ) >> +{ >> + SetMem(WriteRequest, 3 * sizeof (WRITE_REQUEST), 0); Thanks Laszlo _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |