])
])
-# 2.6.24
+# 2.6.24-rc1 sg_init_table
+AC_DEFUN([LIBCFS_SCATTERLIST_INITTABLE],
+[AC_MSG_CHECKING([for sg_init_table])
+LB_LINUX_TRY_COMPILE([
+ #include <asm/types.h>
+ #include <linux/scatterlist.h>
+],[
+ sg_init_table(NULL,0);
+],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_SCATTERLIST_INITTABLE, 1,
+ [scatterlist has sg_init_table])
+],[
+ AC_MSG_RESULT(NO)
+])
+])
+
+# 2.6.24
AC_DEFUN([LIBCFS_NETWORK_NAMESPACE],
[AC_MSG_CHECKING([for network stack has namespaces])
LB_LINUX_TRY_COMPILE([
# 2.6.24
LIBCFS_SYSCTL_UNNUMBERED
LIBCFS_SCATTERLIST_SETPAGE
+LIBCFS_SCATTERLIST_INITTABLE
LIBCFS_NETWORK_NAMESPACE
LIBCFS_FUNC_DUMP_TRACE
# 2.6.26
#endif /* HAVE_STRUCT_CRED */
+#ifndef HAVE_SCATTERLIST_INITTABLE
+#define sg_init_table(sg, nents) memset(sg, 0, sizeof(*(sg))*(nents))
+#endif
+
+#ifndef HAVE_SCATTERLIST_SETPAGE
+#define sg_set_page(sg, p, len, off) \
+ sg_set_buf(sg, page_address(p) + ((off) & ~CFS_PAGE_MASK), len)
+#endif
+
#endif /* _LINUX_LIBCFS_H */
unsigned char *key, unsigned int key_len,
unsigned char *hash, unsigned int *hash_len)
{
- struct scatterlist sl = {0};
+ struct scatterlist sl;
struct hash_desc hdesc;
int err;
const struct cfs_crypto_hash_type *type;
crypto_free_hash(hdesc.tfm);
return -ENOSPC;
}
- sg_set_buf(&sl, (void *)buf, buf_len);
+ sg_init_one(&sl, (void *)buf, buf_len);
hdesc.flags = 0;
err = crypto_hash_digest(&hdesc, &sl, sl.length, hash);
cfs_page_t *page, unsigned int offset,
unsigned int len)
{
- struct scatterlist sl = {0};
+ struct scatterlist sl;
+ sg_init_table(&sl, 1);
sg_set_page(&sl, page, len, offset & ~CFS_PAGE_MASK);
return crypto_hash_update((struct hash_desc *)hdesc, &sl, sl.length);
int cfs_crypto_hash_update(struct cfs_crypto_hash_desc *hdesc,
const void *buf, unsigned int buf_len)
{
- struct scatterlist sl = {0};
+ struct scatterlist sl;
- sg_set_buf(&sl, (void *)buf, buf_len);
+ sg_init_one(&sl, (void *)buf, buf_len);
return crypto_hash_update((struct hash_desc *)hdesc, &sl, sl.length);
}
if (tx->tx_frags == NULL)
break;
+ sg_init_table(tx->tx_frags, IBLND_MAX_RDMA_FRAGS);
+
LIBCFS_CPT_ALLOC(tx->tx_wrq, lnet_cpt_table(), ps->ps_cpt,
(1 + IBLND_MAX_RDMA_FRAGS) *
sizeof(*tx->tx_wrq));
fragnob = min((int)(kiov->kiov_len - offset), nob);
- memset(sg, 0, sizeof(*sg));
sg_set_page(sg, kiov->kiov_page, fragnob,
kiov->kiov_offset + offset);
sg++;