On Fri, May 31, 2013 at 9:42 AM, Ralf Kirchner <[email protected]> wrote: > User interface and backwards compatibility for UTF-8 support in the FAT > file system. Purpose of UTF-8 support is to permit file names and > directory names with characters from all kinds of languages (Czech, > Chinese, Arabian, Hebrew, Korean, ...). This commit does not yet > support multibyte characters. It only contains the user interface and > the backwards compatibility. > --- > cpukit/libfs/Makefile.am | 1 + > cpukit/libfs/src/dosfs/dosfs.h | 197 ++++- > cpukit/libfs/src/dosfs/msdos.h | 70 +- > cpukit/libfs/src/dosfs/msdos_conv.c | 619 ++++++++++++---- > cpukit/libfs/src/dosfs/msdos_conv_default.c | 188 +++++ > cpukit/libfs/src/dosfs/msdos_create.c | 3 +- > cpukit/libfs/src/dosfs/msdos_dir.c | 191 ++--- > cpukit/libfs/src/dosfs/msdos_fsunmount.c | 4 +- > cpukit/libfs/src/dosfs/msdos_init.c | 35 +- > cpukit/libfs/src/dosfs/msdos_initsupp.c | 5 +- > cpukit/libfs/src/dosfs/msdos_misc.c | 1028 > +++++++++++++++++++-------- > 11 Dateien geändert, 1781 Zeilen hinzugefügt(+), 560 Zeilen entfernt(-) > create mode 100644 cpukit/libfs/src/dosfs/msdos_conv_default.c > > diff --git a/cpukit/libfs/Makefile.am b/cpukit/libfs/Makefile.am > index 0828da8..e06c8bd 100644 > --- a/cpukit/libfs/Makefile.am > +++ b/cpukit/libfs/Makefile.am > @@ -81,6 +81,7 @@ libdosfs_a_SOURCES += src/dosfs/msdos_create.c > src/dosfs/msdos_dir.c \ > src/dosfs/msdos_initsupp.c src/dosfs/msdos_misc.c \ > src/dosfs/msdos_mknod.c src/dosfs/msdos_node_type.c \ > src/dosfs/msdos_rmnod.c src/dosfs/msdos_statvfs.c \ > + src/dosfs/msdos_conv_default.c \ > src/dosfs/msdos_conv.c src/dosfs/msdos.h src/dosfs/msdos_format.c \ > src/dosfs/dosfs.h src/dosfs/msdos_rename.c > endif > diff --git a/cpukit/libfs/src/dosfs/dosfs.h b/cpukit/libfs/src/dosfs/dosfs.h > index ea650b2..c7b27df 100644 > --- a/cpukit/libfs/src/dosfs/dosfs.h > +++ b/cpukit/libfs/src/dosfs/dosfs.h > @@ -1,15 +1,18 @@ > /** > - * @file rtems/dosfs.h > + * @file > * > - * @brief Application Interface to MSDOS Filesystem > + * @brief Application Interface to FAT Filesystem > * > - * @ingroup rtems_msdos_format > + * @ingroup DOSFS > */ > > /* > * Copyright (C) 2001 OKTET Ltd., St.-Petersburg, Russia > * Author: Eugeny S. Mints <[email protected]> > * > + * Modifications to support UTF-8 in the file system are > + * Copyright (c) 2013 embedded brains GmbH. > + * > * The license and distribution terms for this file may be > * found in the file LICENSE in this distribution or at > * http://www.rtems.com/license/LICENSE. > @@ -25,6 +28,170 @@ > extern "C" { > #endif > > +typedef struct rtems_dosfs_convert_control rtems_dosfs_convert_control; > + I think it is usual to put the struct definition before the function prototypes in header files. I don't know if we have any rule about it though.
> @@ -131,6 +309,9 @@ int msdos_format ( > > /** @} */ > > +int rtems_dosfs_initialize(rtems_filesystem_mount_table_entry_t *mt_entry, > + const void *data); > + Can you give doxygen for this function now too? I know it did not have it, but it might be helpful. > diff --git a/cpukit/libfs/src/dosfs/msdos.h b/cpukit/libfs/src/dosfs/msdos.h > index 78eda9b..6da47cc 100644 > --- a/cpukit/libfs/src/dosfs/msdos.h > +++ b/cpukit/libfs/src/dosfs/msdos.h > @@ -10,6 +10,9 @@ > * Copyright (C) 2001 OKTET Ltd., St.-Petersburg, Russia > * Author: Eugeny S. Mints <[email protected]> > * > + * Modifications to support UTF-8 in the file system are > + * Copyright (c) 2013 embedded brains GmbH. > + * > * The license and distribution terms for this file may be > * found in the file LICENSE in this distribution or at > * http://www.rtems.com/license/LICENSE. > @@ -20,6 +23,7 @@ > > #include <rtems.h> > #include <rtems/libio_.h> > +#include <rtems/dosfs.h> > > #include "fat.h" > #include "fat_file.h" > @@ -67,6 +71,8 @@ typedef struct msdos_fs_info_s > * just > placeholder > * for anything > */ > + > + rtems_dosfs_convert_control *converter; > } msdos_fs_info_t; > Please add a comment about the converter field. > @@ -309,7 +328,8 @@ int msdos_initialize_support( > rtems_filesystem_mount_table_entry_t *temp_mt_entry, > const rtems_filesystem_operations_table *op_table, > const rtems_filesystem_file_handlers_r *file_handlers, > - const rtems_filesystem_file_handlers_r *directory_handlers > + const rtems_filesystem_file_handlers_r *directory_handlers, > + rtems_dosfs_convert_control *converter > ); > > int msdos_file_close(rtems_libio_t *iop /* IN */); > @@ -387,10 +407,52 @@ int msdos_get_name_node( > > int msdos_dir_info_remove(rtems_filesystem_location_info_t *pathloc); > > -msdos_name_type_t msdos_long_to_short(const char *lfn, int lfn_len, > +ssize_t > +msdos_format_dirent_with_dot(char *dst,const char *src); > + > +msdos_name_type_t msdos_long_to_short(rtems_dosfs_convert_control *converter, > + const char *lfn, int lfn_len, > char* sfn, int sfn_len); > > -int msdos_filename_unix2dos(const char *un, int unlen, char *dn); > +ssize_t > +msdos_filename_utf8_to_short_name_for_compare ( > + rtems_dosfs_convert_control *converter, > + const uint8_t *utf8_name, > + const size_t utf8_name_size, > + void *short_name, > + const size_t short_name_size); > + > +ssize_t > +msdos_filename_utf8_to_short_name_for_save ( > + rtems_dosfs_convert_control *converter, > + const uint8_t *utf8_name, > + const size_t utf8_name_size, > + void *short_name, > + const size_t short_name_size); > + > +ssize_t > +msdos_filename_utf8_to_long_name_for_compare ( > + rtems_dosfs_convert_control *converter, > + const uint8_t *utf8_name, > + const size_t utf8_name_size, > + uint8_t *long_name, > + const size_t long_name_size); > + > +ssize_t > +msdos_filename_utf8_to_long_name_for_save ( > + rtems_dosfs_convert_control *converter, > + const uint8_t *utf8_name, > + const size_t utf8_name_size, > + uint16_t *long_name, > + const size_t long_name_size); > + > +ssize_t > +msdos_get_utf16_string_from_long_entry ( > + const char *entry, > + uint16_t *entry_string_buf, > + const size_t buf_size, > + bool is_first_entry > +); > Why no doxygen comments for these new functions? > void msdos_date_unix2dos( > unsigned int tsp, uint16_t *ddp, > @@ -430,7 +492,7 @@ int msdos_find_name_in_fat_file( > rtems_filesystem_mount_table_entry_t *mt_entry, > fat_file_fd_t *fat_fd, > bool create_node, > - const char *name, > + const uint8_t *name_utf8, > int name_len, > msdos_name_type_t name_type, > fat_dir_pos_t *dir_pos, > diff --git a/cpukit/libfs/src/dosfs/msdos_conv.c > b/cpukit/libfs/src/dosfs/msdos_conv.c > index 7549c42..7e688ef 100644 > --- a/cpukit/libfs/src/dosfs/msdos_conv.c > +++ b/cpukit/libfs/src/dosfs/msdos_conv.c > @@ -22,18 +22,38 @@ > * $NetBSD: msdosfs_conv.c,v 1.10 1994/12/27 18:36:24 mycroft Exp $ > * > * October 1992 > + * > + * Modifications to support UTF-8 in the file system are > + * Copyright (c) 2013 embedded brains GmbH. > */ > > #if HAVE_CONFIG_H > #include "config.h" > #endif > > +#include <ctype.h> > #include <rtems.h> > #include "msdos.h" > > /* #define SECONDSPERDAY (24 * 60 * 60) */ > #define SECONDSPERDAY ((uint32_t) 86400) Does this generate equivalent code as (86400U)? Just curious mostly. I skimmed the rest. It is a lot of code! -Gedare _______________________________________________ rtems-devel mailing list [email protected] http://www.rtems.org/mailman/listinfo/rtems-devel
