dosfs
1# This file was automatically generated by SWIG (https://www.swig.org). 2# Version 4.2.1 3# 4# Do not make changes to this file unless you know what you are doing - modify 5# the SWIG interface file instead. 6 7from sys import version_info as _swig_python_version_info 8from mock_rtems import _dosfs as _dosfs 9 10try: 11 import builtins as __builtin__ 12except ImportError: 13 import __builtin__ 14 15def _swig_repr(self): 16 try: 17 strthis = "proxy of " + self.this.__repr__() 18 except __builtin__.Exception: 19 strthis = "" 20 return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,) 21 22 23def _swig_setattr_nondynamic_instance_variable(set): 24 def set_instance_attr(self, name, value): 25 if name == "this": 26 set(self, name, value) 27 elif name == "thisown": 28 self.this.own(value) 29 elif hasattr(self, name) and isinstance(getattr(type(self), name), property): 30 set(self, name, value) 31 else: 32 raise AttributeError("You cannot add instance attributes to %s" % self) 33 return set_instance_attr 34 35 36def _swig_setattr_nondynamic_class_variable(set): 37 def set_class_attr(cls, name, value): 38 if hasattr(cls, name) and not isinstance(getattr(cls, name), property): 39 set(cls, name, value) 40 else: 41 raise AttributeError("You cannot add class attributes to %s" % cls) 42 return set_class_attr 43 44 45def _swig_add_metaclass(metaclass): 46 """Class decorator for adding a metaclass to a SWIG wrapped class - a slimmed down version of six.add_metaclass""" 47 def wrapper(cls): 48 return metaclass(cls.__name__, cls.__bases__, cls.__dict__.copy()) 49 return wrapper 50 51 52class _SwigNonDynamicMeta(type): 53 """Meta class to enforce nondynamic attributes (no new attributes) for a class""" 54 __setattr__ = _swig_setattr_nondynamic_class_variable(type.__setattr__) 55 56 57class rtems_dosfs_convert_handler(object): 58 r"""FAT filesystem convert handler.""" 59 60 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") 61 __repr__ = _swig_repr 62 utf8_to_codepage = property(_dosfs.rtems_dosfs_convert_handler_utf8_to_codepage_get, _dosfs.rtems_dosfs_convert_handler_utf8_to_codepage_set, doc=r"""utf8_to_codepage : rtems_dosfs_utf8_to_codepage""") 63 codepage_to_utf8 = property(_dosfs.rtems_dosfs_convert_handler_codepage_to_utf8_get, _dosfs.rtems_dosfs_convert_handler_codepage_to_utf8_set, doc=r"""codepage_to_utf8 : rtems_dosfs_codepage_to_utf8""") 64 utf8_to_utf16 = property(_dosfs.rtems_dosfs_convert_handler_utf8_to_utf16_get, _dosfs.rtems_dosfs_convert_handler_utf8_to_utf16_set, doc=r"""utf8_to_utf16 : rtems_dosfs_utf8_to_utf16""") 65 utf16_to_utf8 = property(_dosfs.rtems_dosfs_convert_handler_utf16_to_utf8_get, _dosfs.rtems_dosfs_convert_handler_utf16_to_utf8_set, doc=r"""utf16_to_utf8 : rtems_dosfs_utf16_to_utf8""") 66 utf8_normalize_and_fold = property(_dosfs.rtems_dosfs_convert_handler_utf8_normalize_and_fold_get, _dosfs.rtems_dosfs_convert_handler_utf8_normalize_and_fold_set, doc=r"""utf8_normalize_and_fold : rtems_dosfs_utf8_normalize_and_fold""") 67 destroy = property(_dosfs.rtems_dosfs_convert_handler_destroy_get, _dosfs.rtems_dosfs_convert_handler_destroy_set, doc=r"""destroy : rtems_dosfs_convert_destroy""") 68 69 def __init__(self): 70 r"""__init__(rtems_dosfs_convert_handler self) -> rtems_dosfs_convert_handler""" 71 _dosfs.rtems_dosfs_convert_handler_swiginit(self, _dosfs.new_rtems_dosfs_convert_handler()) 72 __swig_destroy__ = _dosfs.delete_rtems_dosfs_convert_handler 73 74# Register rtems_dosfs_convert_handler in _dosfs: 75_dosfs.rtems_dosfs_convert_handler_swigregister(rtems_dosfs_convert_handler) 76class rtems_dosfs_buffer(object): 77 r"""Proxy of C rtems_dosfs_buffer struct.""" 78 79 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") 80 __repr__ = _swig_repr 81 data = property(_dosfs.rtems_dosfs_buffer_data_get, _dosfs.rtems_dosfs_buffer_data_set, doc=r"""data : p.void""") 82 size = property(_dosfs.rtems_dosfs_buffer_size_get, _dosfs.rtems_dosfs_buffer_size_set, doc=r"""size : size_t""") 83 84 def __init__(self): 85 r"""__init__(rtems_dosfs_buffer self) -> rtems_dosfs_buffer""" 86 _dosfs.rtems_dosfs_buffer_swiginit(self, _dosfs.new_rtems_dosfs_buffer()) 87 __swig_destroy__ = _dosfs.delete_rtems_dosfs_buffer 88 89# Register rtems_dosfs_buffer in _dosfs: 90_dosfs.rtems_dosfs_buffer_swigregister(rtems_dosfs_buffer) 91class rtems_dosfs_convert_control(object): 92 r""" 93 FAT filesystem convert control. 94 95 Short file names are stored in the code page format. Long file names are 96 stored as little-endian UTF-16. The convert control determines the format 97 conversions to and from the POSIX file name strings. 98 """ 99 100 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") 101 __repr__ = _swig_repr 102 handler = property(_dosfs.rtems_dosfs_convert_control_handler_get, _dosfs.rtems_dosfs_convert_control_handler_set, doc=r"""handler : p.q(const).rtems_dosfs_convert_handler""") 103 buffer = property(_dosfs.rtems_dosfs_convert_control_buffer_get, _dosfs.rtems_dosfs_convert_control_buffer_set, doc=r"""buffer : rtems_dosfs_buffer""") 104 105 def __init__(self): 106 r"""__init__(rtems_dosfs_convert_control self) -> rtems_dosfs_convert_control""" 107 _dosfs.rtems_dosfs_convert_control_swiginit(self, _dosfs.new_rtems_dosfs_convert_control()) 108 __swig_destroy__ = _dosfs.delete_rtems_dosfs_convert_control 109 110# Register rtems_dosfs_convert_control in _dosfs: 111_dosfs.rtems_dosfs_convert_control_swigregister(rtems_dosfs_convert_control) 112RTEMS_DOSFS_SEMAPHORES_PER_INSTANCE = _dosfs.RTEMS_DOSFS_SEMAPHORES_PER_INSTANCE 113r""" 114 Semaphore count per FAT filesystem instance. 115 116 This can be used for system configuration via <rtems/confdefs.h>. 117 """ 118class rtems_dosfs_mount_options(object): 119 r"""FAT filesystem mount options.""" 120 121 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") 122 __repr__ = _swig_repr 123 converter = property(_dosfs.rtems_dosfs_mount_options_converter_get, _dosfs.rtems_dosfs_mount_options_converter_set, doc=r""" 124 Converter implementation for new file system instance. 125 126 Note: If you pass a converter to mount, you have to destroy it yourself if 127 mount failed. In a good case it is destroyed at unmount. 128 129 Before converters have been added to the RTEMS implementation of the FAT 130 file system, the implementation was: 131 - Short names were saved in code page format (as is still the case). 132 - Long names were not saved in UTF-16 format as mandated by the FAT file 133 system specification. Instead the character in the local encoding was 134 stored to the low byte directly and the high byte was set to zero. 135 136 There are a few compatibility issues due to a non-standard conform 137 implementation of the FAT file system before the UTF-8 support was added. 138 These following issues affect the default converter and the UTF-8 139 converter: 140 - Before UTF-8 support was added, it was possible to create files with the 141 the same short name in single case and mixed case in a directory. It 142 was for example possible to have files "ABC" and "aBc" in a single 143 directory. Now this bug is fixed. 144 - Before UTF-8 support was added, it was possible to create files with a 145 name length of slightly more than 255 characters. Now the 146 implementation adheres exactly to the 255 character limit. 147 - Long file names saved before UTF-8 support was added could contain 148 non-ASCII characters in the low byte which was saved for a long name 149 character. With the default converter this means such files can be read 150 only by their short file name. With the UTF-8 converter file names will 151 be read correctly as long as the characters written with the old 152 implementation were Latin-1 characters. 153 154 The following sample code demonstrates how to mount a file 155 system with UTF-8 support: 156 157 .. code-block:: c++ 158 159 #include <errno.h> 160 #include <assert.h> 161 #include <rtems/dosfs.h> 162 #include <rtems/libio.h> 163 164 static int mount_with_utf8( 165 const char *device_file, 166 const char *mount_point 167 ) 168 { 169 rtems_dosfs_convert_control *convert_ctrl; 170 int rv; 171 172 convert_ctrl = rtems_dosfs_create_utf8_converter( "CP850" ); 173 174 if ( convert_ctrl != NULL ) { 175 rtems_dosfs_mount_options mount_opts; 176 177 memset( &mount_opts, 0, sizeof( mount_opts ) ); 178 mount_opts.converter = convert_ctrl; 179 180 rv = mount_and_make_target_path( 181 device_file, 182 mount_point, 183 RTEMS_FILESYSTEM_TYPE_DOSFS, 184 RTEMS_FILESYSTEM_READ_WRITE, 185 &mount_opts 186 ); 187 188 if (rv != 0) { 189 (*mount_opts.converter->handler->destroy)(mount_opts.converter); 190 } 191 } else { 192 rv = -1; 193 errno = ENOMEM; 194 } 195 196 return rv; 197 } 198 199 In case you do not want UTF-8 support, you can simply pass a NULL pointer 200 to mount_and_make_target_path() respectively to mount() instead of the 201 mount_opts address. 202 203 See also: rtems_dosfs_create_default_converter() and 204 rtems_dosfs_create_utf8_converter(). 205 """) 206 207 def __init__(self): 208 r"""__init__(rtems_dosfs_mount_options self) -> rtems_dosfs_mount_options""" 209 _dosfs.rtems_dosfs_mount_options_swiginit(self, _dosfs.new_rtems_dosfs_mount_options()) 210 __swig_destroy__ = _dosfs.delete_rtems_dosfs_mount_options 211 212# Register rtems_dosfs_mount_options in _dosfs: 213_dosfs.rtems_dosfs_mount_options_swigregister(rtems_dosfs_mount_options) 214 215def rtems_dosfs_create_default_converter(): 216 r""" 217 Allocates and initializes a default converter. 218 219 This default converter will accept only POSIX file names with pure ASCII 220 characters. This largely corresponds to the file name handling before the 221 optional UTF-8 support was added to the RTEMS implementation of the FAT file 222 system. This handling is mostly backwards compatible to the previous RTEMS 223 implementation of the FAT file system. 224 225 For backwards compatibility and the previous RTEMS implementation of the FAT 226 file system please see also 'rtems_dosfs_mount_options' and mount(). 227 """ 228 return _dosfs.rtems_dosfs_create_default_converter() 229 230def rtems_dosfs_create_utf8_converter(codepage): 231 r""" 232 Allocates and initializes a UTF-8 converter. 233 234 This converter will assume that all file names passed to POSIX file handling 235 methods are UTF-8 strings and will convert them to the selected code page 236 for short file names and to UTF-16 for long file names. This conversion 237 will be done during reading and writing. These conversions correspond to 238 the specification of the FAT file system. This handling is mostly backwards 239 compatible to the previous RTEMS implementation of the FAT file system. 240 241 For backwards compatibility and the previous RTEMS implementation of the FAT 242 file system please see also 'rtems_dosfs_mount_options' and mount(). 243 244 One possible issue with this converter is: When reading file names which 245 have been created with other implementations of the FAT file system, it can 246 happen that during the conversion to UTF-8 a long file name becomes longer 247 and exceeds the 255 bytes limit. In such a case only the short file name 248 will get read. 249 250 :type codepage: string, in 251 :param codepage: The iconv() identification string for the used code 252 page. 253 """ 254 return _dosfs.rtems_dosfs_create_utf8_converter(codepage) 255MSDOS_FMT_INFO_LEVEL_NONE = _dosfs.MSDOS_FMT_INFO_LEVEL_NONE 256 257MSDOS_FMT_INFO_LEVEL_INFO = _dosfs.MSDOS_FMT_INFO_LEVEL_INFO 258 259MSDOS_FMT_INFO_LEVEL_DETAIL = _dosfs.MSDOS_FMT_INFO_LEVEL_DETAIL 260 261MSDOS_FMT_INFO_LEVEL_DEBUG = _dosfs.MSDOS_FMT_INFO_LEVEL_DEBUG 262 263class msdos_format_request_param_t(object): 264 r"""FAT file system format request parameters.""" 265 266 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") 267 __repr__ = _swig_repr 268 OEMName = property(_dosfs.msdos_format_request_param_t_OEMName_get, _dosfs.msdos_format_request_param_t_OEMName_set, doc=r"""OEM name string or NULL.""") 269 VolLabel = property(_dosfs.msdos_format_request_param_t_VolLabel_get, _dosfs.msdos_format_request_param_t_VolLabel_set, doc=r"""Volume label string or NULL.""") 270 sectors_per_cluster = property(_dosfs.msdos_format_request_param_t_sectors_per_cluster_get, _dosfs.msdos_format_request_param_t_sectors_per_cluster_set, doc=r""" 271 Sectors per cluster hint. 272 273 The format procedure may choose another value. Use 0 as default value. 274 """) 275 fat_num = property(_dosfs.msdos_format_request_param_t_fat_num_get, _dosfs.msdos_format_request_param_t_fat_num_set, doc=r""" 276 Number of FATs hint. 277 278 Use 0 as default value. 279 """) 280 files_per_root_dir = property(_dosfs.msdos_format_request_param_t_files_per_root_dir_get, _dosfs.msdos_format_request_param_t_files_per_root_dir_set, doc=r""" 281 Minimum files in root directory for FAT12 and FAT16. 282 283 The format procedure may choose a greater value. Use 0 as default value. 284 """) 285 media = property(_dosfs.msdos_format_request_param_t_media_get, _dosfs.msdos_format_request_param_t_media_set, doc=r""" 286 Media code. 287 288 Use 0 as default value. The default media code is 0xf8. 289 """) 290 quick_format = property(_dosfs.msdos_format_request_param_t_quick_format_get, _dosfs.msdos_format_request_param_t_quick_format_set, doc=r""" 291 Quick format. 292 293 If set to true, then do not clear data sectors to zero. 294 """) 295 skip_alignment = property(_dosfs.msdos_format_request_param_t_skip_alignment_get, _dosfs.msdos_format_request_param_t_skip_alignment_set, doc=r""" 296 Do not align FAT, data cluster, and root directory to a cluster 297 boundary. 298 """) 299 sync_device = property(_dosfs.msdos_format_request_param_t_sync_device_get, _dosfs.msdos_format_request_param_t_sync_device_set, doc=r"""Synchronize device after write operations.""") 300 info_level = property(_dosfs.msdos_format_request_param_t_info_level_get, _dosfs.msdos_format_request_param_t_info_level_set, doc=r"""The amount of info to output.""") 301 302 def __init__(self): 303 r"""__init__(msdos_format_request_param_t self) -> msdos_format_request_param_t""" 304 _dosfs.msdos_format_request_param_t_swiginit(self, _dosfs.new_msdos_format_request_param_t()) 305 __swig_destroy__ = _dosfs.delete_msdos_format_request_param_t 306 307# Register msdos_format_request_param_t in _dosfs: 308_dosfs.msdos_format_request_param_t_swigregister(msdos_format_request_param_t) 309 310def msdos_format(devname, rqdata): 311 r""" 312 Formats a block device with a FAT file system. 313 314 :type devname: string, in 315 :param devname: The block device path. 316 :type rqdata: :py:class:`msdos_format_request_param_t`, in 317 :param rqdata: The FAT file system format request data. Use NULL for 318 default parameters. 319 """ 320 return _dosfs.msdos_format(devname, rqdata) 321 322def rtems_dosfs_initialize(mt_entry, data): 323 324 return _dosfs.rtems_dosfs_initialize(mt_entry, data)
58class rtems_dosfs_convert_handler(object): 59 r"""FAT filesystem convert handler.""" 60 61 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") 62 __repr__ = _swig_repr 63 utf8_to_codepage = property(_dosfs.rtems_dosfs_convert_handler_utf8_to_codepage_get, _dosfs.rtems_dosfs_convert_handler_utf8_to_codepage_set, doc=r"""utf8_to_codepage : rtems_dosfs_utf8_to_codepage""") 64 codepage_to_utf8 = property(_dosfs.rtems_dosfs_convert_handler_codepage_to_utf8_get, _dosfs.rtems_dosfs_convert_handler_codepage_to_utf8_set, doc=r"""codepage_to_utf8 : rtems_dosfs_codepage_to_utf8""") 65 utf8_to_utf16 = property(_dosfs.rtems_dosfs_convert_handler_utf8_to_utf16_get, _dosfs.rtems_dosfs_convert_handler_utf8_to_utf16_set, doc=r"""utf8_to_utf16 : rtems_dosfs_utf8_to_utf16""") 66 utf16_to_utf8 = property(_dosfs.rtems_dosfs_convert_handler_utf16_to_utf8_get, _dosfs.rtems_dosfs_convert_handler_utf16_to_utf8_set, doc=r"""utf16_to_utf8 : rtems_dosfs_utf16_to_utf8""") 67 utf8_normalize_and_fold = property(_dosfs.rtems_dosfs_convert_handler_utf8_normalize_and_fold_get, _dosfs.rtems_dosfs_convert_handler_utf8_normalize_and_fold_set, doc=r"""utf8_normalize_and_fold : rtems_dosfs_utf8_normalize_and_fold""") 68 destroy = property(_dosfs.rtems_dosfs_convert_handler_destroy_get, _dosfs.rtems_dosfs_convert_handler_destroy_set, doc=r"""destroy : rtems_dosfs_convert_destroy""") 69 70 def __init__(self): 71 r"""__init__(rtems_dosfs_convert_handler self) -> rtems_dosfs_convert_handler""" 72 _dosfs.rtems_dosfs_convert_handler_swiginit(self, _dosfs.new_rtems_dosfs_convert_handler()) 73 __swig_destroy__ = _dosfs.delete_rtems_dosfs_convert_handler
FAT filesystem convert handler.
70 def __init__(self): 71 r"""__init__(rtems_dosfs_convert_handler self) -> rtems_dosfs_convert_handler""" 72 _dosfs.rtems_dosfs_convert_handler_swiginit(self, _dosfs.new_rtems_dosfs_convert_handler())
__init__(rtems_dosfs_convert_handler self) -> rtems_dosfs_convert_handler
61 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
The membership flag
77class rtems_dosfs_buffer(object): 78 r"""Proxy of C rtems_dosfs_buffer struct.""" 79 80 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") 81 __repr__ = _swig_repr 82 data = property(_dosfs.rtems_dosfs_buffer_data_get, _dosfs.rtems_dosfs_buffer_data_set, doc=r"""data : p.void""") 83 size = property(_dosfs.rtems_dosfs_buffer_size_get, _dosfs.rtems_dosfs_buffer_size_set, doc=r"""size : size_t""") 84 85 def __init__(self): 86 r"""__init__(rtems_dosfs_buffer self) -> rtems_dosfs_buffer""" 87 _dosfs.rtems_dosfs_buffer_swiginit(self, _dosfs.new_rtems_dosfs_buffer()) 88 __swig_destroy__ = _dosfs.delete_rtems_dosfs_buffer
Proxy of C rtems_dosfs_buffer struct.
85 def __init__(self): 86 r"""__init__(rtems_dosfs_buffer self) -> rtems_dosfs_buffer""" 87 _dosfs.rtems_dosfs_buffer_swiginit(self, _dosfs.new_rtems_dosfs_buffer())
__init__(rtems_dosfs_buffer self) -> rtems_dosfs_buffer
80 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
The membership flag
92class rtems_dosfs_convert_control(object): 93 r""" 94 FAT filesystem convert control. 95 96 Short file names are stored in the code page format. Long file names are 97 stored as little-endian UTF-16. The convert control determines the format 98 conversions to and from the POSIX file name strings. 99 """ 100 101 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") 102 __repr__ = _swig_repr 103 handler = property(_dosfs.rtems_dosfs_convert_control_handler_get, _dosfs.rtems_dosfs_convert_control_handler_set, doc=r"""handler : p.q(const).rtems_dosfs_convert_handler""") 104 buffer = property(_dosfs.rtems_dosfs_convert_control_buffer_get, _dosfs.rtems_dosfs_convert_control_buffer_set, doc=r"""buffer : rtems_dosfs_buffer""") 105 106 def __init__(self): 107 r"""__init__(rtems_dosfs_convert_control self) -> rtems_dosfs_convert_control""" 108 _dosfs.rtems_dosfs_convert_control_swiginit(self, _dosfs.new_rtems_dosfs_convert_control()) 109 __swig_destroy__ = _dosfs.delete_rtems_dosfs_convert_control
FAT filesystem convert control.
Short file names are stored in the code page format. Long file names are stored as little-endian UTF-16. The convert control determines the format conversions to and from the POSIX file name strings.
106 def __init__(self): 107 r"""__init__(rtems_dosfs_convert_control self) -> rtems_dosfs_convert_control""" 108 _dosfs.rtems_dosfs_convert_control_swiginit(self, _dosfs.new_rtems_dosfs_convert_control())
__init__(rtems_dosfs_convert_control self) -> rtems_dosfs_convert_control
101 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
The membership flag
Semaphore count per FAT filesystem instance.
This can be used for system configuration via
119class rtems_dosfs_mount_options(object): 120 r"""FAT filesystem mount options.""" 121 122 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") 123 __repr__ = _swig_repr 124 converter = property(_dosfs.rtems_dosfs_mount_options_converter_get, _dosfs.rtems_dosfs_mount_options_converter_set, doc=r""" 125 Converter implementation for new file system instance. 126 127 Note: If you pass a converter to mount, you have to destroy it yourself if 128 mount failed. In a good case it is destroyed at unmount. 129 130 Before converters have been added to the RTEMS implementation of the FAT 131 file system, the implementation was: 132 - Short names were saved in code page format (as is still the case). 133 - Long names were not saved in UTF-16 format as mandated by the FAT file 134 system specification. Instead the character in the local encoding was 135 stored to the low byte directly and the high byte was set to zero. 136 137 There are a few compatibility issues due to a non-standard conform 138 implementation of the FAT file system before the UTF-8 support was added. 139 These following issues affect the default converter and the UTF-8 140 converter: 141 - Before UTF-8 support was added, it was possible to create files with the 142 the same short name in single case and mixed case in a directory. It 143 was for example possible to have files "ABC" and "aBc" in a single 144 directory. Now this bug is fixed. 145 - Before UTF-8 support was added, it was possible to create files with a 146 name length of slightly more than 255 characters. Now the 147 implementation adheres exactly to the 255 character limit. 148 - Long file names saved before UTF-8 support was added could contain 149 non-ASCII characters in the low byte which was saved for a long name 150 character. With the default converter this means such files can be read 151 only by their short file name. With the UTF-8 converter file names will 152 be read correctly as long as the characters written with the old 153 implementation were Latin-1 characters. 154 155 The following sample code demonstrates how to mount a file 156 system with UTF-8 support: 157 158 .. code-block:: c++ 159 160 #include <errno.h> 161 #include <assert.h> 162 #include <rtems/dosfs.h> 163 #include <rtems/libio.h> 164 165 static int mount_with_utf8( 166 const char *device_file, 167 const char *mount_point 168 ) 169 { 170 rtems_dosfs_convert_control *convert_ctrl; 171 int rv; 172 173 convert_ctrl = rtems_dosfs_create_utf8_converter( "CP850" ); 174 175 if ( convert_ctrl != NULL ) { 176 rtems_dosfs_mount_options mount_opts; 177 178 memset( &mount_opts, 0, sizeof( mount_opts ) ); 179 mount_opts.converter = convert_ctrl; 180 181 rv = mount_and_make_target_path( 182 device_file, 183 mount_point, 184 RTEMS_FILESYSTEM_TYPE_DOSFS, 185 RTEMS_FILESYSTEM_READ_WRITE, 186 &mount_opts 187 ); 188 189 if (rv != 0) { 190 (*mount_opts.converter->handler->destroy)(mount_opts.converter); 191 } 192 } else { 193 rv = -1; 194 errno = ENOMEM; 195 } 196 197 return rv; 198 } 199 200 In case you do not want UTF-8 support, you can simply pass a NULL pointer 201 to mount_and_make_target_path() respectively to mount() instead of the 202 mount_opts address. 203 204 See also: rtems_dosfs_create_default_converter() and 205 rtems_dosfs_create_utf8_converter(). 206 """) 207 208 def __init__(self): 209 r"""__init__(rtems_dosfs_mount_options self) -> rtems_dosfs_mount_options""" 210 _dosfs.rtems_dosfs_mount_options_swiginit(self, _dosfs.new_rtems_dosfs_mount_options()) 211 __swig_destroy__ = _dosfs.delete_rtems_dosfs_mount_options
FAT filesystem mount options.
208 def __init__(self): 209 r"""__init__(rtems_dosfs_mount_options self) -> rtems_dosfs_mount_options""" 210 _dosfs.rtems_dosfs_mount_options_swiginit(self, _dosfs.new_rtems_dosfs_mount_options())
__init__(rtems_dosfs_mount_options self) -> rtems_dosfs_mount_options
122 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
The membership flag
216def rtems_dosfs_create_default_converter(): 217 r""" 218 Allocates and initializes a default converter. 219 220 This default converter will accept only POSIX file names with pure ASCII 221 characters. This largely corresponds to the file name handling before the 222 optional UTF-8 support was added to the RTEMS implementation of the FAT file 223 system. This handling is mostly backwards compatible to the previous RTEMS 224 implementation of the FAT file system. 225 226 For backwards compatibility and the previous RTEMS implementation of the FAT 227 file system please see also 'rtems_dosfs_mount_options' and mount(). 228 """ 229 return _dosfs.rtems_dosfs_create_default_converter()
Allocates and initializes a default converter.
This default converter will accept only POSIX file names with pure ASCII characters. This largely corresponds to the file name handling before the optional UTF-8 support was added to the RTEMS implementation of the FAT file system. This handling is mostly backwards compatible to the previous RTEMS implementation of the FAT file system.
For backwards compatibility and the previous RTEMS implementation of the FAT file system please see also 'rtems_dosfs_mount_options' and mount().
231def rtems_dosfs_create_utf8_converter(codepage): 232 r""" 233 Allocates and initializes a UTF-8 converter. 234 235 This converter will assume that all file names passed to POSIX file handling 236 methods are UTF-8 strings and will convert them to the selected code page 237 for short file names and to UTF-16 for long file names. This conversion 238 will be done during reading and writing. These conversions correspond to 239 the specification of the FAT file system. This handling is mostly backwards 240 compatible to the previous RTEMS implementation of the FAT file system. 241 242 For backwards compatibility and the previous RTEMS implementation of the FAT 243 file system please see also 'rtems_dosfs_mount_options' and mount(). 244 245 One possible issue with this converter is: When reading file names which 246 have been created with other implementations of the FAT file system, it can 247 happen that during the conversion to UTF-8 a long file name becomes longer 248 and exceeds the 255 bytes limit. In such a case only the short file name 249 will get read. 250 251 :type codepage: string, in 252 :param codepage: The iconv() identification string for the used code 253 page. 254 """ 255 return _dosfs.rtems_dosfs_create_utf8_converter(codepage)
Allocates and initializes a UTF-8 converter.
This converter will assume that all file names passed to POSIX file handling methods are UTF-8 strings and will convert them to the selected code page for short file names and to UTF-16 for long file names. This conversion will be done during reading and writing. These conversions correspond to the specification of the FAT file system. This handling is mostly backwards compatible to the previous RTEMS implementation of the FAT file system.
For backwards compatibility and the previous RTEMS implementation of the FAT file system please see also 'rtems_dosfs_mount_options' and mount().
One possible issue with this converter is: When reading file names which have been created with other implementations of the FAT file system, it can happen that during the conversion to UTF-8 a long file name becomes longer and exceeds the 255 bytes limit. In such a case only the short file name will get read.
Parameters
- codepage: The iconv() identification string for the used code page.
264class msdos_format_request_param_t(object): 265 r"""FAT file system format request parameters.""" 266 267 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") 268 __repr__ = _swig_repr 269 OEMName = property(_dosfs.msdos_format_request_param_t_OEMName_get, _dosfs.msdos_format_request_param_t_OEMName_set, doc=r"""OEM name string or NULL.""") 270 VolLabel = property(_dosfs.msdos_format_request_param_t_VolLabel_get, _dosfs.msdos_format_request_param_t_VolLabel_set, doc=r"""Volume label string or NULL.""") 271 sectors_per_cluster = property(_dosfs.msdos_format_request_param_t_sectors_per_cluster_get, _dosfs.msdos_format_request_param_t_sectors_per_cluster_set, doc=r""" 272 Sectors per cluster hint. 273 274 The format procedure may choose another value. Use 0 as default value. 275 """) 276 fat_num = property(_dosfs.msdos_format_request_param_t_fat_num_get, _dosfs.msdos_format_request_param_t_fat_num_set, doc=r""" 277 Number of FATs hint. 278 279 Use 0 as default value. 280 """) 281 files_per_root_dir = property(_dosfs.msdos_format_request_param_t_files_per_root_dir_get, _dosfs.msdos_format_request_param_t_files_per_root_dir_set, doc=r""" 282 Minimum files in root directory for FAT12 and FAT16. 283 284 The format procedure may choose a greater value. Use 0 as default value. 285 """) 286 media = property(_dosfs.msdos_format_request_param_t_media_get, _dosfs.msdos_format_request_param_t_media_set, doc=r""" 287 Media code. 288 289 Use 0 as default value. The default media code is 0xf8. 290 """) 291 quick_format = property(_dosfs.msdos_format_request_param_t_quick_format_get, _dosfs.msdos_format_request_param_t_quick_format_set, doc=r""" 292 Quick format. 293 294 If set to true, then do not clear data sectors to zero. 295 """) 296 skip_alignment = property(_dosfs.msdos_format_request_param_t_skip_alignment_get, _dosfs.msdos_format_request_param_t_skip_alignment_set, doc=r""" 297 Do not align FAT, data cluster, and root directory to a cluster 298 boundary. 299 """) 300 sync_device = property(_dosfs.msdos_format_request_param_t_sync_device_get, _dosfs.msdos_format_request_param_t_sync_device_set, doc=r"""Synchronize device after write operations.""") 301 info_level = property(_dosfs.msdos_format_request_param_t_info_level_get, _dosfs.msdos_format_request_param_t_info_level_set, doc=r"""The amount of info to output.""") 302 303 def __init__(self): 304 r"""__init__(msdos_format_request_param_t self) -> msdos_format_request_param_t""" 305 _dosfs.msdos_format_request_param_t_swiginit(self, _dosfs.new_msdos_format_request_param_t()) 306 __swig_destroy__ = _dosfs.delete_msdos_format_request_param_t
FAT file system format request parameters.
303 def __init__(self): 304 r"""__init__(msdos_format_request_param_t self) -> msdos_format_request_param_t""" 305 _dosfs.msdos_format_request_param_t_swiginit(self, _dosfs.new_msdos_format_request_param_t())
__init__(msdos_format_request_param_t self) -> msdos_format_request_param_t
267 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
The membership flag
311def msdos_format(devname, rqdata): 312 r""" 313 Formats a block device with a FAT file system. 314 315 :type devname: string, in 316 :param devname: The block device path. 317 :type rqdata: :py:class:`msdos_format_request_param_t`, in 318 :param rqdata: The FAT file system format request data. Use NULL for 319 default parameters. 320 """ 321 return _dosfs.msdos_format(devname, rqdata)
Formats a block device with a FAT file system.
Parameters
- devname: The block device path.
- rqdata: The FAT file system format request data. Use NULL for default parameters.