FBSD: use better casts in vop_advlock
authorBen Kaduk <kaduk@mit.edu>
Tue, 21 Jun 2011 02:35:08 +0000 (22:35 -0400)
committerDerrick Brashear <shadow@dementia.org>
Mon, 18 Jul 2011 05:22:51 +0000 (22:22 -0700)
In the bsd.kmod.mk world, the compiler bails when we cast a pointer
directly to int.  Cast through intptr_t as the supported mechanism.
On amd64, this loses bits, but since this instance is just attempting
to use the value as a unique handle, it is probably okay for now.
However, it should be addressed more properly eventually, when
this locking implementation sees wider use.

Change-Id: I4fe8084c14a97dc4efc8d74e9971b1540c028e40
Reviewed-on: http://gerrit.openafs.org/5034
Reviewed-by: Matt Benjamin <matt@linuxbox.com>
Reviewed-by: Garrett Wollman <wollman@csail.mit.edu>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

src/afs/FBSD/osi_vnodeops.c

index 5be9ad0..311b5a9 100644 (file)
@@ -1590,7 +1590,10 @@ afs_vop_advlock(ap)
 
     AFS_GLOCK();
     error =
-       afs_lockctl(VTOAFS(ap->a_vp), ap->a_fl, ap->a_op, &cr, (int)ap->a_id);
+       afs_lockctl(VTOAFS(ap->a_vp),
+               ap->a_fl,
+               ap->a_op, &cr,
+               (int)(intptr_t)ap->a_id);       /* XXX: no longer unique! */
     AFS_GUNLOCK();
     return error;
 }