[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [win-pv-devel] [PATCH 1/2] Add foreign page mapping functions to the GNTTAB interface
On 2015-09-04 14:39, RafaÅ WojdyÅa wrote: > On 2015-09-04 10:58, Paul Durrant wrote: >>> -----Original Message----- >>> From: win-pv-devel-bounces@xxxxxxxxxxxxxxxxxxxx [mailto:win-pv-devel- >>> bounces@xxxxxxxxxxxxxxxxxxxx] On Behalf Of Rafal Wojdyla >>> Sent: 25 August 2015 17:16 >>> To: win-pv-devel@xxxxxxxxxxxxxxxxxxxx >>> Subject: [win-pv-devel] [PATCH 1/2] Add foreign page mapping functions to >>> the GNTTAB interface >>> >>> +__checkReturn >>> +XEN_API >>> +NTSTATUS >>> +GrantTableMapForeignPage( >>> + IN USHORT Domain, >>> + IN ULONG GrantRef, >>> + IN PHYSICAL_ADDRESS Address, >>> + IN BOOLEAN ReadOnly, >>> + OUT ULONG *Handle >>> + ) >>> +{ >>> + struct gnttab_map_grant_ref op; >>> + LONG_PTR rc; >>> + NTSTATUS status; >>> + >>> + RtlZeroMemory(&op, sizeof(op)); >>> + op.dom = Domain; >>> + op.ref = GrantRef; >>> + op.flags = GNTMAP_host_map; >>> + if (ReadOnly) >>> + op.flags |= GNTMAP_readonly; >>> + op.host_addr = Address.QuadPart; >>> + >>> + rc = GrantTableOp(GNTTABOP_map_grant_ref, &op, 1); >>> + >>> + if (rc < 0) { >>> + ERRNO_TO_STATUS(-rc, status); >>> + goto fail1; >>> + } >>> + >>> + if (op.status != GNTST_okay) { >>> + status = STATUS_UNSUCCESSFUL; >>> + goto fail2; >>> + } >>> + >>> + *Handle = op.handle; >>> + >>> + return STATUS_SUCCESS; >>> + >>> +fail2: >>> + Error("fail2: op.status = %d\n", op.status); >> >> In general I've tried to keep 'Error' messages other than 'fail1:' plain. Rather than just setting status to unsuccessful and logging the raw grant status here it would be nicer to have a GNTST_TO_STATUS() macro to set status to something meaningful and then just log that in the 'fail1:' below. > Noted. Unfortunately most of the GNTST_* values don't really have any meaningful NTSTATUS equivalents. Any ideas on how to approach this? I guess we could define custom values but that doesn't sound ideal... -- RafaÅ WojdyÅa Qubes Tools for Windows developer https://www.qubes-os.org/ _______________________________________________ win-pv-devel mailing list win-pv-devel@xxxxxxxxxxxxxxxxxxxx http://lists.xenproject.org/cgi-bin/mailman/listinfo/win-pv-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |