objhash.c: fix (?) invalid casts
When building 64-bit powerpc:
checkpoint/objhash.c: In function 'cr_obj_find_by_objref':checkpoint/objhash.c:121: warning: cast to pointer from integer of different size checkpoint/objhash.c: In function 'cr_obj_new':checkpoint/objhash.c:158: warning: cast to pointer from integer of different size
Is this the right fix or is struct cr_objref->objref the wrong type?
--- checkpoint/objhash.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
This is on top of v12 of the C/R patches.
checkpoint/objhash.c +3 -2
@@ -118,7 +118,8 @@ static struct cr_objref *cr_obj_find_by_objref(struct cr_ctx *ctx, int objref)struct hlist_node *n;struct cr_objref *obj; - h = &ctx->objhash->head[hash_ptr ((void *) objref,CR_OBJHASH_NBITS )]; + h = &ctx->objhash->head[hash_ptr ((void *)(unsigned long )objref, +CR_OBJHASH_NBITS )];hlist_for_each_entry (obj, n, h, hash)if (obj->objref == objref)return obj;
@@ -155,7 +156,7 @@ static struct cr_objref *cr_obj_new(struct cr_ctx *ctx, void *ptr, int objref,if (objref) {/* use @objref to index (restart) */ obj->objref = objref; - i =hash_ptr ((void *) objref,CR_OBJHASH_NBITS ); + i =hash_ptr ((void *)(unsigned long )objref,CR_OBJHASH_NBITS ); }else {/* use @ptr to index, assign objref (checkpoint) */ obj->objref = ctx->objhash->next_free_objref++;;
Signature · 1 line
1.5.5
Quoted 8 lines · Nathan Lynch
When building 64-bit powerpc:
checkpoint/objhash.c: In function 'cr_obj_find_by_objref':checkpoint/objhash.c:121: warning: cast to pointer from integer of different sizecheckpoint/objhash.c: In function 'cr_obj_new':checkpoint/objhash.c:158: warning: cast to pointer from integer of different sizeIs this the right fix or is struct
cr_objref->objrefthe wrong type?
Yeah, Dave suggested on irc changing objref to an unsigned long, and in fact switching to hash_long(). Oren, what do you think?
Meanwhile, obviously, when I tested the s390 c/r patch it was on top of these two patches. Worked beautifuly, thanks.
-serge
Quoted 36 lines
--- checkpoint/objhash.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)This is on top of v12 of the C/R patches.
checkpoint/objhash.c +3
-2@@ -118,7 +118,8 @@ static struct cr_objref *cr_obj_find_by_objref(struct cr_ctx *ctx, int objref)struct hlist_node *n;struct cr_objref *obj; - h = &ctx->objhash->head[hash_ptr ((void *) objref,CR_OBJHASH_NBITS )]; + h = &ctx->objhash->head[hash_ptr ((void *)(unsigned long )objref, +CR_OBJHASH_NBITS )];hlist_for_each_entry (obj, n, h, hash)if (obj->objref == objref)return obj;@@ -155,7 +156,7 @@ static struct cr_objref *cr_obj_new(struct cr_ctx *ctx, void *ptr, int objref,if (objref) {/* use @objref to index (restart) */ obj->objref = objref; - i =hash_ptr ((void *) objref,CR_OBJHASH_NBITS ); + i =hash_ptr ((void *)(unsigned long )objref,CR_OBJHASH_NBITS ); }else {/* use @ptr to index, assign objref (checkpoint) */ obj->objref = ctx->objhash->next_free_objref++;;Signature · 6 lines
1.5.5 _______________________________________________ Containers mailing list Containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org https://lists.linux-foundation.org/mailman/listinfo/containers