/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* BSD 3 Clause License
*
* Copyright (c) 2007, The Storage Networking Industry Association.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* distribution.
*
* - Neither the name of The Storage Networking Industry Association (SNIA)
* nor the names of its contributors may be used to endorse or promote
* products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <pthread.h>
#include <synch.h>
#include <tlm_buffers.h>
#include <tlm.h>
#include "tlm_proto.h"
/*
* tlm_allocate_buffers
*
* build a set of buffers
*/
{
int buf;
if (buffers == 0)
return (0);
int i;
/* Memory allocation failed. Give everything back */
for (i = 0; i < buf; i++)
return (0);
} else {
? xfer_size : 0;
}
}
return (buffers);
}
/*
* tlm_release_buffers
*
* give all memory back to the OS
*/
void
{
int i;
for (i = 0; i < TLM_TAPE_BUFFERS; i++)
}
}
}
/*
* tlm_buffer_mark_empty
*
* Mark a buffer empty and clear its flags. No lock is take here:
* the buffer should be marked empty before it is released for use
* by another thread.
*/
void
{
return;
}
/*
* tlm_buffer_advance_in_idx
*
* Advance the input index of the buffers(round-robin) and return pointer
* to the next buffer in the buffer pool.
*/
{
return (NULL);
bufs->tbs_buffer_in = 0;
}
/*
* tlm_buffer_advance_out_idx
*
* Advance the output index of the buffers(round-robin) and return pointer
* to the next buffer in the buffer pool.
*/
{
return (NULL);
bufs->tbs_buffer_out = 0;
}
/*
* tlm_buffer_in_buf
*
* Return pointer to the next buffer in the buffer pool.
*/
{
return (NULL);
if (idx)
return (ret);
}
/*
* tlm_buffer_out_buf
*
* Return pointer to the next buffer in the buffer pool.
*/
{
return (NULL);
if (idx)
return (ret);
}
/*
* tlm_buffer_release_in_buf
*
* Another buffer is filled. Wake up the consumer if it's waiting for it.
*/
void
{
}
/*
* tlm_buffer_release_out_buf
*
* A buffer is used. Wake up the producer to re-fill a buffer if it's waiting
* for the buffer to be used.
*/
void
{
}
/*
* tlm_buffer_in_buf_wait
*
* Wait for the input buffer to get available.
*/
void
{
}
/*
* tlm_buffer_setup_timer
*
* Set up the time out value.
*/
static inline void
{
if (milli_timo == 0)
milli_timo = 1;
if (milli_timo / 1000)
else
}
/*
* tlm_buffer_in_buf_timed_wait
*
* Wait for the input buffer to get ready with a time out.
*/
void
{
/*
* TLM_BUF_IN_READY doesn't matter for timedwait but clear
* it here so that cond_wait doesn't get the wrong result.
*/
}
/*
* tlm_buffer_out_buf_timed_wait
*
* Wait for the output buffer to get ready with a time out.
*/
void
{
/*
* TLM_BUF_OUT_READY doesn't matter for timedwait but clear
* it here so that cond_wait doesn't get the wrong result.
*/
}
/*
* tlm_cmd_wait
*
* TLM command synchronization typically use by command
* parent threads to wait for launched threads to initialize.
*/
void
{
}
/*
* tlm_cmd_signal
*
* TLM command synchronization typically use by launched threads
* to unleash the parent thread.
*/
void
{
}