69 data->isReadClosed =
false;
70 data->isWriteClosed =
false;
74 data->writeEnd = file;
94 data->isReadClosed =
false;
95 data->isWriteClosed =
false;
111 if (
data->readEnd == file)
113 data->isReadClosed =
true;
115 if (
data->writeEnd == file)
117 data->isWriteClosed =
true;
121 if (
data->isWriteClosed &&
data->isReadClosed)
143 if (
data->readEnd != file)
182 if (
data->writeEnd != file)
211 if (
data->isReadClosed)
236 if ((file ==
data->readEnd &&
data->isWriteClosed) || (file ==
data->writeEnd &&
data->isReadClosed))
241 return &
data->waitQueue;
258 LOG_ERR(
"failed to initialize pipe directory");
266 LOG_ERR(
"failed to initialize pipe new file");
dentry_t * devfs_dir_new(dentry_t *parent, const char *name, const inode_ops_t *inodeOps, void *private)
Create a new directory inside a mounted devfs instance.
dentry_t * devfs_file_new(dentry_t *parent, const char *name, const inode_ops_t *inodeOps, const file_ops_t *fileOps, void *private)
Create a new file inside a mounted devfs instance.
#define LOG_ERR(format,...)
void pmm_free(void *address)
Frees a single physical page.
void * pmm_alloc(void)
Allocates a single physical page.
#define MODULE_INFO(_name, _author, _description, _version, _licence, _deviceTypes)
Macro to define module information.
uint64_t wait_unblock(wait_queue_t *queue, uint64_t amount, errno_t err)
Unblock threads waiting on a wait queue.
void wait_queue_deinit(wait_queue_t *queue)
Deinitialize wait queue.
#define WAIT_ALL
Used to indicate that the wait should unblock all waiting threads.
void wait_queue_init(wait_queue_t *queue)
Initialize wait queue.
#define WAIT_BLOCK_LOCK(queue, lock, condition)
Blocks until the condition is true, condition will be tested on every wakeup. Will release the lock b...
static void lock_init(lock_t *lock)
Initializes a lock.
#define LOCK_SCOPE(lock)
Acquires a lock for the reminder of the current scope.
static void lock_release(lock_t *lock)
Releases a lock.
static void lock_acquire(lock_t *lock)
Acquires a lock, blocking until it is available.
void fifo_init(fifo_t *fifo, uint8_t *buffer, size_t size)
Initialize a fifo buffer.
size_t fifo_bytes_writeable(const fifo_t *fifo)
Return the number of bytes available for writing in a fifo buffer.
size_t fifo_bytes_readable(const fifo_t *fifo)
Return the number of bytes available for reading in a fifo buffer.
size_t fifo_write(fifo_t *fifo, const void *buffer, size_t count)
Write data to the fifo buffer.
size_t fifo_read(fifo_t *fifo, void *buffer, size_t count)
Read data from a fifo buffer at a specific offset.
#define UNREF(ptr)
Decrement reference count.
#define EINVAL
Invalid argument.
#define ENOSYS
Function not implemented.
#define EPIPE
Broken pipe.
#define errno
Error number variable.
#define UNUSED(x)
Mark a variable as unused.
#define PIPE_READ
Pipe read end.
#define PIPE_WRITE
Pipe write end.
poll_events_t
Poll events type.
@ POLLIN
File descriptor is ready to read.
@ POLLHUP
Stream socket peer closed connection, or shut down writing of connection.
@ POLLOUT
File descriptor is ready to write.
#define PAGE_SIZE
The size of a memory page in bytes.
#define NULL
Pointer error value.
#define ERR
Integer error value.
static uint64_t pipe_open(file_t *file)
static dentry_t * pipeDir
static void pipe_close(file_t *file)
static uint64_t pipe_read(file_t *file, void *buffer, size_t count, size_t *offset)
static dentry_t * newFile
static uint64_t pipe_write(file_t *file, const void *buffer, size_t count, size_t *offset)
static uint64_t pipe_open2(file_t *files[2])
static file_ops_t fileOps
static wait_queue_t * pipe_poll(file_t *file, poll_events_t *revents)
EFI_PHYSICAL_ADDRESS buffer
uint64_t _module_procedure(const module_event_t *event)
_PUBLIC void * malloc(size_t size)
_PUBLIC void free(void *ptr)
Directory entry structure.
File operations structure.
uint64_t(* open)(file_t *file)
A simple ticket lock implementation.
The primitive that threads block on.