From 07b04138ec1dba12d5657b0f8c4daa69b72d70cc Mon Sep 17 00:00:00 2001 From: Yann MAGNIN Date: Sat, 12 Apr 2025 14:45:38 +0200 Subject: [PATCH] fygue: fix typo --- src/fs/close.c | 4 +-- src/fs/fygue/fat/fat.c | 7 +++-- src/fs/fygue/fat/fat_dir_read.c | 10 +++---- src/fs/fygue/fat/fat_file_open.c | 10 +++---- src/fs/fygue/fat/fat_file_stat.c | 16 ++++++------ src/fs/fygue/fat/flash/cluster.c | 45 +++++++++++++++----------------- src/fs/fygue/fat/flash/cmap.c | 30 ++++++++++----------- src/fs/fygue/fygue.c | 2 +- src/fs/fygue/fygue_dir_open.c | 2 +- src/fs/fygue/fygue_dir_read.c | 2 +- src/fs/fygue/fygue_file_close.c | 2 +- src/fs/fygue/fygue_file_write.c | 2 +- src/fs/fygue/fygue_mount.c | 2 +- src/fs/fygue/fygue_open.c | 5 ++-- src/fs/open.c | 4 +-- src/fs/stat.c | 6 ++--- src/fs/write.c | 4 +-- 17 files changed, 74 insertions(+), 79 deletions(-) diff --git a/src/fs/close.c b/src/fs/close.c index 430f72d..8050a72 100644 --- a/src/fs/close.c +++ b/src/fs/close.c @@ -13,9 +13,9 @@ int close(int fd) int rc = 0; if(d->type->close == NULL) goto end; - /* Fugue's close primitive can flush pending IO write operation. So, we + /* Fugue's close primitive can flush pending IO write operations. So, we * are in the same situation than the write() primitive: force-sync - * Fygue's descriptor to ensure data intergrity */ + * Fygue's descriptor to ensure data integrity */ rc = d->type->close(d->data); if (fs_descriptor_is_fugue(d)) fs_fygue_sync(); diff --git a/src/fs/fygue/fat/fat.c b/src/fs/fygue/fat/fat.c index 9030659..6fbb96d 100644 --- a/src/fs/fygue/fat/fat.c +++ b/src/fs/fygue/fat/fat.c @@ -51,8 +51,7 @@ struct _fat_bpb * * notes * Fugue use the special sector0 to fetch critical flash information - * (total logical sector count and number of hidden sector). Then, based - * on fecthed information, Fugue select an hardcoded FAT configuration + * (total logical sector count and number of hidden sector). * * return * -1 unable to load the sector0 @@ -89,8 +88,8 @@ static int _fygue_fat_sector0(struct fygue_fat *fat) /* _fygue_fat_configure() - configure the FAT information * * notes - * the objectif is to find the first FAT address and the reserved root - * cluster (at the end of FATs since we only have to handle FAT12/16) + * Find the first FAT address and the reserved root cluster (at the end + * of FATs since we only have to handle FAT12/16) * * note that for FAT12/16 two special cluster entry are added, this is * why we have a manual offset to calculate the number of sector per diff --git a/src/fs/fygue/fat/fat_dir_read.c b/src/fs/fygue/fat/fat_dir_read.c index 39b7cfe..8c073d5 100644 --- a/src/fs/fygue/fat/fat_dir_read.c +++ b/src/fs/fygue/fat/fat_dir_read.c @@ -317,9 +317,9 @@ static int _fygue_readdir_fat(struct _fat_info *finfo) * notes * check special first character of the FAT entry and try to determine * if it is: - * 0x00 unused entry and all remaning entry will be unused - * 0xe5 unused entry - * 0x2e special "." or ".." entry + * 0x00 unused entry and all remaning entry will be unused + * 0xe5 unused entry + * 0x2e special "." or ".." entry * then check the dirent attribute to distinguish an VFAT entry from an * classic FAT entry * @@ -376,8 +376,8 @@ static int _fygue_readdir_fat_check(struct _fat_info *finfo) * return * -2 internal error * -1 argument error - * 0 success - * 1 no directory found */ + * 0 success + * 1 no directory found */ int fygue_fat_dir_read( struct fygue_fat *fat, struct fygue_fat_dir *dir, diff --git a/src/fs/fygue/fat/fat_file_open.c b/src/fs/fygue/fat/fat_file_open.c index 4b249e6..95d62a5 100644 --- a/src/fs/fygue/fat/fat_file_open.c +++ b/src/fs/fygue/fat/fat_file_open.c @@ -9,11 +9,11 @@ int fygue_fat_file_open( struct fygue_fat_dirent *dirent ) { memset(file, 0x00, sizeof(struct fygue_fat_file)); - file->attribute = dirent->attribute; - file->cluster_entry = dirent->cluster_id; - file->size = dirent->size; - file->chunk = NULL; - file->chunk_count = 0; + file->attribute = dirent->attribute; + file->cluster_entry = dirent->cluster_id; + file->size = dirent->size; + file->chunk = NULL; + file->chunk_count = 0; file->chunk_table_max_index = 0; if (fygue_fat_file_sync(fat, file, dirent->cluster_id) != 0) return -1; diff --git a/src/fs/fygue/fat/fat_file_stat.c b/src/fs/fygue/fat/fat_file_stat.c index 5102b3e..67a6833 100644 --- a/src/fs/fygue/fat/fat_file_stat.c +++ b/src/fs/fygue/fat/fat_file_stat.c @@ -34,7 +34,7 @@ static int _get_block_nb(struct fygue_fat *fat, int cluster) // Public //--- -/* fygue_fat_file_stat(): directory-specific stat primitive */ +/* fygue_fat_file_stat(): stat primitive */ int fygue_fat_file_stat( struct fygue_fat *fat, struct fygue_fat_file *file, @@ -44,14 +44,14 @@ int fygue_fat_file_stat( errno = EIO; return -1; } - statbuf->st_dev = 0; /* not supported */ - statbuf->st_ino = file->cluster_entry; - statbuf->st_mode = _get_mode(file->attribute); + statbuf->st_dev = 0; /* not supported */ + statbuf->st_ino = file->cluster_entry; + statbuf->st_mode = _get_mode(file->attribute); statbuf->st_nlink = 0; /* not supported */ - statbuf->st_uid = 0; /* not supported */ - statbuf->st_gid = 0; /* not supported */ - statbuf->st_rdev = 0; /* not supported */ - statbuf->st_size = file->size; + statbuf->st_uid = 0; /* not supported */ + statbuf->st_gid = 0; /* not supported */ + statbuf->st_rdev = 0; /* not supported */ + statbuf->st_size = file->size; statbuf->st_atime = 0; /* not supported */ statbuf->st_mtime = 0; /* not supported */ statbuf->st_ctime = 0; /* not supported */ diff --git a/src/fs/fygue/fat/flash/cluster.c b/src/fs/fygue/fat/flash/cluster.c index 22221f3..dfdca1c 100644 --- a/src/fs/fygue/fat/flash/cluster.c +++ b/src/fs/fygue/fat/flash/cluster.c @@ -29,15 +29,11 @@ struct _bfile_cluster_metadata * * notes * - assume that fcluster is not NULL - * - try using P1 information first then, P2 if this greedy-read fail * - to ensure that the provided bfile metadata is valid we will perform - * some test (also performed by Casio). First, ensure that the - * fcluster "kind" is valid (only 0x88, 0x22 or 0x11 are known and - * used) and then ensure that the "constant" part is also valid + * some test (also performed by Casio). * * todo : ensure checksum * todo : ensure ecc handling (?) - * todo : try P1 then P2 * * return * -1 if the provided `fcluster` is not NULL @@ -93,10 +89,10 @@ static int _fygue_flash_cluster_convert( ) { return -5; } - // on the fxcp400, have only some flash sector with the constants used - // in other device. Internally, on the fxcp400, Casio only perform - // a check an CRC that is performed on the whole cluster - // TODO: CRC check + // The fxcp400 has only some flash sectors with the constants used + // by other devices. Internally, on the fxcp400, Casio only performs + // a CRC check that is performed on the whole target cluster + // TODO: CRC check ? #if 0 if ( memcmp(&(bfile_meta->constant), _constant1, 0x18) != 0 && @@ -114,7 +110,7 @@ static int _fygue_flash_cluster_convert( /* _fygue_flash_cluster_meta(): special metadata cluster handling * * notes: - * metadata cluster are the last flash cluster of a flash sector it does + * metadata clusters are the last flash cluster of a flash sector it does * not have Bfile information. Generate a fake flash cluster with a * special custom kind to allow quick identification */ static int _fygue_flash_cluster_meta( @@ -142,19 +138,20 @@ static int _fygue_flash_cluster_meta( /* _fygue_flash_cluster_details(): special flash sector details handling * * notes: - * flash sector details is a particular flash cluster that contains + * flash sector details are a particular flash cluster that contains * critical versioning information needed to rebuild Casio's flash * mapping. - * However, this particular flash cluster are not represented in the - * same way between machines. For example, the G35EII that use flash - * sector of 64ko merge the details sector inside the metadata cluster to - * keep some space which is not the case with the FXCP400 or CG50 that + * + * However, this particular flash cluster is not represented in the + * same way between machines. For example, the G35EII that uses a flash + * sector of 64ko merges the details sector inside the metadata cluster + * to keep some space which is not the case with the FXCP400 or CG50 that * use 128ko flash sector and which the first cluster should be a details * one type. * * for 64k cluster the 0xf3c0 offset can be calculated as: - * 0x10000 - (8*512) = 0xf000 | sector size minus cluster size - * 15 * 0x40 = 0x3c0 | skip all data cluster meta info */ + * 0x10000 - (8*512) = 0xf000 | sector size minus cluster size + * 15 * 0x40 = 0x3c0 | skip all data cluster meta info */ static int _fygue_flash_cluster_details( struct fygue_flash *flash, struct fygue_flash_cluster *fcluster, @@ -199,7 +196,7 @@ static int _fygue_flash_cluster_details( * * notes * flash cluster data (0x11 or 0x88) are handled in the same way between - * all device */ + * all devices */ static int _fygue_flash_cluster_data( struct fygue_flash *flash, struct fygue_flash_cluster *fcluster, @@ -257,7 +254,7 @@ static int _fygue_flash_cluster_data( * return * -1 if the provided `fline` is not valid * -2 if the provided `fline` have invalid Bfile metadata - * 0 if the meta information has been generated */ + * 0 if the meta information has been generated */ int fygue_flash_cluster_get( struct fygue_flash *flash, struct fygue_flash_cluster *fcluster, @@ -299,13 +296,13 @@ int fygue_flash_cluster_get( /* fygue_flash_cluster_geometry() - get geometry information * * notes - * generate flash cluster geometry information. Note that we handle - * sector as a full 32 entry table, which differ from logical cluster ID - * that ignore the last entry which contain meta information + * generate flash cluster geometry information. Note that we handle + * sectors as a full 32/16 entry table, which differs from logical + * cluster ID that ignores the last entry which contains meta information. * * returns - * -1 if the provided address is not valid - * 0 success */ + * -1 if the provided address is not valid + * 0 success */ int fygue_flash_cluster_geometry( struct fygue_flash *flash, uintptr_t addr, diff --git a/src/fs/fygue/fat/flash/cmap.c b/src/fs/fygue/fat/flash/cmap.c index 6cf8645..bf40245 100644 --- a/src/fs/fygue/fat/flash/cmap.c +++ b/src/fs/fygue/fat/flash/cmap.c @@ -15,19 +15,19 @@ /* fygue_flash_cmap_update() - update the cluster redirection map * * notes - * Since Casio use its own methods to handle flash sector and cluster we + * Since Casio uses its own methods to handle flash sector and cluster we * need to rebuild the translation page between "logical cluster" * (lcluster) and "flash cluster" (fcluster). * - * Casio do not erase systematicaly each sector when they become - * outdated, instead, they use a `age` mechanism which indicate "when" - * the cluster has been created a keep the more recent one + * Casio does not erase systematically each sector when they become + * outdated, instead, they use a `version` mechanism which indicates + * "when" the cluster has been created to keep the more recent one. * * return * -1 if the provided information is not valid - * 0 if the provided lcluster exists and has not been updated - * 1 if the provided lcluster has been created - * 2 if the provided lcluster exists and has been updated */ + * 0 if the provided lcluster exists and has not been updated + * 1 if the provided lcluster has been created + * 2 if the provided lcluster exists and has been updated */ static int fygue_flash_cmap_update( struct fygue_flash_cmap *cmap, struct fygue_flash_cluster *fcluster @@ -144,20 +144,20 @@ int fygue_flash_cmap_lsector_get_addr( /* fygue_flash_cmap_init() - initialize fcluster translation * * notes: - * Casio have its own flash handling layer that hook Fugue primitives to - * control how/when the hardware will perform IO operation + * Casio has its own flash handling layer that hooks Fugue primitives to + * control how/when the hardware will perform IO operations * (read,write,erase). This because the Flash used in recent devices use - * sector of 128ko which imply, when you want to update one byte of + * sector of 128ko which implies, when you want to update one byte of * memory, you need to: - * - copy the whole page in RAM - * - perform the modification - * - write the new page information + * - copy the whole page in RAM + * - perform the modification + * - write the new page information * - * So, todo + * todo: docs * * returns: * -1 if the sector 0 is not found - * 0 success */ + * 0 success */ int fygue_flash_cmap_initialize( struct fygue_flash *flash, struct fygue_flash_cmap *cmap diff --git a/src/fs/fygue/fygue.c b/src/fs/fygue/fygue.c index 9c449f0..a9def31 100644 --- a/src/fs/fygue/fygue.c +++ b/src/fs/fygue/fygue.c @@ -99,7 +99,7 @@ static int fygue_gfdi_file_close(struct fygue_descriptor *desc) } //--- -// Gint File Descriptor Interface (gfdi) for file +// Gint File Descriptor Interface (gfdi) for directory //--- /* fygue_dir_write(): write directory (EISDIR) */ diff --git a/src/fs/fygue/fygue_dir_open.c b/src/fs/fygue/fygue_dir_open.c index fe8d19b..f275136 100644 --- a/src/fs/fygue/fygue_dir_open.c +++ b/src/fs/fygue/fygue_dir_open.c @@ -6,7 +6,7 @@ // Internals //--- -/* realloc a prepare the internal table */ +/* realloc and prepare the internal table */ static int _fygue_dir_open_table_realloc(struct fygue_dir *dir) { void *tmp; diff --git a/src/fs/fygue/fygue_dir_read.c b/src/fs/fygue/fygue_dir_read.c index e6c8ec3..0ccefe3 100644 --- a/src/fs/fygue/fygue_dir_read.c +++ b/src/fs/fygue/fygue_dir_read.c @@ -5,7 +5,7 @@ /* fygue_dir_read(): directory read implementation * * notes - * - assume that the directory have read permission */ + * - assume that the directory has read permission */ ssize_t fygue_dir_read( struct fygue_fsinfo *fsinfo, struct fygue_dir *dir, diff --git a/src/fs/fygue/fygue_file_close.c b/src/fs/fygue/fygue_file_close.c index e1b3447..b68402c 100644 --- a/src/fs/fygue/fygue_file_close.c +++ b/src/fs/fygue/fygue_file_close.c @@ -2,7 +2,7 @@ #include #include "fygue.h" -/* fygue_file_close(): close directory */ +/* fygue_file_close(): close file */ int fygue_file_close( struct fygue_fsinfo *fsinfo, struct fygue_file *file diff --git a/src/fs/fygue/fygue_file_write.c b/src/fs/fygue/fygue_file_write.c index bd2677f..6127076 100644 --- a/src/fs/fygue/fygue_file_write.c +++ b/src/fs/fygue/fygue_file_write.c @@ -1,6 +1,6 @@ #include "fygue.h" -/* fygue_file_write(): write directory (EISDIR) */ +/* fygue_file_write(): write file (EROFS) */ ssize_t fygue_file_write( struct fygue_fsinfo *fsinfo, struct fygue_file *file, diff --git a/src/fs/fygue/fygue_mount.c b/src/fs/fygue/fygue_mount.c index 130ede8..065ec3b 100644 --- a/src/fs/fygue/fygue_mount.c +++ b/src/fs/fygue/fygue_mount.c @@ -15,7 +15,7 @@ static struct fygue_fsinfo *__fygue_fsinfo = NULL; /* fygue_mount() - mount (if needed) and return the filesystem information * * notes - * - assume that this global is const after initialisation */ + * - assume that `__fygue_fsinfo` is const after initialisation */ int fygue_mount(struct fygue_fsinfo **fsinfo) { if (fsinfo == NULL) diff --git a/src/fs/fygue/fygue_open.c b/src/fs/fygue/fygue_open.c index 3700ded..36270d4 100644 --- a/src/fs/fygue/fygue_open.c +++ b/src/fs/fygue/fygue_open.c @@ -14,8 +14,7 @@ * * notes * - assume that path is clean - * - automatically mount the filesystem if needed - * - the saved pathname will not be saved in stat */ + * - automatically mount the filesystem if needed */ int fygue_open_resolve( char const * const path, struct fygue_descriptor *desc @@ -59,7 +58,7 @@ int fygue_open(char const *path, int flags, GUNUSED mode_t mode) if ((exists < 0 && (!(flags & O_CREAT) || (flags & O_DIRECTORY)))) FYGUE_RET_ERRNO(ENOENT); - /* if opening fails and the previous check as not returned an error, + /* if opening fails and the previous check has not returned an error, * it is certainly because of a creation request. We are a read-only * file-system, so, fail */ if (exists < 0) diff --git a/src/fs/open.c b/src/fs/open.c index 9b0528b..6be0a49 100644 --- a/src/fs/open.c +++ b/src/fs/open.c @@ -10,8 +10,8 @@ int open(char const *path, int flags, ...) mode_t mode = va_arg(args, int); va_end(args); - /* Standard open() use Fugue filesystem if a write operation - * is requested, otherwise use the Fygue filesystem */ + /* Standard open() uses Fugue filesystem if a write operation + * is requested, otherwise uses the Fygue filesystem */ int rc = -1; if ((flags & O_WRONLY) || (flags & O_RDWR)) { rc = fugue_open(path, flags, mode); diff --git a/src/fs/stat.c b/src/fs/stat.c index 97cd809..6b505dc 100644 --- a/src/fs/stat.c +++ b/src/fs/stat.c @@ -3,8 +3,8 @@ int stat(char const * restrict path, struct stat * restrict statbuf) { - /* Standard stat() is also provided by Fugue, but rely on Casio's - * syscall which do not provide all of the information and request - * a world-switch (internally) to works */ + /* Standard stat() is also provided by Fugue, but relies on Casio's + * syscall which does not provide all of the information and requests + * a world-switch (internally) to work */ return fygue_stat(path, statbuf); } diff --git a/src/fs/write.c b/src/fs/write.c index fff9b8a..8c0d01b 100644 --- a/src/fs/write.c +++ b/src/fs/write.c @@ -12,8 +12,8 @@ ssize_t write(int fd, const void *buf, size_t size) /* No write function: discard the contents but show no error */ if(d->type->write == NULL) return 0; - /* A special synchronisation must be performed to ensure that all - * Fygue's descriptor meta information are valid */ + /* A special synchronization must be performed to ensure that all + * Fygue's descriptor meta information is valid */ size = d->type->write(d->data, buf, size); if (fs_descriptor_is_fugue(d)) fs_fygue_sync();