Currently libcfs fails to build on systems without pthreads
in the libcfs_lock code with its pseudo lock implementation.
Instead of creating a phony address pointer we create a real
static lock and test the pointer to it. The compiler is much
more happy with this approach.
Signed-off-by: James Simmons <uja.ornl@gmail.com>
Change-Id: Ia66d0972951afbfe9bc69a6375d57e6a13ae4e43
Reviewed-on: http://review.whamcloud.com/4121
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Liang Zhen <liang@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
};
# else /* !HAVE_LIBPTHREAD */
};
# else /* !HAVE_LIBPTHREAD */
-#define CFS_PERCPT_LOCK_MAGIC 0xbabecafe;
struct cfs_percpt_lock {
int pcl_lock;
};
struct cfs_percpt_lock {
int pcl_lock;
};
+
+static const struct cfs_percpt_lock CFS_PERCPT_LOCK_MAGIC;
+
# endif /* HAVE_LIBPTHREAD */
# define cfs_percpt_lock_num(pcl) 1
#endif /* __KERNEL__ */
# endif /* HAVE_LIBPTHREAD */
# define cfs_percpt_lock_num(pcl) 1
#endif /* __KERNEL__ */
struct cfs_percpt_lock *
cfs_percpt_lock_alloc(struct cfs_cpt_table *cptab)
{
struct cfs_percpt_lock *
cfs_percpt_lock_alloc(struct cfs_cpt_table *cptab)
{
- return (struct cfs_percpt_lock *)CFS_PERCPT_LOCK_MAGIC;
+ return ((struct cfs_percpt_lock *) &CFS_PERCPT_LOCK_MAGIC);
}
void
cfs_percpt_lock_free(struct cfs_percpt_lock *pcl)
{
}
void
cfs_percpt_lock_free(struct cfs_percpt_lock *pcl)
{
- LASSERT(pcl == (struct cfs_percpt_lock *)CFS_PERCPT_LOCK_MAGIC);
+ LASSERT(pcl == (struct cfs_percpt_lock *) &CFS_PERCPT_LOCK_MAGIC);
}
void
cfs_percpt_lock(struct cfs_percpt_lock *pcl, int index)
{
}
void
cfs_percpt_lock(struct cfs_percpt_lock *pcl, int index)
{
- LASSERT(pcl == (struct cfs_percpt_lock *)CFS_PERCPT_LOCK_MAGIC);
+ LASSERT(pcl == (struct cfs_percpt_lock *) &CFS_PERCPT_LOCK_MAGIC);
}
void
cfs_percpt_unlock(struct cfs_percpt_lock *pcl, int index)
{
}
void
cfs_percpt_unlock(struct cfs_percpt_lock *pcl, int index)
{
- LASSERT(pcl == (struct cfs_percpt_lock *)CFS_PERCPT_LOCK_MAGIC);
+ LASSERT(pcl == (struct cfs_percpt_lock *) &CFS_PERCPT_LOCK_MAGIC);
}
# endif /* HAVE_LIBPTHREAD */
}
# endif /* HAVE_LIBPTHREAD */