* Cleanup, no functional change.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37861 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
81fcd71e3a
commit
1ffa502964
@ -57,83 +57,83 @@ class Inode;
|
|||||||
|
|
||||||
|
|
||||||
class RingBuffer {
|
class RingBuffer {
|
||||||
public:
|
public:
|
||||||
RingBuffer();
|
RingBuffer();
|
||||||
~RingBuffer();
|
~RingBuffer();
|
||||||
|
|
||||||
status_t CreateBuffer();
|
status_t CreateBuffer();
|
||||||
void DeleteBuffer();
|
void DeleteBuffer();
|
||||||
|
|
||||||
size_t Write(const void *buffer, size_t length);
|
size_t Write(const void* buffer, size_t length);
|
||||||
size_t Read(void *buffer, size_t length);
|
size_t Read(void* buffer, size_t length);
|
||||||
ssize_t UserWrite(const void *buffer, ssize_t length);
|
ssize_t UserWrite(const void* buffer, ssize_t length);
|
||||||
ssize_t UserRead(void *buffer, ssize_t length);
|
ssize_t UserRead(void* buffer, ssize_t length);
|
||||||
|
|
||||||
|
size_t Readable() const;
|
||||||
|
size_t Writable() const;
|
||||||
|
|
||||||
size_t Readable() const;
|
private:
|
||||||
size_t Writable() const;
|
struct ring_buffer* fBuffer;
|
||||||
|
|
||||||
private:
|
|
||||||
struct ring_buffer *fBuffer;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class ReadRequest : public DoublyLinkedListLinkImpl<ReadRequest> {
|
class ReadRequest : public DoublyLinkedListLinkImpl<ReadRequest> {
|
||||||
public:
|
public:
|
||||||
ReadRequest(file_cookie* cookie)
|
ReadRequest(file_cookie* cookie)
|
||||||
:
|
:
|
||||||
fThread(thread_get_current_thread()),
|
fThread(thread_get_current_thread()),
|
||||||
fCookie(cookie),
|
fCookie(cookie),
|
||||||
fNotified(true)
|
fNotified(true)
|
||||||
{
|
{
|
||||||
B_INITIALIZE_SPINLOCK(&fLock);
|
B_INITIALIZE_SPINLOCK(&fLock);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetNotified(bool notified)
|
||||||
|
{
|
||||||
|
InterruptsSpinLocker _(fLock);
|
||||||
|
fNotified = notified;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Notify(status_t status = B_OK)
|
||||||
|
{
|
||||||
|
InterruptsSpinLocker _(fLock);
|
||||||
|
TRACE("ReadRequest %p::Notify(), fNotified %d\n", this, fNotified);
|
||||||
|
|
||||||
|
if (!fNotified) {
|
||||||
|
SpinLocker threadLocker(gThreadSpinlock);
|
||||||
|
thread_unblock_locked(fThread, status);
|
||||||
|
fNotified = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void SetNotified(bool notified)
|
file_cookie* Cookie() const
|
||||||
{
|
{
|
||||||
InterruptsSpinLocker _(fLock);
|
return fCookie;
|
||||||
fNotified = notified;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void Notify(status_t status = B_OK)
|
private:
|
||||||
{
|
spinlock fLock;
|
||||||
InterruptsSpinLocker _(fLock);
|
struct thread* fThread;
|
||||||
TRACE("ReadRequest %p::Notify(), fNotified %d\n", this, fNotified);
|
file_cookie* fCookie;
|
||||||
|
volatile bool fNotified;
|
||||||
if (!fNotified) {
|
|
||||||
SpinLocker threadLocker(gThreadSpinlock);
|
|
||||||
thread_unblock_locked(fThread, status);
|
|
||||||
fNotified = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
file_cookie* Cookie() const
|
|
||||||
{
|
|
||||||
return fCookie;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
spinlock fLock;
|
|
||||||
struct thread* fThread;
|
|
||||||
file_cookie* fCookie;
|
|
||||||
volatile bool fNotified;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class WriteRequest : public DoublyLinkedListLinkImpl<WriteRequest> {
|
class WriteRequest : public DoublyLinkedListLinkImpl<WriteRequest> {
|
||||||
public:
|
public:
|
||||||
WriteRequest(size_t minimalWriteCount)
|
WriteRequest(size_t minimalWriteCount)
|
||||||
:
|
:
|
||||||
fMinimalWriteCount(minimalWriteCount)
|
fMinimalWriteCount(minimalWriteCount)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t MinimalWriteCount() const
|
size_t MinimalWriteCount() const
|
||||||
{
|
{
|
||||||
return fMinimalWriteCount;
|
return fMinimalWriteCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
size_t fMinimalWriteCount;
|
size_t fMinimalWriteCount;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -142,65 +142,70 @@ typedef DoublyLinkedList<WriteRequest> WriteRequestList;
|
|||||||
|
|
||||||
|
|
||||||
class Inode {
|
class Inode {
|
||||||
public:
|
public:
|
||||||
Inode();
|
Inode();
|
||||||
~Inode();
|
~Inode();
|
||||||
|
|
||||||
status_t InitCheck();
|
status_t InitCheck();
|
||||||
|
|
||||||
bool IsActive() const { return fActive; }
|
bool IsActive() const { return fActive; }
|
||||||
timespec CreationTime() const { return fCreationTime; }
|
timespec CreationTime() const { return fCreationTime; }
|
||||||
void SetCreationTime(timespec creationTime)
|
void SetCreationTime(timespec creationTime)
|
||||||
{ fCreationTime = creationTime; }
|
{ fCreationTime = creationTime; }
|
||||||
timespec ModificationTime() const { return fModificationTime; }
|
timespec ModificationTime() const
|
||||||
void SetModificationTime(timespec modificationTime)
|
{ return fModificationTime; }
|
||||||
{ fModificationTime = modificationTime; }
|
void SetModificationTime(timespec modificationTime)
|
||||||
|
{ fModificationTime = modificationTime; }
|
||||||
|
|
||||||
|
mutex* RequestLock() { return &fRequestLock; }
|
||||||
|
|
||||||
|
status_t WriteDataToBuffer(const void* data,
|
||||||
|
size_t* _length, bool nonBlocking);
|
||||||
|
status_t ReadDataFromBuffer(void* data, size_t* _length,
|
||||||
|
bool nonBlocking, ReadRequest& request);
|
||||||
|
size_t BytesAvailable() const
|
||||||
|
{ return fBuffer.Readable(); }
|
||||||
|
size_t BytesWritable() const
|
||||||
|
{ return fBuffer.Writable(); }
|
||||||
|
|
||||||
|
void AddReadRequest(ReadRequest& request);
|
||||||
|
void RemoveReadRequest(ReadRequest& request);
|
||||||
|
status_t WaitForReadRequest(ReadRequest& request);
|
||||||
|
|
||||||
|
void NotifyBytesRead(size_t bytes);
|
||||||
|
void NotifyReadDone();
|
||||||
|
void NotifyBytesWritten(size_t bytes);
|
||||||
|
void NotifyEndClosed(bool writer);
|
||||||
|
|
||||||
|
void Open(int openMode);
|
||||||
|
void Close(int openMode, file_cookie* cookie);
|
||||||
|
int32 ReaderCount() const { return fReaderCount; }
|
||||||
|
int32 WriterCount() const { return fWriterCount; }
|
||||||
|
|
||||||
|
status_t Select(uint8 event, selectsync* sync,
|
||||||
|
int openMode);
|
||||||
|
status_t Deselect(uint8 event, selectsync* sync,
|
||||||
|
int openMode);
|
||||||
|
|
||||||
mutex *RequestLock() { return &fRequestLock; }
|
private:
|
||||||
|
timespec fCreationTime;
|
||||||
status_t WriteDataToBuffer(const void *data, size_t *_length,
|
timespec fModificationTime;
|
||||||
bool nonBlocking);
|
|
||||||
status_t ReadDataFromBuffer(void *data, size_t *_length,
|
RingBuffer fBuffer;
|
||||||
bool nonBlocking, ReadRequest &request);
|
|
||||||
size_t BytesAvailable() const { return fBuffer.Readable(); }
|
ReadRequestList fReadRequests;
|
||||||
size_t BytesWritable() const { return fBuffer.Writable(); }
|
WriteRequestList fWriteRequests;
|
||||||
|
|
||||||
void AddReadRequest(ReadRequest &request);
|
mutex fRequestLock;
|
||||||
void RemoveReadRequest(ReadRequest &request);
|
|
||||||
status_t WaitForReadRequest(ReadRequest &request);
|
ConditionVariable fWriteCondition;
|
||||||
|
|
||||||
void NotifyBytesRead(size_t bytes);
|
int32 fReaderCount;
|
||||||
void NotifyReadDone();
|
int32 fWriterCount;
|
||||||
void NotifyBytesWritten(size_t bytes);
|
bool fActive;
|
||||||
void NotifyEndClosed(bool writer);
|
|
||||||
|
select_sync_pool* fReadSelectSyncPool;
|
||||||
void Open(int openMode);
|
select_sync_pool* fWriteSelectSyncPool;
|
||||||
void Close(int openMode, file_cookie* cookie);
|
|
||||||
int32 ReaderCount() const { return fReaderCount; }
|
|
||||||
int32 WriterCount() const { return fWriterCount; }
|
|
||||||
|
|
||||||
status_t Select(uint8 event, selectsync *sync, int openMode);
|
|
||||||
status_t Deselect(uint8 event, selectsync *sync, int openMode);
|
|
||||||
|
|
||||||
private:
|
|
||||||
timespec fCreationTime;
|
|
||||||
timespec fModificationTime;
|
|
||||||
|
|
||||||
RingBuffer fBuffer;
|
|
||||||
|
|
||||||
ReadRequestList fReadRequests;
|
|
||||||
WriteRequestList fWriteRequests;
|
|
||||||
|
|
||||||
mutex fRequestLock;
|
|
||||||
|
|
||||||
ConditionVariable fWriteCondition;
|
|
||||||
|
|
||||||
int32 fReaderCount;
|
|
||||||
int32 fWriterCount;
|
|
||||||
bool fActive;
|
|
||||||
|
|
||||||
select_sync_pool *fReadSelectSyncPool;
|
|
||||||
select_sync_pool *fWriteSelectSyncPool;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -229,7 +234,8 @@ struct file_cookie {
|
|||||||
|
|
||||||
|
|
||||||
RingBuffer::RingBuffer()
|
RingBuffer::RingBuffer()
|
||||||
: fBuffer(NULL)
|
:
|
||||||
|
fBuffer(NULL)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -247,7 +253,7 @@ RingBuffer::CreateBuffer()
|
|||||||
return B_OK;
|
return B_OK;
|
||||||
|
|
||||||
fBuffer = create_ring_buffer(PIPEFS_MAX_BUFFER_SIZE);
|
fBuffer = create_ring_buffer(PIPEFS_MAX_BUFFER_SIZE);
|
||||||
return (fBuffer != NULL ? B_OK : B_NO_MEMORY);
|
return fBuffer != NULL ? B_OK : B_NO_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -262,56 +268,56 @@ RingBuffer::DeleteBuffer()
|
|||||||
|
|
||||||
|
|
||||||
inline size_t
|
inline size_t
|
||||||
RingBuffer::Write(const void *buffer, size_t length)
|
RingBuffer::Write(const void* buffer, size_t length)
|
||||||
{
|
{
|
||||||
if (fBuffer == NULL)
|
if (fBuffer == NULL)
|
||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
|
|
||||||
return ring_buffer_write(fBuffer, (const uint8 *)buffer, length);
|
return ring_buffer_write(fBuffer, (const uint8*)buffer, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline size_t
|
inline size_t
|
||||||
RingBuffer::Read(void *buffer, size_t length)
|
RingBuffer::Read(void* buffer, size_t length)
|
||||||
{
|
{
|
||||||
if (fBuffer == NULL)
|
if (fBuffer == NULL)
|
||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
|
|
||||||
return ring_buffer_read(fBuffer, (uint8 *)buffer, length);
|
return ring_buffer_read(fBuffer, (uint8*)buffer, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline ssize_t
|
inline ssize_t
|
||||||
RingBuffer::UserWrite(const void *buffer, ssize_t length)
|
RingBuffer::UserWrite(const void* buffer, ssize_t length)
|
||||||
{
|
{
|
||||||
if (fBuffer == NULL)
|
if (fBuffer == NULL)
|
||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
|
|
||||||
return ring_buffer_user_write(fBuffer, (const uint8 *)buffer, length);
|
return ring_buffer_user_write(fBuffer, (const uint8*)buffer, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline ssize_t
|
inline ssize_t
|
||||||
RingBuffer::UserRead(void *buffer, ssize_t length)
|
RingBuffer::UserRead(void* buffer, ssize_t length)
|
||||||
{
|
{
|
||||||
if (fBuffer == NULL)
|
if (fBuffer == NULL)
|
||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
|
|
||||||
return ring_buffer_user_read(fBuffer, (uint8 *)buffer, length);
|
return ring_buffer_user_read(fBuffer, (uint8*)buffer, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline size_t
|
inline size_t
|
||||||
RingBuffer::Readable() const
|
RingBuffer::Readable() const
|
||||||
{
|
{
|
||||||
return (fBuffer != NULL ? ring_buffer_readable(fBuffer) : 0);
|
return fBuffer != NULL ? ring_buffer_readable(fBuffer) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline size_t
|
inline size_t
|
||||||
RingBuffer::Writable() const
|
RingBuffer::Writable() const
|
||||||
{
|
{
|
||||||
return (fBuffer != NULL ? ring_buffer_writable(fBuffer) : 0);
|
return fBuffer != NULL ? ring_buffer_writable(fBuffer) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -360,7 +366,7 @@ Inode::InitCheck()
|
|||||||
the returned length is > 0, the returned error code can be ignored.
|
the returned length is > 0, the returned error code can be ignored.
|
||||||
*/
|
*/
|
||||||
status_t
|
status_t
|
||||||
Inode::WriteDataToBuffer(const void *_data, size_t *_length, bool nonBlocking)
|
Inode::WriteDataToBuffer(const void* _data, size_t* _length, bool nonBlocking)
|
||||||
{
|
{
|
||||||
const uint8* data = (const uint8*)_data;
|
const uint8* data = (const uint8*)_data;
|
||||||
size_t dataSize = *_length;
|
size_t dataSize = *_length;
|
||||||
@ -427,8 +433,8 @@ Inode::WriteDataToBuffer(const void *_data, size_t *_length, bool nonBlocking)
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
Inode::ReadDataFromBuffer(void *data, size_t *_length, bool nonBlocking,
|
Inode::ReadDataFromBuffer(void* data, size_t* _length, bool nonBlocking,
|
||||||
ReadRequest &request)
|
ReadRequest& request)
|
||||||
{
|
{
|
||||||
size_t dataSize = *_length;
|
size_t dataSize = *_length;
|
||||||
*_length = 0;
|
*_length = 0;
|
||||||
@ -480,21 +486,21 @@ Inode::ReadDataFromBuffer(void *data, size_t *_length, bool nonBlocking,
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Inode::AddReadRequest(ReadRequest &request)
|
Inode::AddReadRequest(ReadRequest& request)
|
||||||
{
|
{
|
||||||
fReadRequests.Add(&request);
|
fReadRequests.Add(&request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Inode::RemoveReadRequest(ReadRequest &request)
|
Inode::RemoveReadRequest(ReadRequest& request)
|
||||||
{
|
{
|
||||||
fReadRequests.Remove(&request);
|
fReadRequests.Remove(&request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
Inode::WaitForReadRequest(ReadRequest &request)
|
Inode::WaitForReadRequest(ReadRequest& request)
|
||||||
{
|
{
|
||||||
// add the entry to wait on
|
// add the entry to wait on
|
||||||
thread_prepare_to_block(thread_get_current_thread(), B_CAN_INTERRUPT,
|
thread_prepare_to_block(thread_get_current_thread(), B_CAN_INTERRUPT,
|
||||||
@ -531,7 +537,7 @@ Inode::NotifyBytesRead(size_t bytes)
|
|||||||
// If any of the waiting writers has a minimal write count that has
|
// If any of the waiting writers has a minimal write count that has
|
||||||
// now become satisfied, we notify all of them (condition variables
|
// now become satisfied, we notify all of them (condition variables
|
||||||
// don't support doing that selectively).
|
// don't support doing that selectively).
|
||||||
WriteRequest *request;
|
WriteRequest* request;
|
||||||
WriteRequestList::Iterator iterator = fWriteRequests.GetIterator();
|
WriteRequestList::Iterator iterator = fWriteRequests.GetIterator();
|
||||||
while ((request = iterator.Next()) != NULL) {
|
while ((request = iterator.Next()) != NULL) {
|
||||||
size_t minWriteCount = request->MinimalWriteCount();
|
size_t minWriteCount = request->MinimalWriteCount();
|
||||||
@ -655,7 +661,7 @@ Inode::Close(int openMode, file_cookie* cookie)
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
Inode::Select(uint8 event, selectsync *sync, int openMode)
|
Inode::Select(uint8 event, selectsync* sync, int openMode)
|
||||||
{
|
{
|
||||||
bool writer = true;
|
bool writer = true;
|
||||||
select_sync_pool** pool;
|
select_sync_pool** pool;
|
||||||
@ -689,7 +695,7 @@ Inode::Select(uint8 event, selectsync *sync, int openMode)
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
Inode::Deselect(uint8 event, selectsync *sync, int openMode)
|
Inode::Deselect(uint8 event, selectsync* sync, int openMode)
|
||||||
{
|
{
|
||||||
select_sync_pool** pool;
|
select_sync_pool** pool;
|
||||||
if ((openMode & O_RWMASK) == O_RDONLY) {
|
if ((openMode & O_RWMASK) == O_RDONLY) {
|
||||||
@ -704,11 +710,11 @@ Inode::Deselect(uint8 event, selectsync *sync, int openMode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark - vnode API
|
||||||
|
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
fifo_put_vnode(fs_volume *volume, fs_vnode *vnode, bool reenter)
|
fifo_put_vnode(fs_volume* volume, fs_vnode* vnode, bool reenter)
|
||||||
{
|
{
|
||||||
FIFOInode* fifo = (FIFOInode*)vnode->private_node;
|
FIFOInode* fifo = (FIFOInode*)vnode->private_node;
|
||||||
fs_vnode* superVnode = fifo->SuperVnode();
|
fs_vnode* superVnode = fifo->SuperVnode();
|
||||||
@ -724,7 +730,7 @@ fifo_put_vnode(fs_volume *volume, fs_vnode *vnode, bool reenter)
|
|||||||
|
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
fifo_remove_vnode(fs_volume *volume, fs_vnode *vnode, bool reenter)
|
fifo_remove_vnode(fs_volume* volume, fs_vnode* vnode, bool reenter)
|
||||||
{
|
{
|
||||||
FIFOInode* fifo = (FIFOInode*)vnode->private_node;
|
FIFOInode* fifo = (FIFOInode*)vnode->private_node;
|
||||||
fs_vnode* superVnode = fifo->SuperVnode();
|
fs_vnode* superVnode = fifo->SuperVnode();
|
||||||
@ -740,14 +746,14 @@ fifo_remove_vnode(fs_volume *volume, fs_vnode *vnode, bool reenter)
|
|||||||
|
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
fifo_open(fs_volume *_volume, fs_vnode *_node, int openMode,
|
fifo_open(fs_volume* _volume, fs_vnode* _node, int openMode,
|
||||||
void **_cookie)
|
void** _cookie)
|
||||||
{
|
{
|
||||||
Inode *inode = (Inode *)_node->private_node;
|
Inode* inode = (Inode*)_node->private_node;
|
||||||
|
|
||||||
TRACE("fifo_open(): node = %p, openMode = %d\n", inode, openMode);
|
TRACE("fifo_open(): node = %p, openMode = %d\n", inode, openMode);
|
||||||
|
|
||||||
file_cookie *cookie = (file_cookie *)malloc(sizeof(file_cookie));
|
file_cookie* cookie = (file_cookie*)malloc(sizeof(file_cookie));
|
||||||
if (cookie == NULL)
|
if (cookie == NULL)
|
||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
|
|
||||||
@ -755,16 +761,16 @@ fifo_open(fs_volume *_volume, fs_vnode *_node, int openMode,
|
|||||||
cookie->open_mode = openMode;
|
cookie->open_mode = openMode;
|
||||||
inode->Open(openMode);
|
inode->Open(openMode);
|
||||||
|
|
||||||
*_cookie = (void *)cookie;
|
*_cookie = (void*)cookie;
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
fifo_close(fs_volume *volume, fs_vnode *vnode, void *_cookie)
|
fifo_close(fs_volume* volume, fs_vnode* vnode, void* _cookie)
|
||||||
{
|
{
|
||||||
file_cookie *cookie = (file_cookie *)_cookie;
|
file_cookie* cookie = (file_cookie*)_cookie;
|
||||||
FIFOInode* fifo = (FIFOInode*)vnode->private_node;
|
FIFOInode* fifo = (FIFOInode*)vnode->private_node;
|
||||||
|
|
||||||
fifo->Close(cookie->open_mode, cookie);
|
fifo->Close(cookie->open_mode, cookie);
|
||||||
@ -774,9 +780,9 @@ fifo_close(fs_volume *volume, fs_vnode *vnode, void *_cookie)
|
|||||||
|
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
fifo_free_cookie(fs_volume *_volume, fs_vnode *_node, void *_cookie)
|
fifo_free_cookie(fs_volume* _volume, fs_vnode* _node, void* _cookie)
|
||||||
{
|
{
|
||||||
file_cookie *cookie = (file_cookie *)_cookie;
|
file_cookie* cookie = (file_cookie*)_cookie;
|
||||||
|
|
||||||
TRACE("fifo_freecookie: entry vnode %p, cookie %p\n", _node, _cookie);
|
TRACE("fifo_freecookie: entry vnode %p, cookie %p\n", _node, _cookie);
|
||||||
|
|
||||||
@ -787,18 +793,18 @@ fifo_free_cookie(fs_volume *_volume, fs_vnode *_node, void *_cookie)
|
|||||||
|
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
fifo_fsync(fs_volume *_volume, fs_vnode *_v)
|
fifo_fsync(fs_volume* _volume, fs_vnode* _node)
|
||||||
{
|
{
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
fifo_read(fs_volume *_volume, fs_vnode *_node, void *_cookie,
|
fifo_read(fs_volume* _volume, fs_vnode* _node, void* _cookie,
|
||||||
off_t /*pos*/, void *buffer, size_t *_length)
|
off_t /*pos*/, void* buffer, size_t* _length)
|
||||||
{
|
{
|
||||||
file_cookie *cookie = (file_cookie *)_cookie;
|
file_cookie* cookie = (file_cookie*)_cookie;
|
||||||
Inode *inode = (Inode *)_node->private_node;
|
Inode* inode = (Inode*)_node->private_node;
|
||||||
|
|
||||||
TRACE("fifo_read(vnode = %p, cookie = %p, length = %lu, mode = %d)\n",
|
TRACE("fifo_read(vnode = %p, cookie = %p, length = %lu, mode = %d)\n",
|
||||||
inode, cookie, *_length, cookie->open_mode);
|
inode, cookie, *_length, cookie->open_mode);
|
||||||
@ -842,11 +848,11 @@ fifo_read(fs_volume *_volume, fs_vnode *_node, void *_cookie,
|
|||||||
|
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
fifo_write(fs_volume *_volume, fs_vnode *_node, void *_cookie,
|
fifo_write(fs_volume* _volume, fs_vnode* _node, void* _cookie,
|
||||||
off_t /*pos*/, const void *buffer, size_t *_length)
|
off_t /*pos*/, const void* buffer, size_t* _length)
|
||||||
{
|
{
|
||||||
file_cookie *cookie = (file_cookie *)_cookie;
|
file_cookie* cookie = (file_cookie*)_cookie;
|
||||||
Inode *inode = (Inode *)_node->private_node;
|
Inode* inode = (Inode*)_node->private_node;
|
||||||
|
|
||||||
TRACE("fifo_write(vnode = %p, cookie = %p, length = %lu)\n",
|
TRACE("fifo_write(vnode = %p, cookie = %p, length = %lu)\n",
|
||||||
_node, cookie, *_length);
|
_node, cookie, *_length);
|
||||||
@ -873,7 +879,7 @@ fifo_write(fs_volume *_volume, fs_vnode *_node, void *_cookie,
|
|||||||
|
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
fifo_read_stat(fs_volume *volume, fs_vnode *vnode, struct ::stat *st)
|
fifo_read_stat(fs_volume* volume, fs_vnode* vnode, struct ::stat* st)
|
||||||
{
|
{
|
||||||
FIFOInode* fifo = (FIFOInode*)vnode->private_node;
|
FIFOInode* fifo = (FIFOInode*)vnode->private_node;
|
||||||
fs_vnode* superVnode = fifo->SuperVnode();
|
fs_vnode* superVnode = fifo->SuperVnode();
|
||||||
@ -902,7 +908,7 @@ fifo_read_stat(fs_volume *volume, fs_vnode *vnode, struct ::stat *st)
|
|||||||
|
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
fifo_write_stat(fs_volume *volume, fs_vnode *vnode, const struct ::stat *st,
|
fifo_write_stat(fs_volume* volume, fs_vnode* vnode, const struct ::stat* st,
|
||||||
uint32 statMask)
|
uint32 statMask)
|
||||||
{
|
{
|
||||||
// we cannot change the size of anything
|
// we cannot change the size of anything
|
||||||
@ -925,8 +931,8 @@ fifo_write_stat(fs_volume *volume, fs_vnode *vnode, const struct ::stat *st,
|
|||||||
|
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
fifo_ioctl(fs_volume *_volume, fs_vnode *_vnode, void *_cookie, uint32 op,
|
fifo_ioctl(fs_volume* _volume, fs_vnode* _vnode, void* _cookie, uint32 op,
|
||||||
void *buffer, size_t length)
|
void* buffer, size_t length)
|
||||||
{
|
{
|
||||||
TRACE("fifo_ioctl: vnode %p, cookie %p, op %ld, buf %p, len %ld\n",
|
TRACE("fifo_ioctl: vnode %p, cookie %p, op %ld, buf %p, len %ld\n",
|
||||||
_vnode, _cookie, op, buffer, length);
|
_vnode, _cookie, op, buffer, length);
|
||||||
@ -936,10 +942,10 @@ fifo_ioctl(fs_volume *_volume, fs_vnode *_vnode, void *_cookie, uint32 op,
|
|||||||
|
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
fifo_set_flags(fs_volume *_volume, fs_vnode *_vnode, void *_cookie,
|
fifo_set_flags(fs_volume* _volume, fs_vnode* _vnode, void* _cookie,
|
||||||
int flags)
|
int flags)
|
||||||
{
|
{
|
||||||
file_cookie *cookie = (file_cookie *)_cookie;
|
file_cookie* cookie = (file_cookie*)_cookie;
|
||||||
|
|
||||||
TRACE("fifo_set_flags(vnode = %p, flags = %x)\n", _vnode, flags);
|
TRACE("fifo_set_flags(vnode = %p, flags = %x)\n", _vnode, flags);
|
||||||
cookie->open_mode = (cookie->open_mode & ~(O_APPEND | O_NONBLOCK)) | flags;
|
cookie->open_mode = (cookie->open_mode & ~(O_APPEND | O_NONBLOCK)) | flags;
|
||||||
@ -948,13 +954,13 @@ fifo_set_flags(fs_volume *_volume, fs_vnode *_vnode, void *_cookie,
|
|||||||
|
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
fifo_select(fs_volume *_volume, fs_vnode *_node, void *_cookie,
|
fifo_select(fs_volume* _volume, fs_vnode* _node, void* _cookie,
|
||||||
uint8 event, selectsync *sync)
|
uint8 event, selectsync* sync)
|
||||||
{
|
{
|
||||||
file_cookie *cookie = (file_cookie *)_cookie;
|
file_cookie* cookie = (file_cookie*)_cookie;
|
||||||
|
|
||||||
TRACE("fifo_select(vnode = %p)\n", _node);
|
TRACE("fifo_select(vnode = %p)\n", _node);
|
||||||
Inode *inode = (Inode *)_node->private_node;
|
Inode* inode = (Inode*)_node->private_node;
|
||||||
if (!inode)
|
if (!inode)
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|
||||||
@ -964,14 +970,14 @@ fifo_select(fs_volume *_volume, fs_vnode *_node, void *_cookie,
|
|||||||
|
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
fifo_deselect(fs_volume *_volume, fs_vnode *_node, void *_cookie,
|
fifo_deselect(fs_volume* _volume, fs_vnode* _node, void* _cookie,
|
||||||
uint8 event, selectsync *sync)
|
uint8 event, selectsync* sync)
|
||||||
{
|
{
|
||||||
file_cookie *cookie = (file_cookie *)_cookie;
|
file_cookie* cookie = (file_cookie*)_cookie;
|
||||||
|
|
||||||
TRACE("fifo_deselect(vnode = %p)\n", _node);
|
TRACE("fifo_deselect(vnode = %p)\n", _node);
|
||||||
Inode *inode = (Inode *)_node->private_node;
|
Inode* inode = (Inode*)_node->private_node;
|
||||||
if (!inode)
|
if (inode == NULL)
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|
||||||
MutexLocker locker(inode->RequestLock());
|
MutexLocker locker(inode->RequestLock());
|
||||||
@ -980,31 +986,31 @@ fifo_deselect(fs_volume *_volume, fs_vnode *_node, void *_cookie,
|
|||||||
|
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
fifo_can_page(fs_volume *_volume, fs_vnode *_v, void *cookie)
|
fifo_can_page(fs_volume* _volume, fs_vnode* _node, void* cookie)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
fifo_read_pages(fs_volume *_volume, fs_vnode *_v, void *cookie, off_t pos,
|
fifo_read_pages(fs_volume* _volume, fs_vnode* _node, void* cookie, off_t pos,
|
||||||
const iovec *vecs, size_t count, size_t *_numBytes)
|
const iovec* vecs, size_t count, size_t* _numBytes)
|
||||||
{
|
{
|
||||||
return B_NOT_ALLOWED;
|
return B_NOT_ALLOWED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
fifo_write_pages(fs_volume *_volume, fs_vnode *_v, void *cookie,
|
fifo_write_pages(fs_volume* _volume, fs_vnode* _node, void* cookie,
|
||||||
off_t pos, const iovec *vecs, size_t count, size_t *_numBytes)
|
off_t pos, const iovec* vecs, size_t count, size_t* _numBytes)
|
||||||
{
|
{
|
||||||
return B_NOT_ALLOWED;
|
return B_NOT_ALLOWED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
fifo_get_super_vnode(fs_volume *volume, fs_vnode *vnode, fs_volume *superVolume,
|
fifo_get_super_vnode(fs_volume* volume, fs_vnode* vnode, fs_volume* superVolume,
|
||||||
fs_vnode *_superVnode)
|
fs_vnode* _superVnode)
|
||||||
{
|
{
|
||||||
FIFOInode* fifo = (FIFOInode*)vnode->private_node;
|
FIFOInode* fifo = (FIFOInode*)vnode->private_node;
|
||||||
fs_vnode* superVnode = fifo->SuperVnode();
|
fs_vnode* superVnode = fifo->SuperVnode();
|
||||||
@ -1100,6 +1106,7 @@ static fs_vnode_ops sFIFOVnodeOps = {
|
|||||||
|
|
||||||
} // namespace fifo
|
} // namespace fifo
|
||||||
|
|
||||||
|
|
||||||
using namespace fifo;
|
using namespace fifo;
|
||||||
|
|
||||||
|
|
||||||
@ -1109,7 +1116,7 @@ using namespace fifo;
|
|||||||
status_t
|
status_t
|
||||||
create_fifo_vnode(fs_volume* superVolume, fs_vnode* vnode)
|
create_fifo_vnode(fs_volume* superVolume, fs_vnode* vnode)
|
||||||
{
|
{
|
||||||
FIFOInode *fifo = new(std::nothrow) FIFOInode(vnode);
|
FIFOInode* fifo = new(std::nothrow) FIFOInode(vnode);
|
||||||
if (fifo == NULL)
|
if (fifo == NULL)
|
||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user