mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-28 17:30:18 +00:00
ibmvstgt: started backporting.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@2353 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -46,7 +46,10 @@
|
||||
#include <asm/vio.h>
|
||||
#else
|
||||
#include <linux/mod_devicetable.h>
|
||||
#endif
|
||||
#if defined(INSIDE_KERNEL_TREE) || defined(__powerpc__)
|
||||
#include <linux/of.h>
|
||||
#else
|
||||
#include "dummy_powerpc_defs.h"
|
||||
#endif
|
||||
|
||||
|
||||
@@ -60,15 +60,29 @@ static int srp_iu_pool_alloc(struct srp_queue *q, size_t max,
|
||||
goto free_pool;
|
||||
|
||||
spin_lock_init(&q->lock);
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33)
|
||||
q->queue = kfifo_init((void *) q->pool, max * sizeof(void *),
|
||||
GFP_KERNEL, &q->lock);
|
||||
if (IS_ERR(q->queue))
|
||||
goto free_item;
|
||||
#else
|
||||
kfifo_init(&q->queue, (void *) q->pool, max * sizeof(void *));
|
||||
#endif
|
||||
|
||||
for (i = 0, iue = q->items; i < max; i++) {
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33)
|
||||
__kfifo_put(q->queue, (void *) &iue, sizeof(void *));
|
||||
#else
|
||||
kfifo_in(&q->queue, (void *) &iue, sizeof(void *));
|
||||
#endif
|
||||
iue->sbuf = ring[i];
|
||||
iue++;
|
||||
}
|
||||
return 0;
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33)
|
||||
free_item:
|
||||
#endif
|
||||
kfree(q->items);
|
||||
free_pool:
|
||||
kfree(q->pool);
|
||||
@@ -165,11 +179,15 @@ struct iu_entry *srp_iu_get(struct srp_target *target)
|
||||
{
|
||||
struct iu_entry *iue = NULL;
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33)
|
||||
kfifo_get(target->iu_queue.queue, (void *) &iue, sizeof(void *));
|
||||
#else
|
||||
if (kfifo_out_locked(&target->iu_queue.queue, (void *) &iue,
|
||||
sizeof(void *), &target->iu_queue.lock) != sizeof(void *)) {
|
||||
WARN_ONCE(1, "unexpected fifo state");
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
if (!iue)
|
||||
return iue;
|
||||
iue->target = target;
|
||||
@@ -181,8 +199,12 @@ EXPORT_SYMBOL_GPL(srp_iu_get);
|
||||
|
||||
void srp_iu_put(struct iu_entry *iue)
|
||||
{
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33)
|
||||
kfifo_put(iue->target->iu_queue.queue, (void *) &iue, sizeof(void *));
|
||||
#else
|
||||
kfifo_in_locked(&iue->target->iu_queue.queue, (void *) &iue,
|
||||
sizeof(void *), &iue->target->iu_queue.lock);
|
||||
#endif
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(srp_iu_put);
|
||||
|
||||
|
||||
@@ -25,7 +25,11 @@ struct srp_buf {
|
||||
struct srp_queue {
|
||||
void *pool;
|
||||
void *items;
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33)
|
||||
struct kfifo *queue;
|
||||
#else
|
||||
struct kfifo queue;
|
||||
#endif
|
||||
spinlock_t lock;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user