From c30a15e590c7e5bfd27e4704c81648071f11d51f Mon Sep 17 00:00:00 2001 From: Donggeun Kim Date: Mon, 24 Oct 2011 21:15:28 +0000 Subject: FAT: Add FAT write feature In some cases, saving data in RAM as a file with FAT format is required. This patch allows the file to be written in FAT formatted partition. The usage is similar with reading a file. First, fat_register_device function is called before file_fat_write function in order to set target partition. Then, file_fat_write function is invoked with desired file name, start ram address for writing data, and file size. Signed-off-by: Donggeun Kim Signed-off-by: Kyungmin Park --- fs/fat/fat.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'fs/fat/fat.c') diff --git a/fs/fat/fat.c b/fs/fat/fat.c index 756ac64a8b..7cf173caaa 100644 --- a/fs/fat/fat.c +++ b/fs/fat/fat.c @@ -46,6 +46,7 @@ static void downcase (char *str) static block_dev_desc_t *cur_dev = NULL; static unsigned long part_offset = 0; +static unsigned long part_size; static int cur_part = 1; @@ -99,6 +100,7 @@ int fat_register_device (block_dev_desc_t * dev_desc, int part_no) if (!get_partition_info(dev_desc, part_no, &info)) { part_offset = info.start; cur_part = part_no; + part_size = info.size; } else if ((strncmp((char *)&buffer[DOS_FS_TYPE_OFFSET], "FAT", 3) == 0) || (strncmp((char *)&buffer[DOS_FS32_TYPE_OFFSET], "FAT32", 5) == 0)) { /* ok, we assume we are on a PBR only */ -- cgit v1.2.1