63        panic(
NULL, 
"failed to create klog sysfs file");
 
 
  127    if (
string == 
NULL || length == 0)
 
 
#define MAX_PATH
Maximum length of filepaths.
#define LOG_FILE_MAX_BUFFER
Maximum buffer size for the log file.
void log_file_flush_to_screen(void)
Flush the content of the log file to the screen.
void log_file_expose(void)
Expose the kernel log file to userspace in sysfs.
void log_file_write(const char *string, uint64_t length)
Write a string to the kernel log file.
NORETURN void panic(const interrupt_frame_t *frame, const char *format,...)
Panic the kernel, printing a message and halting.
#define SCREEN_WRAP_INDENT
Number of spaces to indent when a line wraps.
void log_screen_write(const char *string, uint64_t length)
Write a string to the screen.
uint64_t log_screen_get_width(void)
Get screen width in characters.
void log_screen_clear(void)
Clear the screen.
uint64_t log_screen_get_height(void)
Get screen height in characters.
#define LOG_USER(format,...)
#define LOCK_CREATE
Create a lock initializer. @macro LOCK_CREATE.
#define LOCK_SCOPE(lock)
Acquires a lock for the reminder of the current scope.
static uint64_t ring_write(ring_t *ring, const void *buffer, uint64_t count)
Write data to the ring buffer.
#define RING_CREATE(bufferPtr, bufferSize)
Create a ring buffer initializer.
static uint64_t ring_get_byte(const ring_t *ring, uint64_t offset, uint8_t *byte)
Get a byte from the ring buffer at a specific offset without modifying the read index.
static uint64_t ring_data_length(const ring_t *ring)
Get the length of data currently stored in the ring buffer.
static uint64_t ring_read_at(const ring_t *ring, uint64_t offset, void *buffer, uint64_t count)
Read data from the ring buffer at a specific offset without modifying the read index.
#define EINVAL
Invalid argument.
#define errno
Error number variable.
#define NULL
Pointer error value.
#define ERR
Integer error value.
static uint64_t log_file_op_read(file_t *file, void *buffer, uint64_t count, uint64_t *offset)
static void log_file_advance_fake_cursor(char chr, uint64_t *lineLength, uint64_t *lineCount)
static char buffer[LOG_FILE_MAX_BUFFER]
static char workingBuffer[LOG_FILE_MAX_BUFFER]
static file_ops_t logFileOps
static uint64_t log_file_op_write(file_t *file, const void *buffer, uint64_t count, uint64_t *offset)
_PUBLIC void * memcpy(void *_RESTRICT s1, const void *_RESTRICT s2, size_t n)
Directory entry structure.
File operations structure.
uint64_t(* read)(file_t *file, void *buffer, uint64_t count, uint64_t *offset)
A simple ticket lock implementation.
dentry_t * sysfs_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 SysFS instance.