summaryrefslogtreecommitdiffstats
path: root/cpukit/libfs/src/dosfs/fat.h
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2009-04-29 08:31:27 +0000
committerChris Johns <chrisj@rtems.org>2009-04-29 08:31:27 +0000
commit07d6fd513f1c4d3c6905c880948671de1181fac2 (patch)
tree4dabf3fdd0b056bba7b0e9beb40f01277e5c2776 /cpukit/libfs/src/dosfs/fat.h
parent2009-04-28 Chris Johns <chrisj@rtems.org> (diff)
downloadrtems-07d6fd513f1c4d3c6905c880948671de1181fac2.tar.bz2
2009-04-29 Chris Johns <chrisj@rtems.org>
* libcsupport/include/rtems/libio.h: Add rtems_off64_t for internal use. Update the internal off_t to the 64bit offset. * libnetworking/lib/ftpfs.c, libnetworking/lib/tftpDriver.c, libfs/src/nfsclient/src/nfs.c, libfs/src/imfs/imfs_fifo.c, libfs/src/imfs/memfile.c, libfs/src/imfs/imfs_directory.c, libfs/src/imfs/imfs.h, libfs/src/imfs/deviceio.c: Change off_t to rtems_off64_t. * libmisc/shell/main_msdosfmt.c: Add an info level so the format code can tell the user what is happening. Add more options to control the format configuration. * libfs/src/dosfs/msdos_format.c: Add a print function to display the format progress and print statements. Select a better default cluster size depending on the size of the disk. This lowers the size of the FAT on large disks. Read and maintain the MRB partition information. * libfs/src/dosfs/dosfs.h, libfs/src/dosfs/fat.h, libfs/src/dosfs/fat_file.c, libfs/src/dosfs/fat_file.h, libfs/src/dosfs/msdos.h, libfs/src/dosfs/msdos_conv.c, libfs/src/dosfs/msdos_create.c, libfs/src/dosfs/msdos_file.c, libfs/src/dosfs/msdos_handlers_dir.c, libfs/src/dosfs/msdos_handlers_file.c, libfs/src/dosfs/msdos_init.c, libfs/src/dosfs/msdos_initsupp.c, libfs/src/dosfs/msdos_misc.c, libfs/src/dosfs/msdos_mknod.c: Add long file name support. Change off_t to rtems_off64_t.
Diffstat (limited to 'cpukit/libfs/src/dosfs/fat.h')
-rw-r--r--cpukit/libfs/src/dosfs/fat.h39
1 files changed, 33 insertions, 6 deletions
diff --git a/cpukit/libfs/src/dosfs/fat.h b/cpukit/libfs/src/dosfs/fat.h
index 83505922cc..74d0512fe5 100644
--- a/cpukit/libfs/src/dosfs/fat.h
+++ b/cpukit/libfs/src/dosfs/fat.h
@@ -250,7 +250,7 @@ extern "C" {
#define FAT_GET_FSINFO_TRAIL_SIGNATURE(x) FAT_GET_VAL32(x,508)
#define FAT_SET_FSINFO_TRAIL_SIGNATURE(x,val) FAT_SET_VAL32(x,508,val)
-#define FAT_FSINFO_TRAIL_SIGNATURE_VALUE (0x000055AA)
+#define FAT_FSINFO_TRAIL_SIGNATURE_VALUE (0xAA550000)
/*
* I read FSInfo sector from offset 484 to access the information, so offsets
* of these fields a relative
@@ -351,15 +351,31 @@ typedef struct fat_fs_info_s
} fat_fs_info_t;
/*
- * if the name we looking for is file we store not only first data cluster
- * number, but and cluster number and offset for directory entry for this
- * name
+ * FAT position is a the cluster and the offset into the
+ * cluster.
*/
-typedef struct fat_auxiliary_s
+typedef struct fat_pos_s
{
uint32_t cln;
uint32_t ofs;
-} fat_auxiliary_t;
+} fat_pos_t;
+
+/*
+ * If the name we looking for is file we store not only first data cluster
+ * number, but and cluster number and offset for directory entry for this
+ * name. We also add the LFN start offset so we can delete it the whole
+ * file name. We can then use this to delete the file.
+ */
+typedef struct fat_dir_pos_s
+{
+ fat_pos_t sname;
+ fat_pos_t lname;
+} fat_dir_pos_t;
+
+/*
+ * Set the long name entries to this value for a short file name.
+ */
+#define FAT_FILE_SHORT_NAME (0xffffffff)
#define FAT_FAT_OFFSET(fat_type, cln) \
((fat_type) & FAT_FAT12 ? ((cln) + ((cln) >> 1)) : \
@@ -380,6 +396,17 @@ typedef struct fat_auxiliary_s
#define FAT_OP_TYPE_READ 0x1
#define FAT_OP_TYPE_GET 0x2
+static inline void
+fat_dir_pos_init(
+ fat_dir_pos_t *dir_pos
+ )
+{
+ dir_pos->sname.cln = 0;
+ dir_pos->sname.ofs = 0;
+ dir_pos->lname.cln = FAT_FILE_SHORT_NAME;
+ dir_pos->lname.ofs = FAT_FILE_SHORT_NAME;
+}
+
static inline uint32_t
fat_cluster_num_to_sector_num(
rtems_filesystem_mount_table_entry_t *mt_entry,