Whamcloud - gitweb
LU-11303 out: clean up osp_update_rpc_pack() macro 07/33107/3
authorAndreas Dilger <adilger@whamcloud.com>
Tue, 4 Sep 2018 09:50:48 +0000 (17:50 +0800)
committerOleg Drokin <green@whamcloud.com>
Fri, 21 Sep 2018 03:30:47 +0000 (03:30 +0000)
commit3314af7c7b18bbd60e6a540105fd0ed6d7de6848
tree5f7c9c4069fbbed33ce1c936ecf665430ab811ff
parentfbeb6e218f4c60a77db17142d3debc10d784f2d9
LU-11303 out: clean up osp_update_rpc_pack() macro

The osp_update_rpc_pack() macro was using both an operation "name"
argument as well as an "opcode" argument, but totally ignoring the
"opcode" argument.  This allowed a caller in osp_attr_set() to pass
a non-existent opcode name to the function that was ignored.

The function also concatenated the passed name string to generate
a function name to be called (which supplied its own opcode value).
This name concatenation obscures the code functionality, since the
called functions are not actually referenced directly in the code.

Instead, pass the function name as the argument, and drop the opcode
completely.  This at least makes it possible to see where the function
is being called.  Change the macro to be upper-case, so that it is
more clear that it is a macro rather than a real function.  It would
be better to replace the macro with an actual function, but this is
not very practical due to the use of variable-length argument lists.

Test-Parameters: trivial
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: I7bf5c1d0f7a9abab1d8de8046cc408961f3ebbe5
Reviewed-on: https://review.whamcloud.com/33107
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: John L. Hammond <jhammond@whamcloud.com>
Reviewed-by: Hongchao Zhang <hongchao@whamcloud.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/osp/osp_internal.h
lustre/osp/osp_md_object.c
lustre/osp/osp_object.c