kernel: 64-bit offsets for VFS

This commit is contained in:
K. Lange 2018-11-23 09:56:44 +09:00
parent e7616e7da2
commit de7463d141
29 changed files with 122 additions and 127 deletions

View File

@ -66,7 +66,7 @@ KCC = $(TARGET_TRIPLET)-gcc
LGCC = -lgcc
else
KCC = clang --target=i686-elf -static -Ibase/usr/include -nostdinc -mno-sse
LGCC =
LGCC = -lgcc
endif
KAS = $(TARGET_TRIPLET)-as
KLD = $(TARGET_TRIPLET)-ld

View File

@ -37,8 +37,8 @@
struct fs_node;
typedef uint32_t (*read_type_t) (struct fs_node *, uint32_t, uint32_t, uint8_t *);
typedef uint32_t (*write_type_t) (struct fs_node *, uint32_t, uint32_t, uint8_t *);
typedef uint32_t (*read_type_t) (struct fs_node *, uint64_t, uint32_t, uint8_t *);
typedef uint32_t (*write_type_t) (struct fs_node *, uint64_t, uint32_t, uint8_t *);
typedef void (*open_type_t) (struct fs_node *, unsigned int flags);
typedef void (*close_type_t) (struct fs_node *);
typedef struct dirent *(*readdir_type_t) (struct fs_node *, uint32_t);
@ -135,8 +135,8 @@ extern fs_node_t *fs_root;
extern int pty_create(void *size, fs_node_t ** fs_master, fs_node_t ** fs_slave);
int has_permission(fs_node_t *node, int permission_bit);
uint32_t read_fs(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffer);
uint32_t write_fs(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffer);
uint32_t read_fs(fs_node_t *node, uint64_t offset, uint32_t size, uint8_t *buffer);
uint32_t write_fs(fs_node_t *node, uint64_t offset, uint32_t size, uint8_t *buffer);
void open_fs(fs_node_t *node, unsigned int flags);
void close_fs(fs_node_t *node);
struct dirent *readdir_fs(fs_node_t *node, uint32_t index);

View File

@ -53,7 +53,7 @@ typedef struct image {
/* Resizable descriptor table */
typedef struct descriptor_table {
fs_node_t ** entries;
size_t * offsets;
uint64_t * offsets;
int * modes;
size_t length;
size_t capacity;

View File

@ -15,11 +15,6 @@
#define DEBUG_PIPES 0
uint32_t read_pipe(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffer);
uint32_t write_pipe(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffer);
void open_pipe(fs_node_t *node, unsigned int flags);
void close_pipe(fs_node_t *node);
static inline size_t pipe_unread(pipe_device_t * pipe) {
if (pipe->read_ptr == pipe->write_ptr) {
return 0;
@ -82,7 +77,7 @@ static void pipe_alert_waiters(pipe_device_t * pipe) {
}
}
uint32_t read_pipe(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffer) {
uint32_t read_pipe(fs_node_t *node, uint64_t offset, uint32_t size, uint8_t *buffer) {
assert(node->device != 0 && "Attempted to read from a fully-closed pipe.");
/* Retreive the pipe object associated with this file node */
@ -125,7 +120,7 @@ uint32_t read_pipe(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buf
return collected;
}
uint32_t write_pipe(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffer) {
uint32_t write_pipe(fs_node_t *node, uint64_t offset, uint32_t size, uint8_t *buffer) {
assert(node->device != 0 && "Attempted to write to a fully-closed pipe.");
/* Retreive the pipe object associated with this file node */

View File

@ -15,12 +15,12 @@
#include <kernel/printf.h>
#include <kernel/mem.h>
static uint32_t read_ramdisk(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffer);
static uint32_t write_ramdisk(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffer);
static uint32_t read_ramdisk(fs_node_t *node, uint64_t offset, uint32_t size, uint8_t *buffer);
static uint32_t write_ramdisk(fs_node_t *node, uint64_t offset, uint32_t size, uint8_t *buffer);
static void open_ramdisk(fs_node_t *node, unsigned int flags);
static void close_ramdisk(fs_node_t *node);
static uint32_t read_ramdisk(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffer) {
static uint32_t read_ramdisk(fs_node_t *node, uint64_t offset, uint32_t size, uint8_t *buffer) {
if (offset > node->length) {
return 0;
@ -31,12 +31,12 @@ static uint32_t read_ramdisk(fs_node_t *node, uint32_t offset, uint32_t size, ui
size = i;
}
memcpy(buffer, (void *)(node->inode + offset), size);
memcpy(buffer, (void *)(node->inode + (uintptr_t)offset), size);
return size;
}
static uint32_t write_ramdisk(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffer) {
static uint32_t write_ramdisk(fs_node_t *node, uint64_t offset, uint32_t size, uint8_t *buffer) {
if (offset > node->length) {
return 0;
}
@ -46,7 +46,7 @@ static uint32_t write_ramdisk(fs_node_t *node, uint32_t offset, uint32_t size, u
size = i;
}
memcpy((void *)(node->inode + offset), buffer, size);
memcpy((void *)(node->inode + (uintptr_t)offset), buffer, size);
return size;
}

View File

@ -317,13 +317,13 @@ int pty_ioctl(pty_t * pty, int request, void * argp) {
}
}
uint32_t read_pty_master(fs_node_t * node, uint32_t offset, uint32_t size, uint8_t *buffer) {
uint32_t read_pty_master(fs_node_t * node, uint64_t offset, uint32_t size, uint8_t *buffer) {
pty_t * pty = (pty_t *)node->device;
/* Standard pipe read */
return ring_buffer_read(pty->out, size, buffer);
}
uint32_t write_pty_master(fs_node_t * node, uint32_t offset, uint32_t size, uint8_t *buffer) {
uint32_t write_pty_master(fs_node_t * node, uint64_t offset, uint32_t size, uint8_t *buffer) {
pty_t * pty = (pty_t *)node->device;
size_t l = 0;
@ -340,7 +340,7 @@ void close_pty_master(fs_node_t * node) {
return;
}
uint32_t read_pty_slave(fs_node_t * node, uint32_t offset, uint32_t size, uint8_t *buffer) {
uint32_t read_pty_slave(fs_node_t * node, uint64_t offset, uint32_t size, uint8_t *buffer) {
pty_t * pty = (pty_t *)node->device;
if (pty->tios.c_lflag & ICANON) {
@ -354,7 +354,7 @@ uint32_t read_pty_slave(fs_node_t * node, uint32_t offset, uint32_t size, uint8
}
}
uint32_t write_pty_slave(fs_node_t * node, uint32_t offset, uint32_t size, uint8_t *buffer) {
uint32_t write_pty_slave(fs_node_t * node, uint64_t offset, uint32_t size, uint8_t *buffer) {
pty_t * pty = (pty_t *)node->device;
size_t l = 0;

View File

@ -28,7 +28,7 @@ static void close_complete(struct unix_pipe * self) {
ring_buffer_destroy(self->buffer);
}
static uint32_t read_unixpipe(fs_node_t * node, uint32_t offset, uint32_t size, uint8_t *buffer) {
static uint32_t read_unixpipe(fs_node_t * node, uint64_t offset, uint32_t size, uint8_t *buffer) {
struct unix_pipe * self = node->device;
size_t read = 0;
@ -46,7 +46,7 @@ static uint32_t read_unixpipe(fs_node_t * node, uint32_t offset, uint32_t size,
return read;
}
static uint32_t write_unixpipe(fs_node_t * node, uint32_t offset, uint32_t size, uint8_t *buffer) {
static uint32_t write_unixpipe(fs_node_t * node, uint64_t offset, uint32_t size, uint8_t *buffer) {
struct unix_pipe * self = node->device;
size_t written = 0;

View File

@ -132,7 +132,7 @@ int selectwait_fs(fs_node_t * node, void * process) {
* @param buffer A buffer to copy of the read data into
* @returns Bytes read
*/
uint32_t read_fs(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffer) {
uint32_t read_fs(fs_node_t *node, uint64_t offset, uint32_t size, uint8_t *buffer) {
if (!node) return -ENOENT;
if (node->read) {
@ -152,7 +152,7 @@ uint32_t read_fs(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffe
* @param buffer A buffer to copy from
* @returns Bytes written
*/
uint32_t write_fs(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffer) {
uint32_t write_fs(fs_node_t *node, uint64_t offset, uint32_t size, uint8_t *buffer) {
if (!node) return -ENOENT;
if (node->write) {

11
kernel/misc/lgcc.c Normal file
View File

@ -0,0 +1,11 @@
/* Garbage */
#include <kernel/system.h>
#define USES(func) void * _USES_ ## func (void) { return (void*)(uintptr_t)&func; }
extern unsigned long __umoddi3 (unsigned long a, unsigned long b);
USES(__umoddi3)
extern unsigned long __udivdi3 (unsigned long a, unsigned long b);
USES(__udivdi3)

View File

@ -7,7 +7,7 @@
#include <va_list.h>
#define EARLY_LOG_DEVICE 0x3F8
static uint32_t _ubsan_log_write(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffer) {
static uint32_t _ubsan_log_write(fs_node_t *node, uint64_t offset, uint32_t size, uint8_t *buffer) {
for (unsigned int i = 0; i < size; ++i) {
outportb(EARLY_LOG_DEVICE, buffer[i]);
}

View File

@ -280,7 +280,7 @@ process_t * spawn_init(void) {
init->fds->capacity = 4;
init->fds->entries = malloc(sizeof(fs_node_t *) * init->fds->capacity);
init->fds->modes = malloc(sizeof(int) * init->fds->capacity);
init->fds->offsets = malloc(sizeof(size_t) * init->fds->capacity);
init->fds->offsets = malloc(sizeof(uint64_t) * init->fds->capacity);
/* Set the working directory */
init->wd_node = clone_fs(fs_root);
@ -431,7 +431,7 @@ process_t * spawn_process(volatile process_t * parent, int reuse_fds) {
debug_print(INFO," fds / files {");
proc->fds->entries = malloc(sizeof(fs_node_t *) * proc->fds->capacity);
proc->fds->modes = malloc(sizeof(int) * proc->fds->capacity);
proc->fds->offsets = malloc(sizeof(size_t) * proc->fds->capacity);
proc->fds->offsets = malloc(sizeof(uint64_t) * proc->fds->capacity);
assert(proc->fds->entries && "Failed to allocate file descriptor table for new process.");
debug_print(INFO," ---");
for (uint32_t i = 0; i < parent->fds->length; ++i) {
@ -600,7 +600,7 @@ uint32_t process_append_fd(process_t * proc, fs_node_t * node) {
proc->fds->capacity *= 2;
proc->fds->entries = realloc(proc->fds->entries, sizeof(fs_node_t *) * proc->fds->capacity);
proc->fds->modes = realloc(proc->fds->modes, sizeof(int) * proc->fds->capacity);
proc->fds->offsets = realloc(proc->fds->offsets, sizeof(size_t) * proc->fds->capacity);
proc->fds->offsets = realloc(proc->fds->offsets, sizeof(uint64_t) * proc->fds->capacity);
}
proc->fds->entries[proc->fds->length] = node;
/* modes, offsets must be set by caller */

View File

@ -17,8 +17,8 @@ char * __kernel_version_format = "%d.%d.%d-%s";
/* Version numbers X.Y.Z */
int __kernel_version_major = 1;
int __kernel_version_minor = 8;
int __kernel_version_lower = 2;
int __kernel_version_minor = 9;
int __kernel_version_lower = 0;
/* Kernel build suffix, which doesn't necessarily
* mean anything, but can be used to distinguish

View File

@ -70,11 +70,11 @@ static spin_lock_t ata_lock = { 0 };
/* TODO support other sector sizes */
#define ATA_SECTOR_SIZE 512
static void ata_device_read_sector(struct ata_device * dev, uint32_t lba, uint8_t * buf);
static void ata_device_read_sector_atapi(struct ata_device * dev, uint32_t lba, uint8_t * buf);
static void ata_device_write_sector_retry(struct ata_device * dev, uint32_t lba, uint8_t * buf);
static uint32_t read_ata(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffer);
static uint32_t write_ata(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffer);
static void ata_device_read_sector(struct ata_device * dev, uint64_t lba, uint8_t * buf);
static void ata_device_read_sector_atapi(struct ata_device * dev, uint64_t lba, uint8_t * buf);
static void ata_device_write_sector_retry(struct ata_device * dev, uint64_t lba, uint8_t * buf);
static uint32_t read_ata(fs_node_t *node, uint64_t offset, uint32_t size, uint8_t *buffer);
static uint32_t write_ata(fs_node_t *node, uint64_t offset, uint32_t size, uint8_t *buffer);
static void open_ata(fs_node_t *node, unsigned int flags);
static void close_ata(fs_node_t *node);
@ -96,7 +96,7 @@ static uint64_t atapi_max_offset(struct ata_device * dev) {
return (max_sector + 1) * dev->atapi_sector_size;
}
static uint32_t read_ata(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffer) {
static uint32_t read_ata(fs_node_t *node, uint64_t offset, uint32_t size, uint8_t *buffer) {
struct ata_device * dev = (struct ata_device *)node->device;
@ -119,7 +119,7 @@ static uint32_t read_ata(fs_node_t *node, uint32_t offset, uint32_t size, uint8_
char * tmp = malloc(ATA_SECTOR_SIZE);
ata_device_read_sector(dev, start_block, (uint8_t *)tmp);
memcpy(buffer, (void *)((uintptr_t)tmp + (offset % ATA_SECTOR_SIZE)), prefix_size);
memcpy(buffer, (void *)((uintptr_t)tmp + ((uintptr_t)offset % ATA_SECTOR_SIZE)), prefix_size);
free(tmp);
@ -148,7 +148,7 @@ static uint32_t read_ata(fs_node_t *node, uint32_t offset, uint32_t size, uint8_
return size;
}
static uint32_t read_atapi(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffer) {
static uint32_t read_atapi(fs_node_t *node, uint64_t offset, uint32_t size, uint8_t *buffer) {
struct ata_device * dev = (struct ata_device *)node->device;
@ -171,7 +171,7 @@ static uint32_t read_atapi(fs_node_t *node, uint32_t offset, uint32_t size, uint
char * tmp = malloc(dev->atapi_sector_size);
ata_device_read_sector_atapi(dev, start_block, (uint8_t *)tmp);
memcpy(buffer, (void *)((uintptr_t)tmp + (offset % dev->atapi_sector_size)), prefix_size);
memcpy(buffer, (void *)((uintptr_t)tmp + ((uintptr_t)offset % dev->atapi_sector_size)), prefix_size);
free(tmp);
@ -201,7 +201,7 @@ static uint32_t read_atapi(fs_node_t *node, uint32_t offset, uint32_t size, uint
}
static uint32_t write_ata(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffer) {
static uint32_t write_ata(fs_node_t *node, uint64_t offset, uint32_t size, uint8_t *buffer) {
struct ata_device * dev = (struct ata_device *)node->device;
unsigned int start_block = offset / ATA_SECTOR_SIZE;
@ -226,7 +226,7 @@ static uint32_t write_ata(fs_node_t *node, uint32_t offset, uint32_t size, uint8
debug_print(NOTICE, "Writing first block");
memcpy((void *)((uintptr_t)tmp + (offset % ATA_SECTOR_SIZE)), buffer, prefix_size);
memcpy((void *)((uintptr_t)tmp + ((uintptr_t)offset % ATA_SECTOR_SIZE)), buffer, prefix_size);
ata_device_write_sector_retry(dev, start_block, (uint8_t *)tmp);
free(tmp);
@ -606,7 +606,7 @@ static int ata_device_detect(struct ata_device * dev) {
return 0;
}
static void ata_device_read_sector(struct ata_device * dev, uint32_t lba, uint8_t * buf) {
static void ata_device_read_sector(struct ata_device * dev, uint64_t lba, uint8_t * buf) {
uint16_t bus = dev->io_base;
uint8_t slave = dev->slave;
@ -640,13 +640,17 @@ try_again:
}
outportb(bus + ATA_REG_CONTROL, 0x00);
outportb(bus + ATA_REG_HDDEVSEL, 0xe0 | slave << 4 | (lba & 0x0f000000) >> 24);
outportb(bus + ATA_REG_HDDEVSEL, 0xe0 | slave << 4);
ata_io_wait(dev);
outportb(bus + ATA_REG_FEATURES, 0x00);
outportb(bus + ATA_REG_SECCOUNT0, 1);
outportb(bus + ATA_REG_LBA0, (lba & 0x000000ff) >> 0);
outportb(bus + ATA_REG_LBA1, (lba & 0x0000ff00) >> 8);
outportb(bus + ATA_REG_LBA2, (lba & 0x00ff0000) >> 16);
outportb(bus + ATA_REG_LBA3, (lba & 0xff000000) >> 24);
outportb(bus + ATA_REG_LBA4, (lba & 0xff00000000) >> 32);
outportb(bus + ATA_REG_LBA5, (lba & 0xff0000000000) >> 40);
//outportb(bus + ATA_REG_COMMAND, ATA_CMD_READ_PIO);
#if 1
while (1) {
@ -700,7 +704,7 @@ try_again:
spin_unlock(ata_lock);
}
static void ata_device_read_sector_atapi(struct ata_device * dev, uint32_t lba, uint8_t * buf) {
static void ata_device_read_sector_atapi(struct ata_device * dev, uint64_t lba, uint8_t * buf) {
if (!dev->is_atapi) return;
@ -771,7 +775,7 @@ atapi_error_on_read_setup:
}
static void ata_device_write_sector(struct ata_device * dev, uint32_t lba, uint8_t * buf) {
static void ata_device_write_sector(struct ata_device * dev, uint64_t lba, uint8_t * buf) {
uint16_t bus = dev->io_base;
uint8_t slave = dev->slave;
@ -780,7 +784,7 @@ static void ata_device_write_sector(struct ata_device * dev, uint32_t lba, uint8
outportb(bus + ATA_REG_CONTROL, 0x02);
ata_wait(dev, 0);
outportb(bus + ATA_REG_HDDEVSEL, 0xe0 | slave << 4 | (lba & 0x0f000000) >> 24);
outportb(bus + ATA_REG_HDDEVSEL, 0xe0 | slave << 4);
ata_wait(dev, 0);
outportb(bus + ATA_REG_FEATURES, 0x00);
@ -788,6 +792,10 @@ static void ata_device_write_sector(struct ata_device * dev, uint32_t lba, uint8
outportb(bus + ATA_REG_LBA0, (lba & 0x000000ff) >> 0);
outportb(bus + ATA_REG_LBA1, (lba & 0x0000ff00) >> 8);
outportb(bus + ATA_REG_LBA2, (lba & 0x00ff0000) >> 16);
outportb(bus + ATA_REG_LBA3, (lba & 0xff000000) >> 24);
outportb(bus + ATA_REG_LBA4, (lba & 0xff00000000) >> 32);
outportb(bus + ATA_REG_LBA5, (lba & 0xff0000000000) >> 40);
outportb(bus + ATA_REG_COMMAND, ATA_CMD_WRITE_PIO);
ata_wait(dev, 0);
int size = ATA_SECTOR_SIZE / 2;
@ -809,7 +817,7 @@ static int buffer_compare(uint32_t * ptr1, uint32_t * ptr2, size_t size) {
return 0;
}
static void ata_device_write_sector_retry(struct ata_device * dev, uint32_t lba, uint8_t * buf) {
static void ata_device_write_sector_retry(struct ata_device * dev, uint64_t lba, uint8_t * buf) {
uint8_t * read_buf = malloc(ATA_SECTOR_SIZE);
do {
ata_device_write_sector(dev, lba, buf);

View File

@ -34,10 +34,6 @@ static spin_lock_t ata_lock = { 0 };
static void ata_device_read_sector(struct ata_device * dev, uint32_t lba, uint8_t * buf);
static void ata_device_write_sector_retry(struct ata_device * dev, uint32_t lba, uint8_t * buf);
static uint32_t read_ata(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffer);
static uint32_t write_ata(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffer);
static void open_ata(fs_node_t *node, unsigned int flags);
static void close_ata(fs_node_t *node);
static uint64_t ata_max_offset(struct ata_device * dev) {
uint64_t sectors = dev->identity.sectors_48;
@ -49,7 +45,7 @@ static uint64_t ata_max_offset(struct ata_device * dev) {
return sectors * ATA_SECTOR_SIZE;
}
static uint32_t read_ata(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffer) {
static uint32_t read_ata(fs_node_t *node, uint64_t offset, uint32_t size, uint8_t *buffer) {
struct ata_device * dev = (struct ata_device *)node->device;
@ -72,7 +68,7 @@ static uint32_t read_ata(fs_node_t *node, uint32_t offset, uint32_t size, uint8_
char * tmp = malloc(ATA_SECTOR_SIZE);
ata_device_read_sector(dev, start_block, (uint8_t *)tmp);
memcpy(buffer, (void *)((uintptr_t)tmp + (offset % ATA_SECTOR_SIZE)), prefix_size);
memcpy(buffer, (void *)((uintptr_t)tmp + ((uintptr_t)offset % ATA_SECTOR_SIZE)), prefix_size);
free(tmp);
@ -101,7 +97,7 @@ static uint32_t read_ata(fs_node_t *node, uint32_t offset, uint32_t size, uint8_
return size;
}
static uint32_t write_ata(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffer) {
static uint32_t write_ata(fs_node_t *node, uint64_t offset, uint32_t size, uint8_t *buffer) {
struct ata_device * dev = (struct ata_device *)node->device;
unsigned int start_block = offset / ATA_SECTOR_SIZE;
@ -126,7 +122,7 @@ static uint32_t write_ata(fs_node_t *node, uint32_t offset, uint32_t size, uint8
debug_print(NOTICE, "Writing first block");
memcpy((void *)((uintptr_t)tmp + (offset % ATA_SECTOR_SIZE)), buffer, prefix_size);
memcpy((void *)((uintptr_t)tmp + ((uintptr_t)offset % ATA_SECTOR_SIZE)), buffer, prefix_size);
ata_device_write_sector_retry(dev, start_block, (uint8_t *)tmp);
free(tmp);

View File

@ -18,7 +18,7 @@ struct dos_partition_entry {
partition_t partition;
};
static uint32_t read_part(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffer) {
static uint32_t read_part(fs_node_t *node, uint64_t offset, uint32_t size, uint8_t *buffer) {
struct dos_partition_entry * device = (struct dos_partition_entry *)node->device;
if (offset > device->partition.sector_count * SECTORSIZE) {
@ -34,7 +34,7 @@ static uint32_t read_part(fs_node_t *node, uint32_t offset, uint32_t size, uint8
return read_fs(device->device, offset + device->partition.lba_first_sector * SECTORSIZE, size, buffer);
}
static uint32_t write_part(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffer) {
static uint32_t write_part(fs_node_t *node, uint64_t offset, uint32_t size, uint8_t *buffer) {
struct dos_partition_entry * device = (struct dos_partition_entry *)node->device;
if (offset > device->partition.sector_count * SECTORSIZE) {

View File

@ -1131,7 +1131,7 @@ static ext2_inodetable_t * read_inode(ext2_fs_t * this, uint32_t inode) {
return inodet;
}
static uint32_t read_ext2(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffer) {
static uint32_t read_ext2(fs_node_t *node, uint64_t offset, uint32_t size, uint8_t *buffer) {
ext2_fs_t * this = (ext2_fs_t *)node->device;
ext2_inodetable_t * inode = read_inode(this, node->inode);
uint32_t end;
@ -1149,14 +1149,14 @@ static uint32_t read_ext2(fs_node_t *node, uint32_t offset, uint32_t size, uint8
uint8_t * buf = malloc(this->block_size);
if (start_block == end_block) {
inode_read_block(this, inode, start_block, buf);
memcpy(buffer, (uint8_t *)(((uint32_t)buf) + (offset % this->block_size)), size_to_read);
memcpy(buffer, (uint8_t *)(((uint32_t)buf) + ((uintptr_t)offset % this->block_size)), size_to_read);
} else {
uint32_t block_offset;
uint32_t blocks_read = 0;
for (block_offset = start_block; block_offset < end_block; block_offset++, blocks_read++) {
if (block_offset == start_block) {
inode_read_block(this, inode, block_offset, buf);
memcpy(buffer, (uint8_t *)(((uint32_t)buf) + (offset % this->block_size)), this->block_size - (offset % this->block_size));
memcpy(buffer, (uint8_t *)(((uint32_t)buf) + ((uintptr_t)offset % this->block_size)), this->block_size - (offset % this->block_size));
} else {
inode_read_block(this, inode, block_offset, buf);
memcpy(buffer + this->block_size * blocks_read - (offset % this->block_size), buf, this->block_size);
@ -1172,7 +1172,7 @@ static uint32_t read_ext2(fs_node_t *node, uint32_t offset, uint32_t size, uint8
return size_to_read;
}
static uint32_t write_inode_buffer(ext2_fs_t * this, ext2_inodetable_t * inode, uint32_t inode_number, uint32_t offset, uint32_t size, uint8_t *buffer) {
static uint32_t write_inode_buffer(ext2_fs_t * this, ext2_inodetable_t * inode, uint32_t inode_number, uint64_t offset, uint32_t size, uint8_t *buffer) {
uint32_t end = offset + size;
if (end > inode->size) {
inode->size = end;
@ -1186,7 +1186,7 @@ static uint32_t write_inode_buffer(ext2_fs_t * this, ext2_inodetable_t * inode,
uint8_t * buf = malloc(this->block_size);
if (start_block == end_block) {
inode_read_block(this, inode, start_block, buf);
memcpy((uint8_t *)(((uint32_t)buf) + (offset % this->block_size)), buffer, size_to_read);
memcpy((uint8_t *)(((uint32_t)buf) + ((uintptr_t)offset % this->block_size)), buffer, size_to_read);
inode_write_block(this, inode, inode_number, start_block, buf);
} else {
uint32_t block_offset;
@ -1194,7 +1194,7 @@ static uint32_t write_inode_buffer(ext2_fs_t * this, ext2_inodetable_t * inode,
for (block_offset = start_block; block_offset < end_block; block_offset++, blocks_read++) {
if (block_offset == start_block) {
int b = inode_read_block(this, inode, block_offset, buf);
memcpy((uint8_t *)(((uint32_t)buf) + (offset % this->block_size)), buffer, this->block_size - (offset % this->block_size));
memcpy((uint8_t *)(((uint32_t)buf) + ((uintptr_t)offset % this->block_size)), buffer, this->block_size - (offset % this->block_size));
inode_write_block(this, inode, inode_number, block_offset, buf);
if (!b) {
refresh_inode(this, inode, inode_number);
@ -1218,7 +1218,7 @@ static uint32_t write_inode_buffer(ext2_fs_t * this, ext2_inodetable_t * inode,
return size_to_read;
}
static uint32_t write_ext2(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffer) {
static uint32_t write_ext2(fs_node_t *node, uint64_t offset, uint32_t size, uint8_t *buffer) {
ext2_fs_t * this = (ext2_fs_t *)node->device;
ext2_inodetable_t * inode = read_inode(this, node->inode);

View File

@ -269,7 +269,7 @@ cleanup:
return dirent;
}
static uint32_t read_iso(fs_node_t * node, uint32_t offset, uint32_t size, uint8_t * buffer) {
static uint32_t read_iso(fs_node_t * node, uint64_t offset, uint32_t size, uint8_t * buffer) {
iso_9660_fs_t * this = node->device;
char * tmp = malloc(this->block_size);
read_sector(this, node->inode, tmp);

View File

@ -221,7 +221,7 @@ static void lfb_video_panic(char ** msgs) {
}
}
static uint32_t framebuffer_func(fs_node_t * node, uint32_t offset, uint32_t size, uint8_t * buffer) {
static uint32_t framebuffer_func(fs_node_t * node, uint64_t offset, uint32_t size, uint8_t * buffer) {
char * buf = malloc(4096);
if (lfb_driver_name) {

View File

@ -34,7 +34,7 @@ static int tasklet_pid = 0;
uint32_t get_primary_dns(void);
static uint32_t netif_func(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffer) {
static uint32_t netif_func(fs_node_t *node, uint64_t offset, uint32_t size, uint8_t *buffer) {
char * buf = malloc(4096);
struct netif * netif = &_netif;
@ -424,7 +424,7 @@ static int socket_wait(fs_node_t * node, void * process) {
return 0;
}
static uint32_t socket_read(fs_node_t * node, uint32_t offset, uint32_t size, uint8_t * buffer) {
static uint32_t socket_read(fs_node_t * node, uint64_t offset, uint32_t size, uint8_t * buffer) {
/* Sleep until we have something to receive */
#if 0
fgets((char *)buffer, size, node->device);
@ -433,7 +433,7 @@ static uint32_t socket_read(fs_node_t * node, uint32_t offset, uint32_t size, ui
return net_recv(node->device, buffer, size);
#endif
}
static uint32_t socket_write(fs_node_t * node, uint32_t offset, uint32_t size, uint8_t * buffer) {
static uint32_t socket_write(fs_node_t * node, uint64_t offset, uint32_t size, uint8_t * buffer) {
/* Add the packet to the appropriate interface queue and send it off. */
net_send((struct socket *)node->device, buffer, size, 0);

View File

@ -98,7 +98,7 @@ static pex_client_t * create_client(pex_ex_t * p) {
return out;
}
static uint32_t read_server(fs_node_t * node, uint32_t offset, uint32_t size, uint8_t * buffer) {
static uint32_t read_server(fs_node_t * node, uint64_t offset, uint32_t size, uint8_t * buffer) {
pex_ex_t * p = (pex_ex_t *)node->device;
debug_print(INFO, "[pex] server read(...)");
@ -119,7 +119,7 @@ static uint32_t read_server(fs_node_t * node, uint32_t offset, uint32_t size, ui
return out;
}
static uint32_t write_server(fs_node_t * node, uint32_t offset, uint32_t size, uint8_t * buffer) {
static uint32_t write_server(fs_node_t * node, uint64_t offset, uint32_t size, uint8_t * buffer) {
pex_ex_t * p = (pex_ex_t *)node->device;
debug_print(INFO, "[pex] server write(...)");
@ -158,7 +158,7 @@ static int ioctl_server(fs_node_t * node, int request, void * argp) {
}
}
static uint32_t read_client(fs_node_t * node, uint32_t offset, uint32_t size, uint8_t * buffer) {
static uint32_t read_client(fs_node_t * node, uint64_t offset, uint32_t size, uint8_t * buffer) {
pex_client_t * c = (pex_client_t *)node->inode;
if (c->parent != node->device) {
debug_print(WARNING, "[pex] Invalid device endpoint on client read?");
@ -185,7 +185,7 @@ static uint32_t read_client(fs_node_t * node, uint32_t offset, uint32_t size, ui
return out;
}
static uint32_t write_client(fs_node_t * node, uint32_t offset, uint32_t size, uint8_t * buffer) {
static uint32_t write_client(fs_node_t * node, uint64_t offset, uint32_t size, uint8_t * buffer) {
pex_client_t * c = (pex_client_t *)node->inode;
if (c->parent != node->device) {
debug_print(WARNING, "[pex] Invalid device endpoint on client write?");

View File

@ -34,7 +34,7 @@ struct spkr {
int frequency;
};
static uint32_t write_spkr(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffer) {
static uint32_t write_spkr(fs_node_t *node, uint64_t offset, uint32_t size, uint8_t *buffer) {
if (!size % (sizeof(struct spkr))) {
return 0;
}

View File

@ -11,7 +11,7 @@
#include <kernel/fs.h>
#include <kernel/module.h>
static uint32_t read_port(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffer) {
static uint32_t read_port(fs_node_t *node, uint64_t offset, uint32_t size, uint8_t *buffer) {
switch (size) {
case 1:
buffer[0] = inportb(offset);
@ -32,7 +32,7 @@ static uint32_t read_port(fs_node_t *node, uint32_t offset, uint32_t size, uint8
return size;
}
static uint32_t write_port(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffer) {
static uint32_t write_port(fs_node_t *node, uint64_t offset, uint32_t size, uint8_t *buffer) {
switch (size) {
case 1:
outportb(offset, buffer[0]);

View File

@ -38,7 +38,7 @@ static fs_node_t * procfs_generic_create(char * name, read_type_t read_func) {
return fnode;
}
static uint32_t proc_cmdline_func(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffer) {
static uint32_t proc_cmdline_func(fs_node_t *node, uint64_t offset, uint32_t size, uint8_t *buffer) {
char buf[1024];
process_t * proc = process_from_pid(node->inode);
@ -128,7 +128,7 @@ static size_t calculate_shm_resident(page_directory_t * src) {
return pages;
}
static uint32_t proc_status_func(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffer) {
static uint32_t proc_status_func(fs_node_t *node, uint64_t offset, uint32_t size, uint8_t *buffer) {
char buf[2048];
process_t * proc = process_from_pid(node->inode);
process_t * parent = process_get_parent(proc);
@ -281,7 +281,7 @@ static fs_node_t * procfs_procdir_create(process_t * process) {
#define cpuid(in,a,b,c,d) do { asm volatile ("cpuid" : "=a"(a),"=b"(b),"=c"(c),"=d"(d) : "a"(in)); } while(0)
static uint32_t cpuinfo_func(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffer) {
static uint32_t cpuinfo_func(fs_node_t *node, uint64_t offset, uint32_t size, uint8_t *buffer) {
char buf[1024];
unsigned long a, b, unused;;
@ -319,7 +319,7 @@ static uint32_t cpuinfo_func(fs_node_t *node, uint32_t offset, uint32_t size, ui
extern uintptr_t heap_end;
extern uintptr_t kernel_heap_alloc_point;
static uint32_t meminfo_func(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffer) {
static uint32_t meminfo_func(fs_node_t *node, uint64_t offset, uint32_t size, uint8_t *buffer) {
char buf[1024];
unsigned int total = memory_total();
unsigned int free = total - memory_use();
@ -341,7 +341,7 @@ static uint32_t meminfo_func(fs_node_t *node, uint32_t offset, uint32_t size, ui
return size;
}
static uint32_t pat_func(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffer) {
static uint32_t pat_func(fs_node_t *node, uint64_t offset, uint32_t size, uint8_t *buffer) {
char buf[1024];
uint64_t pat_values;
@ -395,7 +395,7 @@ static uint32_t pat_func(fs_node_t *node, uint32_t offset, uint32_t size, uint8_
}
static uint32_t uptime_func(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffer) {
static uint32_t uptime_func(fs_node_t *node, uint64_t offset, uint32_t size, uint8_t *buffer) {
char buf[1024];
sprintf(buf, "%d.%3d\n", timer_ticks, timer_subticks);
@ -407,7 +407,7 @@ static uint32_t uptime_func(fs_node_t *node, uint32_t offset, uint32_t size, uin
return size;
}
static uint32_t cmdline_func(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffer) {
static uint32_t cmdline_func(fs_node_t *node, uint64_t offset, uint32_t size, uint8_t *buffer) {
char buf[1024];
extern char * cmdline;
sprintf(buf, "%s\n", cmdline ? cmdline : "");
@ -420,7 +420,7 @@ static uint32_t cmdline_func(fs_node_t *node, uint32_t offset, uint32_t size, ui
return size;
}
static uint32_t version_func(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffer) {
static uint32_t version_func(fs_node_t *node, uint64_t offset, uint32_t size, uint8_t *buffer) {
char buf[1024];
char version_number[512];
sprintf(version_number, __kernel_version_format,
@ -444,7 +444,7 @@ static uint32_t version_func(fs_node_t *node, uint32_t offset, uint32_t size, ui
return size;
}
static uint32_t compiler_func(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffer) {
static uint32_t compiler_func(fs_node_t *node, uint64_t offset, uint32_t size, uint8_t *buffer) {
char buf[1024];
sprintf(buf, "%s\n", __kernel_compiler_version);
@ -485,7 +485,7 @@ static void mount_recurse(char * buf, tree_node_t * node, size_t height) {
}
}
static uint32_t mounts_func(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffer) {
static uint32_t mounts_func(fs_node_t *node, uint64_t offset, uint32_t size, uint8_t *buffer) {
char * buf = malloc(4096);
buf[0] = '\0';
@ -504,7 +504,7 @@ static uint32_t mounts_func(fs_node_t *node, uint32_t offset, uint32_t size, uin
return size;
}
static uint32_t modules_func(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffer) {
static uint32_t modules_func(fs_node_t *node, uint64_t offset, uint32_t size, uint8_t *buffer) {
list_t * hash_keys = hashmap_keys(modules_get_list());
char * buf = malloc(hash_keys->length * 512);
unsigned int soffset = 0;
@ -548,7 +548,7 @@ static uint32_t modules_func(fs_node_t *node, uint32_t offset, uint32_t size, ui
extern hashmap_t * fs_types; /* from kernel/fs/vfs.c */
static uint32_t filesystems_func(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffer) {
static uint32_t filesystems_func(fs_node_t *node, uint64_t offset, uint32_t size, uint8_t *buffer) {
list_t * hash_keys = hashmap_keys(fs_types);
char * buf = malloc(hash_keys->length * 512);
unsigned int soffset = 0;
@ -570,7 +570,7 @@ static uint32_t filesystems_func(fs_node_t *node, uint32_t offset, uint32_t size
return size;
}
static uint32_t loader_func(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffer) {
static uint32_t loader_func(fs_node_t *node, uint64_t offset, uint32_t size, uint8_t *buffer) {
char * buf = malloc(512);
if (mboot_ptr->flags & MULTIBOOT_FLAG_LOADER) {
@ -594,7 +594,7 @@ static uint32_t loader_func(fs_node_t *node, uint32_t offset, uint32_t size, uin
extern char * get_irq_handler(int irq, int chain);
static uint32_t irq_func(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffer) {
static uint32_t irq_func(fs_node_t *node, uint64_t offset, uint32_t size, uint8_t *buffer) {
char * buf = malloc(4096);
unsigned int soffset = 0;
@ -660,7 +660,7 @@ static void scan_count(uint32_t device, uint16_t vendorid, uint16_t deviceid, vo
(*count)++;
}
static uint32_t pci_func(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffer) {
static uint32_t pci_func(fs_node_t *node, uint64_t offset, uint32_t size, uint8_t *buffer) {
size_t count = 0;
pci_scan(&scan_count, -1, &count);

View File

@ -12,22 +12,16 @@
#include <kernel/fs.h>
#include <kernel/module.h>
static uint32_t read_random(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffer);
static uint32_t write_random(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffer);
static void open_random(fs_node_t *node, unsigned int flags);
static void close_random(fs_node_t *node);
static uint32_t read_random(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffer) {
static uint32_t read_random(fs_node_t *node, uint64_t offset, uint32_t size, uint8_t *buffer) {
uint32_t s = 0;
while (s < size) {
buffer[s] = krand() % 0xFF;
offset++;
s++;
}
return size;
}
static uint32_t write_random(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffer) {
static uint32_t write_random(fs_node_t *node, uint64_t offset, uint32_t size, uint8_t *buffer) {
return size;
}

View File

@ -24,7 +24,7 @@
#define SND_BUF_SIZE 0x4000
static uint32_t snd_dsp_write(fs_node_t * node, uint32_t offset, uint32_t size, uint8_t *buffer);
static uint32_t snd_dsp_write(fs_node_t * node, uint64_t offset, uint32_t size, uint8_t *buffer);
static int snd_dsp_ioctl(fs_node_t * node, int request, void * argp);
static void snd_dsp_open(fs_node_t * node, unsigned int flags);
static void snd_dsp_close(fs_node_t * node);
@ -102,7 +102,7 @@ snd_unregister_cleanup:
return rv;
}
static uint32_t snd_dsp_write(fs_node_t * node, uint32_t offset, uint32_t size, uint8_t *buffer) {
static uint32_t snd_dsp_write(fs_node_t * node, uint64_t offset, uint32_t size, uint8_t *buffer) {
if (!_devices.length) return -1; /* No sink available. */
struct dsp_node * dsp = node->device;

View File

@ -176,7 +176,7 @@ static char * tmpfs_file_getset_block(struct tmpfs_file * t, size_t blockid, int
}
static uint32_t read_tmpfs(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffer) {
static uint32_t read_tmpfs(fs_node_t *node, uint64_t offset, uint32_t size, uint8_t *buffer) {
struct tmpfs_file * t = (struct tmpfs_file *)(node->device);
t->atime = now();
@ -195,7 +195,7 @@ static uint32_t read_tmpfs(fs_node_t *node, uint32_t offset, uint32_t size, uint
if (start_block == end_block && offset == end) return 0;
if (start_block == end_block) {
void *buf = tmpfs_file_getset_block(t, start_block, 0);
memcpy(buffer, (uint8_t *)(((uint32_t)buf) + (offset % BLOCKSIZE)), size_to_read);
memcpy(buffer, (uint8_t *)(((uint32_t)buf) + ((uintptr_t)offset % BLOCKSIZE)), size_to_read);
spin_unlock(tmpfs_page_lock);
return size_to_read;
} else {
@ -204,7 +204,7 @@ static uint32_t read_tmpfs(fs_node_t *node, uint32_t offset, uint32_t size, uint
for (block_offset = start_block; block_offset < end_block; block_offset++, blocks_read++) {
if (block_offset == start_block) {
void *buf = tmpfs_file_getset_block(t, block_offset, 0);
memcpy(buffer, (uint8_t *)(((uint32_t)buf) + (offset % BLOCKSIZE)), BLOCKSIZE - (offset % BLOCKSIZE));
memcpy(buffer, (uint8_t *)(((uint32_t)buf) + ((uintptr_t)offset % BLOCKSIZE)), BLOCKSIZE - (offset % BLOCKSIZE));
spin_unlock(tmpfs_page_lock);
} else {
void *buf = tmpfs_file_getset_block(t, block_offset, 0);
@ -221,7 +221,7 @@ static uint32_t read_tmpfs(fs_node_t *node, uint32_t offset, uint32_t size, uint
return size_to_read;
}
static uint32_t write_tmpfs(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffer) {
static uint32_t write_tmpfs(fs_node_t *node, uint64_t offset, uint32_t size, uint8_t *buffer) {
struct tmpfs_file * t = (struct tmpfs_file *)(node->device);
t->atime = now();
@ -238,7 +238,7 @@ static uint32_t write_tmpfs(fs_node_t *node, uint32_t offset, uint32_t size, uin
uint32_t size_to_read = end - offset;
if (start_block == end_block) {
void *buf = tmpfs_file_getset_block(t, start_block, 1);
memcpy((uint8_t *)(((uint32_t)buf) + (offset % BLOCKSIZE)), buffer, size_to_read);
memcpy((uint8_t *)(((uint32_t)buf) + ((uintptr_t)offset % BLOCKSIZE)), buffer, size_to_read);
spin_unlock(tmpfs_page_lock);
return size_to_read;
} else {
@ -247,7 +247,7 @@ static uint32_t write_tmpfs(fs_node_t *node, uint32_t offset, uint32_t size, uin
for (block_offset = start_block; block_offset < end_block; block_offset++, blocks_read++) {
if (block_offset == start_block) {
void *buf = tmpfs_file_getset_block(t, block_offset, 1);
memcpy((uint8_t *)(((uint32_t)buf) + (offset % BLOCKSIZE)), buffer, BLOCKSIZE - (offset % BLOCKSIZE));
memcpy((uint8_t *)(((uint32_t)buf) + ((uintptr_t)offset % BLOCKSIZE)), buffer, BLOCKSIZE - (offset % BLOCKSIZE));
spin_unlock(tmpfs_page_lock);
} else {
void *buf = tmpfs_file_getset_block(t, block_offset, 1);

View File

@ -107,7 +107,7 @@ struct vbox_pointershape {
#define EARLY_LOG_DEVICE 0x504
static uint32_t _vbox_write(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffer) {
static uint32_t _vbox_write(fs_node_t *node, uint64_t offset, uint32_t size, uint8_t *buffer) {
for (unsigned int i = 0; i < size; ++i) {
outportb(EARLY_LOG_DEVICE, buffer[i]);
}
@ -219,7 +219,7 @@ static int ioctl_mouse(fs_node_t * node, int request, void * argp) {
return -1;
}
uint32_t write_pointer(fs_node_t * node, uint32_t offset, uint32_t size, uint8_t *buffer) {
uint32_t write_pointer(fs_node_t * node, uint64_t offset, uint32_t size, uint8_t *buffer) {
if (!mouse_state) {
return -1;
@ -231,7 +231,7 @@ uint32_t write_pointer(fs_node_t * node, uint32_t offset, uint32_t size, uint8_t
return size;
}
uint32_t write_rectpipe(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffer) {
uint32_t write_rectpipe(fs_node_t *node, uint64_t offset, uint32_t size, uint8_t *buffer) {
(void)node;
(void)offset;

View File

@ -63,7 +63,7 @@ static void term_write(char c) {
write_string(foo);
}
static uint32_t vga_write(fs_node_t * node, uint32_t offset, uint32_t size, uint8_t *buffer) {
static uint32_t vga_write(fs_node_t * node, uint64_t offset, uint32_t size, uint8_t *buffer) {
/* XXX do some terminal processing like we did in the old days */
size_t i = 0;
while (*buffer && i < size) {

View File

@ -11,20 +11,11 @@
#include <kernel/fs.h>
#include <kernel/module.h>
static uint32_t read_null(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffer);
static uint32_t write_null(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffer);
static void open_null(fs_node_t *node, unsigned int flags);
static void close_null(fs_node_t *node);
static uint32_t read_zero(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffer);
static uint32_t write_zero(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffer);
static void open_zero(fs_node_t *node, unsigned int flags);
static void close_zero(fs_node_t *node);
static uint32_t read_null(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffer) {
static uint32_t read_null(fs_node_t *node, uint64_t offset, uint32_t size, uint8_t *buffer) {
return 0;
}
static uint32_t write_null(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffer) {
static uint32_t write_null(fs_node_t *node, uint64_t offset, uint32_t size, uint8_t *buffer) {
return 0;
}
@ -36,12 +27,12 @@ static void close_null(fs_node_t * node) {
return;
}
static uint32_t read_zero(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffer) {
static uint32_t read_zero(fs_node_t *node, uint64_t offset, uint32_t size, uint8_t *buffer) {
memset(buffer, 0x00, size);
return 1;
}
static uint32_t write_zero(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffer) {
static uint32_t write_zero(fs_node_t *node, uint64_t offset, uint32_t size, uint8_t *buffer) {
return 0;
}