[Devel] Re: [PATCH 03/12] Replace obj_no_grab and obj_no_drop ckpt ops with NULL
Nathan Lynch
ntl at pobox.com
Fri Feb 26 10:48:04 PST 2010
On Fri, 2010-02-26 at 00:45 -0800, Matt Helsley wrote:
> Distributing the ckpt_obj_ops would require sharing these functions when
> we can get by with simple NULL pointers in the grab/drop operations.
>
> Signed-off-by: Matt Helsley <matthltc at us.ibm.com>
> ---
> checkpoint/objhash.c | 36 ++++++++++++++++--------------------
> 1 files changed, 16 insertions(+), 20 deletions(-)
>
> diff --git a/checkpoint/objhash.c b/checkpoint/objhash.c
> index 832520d..999d731 100644
> --- a/checkpoint/objhash.c
> +++ b/checkpoint/objhash.c
> @@ -47,16 +47,6 @@ struct ckpt_obj_hash {
>
> /* helper grab/drop/users functions */
>
> -static void obj_no_drop(void *ptr, int lastref)
> -{
> - return;
> -}
> -
> -static int obj_no_grab(void *ptr)
> -{
> - return 0;
> -}
> -
> static int obj_inode_grab(void *ptr)
> {
> return igrab((struct inode *) ptr) ? 0 : -EBADF;
> @@ -346,8 +336,8 @@ static void *restore_lsm_string_wrap(struct ckpt_ctx *ctx)
> static const struct ckpt_obj_ops ckpt_obj_ignored_ops = {
> .obj_name = "IGNORED",
> .obj_type = CKPT_OBJ_IGNORE,
> - .ref_drop = obj_no_drop,
> - .ref_grab = obj_no_grab,
> + .ref_drop = NULL,
> + .ref_grab = NULL,
> };
>
> /* inode object */
> @@ -412,8 +402,8 @@ static const struct ckpt_obj_ops ckpt_obj_sighand_ops = {
> static const struct ckpt_obj_ops ckpt_obj_signal_ops = {
> .obj_name = "SIGNAL",
> .obj_type = CKPT_OBJ_SIGNAL,
> - .ref_drop = obj_no_drop,
> - .ref_grab = obj_no_grab,
> + .ref_drop = NULL,
> + .ref_grab = NULL,
> };
> /* ns object */
> static const struct ckpt_obj_ops ckpt_obj_nsproxy_ops = {
> @@ -519,8 +509,8 @@ static const struct ckpt_obj_ops ckpt_obj_tty_ops = {
> static const struct ckpt_obj_ops ckpt_obj_security_ptr_ops = {
> .obj_name = "SECURITY PTR",
> .obj_type = CKPT_OBJ_SECURITY_PTR,
> - .ref_drop = obj_no_drop,
> - .ref_grab = obj_no_grab,
> + .ref_drop = NULL,
> + .ref_grab = NULL,
> };
ref_drop/grab will be NULL if you just remove the initializers -- do you
think it is preferable to be explicit?
Regardless, this is looking good to me.
_______________________________________________
Containers mailing list
Containers at lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers
More information about the Devel
mailing list