diff options
author | Nithin Raju <nithin@vmware.com> | 2014-08-29 15:47:49 -0700 |
---|---|---|
committer | Ben Pfaff <blp@nicira.com> | 2014-09-04 12:40:42 -0700 |
commit | e4bd84f36b5670b8f394c8bb5170a85aed9b5901 (patch) | |
tree | e082e2f3ef9161d64aade06e9dfe79612ab1da50 /datapath-windows/ovsext/Datapath.h | |
parent | a19f14a74d7efcde7116e95051cbc28d3ee9984b (diff) | |
download | openvswitch-e4bd84f36b5670b8f394c8bb5170a85aed9b5901.tar.gz |
datapath-windows: add a context structure for user parameters
In this patch we add a context structure for collecting all the parameters
passed from usersapce in one place. The idea is to reduce the number of
parameters being passed to the netlink command handler functions.
It can be argued that not all functions require all the arguments, but this
approach keeps the code clean, IMO.
Signed-off-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ankur Sharma <ankursharma@vmware.com>
Acked-by: Ankur Sharma <ankursharma@vmware.com>
Acked-by: Saurabh Shah <ssaurabh@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'datapath-windows/ovsext/Datapath.h')
-rw-r--r-- | datapath-windows/ovsext/Datapath.h | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/datapath-windows/ovsext/Datapath.h b/datapath-windows/ovsext/Datapath.h index a8faeffbf..4e6c9b1ae 100644 --- a/datapath-windows/ovsext/Datapath.h +++ b/datapath-windows/ovsext/Datapath.h @@ -85,6 +85,44 @@ POVS_OPEN_INSTANCE OvsGetOpenInstance(PFILE_OBJECT fileObject, NTSTATUS OvsCompleteIrpRequest(PIRP irp, ULONG_PTR infoPtr, NTSTATUS status); + +/* + * Utility structure and functions to collect in one place all the parameters + * passed during a call from userspace. + */ +typedef struct _OVS_USER_PARAMS_CONTEXT { + PIRP irp; /* The IRP used for the userspace call. */ + POVS_OPEN_INSTANCE ovsInstance; /* Private data of the device handle. */ + UINT32 devOp; /* Device operation of the userspace call. */ + POVS_MESSAGE ovsMsg; /* OVS message that userspace passed down. */ + PVOID inputBuffer; /* Input data specified by userspace. Maybe NULL. */ + UINT32 inputLength; /* Length of input buffer. */ + PVOID outputBuffer; /* Output buffer specified by userspace for reading + * data. Maybe NULL. */ + UINT32 outputLength; /* Length of output buffer. */ +} OVS_USER_PARAMS_CONTEXT, *POVS_USER_PARAMS_CONTEXT; + +static __inline VOID +InitUserParamsCtx(PIRP irp, + POVS_OPEN_INSTANCE ovsInstance, + UINT32 devOp, + POVS_MESSAGE ovsMsg, + PVOID inputBuffer, + UINT32 inputLength, + PVOID outputBuffer, + UINT32 outputLength, + POVS_USER_PARAMS_CONTEXT usrParamsCtx) +{ + usrParamsCtx->irp = irp; + usrParamsCtx->ovsInstance = ovsInstance; + usrParamsCtx->devOp = devOp; + usrParamsCtx->ovsMsg = ovsMsg; + usrParamsCtx->inputBuffer = inputBuffer; + usrParamsCtx->inputLength = inputLength; + usrParamsCtx->outputBuffer = outputBuffer; + usrParamsCtx->outputLength = outputLength; +} + static __inline NTSTATUS InitUserDumpState(POVS_OPEN_INSTANCE instance, POVS_MESSAGE ovsMsg) |