Update SMEMFS (add synchronous primitives) + Update GladFS (add synchronous primitives)

This commit is contained in:
Yann MAGNIN 2020-01-08 10:14:11 +01:00
parent 215925ed35
commit 6eea55d645
36 changed files with 262 additions and 77 deletions

View File

@ -5,6 +5,6 @@
#include <stdint.h>
extern uint32_t atomic_start(void);
extern uint32_t atomic_end(void);
extern uint32_t atomic_stop(void);
#endif /*__KERNEL_ATOMIC_H__*/

View File

@ -15,7 +15,7 @@
struct file_system_operations
{
void *(*mount)(void);
void *(*umount)(void);
int (*umount)(void);
};
// Internal super block operations

View File

@ -145,7 +145,7 @@ int start(void)
atomic_start();
fx9860_context_save(&casio_context);
vhex_context_set();
atomic_end();
atomic_stop();
// Internal FS init !
gladfs_initialize();
@ -193,7 +193,7 @@ int start(void)
// Restore Casio context.
fx9860_context_restore(&casio_context);
atomic_end();
atomic_stop();
// Casio VRAM workaround
// @note: GetKey call Bdisp_PutDD_VRAM()

View File

@ -61,7 +61,7 @@ ssize_t display_write(const void *buffer, size_t count)
//t6k11_display(vram);
// End atomic operation.
atomic_end();
atomic_stop();
// Return the number of written char.
return (i);

View File

@ -74,7 +74,7 @@ ssize_t tty_read(void *inode, void *buffer, size_t count)
// Get next key.
keynode = keynode->next;
}
atomic_end();
atomic_stop();
// Display buffer on TTY.
tty_buffer_display(&keyboard);
@ -163,7 +163,7 @@ static int check_special(struct keyboard_obj_s *keyboard, key_t key)
atomic_start();
fx9860_context_save(&vhex_context);
fx9860_context_restore(&casio_context);
atomic_end();
atomic_stop();
// Inject MENU key and call GetKey().
// TODO !!!
@ -178,7 +178,7 @@ static int check_special(struct keyboard_obj_s *keyboard, key_t key)
atomic_start();
fx9860_context_save(&casio_context);
fx9860_context_restore(&vhex_context);
atomic_end();
atomic_stop();
return (1);
}

View File

@ -171,7 +171,7 @@ static void tty_display(void)
display_ioctl(DISPLAY_IOCTL_SETY, srow);
// End atomic operation
atomic_end();
atomic_stop();
}
ssize_t tty_write(void *inode, const void *buffer, size_t count)

View File

@ -1,6 +1,8 @@
#include <kernel/fs/gladfs.h>
#include <kernel/memory.h>
/* gladfs_file_pos() - Get approriate file fragment date */
/* @note: This function is internal of GladFS, do not call it ! */
struct gladfs_fragment_data_s **gladfs_file_pos(off_t *offset, struct gladfs_inode_s *inode, off_t pos)
{
struct gladfs_fragment_data_s **fragdata;

View File

@ -5,6 +5,7 @@
// Internal helper
extern struct gladfs_fragment_data_s **gladfs_file_pos(off_t *offset, struct gladfs_inode_s *inode, off_t pos);
/* gladfs_read() - GladFS inode read primitive (sync) */
ssize_t gladfs_read(void *inode, void *buf, size_t count, off_t pos)
{
struct gladfs_fragment_data_s **fragdata;
@ -19,7 +20,10 @@ ssize_t gladfs_read(void *inode, void *buf, size_t count, off_t pos)
// Get appropriate data fragment
fragdata = gladfs_file_pos(&offset, inode, pos);
if (fragdata == NULL || *fragdata == NULL)
{
atomic_stop();
return (-1);
}
// Walk into fragemented data
current_size = 0;
@ -58,7 +62,7 @@ ssize_t gladfs_read(void *inode, void *buf, size_t count, off_t pos)
}
// End atomic operations
atomic_end();
atomic_stop();
// Return read bytes
return (current_size);

View File

@ -5,6 +5,7 @@
// Internal helper
extern struct gladfs_fragment_data_s **gladfs_file_pos(off_t *offset, struct gladfs_inode_s *inode, off_t pos);
/* gladfs_write() - GladFS inode write primitive (sync) */
ssize_t gladfs_write(void *inode, const void *buf, size_t count, off_t pos)
{
extern struct gladfs_superblock_s gladfs_superblock;
@ -14,32 +15,37 @@ ssize_t gladfs_write(void *inode, const void *buf, size_t count, off_t pos)
size_t write_size;
off_t offset;
// Check error
if (inode == NULL)
return (-1);
// Start atomic operation
atomic_start();
// Get appropriate data fragment
fragdata = gladfs_file_pos(&offset, inode, pos);
if (fragdata == NULL)
{
atomic_stop();
return (-1);
}
// Generate new indirect block if needed
if (*fragdata == NULL)
{
// @note: for now, the indirect block allocation is
// not really implemented :(
// @note: for now, the indirect block allocation (like
// ext2 file system) is not really implemented :(
gladfs_superblock.super_op.alloc_fragdata(fragdata, 1);
if (*fragdata == NULL)
{
atomic_stop();
return (-1);
}
// Reset offset
offset = 0;
}
// Debug
kvram_clear();
printk(0, 0, "Le sexe !");
printk(0, 1, "offset = %d", offset);
printk(0, 2, "fragdata = %p", *fragdata);
kvram_display();
DBG_WAIT;
// Walk into fragemented data
current_size = 0;
count = count - offset;
@ -86,7 +92,7 @@ ssize_t gladfs_write(void *inode, const void *buf, size_t count, off_t pos)
}
// End atomic operations
atomic_end();
atomic_stop();
// Return written bytes.
return (current_size);

View File

@ -1,25 +1,41 @@
#include <kernel/fs/gladfs.h>
#include <kernel/atomic.h>
#include <kernel/util.h>
/* gladfs_mount() - GladFS mount primitive (sync) */
void *gladfs_mount(void)
{
extern struct gladfs_superblock_s gladfs_superblock;
void *root_inode;
// If already mounted, return the root inode
if (gladfs_superblock.root_inode != NULL)
return (gladfs_superblock.root_inode);
// Start atomic operation
atomic_start();
// Try to create root inode.
gladfs_superblock.root_inode = gladfs_superblock.super_op.alloc_inode("/", GLADFS_INODE_TYPE_ROOT);
// If the root node does not exist...
if (gladfs_superblock.root_inode == NULL)
{
kvram_clear();
kvram_print(0, 0, "GladFS: ROOT inode alloc error !");
kvram_display();
DBG_WAIT;
return (NULL);
// ...Try to create root inode.
gladfs_superblock.root_inode = gladfs_superblock.super_op.alloc_inode("/", GLADFS_INODE_TYPE_ROOT);
if (gladfs_superblock.root_inode == NULL)
{
kvram_clear();
kvram_print(0, 0, "GladFS: ROOT inode alloc error !");
kvram_display();
DBG_WAIT;
}
}
// Get root inode
// @note: In theroy, the super block is
// stored on the device so, to ensure the
// synchronous primitives, we get the root
// inode here to restore interrupt before
// leave.
root_inode = gladfs_superblock.root_inode;
// Stop atomic operations
atomic_stop();
// Return root inode
return (gladfs_superblock.root_inode);
return (root_inode);
}

View File

@ -1,7 +1,9 @@
#include <kernel/fs/gladfs.h>
/* gladfs_umount() - GladFS unmount primitives (asyn) */
int gladfs_umount(void)
{
// Do nothing for now
// TODO: free'd root inode ?
return (0);
}

View File

@ -12,7 +12,7 @@ struct file_system_type gladfs_filesystem =
// FS specific openrations
.filesystem_operations = {
.mount = &gladfs_mount,
.umount = NULL
.umount = &gladfs_umount
},
// File operations

View File

@ -2,6 +2,7 @@
#include <kernel/fs/stat.h>
#include <kernel/atomic.h>
/* gladfs_creat() - Create new "empty" inode (atomically, sync) */
void *gladfs_creat(void *parent_inode, const char *file_name, mode_t mode)
{
extern struct gladfs_superblock_s gladfs_superblock;
@ -14,7 +15,10 @@ void *gladfs_creat(void *parent_inode, const char *file_name, mode_t mode)
// Create new inode
new_inode = gladfs_superblock.super_op.alloc_inode(file_name, mode | __S_IFREG);
if (new_inode == NULL)
{
atomic_stop();
return (NULL);
}
// Update FHS
parent = parent_inode;
@ -22,8 +26,8 @@ void *gladfs_creat(void *parent_inode, const char *file_name, mode_t mode)
new_inode->next = parent->children;
parent->children = new_inode;
// Stp atomic operation
atomic_end();
// Stop atomic operation
atomic_stop();
// Return inode
return(new_inode);

View File

@ -1,8 +1,17 @@
#include <kernel/fs/gladfs.h>
#include <kernel/fs/stat.h>
/* gladfs_find_first_child() - Return the first child of folder inode (async) */
void *gladfs_find_first_child(void *inode)
{
// Check inode fault
if (inode == NULL)
return (NULL);
// Check inode validity
if ((((struct gladfs_inode_s*)inode)->mode & __S_IFDIR) == 0)
return (NULL);
// Return the first child of the directory.
return (((struct gladfs_inode_s*)inode)->children);
}

View File

@ -1,8 +1,12 @@
#include <kernel/fs/gladfs.h>
/* gladfs_find_next_sibling() - Find the next file from the same parent (async) */
void *gladfs_find_next_sibling(void *inode)
{
// Check inode fault
if (inode == NULL)
return (NULL);
// Return the next inode
return (((struct gladfs_inode_s*)inode)->next);
}

View File

@ -1,8 +1,12 @@
#include <kernel/fs/gladfs.h>
/* gladfs_find_parent() - Retrun the parent inode of a file (async) */
void *gladfs_find_parent(void *inode)
{
// Check inode fault
if (inode == NULL)
return (NULL);
// Retrun the parent inode
return (((struct gladfs_inode_s*)inode)->parent);
}

View File

@ -1,5 +1,6 @@
#include <kernel/fs/gladfs.h>
/* gladfs_get_mode() - Dump permission and type of a file (async) */
mode_t gladfs_get_mode(void *inode)
{
return (((struct gladfs_inode_s*)inode)->mode);

View File

@ -1,6 +1,8 @@
#include <kernel/fs/gladfs.h>
#include <kernel/atomic.h>
#include <kernel/util.h>
/* gladfs_get_name() - Dump the name of a file (sync) */
int gladfs_get_name(void *inode, char *name, size_t count)
{
// Check potential error
@ -11,7 +13,13 @@ int gladfs_get_name(void *inode, char *name, size_t count)
if (count > GLADFS_INODE_NAME_LENGHT)
count = GLADFS_INODE_NAME_LENGHT;
// Start atomic operation
atomic_start();
// Dump name
strncpy(name, ((struct gladfs_inode_s*)inode)->name, count);
// Stop atomic operation
atomic_stop();
return (0);
}

View File

@ -2,6 +2,7 @@
#include <kernel/fs/stat.h>
#include <kernel/atomic.h>
/* gladfs_mkdir() - Create new folder inode (atomically, sync) */
void *gladfs_mkdir(void *parent_inode, const char *file_name, mode_t mode)
{
extern struct gladfs_superblock_s gladfs_superblock;
@ -14,7 +15,10 @@ void *gladfs_mkdir(void *parent_inode, const char *file_name, mode_t mode)
// Create new inode
new_inode = gladfs_superblock.super_op.alloc_inode(file_name, mode | __S_IFDIR);
if (new_inode == NULL)
{
atomic_stop();
return (NULL);
}
// Update FHS
parent = parent_inode;
@ -22,8 +26,8 @@ void *gladfs_mkdir(void *parent_inode, const char *file_name, mode_t mode)
new_inode->next = parent->children;
parent->children = new_inode;
// Stp atomic operation
atomic_end();
// Stop atomic operation
atomic_stop();
// Return inode
return(new_inode);

View File

@ -1,6 +1,8 @@
#include <kernel/fs/gladfs.h>
#include <kernel/memory.h>
#include <kernel/atomic.h>
/* gladfs_alloc_fragdata() - Superblock primitive to alloc "empty" fragment data block (sync) */
int gladfs_alloc_fragdata(struct gladfs_fragment_data_s **parent, int nb_block)
{
extern struct gladfs_superblock_s gladfs_superblock;
@ -9,14 +11,23 @@ int gladfs_alloc_fragdata(struct gladfs_fragment_data_s **parent, int nb_block)
if (parent == NULL)
return (-1);
// Start atomic opeation
atomic_start();
// Try to alloc block
*parent = pm_alloc(gladfs_superblock.block_size * nb_block);
if (*parent == NULL)
{
atomic_stop();
return (-1);
}
// Fill default value.
(*parent)->next = 0x00000000;
(*parent)->data_size = gladfs_superblock.block_size * nb_block;
(*parent)->data_used = 0x00000000;
// Stop atomic operation
atomic_stop();
return (0);
}

View File

@ -1,15 +1,23 @@
#include <kernel/fs/gladfs.h>
#include <kernel/memory.h>
#include <kernel/atomic.h>
#include <kernel/util.h>
/* gladfs_alloc_inode() - Superblock primitive to alloc "empty" inode (sync) */
struct gladfs_inode_s *gladfs_alloc_inode(const char *name, mode_t mode)
{
struct gladfs_inode_s *inode;
// Start atomic operation
atomic_start();
// alloc memory
inode = pm_alloc(sizeof(struct gladfs_inode_s));
if (inode == NULL)
{
atomic_stop();
return (NULL);
}
// Fill inode.
memset(inode, 0x00, sizeof(struct gladfs_inode_s));
@ -21,5 +29,8 @@ struct gladfs_inode_s *gladfs_alloc_inode(const char *name, mode_t mode)
inode->size = 0;
inode->fragnumber = 0;
inode->fragdata = NULL;
// Stop atomic operation
atomic_stop();
return (inode);
}

View File

@ -1,13 +1,22 @@
#include <kernel/fs/gladfs.h>
#include <kernel/memory.h>
#include <kernel/atomic.h>
/* gladfs_destroy_fragdata() - Free'd allocated fragmented data (sync) */
/* @note: *WARNING* no verification will be done, so do not use this primitive */
int gladfs_destroy_fragdata(struct gladfs_fragment_data_s *fragment)
{
// Check error
if (fragment == NULL)
return (-1);
// Start atomic operation
atomic_start();
// Free'd allocated space
pm_free(fragment);
// Stop atomic operation
atomic_stop();
return (0);
}

View File

@ -1,6 +1,9 @@
#include <kernel/fs/gladfs.h>
#include <kernel/memory.h>
#include <kernel/atomic.h>
/* gladfs_destroy_inode() - Free'd allocated inode (sync) */
/* @note: *WARNING* no verification will be done, so do not use this primitive */
int gladfs_destroy_inode(struct gladfs_inode_s *inode)
{
struct gladfs_fragment_data_s *fragdata;
@ -10,13 +13,16 @@ int gladfs_destroy_inode(struct gladfs_inode_s *inode)
if (inode == NULL)
return (-1);
// Start atomic operations
atomic_start();
// Free fragmented data
fragdata = inode->fragdata;
while (fragdata == NULL)
{
// Get next fragement
next = (void *)fragdata->next;
pm_free(fragdata);
gladfs_destroy_fragdata(fragdata);
// Update current fragment
fragdata = next;
@ -24,5 +30,8 @@ int gladfs_destroy_inode(struct gladfs_inode_s *inode)
// Free inode
pm_free(inode);
// Stop atomic operations
atomic_stop();
return (0);
}

View File

@ -1,5 +1,6 @@
#include <kernel/fs/smemfs.h>
#include <kernel/fs/file.h>
#include <kernel/atomic.h>
#include <kernel/util.h>
/* casio_smem_data_base_address() - Generate the fragmented data address (0xa0000000 + offset) */
@ -32,6 +33,9 @@ ssize_t smemfs_read(void *inode, void *buf, size_t count, off_t pos)
if (inode == NULL || buf == NULL)
return (-1);
// Start atomic operation
atomic_start();
// Get the current data fragment.
current_size = 0;
fragment = (void *)((uint32_t)inode + sizeof(struct casio_smem_header_s));
@ -44,7 +48,10 @@ ssize_t smemfs_read(void *inode, void *buf, size_t count, off_t pos)
// Check fragment error
if (fragment->magic != CASIO_SMEM_FRAGMENT_MAGIC)
{
atomic_stop();
return (-1);
}
// Read file data
current_size = 0;
@ -60,7 +67,7 @@ ssize_t smemfs_read(void *inode, void *buf, size_t count, off_t pos)
// Get the data address.
data_base_addr = casio_smem_get_data_base_address(fragment);
if (data_base_addr == NULL)
return (current_size);
break;
// Handle fragment data offset.
if (fragment_data_offset != 0)
@ -76,5 +83,8 @@ ssize_t smemfs_read(void *inode, void *buf, size_t count, off_t pos)
current_size = current_size + real_size;
fragment = fragment + 1;
}
// Stop atomic operation
atomic_stop();
return (current_size);
}

View File

@ -1,10 +1,21 @@
#include <kernel/fs/smemfs.h>
#include <kernel/atomic.h>
/* casio_smem_mount() - Get Block and Preheader Table addresses */
/* casio_smem_mount() - Mount the file system (sync) */
void *smemfs_mount(void)
{
extern struct smemfs_superblock_s smemfs_superblock;
void *root_inode;
// Start atomic operation
atomic_start();
// Get root inode
root_inode = smemfs_superblock.sector_table;
// Stop atomic operation
atomic_stop();
// Return the sector table to simulate the root inode.
return ((void*)smemfs_superblock.sector_table);
return (root_inode);
}

View File

@ -0,0 +1,8 @@
#include <kernel/fs/smemfs.h>
/* casio_smem_umount() - Unmount the File System */
int smemfs_umount(void)
{
// Do nothing for now
return (0);
}

View File

@ -12,7 +12,7 @@ struct file_system_type smemfs_filesystem =
// FS specific openrations
.filesystem_operations = {
.mount = &smemfs_mount,
.umount = NULL
.umount = &smemfs_umount
},
// File operations

View File

@ -1,34 +1,43 @@
#include <kernel/fs/smemfs.h>
#include <kernel/atomic.h>
#include <kernel/util.h>
/* smemfs_find_first_child() - Find the fist file in the (folder) inode */
/* smemfs_find_first_child() - Find the fist file in the (folder) inode (sync) */
void *smemfs_find_first_child(void *inode)
{
extern struct smemfs_superblock_s smemfs_superblock;
uint16_t folder_id;
void *child_inode;
// Check error.
if (inode == NULL)
return (NULL);
// Start atomic operation
atomic_start();
// Check root inode
if (inode == smemfs_superblock.sector_table)
{
folder_id = CASIO_SMEM_ROOT_ID;
} else {
// Check inode validity
if (((struct casio_smem_header_s *)inode)->info != CASIO_SMEM_HEADER_INFO_EXIST)
return (NULL);
// Check directory
if (((struct casio_smem_header_s *)inode)->type != CASIO_SMEM_HEADER_TYPE_DIRECTORY)
if (((struct casio_smem_header_s *)inode)->info != CASIO_SMEM_HEADER_INFO_EXIST ||
((struct casio_smem_header_s *)inode)->type != CASIO_SMEM_HEADER_TYPE_DIRECTORY)
{
atomic_stop();
return (NULL);
}
// Get directory ID
folder_id = ((struct casio_smem_header_s *)inode)->id;
}
// Return the first child of the file.
return (smemfs_walk(inode, smemfs_superblock.inode_table,
folder_id, WALK_FLAG_ID_CHECK_PARENT));
child_inode = smemfs_walk(inode, smemfs_superblock.inode_table,
folder_id, WALK_FLAG_ID_CHECK_PARENT);
// Stop atomic operation
atomic_stop();
return (child_inode);
}

View File

@ -1,26 +1,36 @@
#include <kernel/fs/smemfs.h>
#include <kernel/atomic.h>
#include <kernel/util.h>
/* smemfs_find_next_sibling() - Find the next file from the same parent (sync) */
void *smemfs_find_next_sibling(void *inode)
{
extern struct smemfs_superblock_s smemfs_superblock;
void *sibling_inode;
uint16_t folder_id;
// Check error.
if (inode == NULL)
return (NULL);
// Check root inode
if (inode == smemfs_superblock.sector_table)
return (NULL);
// Start atomic operation
atomic_start();
// Check inode validity
if (((struct casio_smem_header_s *)inode)->info != CASIO_SMEM_HEADER_INFO_EXIST)
// Check inode validity (and root)
if (inode == smemfs_superblock.sector_table ||
((struct casio_smem_header_s *)inode)->info != CASIO_SMEM_HEADER_INFO_EXIST)
{
atomic_stop();
return (NULL);
}
// Get parent ID.
folder_id = ((struct casio_smem_header_s *)inode)->parent.id;
// Return the next file of the directory.
return (smemfs_walk(inode, inode, folder_id, WALK_FLAG_ID_CHECK_PARENT));
sibling_inode = smemfs_walk(inode, inode, folder_id, WALK_FLAG_ID_CHECK_PARENT);
// Stop atomic operation
atomic_stop();
return (sibling_inode);
}

View File

@ -1,27 +1,36 @@
#include <kernel/fs/smemfs.h>
#include <kernel/atomic.h>
/* smemfs_find_parent() - Return the parent inode */
void *smemfs_find_parent(void *inode)
{
extern struct smemfs_superblock_s smemfs_superblock;
void *parent_inode;
uint16_t folder_id;
// Check error.
if (inode == NULL)
return (NULL);
// Check root inode
if (inode == smemfs_superblock.sector_table)
return (NULL);
// Start atomic operation
atomic_start();
// Check inode validity
if (((struct casio_smem_header_s *)inode)->info != CASIO_SMEM_HEADER_INFO_EXIST)
// Check inode validity (and root)
if (inode == smemfs_superblock.sector_table ||
((struct casio_smem_header_s *)inode)->info != CASIO_SMEM_HEADER_INFO_EXIST)
{
atomic_stop();
return (NULL);
}
// Get parent ID.
folder_id = ((struct casio_smem_header_s *)inode)->parent.id;
// Return first inode find
return (smemfs_walk(inode, smemfs_superblock.inode_table, folder_id,
WALK_FLAG_ID_CHECK_DIRECTORY));
parent_inode = smemfs_walk(inode, smemfs_superblock.inode_table, folder_id,
WALK_FLAG_ID_CHECK_DIRECTORY);
// Stop atomic operation
atomic_stop();
return (parent_inode);
}

View File

@ -1,31 +1,42 @@
#include <kernel/fs/smemfs.h>
#include <kernel/fs/stat.h>
#include <kernel/atomic.h>
/* smemfs_get_mode() - Return the permission dans the type of a file (sync) */
mode_t smemfs_get_mode(void *inode)
{
extern struct smemfs_superblock_s smemfs_superblock;
struct casio_smem_header_s *header;
int inode_type;
mode_t inode_type;
// Check error
if (inode == NULL)
return (-1);
// Start atomic opeartion
atomic_start();
// Check root inode
if (inode == smemfs_superblock.sector_table)
{
atomic_stop();
return (__S_IFDIR | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
}
// Check inode validity
header = inode;
if (header->info != CASIO_SMEM_HEADER_INFO_EXIST)
{
atomic_stop();
return (-1);
}
// We can only check if the file is a
// directory or not (Bfile limitation)
if (header->type == CASIO_SMEM_HEADER_TYPE_DIRECTORY)
inode_type = __S_IFDIR;
else
inode_type = __S_IFREG;
inode_type = (header->type == CASIO_SMEM_HEADER_TYPE_DIRECTORY) ? __S_IFDIR : __S_IFREG;
// Stop atomic operation
atomic_stop();
// Return default permission and type
return (inode_type | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);

View File

@ -1,5 +1,7 @@
#include <kernel/fs/smemfs.h>
#include <kernel/atomic.h>
/* smemfs_get_name() - Dump the name of a file (sync) */
int smemfs_get_name(void *inode, char *buf, size_t count)
{
extern struct smemfs_superblock_s smemfs_superblock;
@ -9,18 +11,25 @@ int smemfs_get_name(void *inode, char *buf, size_t count)
if (inode == NULL)
return (-1);
// Start atomic operation
atomic_start();
// Check root inode
if (inode == smemfs_superblock.sector_table)
{
buf[0] = '/';
buf[1] = '\0';
atomic_stop();
return (0);
}
// Check inode validity
header = inode;
if (header->info != CASIO_SMEM_HEADER_INFO_EXIST)
{
atomic_stop();
return (-1);
}
// Get "real" name size
count = count - 1;
@ -35,5 +44,8 @@ int smemfs_get_name(void *inode, char *buf, size_t count)
header->name[i] != 0xffff)
buf[i] = header->name[i];
buf[i] = '\0';
// Start atomic operation
atomic_stop();
return (0);
}

View File

@ -1,6 +1,7 @@
#include <kernel/fs/smemfs.h>
/* smemfs_walk() - Find inode based on directory ID and flags */
/* @note: This function is internal of smemFS, do not call it ! */
smemfs_inode_t *smemfs_walk(smemfs_inode_t *current,
smemfs_inode_t *entry, uint16_t folder_id, int flags)
{

View File

@ -3,10 +3,10 @@
##---
.text
.global _atomic_start
.global _atomic_end
.global _atomic_stop
.type _atomic_start, @function
.type _atomic_end, @function
.type _atomic_stop, @function
.extern _sr_save
.extern _atomic_counter
@ -48,12 +48,12 @@ atomic_start_exit:
/*TODO: Fix reentrace corruption !!!*/
/*
** @proto: uint32_t atomic_end(void)
** @proto: uint32_t atomic_stop(void)
** @return:
** * Saved SR register if has been restored.
** * 0xffffffff otherwise.
*/
_atomic_end:
_atomic_stop:
! Check if the calculator is currently
! into an atomic operation and update

View File

@ -23,7 +23,7 @@ void kvram_clear(void)
vram[i] = 0x00000000;
// End of atomic operation
atomic_end();
atomic_stop();
}
/* kvram_display() - Disaplay Video RAM into screen */
@ -64,7 +64,7 @@ void kvram_scroll(int lines)
}
// End of atomic operation
atomic_end();
atomic_stop();
}
/* kvram_reverse() - Reverse Video RAM area */
@ -130,7 +130,7 @@ void kvram_reverse(int x, int y, int width, int height)
}
// End of atomic operation
atomic_end();
atomic_stop();
}
/* kvram_print() - Print string on Video RAM */

View File

@ -44,7 +44,7 @@ int timer_install(void *callback, void *arg, uint32_t delay_ms, uint8_t mode)
// End of atomic operations.
// and return the timer ID.
atomic_end();
atomic_stop();
return (timer_ID);
}
@ -73,6 +73,6 @@ int timer_uninstall(int timer_ID)
timercache[timer_ID].status = TIMER_UNUSED;
// Stop atomic operation and return.
atomic_end();
atomic_stop();
return (0);
}