libiscsi.c (eadcbfa58ae8693f0d6a0f591d8f51d55cf068e1) libiscsi.c (bfcc62ed7066268349e8e7955925bdaf4be0eec0)
1/*
2 * iSCSI lib functions
3 *
4 * Copyright (C) 2006 Red Hat, Inc. All rights reserved.
5 * Copyright (C) 2004 - 2006 Mike Christie
6 * Copyright (C) 2004 - 2005 Dmitry Yusupov
7 * Copyright (C) 2004 - 2005 Alex Aizman
8 * maintained by open-iscsi@googlegroups.com

--- 2542 unchanged lines hidden (view full) ---

2551 memset(q, 0, sizeof(*q));
2552
2553 q->max = max;
2554
2555 /* If the user passed an items pointer, he wants a copy of
2556 * the array. */
2557 if (items)
2558 num_arrays++;
1/*
2 * iSCSI lib functions
3 *
4 * Copyright (C) 2006 Red Hat, Inc. All rights reserved.
5 * Copyright (C) 2004 - 2006 Mike Christie
6 * Copyright (C) 2004 - 2005 Dmitry Yusupov
7 * Copyright (C) 2004 - 2005 Alex Aizman
8 * maintained by open-iscsi@googlegroups.com

--- 2542 unchanged lines hidden (view full) ---

2551 memset(q, 0, sizeof(*q));
2552
2553 q->max = max;
2554
2555 /* If the user passed an items pointer, he wants a copy of
2556 * the array. */
2557 if (items)
2558 num_arrays++;
2559 q->pool = kzalloc(num_arrays * max * sizeof(void*), GFP_KERNEL);
2559 q->pool = kvzalloc(num_arrays * max * sizeof(void*), GFP_KERNEL);
2560 if (q->pool == NULL)
2561 return -ENOMEM;
2562
2563 kfifo_init(&q->queue, (void*)q->pool, max * sizeof(void*));
2564
2565 for (i = 0; i < max; i++) {
2566 q->pool[i] = kzalloc(item_size, GFP_KERNEL);
2567 if (q->pool[i] == NULL) {

--- 17 unchanged lines hidden (view full) ---

2585EXPORT_SYMBOL_GPL(iscsi_pool_init);
2586
2587void iscsi_pool_free(struct iscsi_pool *q)
2588{
2589 int i;
2590
2591 for (i = 0; i < q->max; i++)
2592 kfree(q->pool[i]);
2560 if (q->pool == NULL)
2561 return -ENOMEM;
2562
2563 kfifo_init(&q->queue, (void*)q->pool, max * sizeof(void*));
2564
2565 for (i = 0; i < max; i++) {
2566 q->pool[i] = kzalloc(item_size, GFP_KERNEL);
2567 if (q->pool[i] == NULL) {

--- 17 unchanged lines hidden (view full) ---

2585EXPORT_SYMBOL_GPL(iscsi_pool_init);
2586
2587void iscsi_pool_free(struct iscsi_pool *q)
2588{
2589 int i;
2590
2591 for (i = 0; i < q->max; i++)
2592 kfree(q->pool[i]);
2593 kfree(q->pool);
2593 kvfree(q->pool);
2594}
2595EXPORT_SYMBOL_GPL(iscsi_pool_free);
2596
2597/**
2598 * iscsi_host_add - add host to system
2599 * @shost: scsi host
2600 * @pdev: parent device
2601 *

--- 1050 unchanged lines hidden ---
2594}
2595EXPORT_SYMBOL_GPL(iscsi_pool_free);
2596
2597/**
2598 * iscsi_host_add - add host to system
2599 * @shost: scsi host
2600 * @pdev: parent device
2601 *

--- 1050 unchanged lines hidden ---