xilffs: Removed compilation errors,added ReadOnly option.

This patch removes compilation errors in xilffs library.
This errors are coming when we configure ReadOnly, use
StringFunctions and use LFN options. This patch also does
configuring _FS_READONLY macro based on the option given
by the user.

Signed-off-by: P L Sai Krishna <lakshmis@xilinx.com>
This commit is contained in:
P L Sai Krishna 2015-07-01 10:51:36 +05:30 committed by Nava kishore Manne
parent 633480b43e
commit 746db5f257
3 changed files with 18 additions and 7 deletions

View file

@ -1658,13 +1658,13 @@ FRESULT dir_find (
dp->lfn_idx = dp->index; /* Start index of LFN */
}
/* Check validity of the LFN entry and compare it with given name */
ord = (c == ord && sum == directory[LDIR_Chksum] && cmp_lfn(dp->lfn, dir)) ? ord - 1 : 0xFF;
ord = (c == ord && sum == directory[LDIR_Chksum] && cmp_lfn(dp->lfn, directory)) ? ord - 1 : 0xFF;
}
} else { /* An SFN entry is found */
if (!ord && sum == sum_sfn(directory)) {
break; /* LFN matched? */
}
if (!(dp->fn[NS] & NS_LOSS) && !mem_cmp(dir, dp->fn, 11)) {
if (!(dp->fn[NS] & NS_LOSS) && !mem_cmp(directory, dp->fn, 11)) {
break; /* SFN matched? */
}
ord = 0xFF; dp->lfn_idx = 0xFFFF; /* Reset LFN sequence */
@ -3516,8 +3516,9 @@ FRESULT f_lseek (
if (clst == 0U) { /* When disk gets full, clip file size */
LocOfs = bcs; break;
}
} else {
} else
#endif
{
clst = get_fat(fp->fs, clst); /* Follow cluster chain if not in write mode */
}
if (clst == 0xFFFFFFFFU) {
@ -5128,7 +5129,6 @@ int f_printf (
}
if (c != '%') { /* Non escape character */
putc_bfd(&pb, c);
}
continue;
}
w = f = 0;

View file

@ -272,7 +272,7 @@ FRESULT f_fdisk (BYTE pdrv, const DWORD szt[], void* work); /* Divide a physic
#endif
#endif
#if _USE_STRFUNC
TCHAR* f_gets (TCHAR* buff, int len, FIL* fp); /* Get a string from the file */
TCHAR* f_gets (TCHAR* buff, s32 len, FIL* fp); /* Get a string from the file */
#if !_FS_READONLY
int f_putc (TCHAR c, FIL* fp); /* Put a character to the file */
int f_puts (const TCHAR* str, FIL* cp); /* Put a string to the file */

View file

@ -5,6 +5,11 @@
#ifndef _FFCONF
#define _FFCONF 8051 /* Revision ID */
#ifdef __cplusplus
extern "C" {
#endif
#include "xparameters.h"
/*---------------------------------------------------------------------------/
/ Functions and Buffer Configurations
@ -16,8 +21,11 @@
/ the file system object (FATFS) instead of private sector buffer eliminated
/ from the file object (FIL). */
#define _FS_READONLY 0 /* 0:Read/Write or 1:Read only */
#ifdef FILE_SYSTEM_READ_ONLY
#define _FS_READONLY 1 /* 1:Read only */
#else
#define _FS_READONLY 0 /* 0:Read/Write */
#endif
/* Setting _FS_READONLY to 1 defines read only configuration. This removes
/ writing functions, f_write(), f_sync(), f_unlink(), f_mkdir(), f_chmod(),
/ f_rename(), f_truncate() and useless f_getfree(). */
@ -224,5 +232,8 @@
/ PIC32 0 H8/300H 0 x86 0/1
*/
#ifdef __cplusplus
}
#endif
#endif /* _FFCONF */