Index: EcnlProtoTool/trunk/ntshell/fatfs/ccsbcs.c
===================================================================
--- EcnlProtoTool/trunk/ntshell/fatfs/ccsbcs.c	(revision 433)
+++ EcnlProtoTool/trunk/ntshell/fatfs/ccsbcs.c	(revision 434)
@@ -25,5 +25,5 @@
 
 
-#if _CODE_PAGE == 437
+#if FF_CODE_PAGE == 437
 #define _TBLDEF 1
 static
@@ -39,5 +39,5 @@
 };
 
-#elif _CODE_PAGE == 720
+#elif FF_CODE_PAGE == 720
 #define _TBLDEF 1
 static
@@ -53,5 +53,5 @@
 };
 
-#elif _CODE_PAGE == 737
+#elif FF_CODE_PAGE == 737
 #define _TBLDEF 1
 static
@@ -67,5 +67,5 @@
 };
 
-#elif _CODE_PAGE == 771
+#elif FF_CODE_PAGE == 771
 #define _TBLDEF 1
 static
@@ -81,5 +81,5 @@
 };
 
-#elif _CODE_PAGE == 775
+#elif FF_CODE_PAGE == 775
 #define _TBLDEF 1
 static
@@ -95,5 +95,5 @@
 };
 
-#elif _CODE_PAGE == 850
+#elif FF_CODE_PAGE == 850
 #define _TBLDEF 1
 static
@@ -109,5 +109,5 @@
 };
 
-#elif _CODE_PAGE == 852
+#elif FF_CODE_PAGE == 852
 #define _TBLDEF 1
 static
@@ -123,5 +123,5 @@
 };
 
-#elif _CODE_PAGE == 855
+#elif FF_CODE_PAGE == 855
 #define _TBLDEF 1
 static
@@ -137,5 +137,5 @@
 };
 
-#elif _CODE_PAGE == 857
+#elif FF_CODE_PAGE == 857
 #define _TBLDEF 1
 static
@@ -151,5 +151,5 @@
 };
 
-#elif _CODE_PAGE == 860
+#elif FF_CODE_PAGE == 860
 #define _TBLDEF 1
 static
@@ -165,5 +165,5 @@
 };
 
-#elif _CODE_PAGE == 861
+#elif FF_CODE_PAGE == 861
 #define _TBLDEF 1
 static
@@ -179,5 +179,5 @@
 };
 
-#elif _CODE_PAGE == 862
+#elif FF_CODE_PAGE == 862
 #define _TBLDEF 1
 static
@@ -193,5 +193,5 @@
 };
 
-#elif _CODE_PAGE == 863
+#elif FF_CODE_PAGE == 863
 #define _TBLDEF 1
 static
@@ -207,5 +207,5 @@
 };
 
-#elif _CODE_PAGE == 864
+#elif FF_CODE_PAGE == 864
 #define _TBLDEF 1
 static
@@ -221,5 +221,5 @@
 };
 
-#elif _CODE_PAGE == 865
+#elif FF_CODE_PAGE == 865
 #define _TBLDEF 1
 static
@@ -235,5 +235,5 @@
 };
 
-#elif _CODE_PAGE == 866
+#elif FF_CODE_PAGE == 866
 #define _TBLDEF 1
 static
@@ -249,5 +249,5 @@
 };
 
-#elif _CODE_PAGE == 869
+#elif FF_CODE_PAGE == 869
 #define _TBLDEF 1
 static
@@ -266,5 +266,5 @@
 
 
-#if _CODE_PAGE != 65001 && (!_TBLDEF || !_USE_LFN)
+#if FF_CODE_PAGE != 65001 && (!_TBLDEF || !FF_USE_LFN)
 #error This file is not needed at current configuration. Remove from the project.
 #endif
@@ -272,5 +272,5 @@
 
 
-#if _CODE_PAGE != 65001
+#if FF_CODE_PAGE != 65001
 WCHAR ff_convert (	/* Converted character, Returns zero on error */
 	WCHAR	chr,	/* Character code to be converted */
Index: EcnlProtoTool/trunk/ntshell/fatfs/diskio.c
===================================================================
--- EcnlProtoTool/trunk/ntshell/fatfs/diskio.c	(revision 433)
+++ EcnlProtoTool/trunk/ntshell/fatfs/diskio.c	(revision 434)
@@ -35,5 +35,5 @@
 int get_status(volatile RD_STAT *stat) {
 	stat->sz_sector = SS_RAMDISK;
-	if(stat->sz_sector < _MIN_SS || stat->sz_sector > _MAX_SS) return 0;
+	if(stat->sz_sector < FF_MIN_SS || stat->sz_sector > FF_MAX_SS) return 0;
 	stat->n_sectors = SZ_RAMDISK * 1024 / SS_RAMDISK;
 	stat->status = 0;
Index: EcnlProtoTool/trunk/ntshell/fatfs/diskio.h
===================================================================
--- EcnlProtoTool/trunk/ntshell/fatfs/diskio.h	(revision 433)
+++ EcnlProtoTool/trunk/ntshell/fatfs/diskio.h	(revision 434)
@@ -60,9 +60,9 @@
 
 /* Generic command (Used by FatFs) */
-#define CTRL_SYNC			0	/* Complete pending write process (needed at _FS_READONLY == 0) */
-#define GET_SECTOR_COUNT	1	/* Get media size (needed at _USE_MKFS == 1) */
-#define GET_SECTOR_SIZE		2	/* Get sector size (needed at _MAX_SS != _MIN_SS) */
-#define GET_BLOCK_SIZE		3	/* Get erase block size (needed at _USE_MKFS == 1) */
-#define CTRL_TRIM			4	/* Inform device that the data on the block of sectors is no longer used (needed at _USE_TRIM == 1) */
+#define CTRL_SYNC			0	/* Complete pending write process (needed at FF_FS_READONLY == 0) */
+#define GET_SECTOR_COUNT	1	/* Get media size (needed at FF_USE_MKFS == 1) */
+#define GET_SECTOR_SIZE		2	/* Get sector size (needed at FF_MAX_SS != FF_MIN_SS) */
+#define GET_BLOCK_SIZE		3	/* Get erase block size (needed at FF_USE_MKFS == 1) */
+#define CTRL_TRIM			4	/* Inform device that the data on the block of sectors is no longer used (needed at FF_USE_TRIM == 1) */
 
 /* Generic command (Not used by FatFs) */
Index: EcnlProtoTool/trunk/ntshell/fatfs/ff.c
===================================================================
--- EcnlProtoTool/trunk/ntshell/fatfs/ff.c	(revision 433)
+++ EcnlProtoTool/trunk/ntshell/fatfs/ff.c	(revision 434)
@@ -34,6 +34,6 @@
 
 /* Reentrancy related */
-#if _FS_REENTRANT
-#if _USE_LFN == 1
+#if FF_FS_REENTRANT
+#if FF_USE_LFN == 1
 #error Static LFN work area cannot be used at thread-safe configuration
 #endif
@@ -49,9 +49,9 @@
 
 /* Definitions of sector size */
-#if (_MAX_SS < _MIN_SS) || (_MAX_SS != 512 && _MAX_SS != 1024 && _MAX_SS != 2048 && _MAX_SS != 4096) || (_MIN_SS != 512 && _MIN_SS != 1024 && _MIN_SS != 2048 && _MIN_SS != 4096)
+#if (FF_MAX_SS < FF_MIN_SS) || (FF_MAX_SS != 512 && FF_MAX_SS != 1024 && FF_MAX_SS != 2048 && FF_MAX_SS != 4096) || (FF_MIN_SS != 512 && FF_MIN_SS != 1024 && FF_MIN_SS != 2048 && FF_MIN_SS != 4096)
 #error Wrong sector size configuration
 #endif
-#if _MAX_SS == _MIN_SS
-#define	SS(fs)	((UINT)_MAX_SS)	/* Fixed sector size */
+#if FF_MAX_SS == FF_MIN_SS
+#define	SS(fs)	((UINT)FF_MAX_SS)	/* Fixed sector size */
 #else
 #define	SS(fs)	((fs)->ssize)	/* Variable sector size */
@@ -60,9 +60,9 @@
 
 /* Timestamp feature */
-#if _FS_NORTC == 1
-#if _NORTC_YEAR < 1980 || _NORTC_YEAR > 2107 || _NORTC_MON < 1 || _NORTC_MON > 12 || _NORTC_MDAY < 1 || _NORTC_MDAY > 31
-#error Invalid _FS_NORTC settings
-#endif
-#define GET_FATTIME()	((DWORD)(_NORTC_YEAR - 1980) << 25 | (DWORD)_NORTC_MON << 21 | (DWORD)_NORTC_MDAY << 16)
+#if FF_FS_NORTC == 1
+#if FF_NORTC_YEAR < 1980 || FF_NORTC_YEAR > 2107 || FF_NORTC_MON < 1 || FF_NORTC_MON > 12 || FF_NORTC_MDAY < 1 || FF_NORTC_MDAY > 31
+#error Invalid FF_FS_NORTC settings
+#endif
+#define GET_FATTIME()	((DWORD)(FF_NORTC_YEAR - 1980) << 25 | (DWORD)FF_NORTC_MON << 21 | (DWORD)FF_NORTC_MDAY << 16)
 #else
 #define GET_FATTIME()	get_fattime()
@@ -71,7 +71,7 @@
 
 /* File access control feature */
-#if _FS_LOCK
-#if _FS_READONLY
-#error _FS_LOCK must be 0 at read-only configuration
+#if FF_FS_LOCK != 0
+#if FF_FS_READONLY
+#error FF_FS_LOCK must be 0 at read-only configuration
 #endif
 typedef struct {
@@ -87,5 +87,5 @@
 /* DBCS code ranges and SBCS upper conversion tables */
 
-#if _CODE_PAGE == 932	/* Japanese Shift-JIS */
+#if FF_CODE_PAGE == 932	/* Japanese Shift-JIS */
 #define _DF1S	0x81	/* DBC 1st byte range 1 start */
 #define _DF1E	0x9F	/* DBC 1st byte range 1 end */
@@ -97,5 +97,5 @@
 #define _DS2E	0xFC	/* DBC 2nd byte range 2 end */
 
-#elif _CODE_PAGE == 936	/* Simplified Chinese GBK */
+#elif FF_CODE_PAGE == 936	/* Simplified Chinese GBK */
 #define _DF1S	0x81
 #define _DF1E	0xFE
@@ -105,5 +105,5 @@
 #define _DS2E	0xFE
 
-#elif _CODE_PAGE == 949	/* Korean */
+#elif FF_CODE_PAGE == 949	/* Korean */
 #define _DF1S	0x81
 #define _DF1E	0xFE
@@ -115,5 +115,5 @@
 #define _DS3E	0xFE
 
-#elif _CODE_PAGE == 950	/* Traditional Chinese Big5 */
+#elif FF_CODE_PAGE == 950	/* Traditional Chinese Big5 */
 #define _DF1S	0x81
 #define _DF1E	0xFE
@@ -123,5 +123,5 @@
 #define _DS2E	0xFE
 
-#elif _CODE_PAGE == 437	/* U.S. */
+#elif FF_CODE_PAGE == 437	/* U.S. */
 #define _DF1S	0
 #define _EXCVT {0x80,0x9A,0x45,0x41,0x8E,0x41,0x8F,0x80,0x45,0x45,0x45,0x49,0x49,0x49,0x8E,0x8F, \
@@ -134,5 +134,5 @@
 				0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
 
-#elif _CODE_PAGE == 720	/* Arabic */
+#elif FF_CODE_PAGE == 720	/* Arabic */
 #define _DF1S	0
 #define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, \
@@ -145,5 +145,5 @@
 				0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
 
-#elif _CODE_PAGE == 737	/* Greek */
+#elif FF_CODE_PAGE == 737	/* Greek */
 #define _DF1S	0
 #define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, \
@@ -156,5 +156,5 @@
 				0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
 
-#elif _CODE_PAGE == 771	/* KBL */
+#elif FF_CODE_PAGE == 771	/* KBL */
 #define _DF1S	0
 #define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, \
@@ -167,5 +167,5 @@
 				0xF0,0xF0,0xF2,0xF2,0xF4,0xF4,0xF6,0xF6,0xF8,0xF8,0xFA,0xFA,0xFC,0xFC,0xFE,0xFF}
 
-#elif _CODE_PAGE == 775	/* Baltic */
+#elif FF_CODE_PAGE == 775	/* Baltic */
 #define _DF1S	0
 #define _EXCVT {0x80,0x9A,0x91,0xA0,0x8E,0x95,0x8F,0x80,0xAD,0xED,0x8A,0x8A,0xA1,0x8D,0x8E,0x8F, \
@@ -178,5 +178,5 @@
 				0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
 
-#elif _CODE_PAGE == 850	/* Latin 1 */
+#elif FF_CODE_PAGE == 850	/* Latin 1 */
 #define _DF1S	0
 #define _EXCVT {0x43,0x55,0x45,0x41,0x41,0x41,0x41,0x43,0x45,0x45,0x45,0x49,0x49,0x49,0x41,0x41, \
@@ -189,5 +189,5 @@
 				0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
 
-#elif _CODE_PAGE == 852	/* Latin 2 */
+#elif FF_CODE_PAGE == 852	/* Latin 2 */
 #define _DF1S	0
 #define _EXCVT {0x80,0x9A,0x90,0xB6,0x8E,0xDE,0x8F,0x80,0x9D,0xD3,0x8A,0x8A,0xD7,0x8D,0x8E,0x8F, \
@@ -200,5 +200,5 @@
 				0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xEB,0xFC,0xFC,0xFE,0xFF}
 
-#elif _CODE_PAGE == 855	/* Cyrillic */
+#elif FF_CODE_PAGE == 855	/* Cyrillic */
 #define _DF1S	0
 #define _EXCVT {0x81,0x81,0x83,0x83,0x85,0x85,0x87,0x87,0x89,0x89,0x8B,0x8B,0x8D,0x8D,0x8F,0x8F, \
@@ -211,5 +211,5 @@
 				0xF0,0xF2,0xF2,0xF4,0xF4,0xF6,0xF6,0xF8,0xF8,0xFA,0xFA,0xFC,0xFC,0xFD,0xFE,0xFF}
 
-#elif _CODE_PAGE == 857	/* Turkish */
+#elif FF_CODE_PAGE == 857	/* Turkish */
 #define _DF1S	0
 #define _EXCVT {0x80,0x9A,0x90,0xB6,0x8E,0xB7,0x8F,0x80,0xD2,0xD3,0xD4,0xD8,0xD7,0x49,0x8E,0x8F, \
@@ -222,5 +222,5 @@
 				0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
 
-#elif _CODE_PAGE == 860	/* Portuguese */
+#elif FF_CODE_PAGE == 860	/* Portuguese */
 #define _DF1S	0
 #define _EXCVT {0x80,0x9A,0x90,0x8F,0x8E,0x91,0x86,0x80,0x89,0x89,0x92,0x8B,0x8C,0x98,0x8E,0x8F, \
@@ -233,5 +233,5 @@
 				0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
 
-#elif _CODE_PAGE == 861	/* Icelandic */
+#elif FF_CODE_PAGE == 861	/* Icelandic */
 #define _DF1S	0
 #define _EXCVT {0x80,0x9A,0x90,0x41,0x8E,0x41,0x8F,0x80,0x45,0x45,0x45,0x8B,0x8B,0x8D,0x8E,0x8F, \
@@ -244,5 +244,5 @@
 				0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
 
-#elif _CODE_PAGE == 862	/* Hebrew */
+#elif FF_CODE_PAGE == 862	/* Hebrew */
 #define _DF1S	0
 #define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, \
@@ -255,5 +255,5 @@
 				0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
 
-#elif _CODE_PAGE == 863	/* Canadian-French */
+#elif FF_CODE_PAGE == 863	/* Canadian-French */
 #define _DF1S	0
 #define _EXCVT {0x43,0x55,0x45,0x41,0x41,0x41,0x86,0x43,0x45,0x45,0x45,0x49,0x49,0x8D,0x41,0x8F, \
@@ -266,5 +266,5 @@
 				0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
 
-#elif _CODE_PAGE == 864	/* Arabic */
+#elif FF_CODE_PAGE == 864	/* Arabic */
 #define _DF1S	0
 #define _EXCVT {0x80,0x9A,0x45,0x41,0x8E,0x41,0x8F,0x80,0x45,0x45,0x45,0x49,0x49,0x49,0x8E,0x8F, \
@@ -277,5 +277,5 @@
 				0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
 
-#elif _CODE_PAGE == 865	/* Nordic */
+#elif FF_CODE_PAGE == 865	/* Nordic */
 #define _DF1S	0
 #define _EXCVT {0x80,0x9A,0x90,0x41,0x8E,0x41,0x8F,0x80,0x45,0x45,0x45,0x49,0x49,0x49,0x8E,0x8F, \
@@ -288,5 +288,5 @@
 				0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
 
-#elif _CODE_PAGE == 866	/* Russian */
+#elif FF_CODE_PAGE == 866	/* Russian */
 #define _DF1S	0
 #define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, \
@@ -299,5 +299,5 @@
 				0xF0,0xF0,0xF2,0xF2,0xF4,0xF4,0xF6,0xF6,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
 
-#elif _CODE_PAGE == 869	/* Greek 2 */
+#elif FF_CODE_PAGE == 869	/* Greek 2 */
 #define _DF1S	0
 #define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, \
@@ -310,12 +310,12 @@
 				0xF0,0xF1,0xD1,0xD2,0xD3,0xF5,0xD4,0xF7,0xF8,0xF9,0xD5,0x96,0x95,0x98,0xFE,0xFF}
 
-#elif _CODE_PAGE == 1	/* ASCII (for only non-LFN cfg) */
-#if _USE_LFN
+#elif FF_CODE_PAGE == 1	/* ASCII (for only non-LFN cfg) */
+#if FF_USE_LFN
 #error Cannot use LFN feature without valid code page.
 #endif
 #define _DF1S	0
 
-#elif _CODE_PAGE == 65001 /* UTF-8 */
-#if _LFN_UNICODE
+#elif FF_CODE_PAGE == 65001 /* UTF-8 */
+#if FF_LFN_UNICODE
 #error Cannot use LFN_UNICODE feature without valid code page.
 #endif
@@ -532,41 +532,41 @@
 */
 
-#if _VOLUMES < 1 || _VOLUMES > 9
-#error Wrong _VOLUMES setting
-#endif
-static FATFS *FatFs[_VOLUMES];	/* Pointer to the file system objects (logical drives) */
+#if FF_VOLUMES < 1 || FF_VOLUMES > 9
+#error Wrong FF_VOLUMES setting
+#endif
+static FATFS *FatFs[FF_VOLUMES];	/* Pointer to the file system objects (logical drives) */
 static WORD Fsid;				/* File system mount ID */
 
-#if _FS_RPATH && _VOLUMES >= 2
+#if FF_FS_RPATH && FF_VOLUMES >= 2
 static BYTE CurrVol;			/* Current drive */
 #endif
 
-#if _FS_LOCK
-static FILESEM Files[_FS_LOCK];	/* Open object lock semaphores */
-#endif
-
-#if _USE_LFN == 0			/* Non LFN feature */
+#if FF_FS_LOCK != 0
+static FILESEM Files[FF_FS_LOCK];	/* Open object lock semaphores */
+#endif
+
+#if FF_USE_LFN == 0			/* Non LFN feature */
 #define	DEFINE_NAMEBUF		BYTE sfn[12]
 #define INIT_BUF(dobj)		(dobj).fn = sfn
 #define	FREE_BUF()
 #else
-#if _MAX_LFN < 12 || _MAX_LFN > 255
-#error Wrong _MAX_LFN setting
-#endif
-#if _USE_LFN == 1			/* LFN feature with static working buffer */
-static WCHAR LfnBuf[_MAX_LFN + 1];
+#if FF_MAX_LFN < 12 || FF_MAX_LFN > 255
+#error Wrong FF_MAX_LFN setting
+#endif
+#if FF_USE_LFN == 1			/* LFN feature with static working buffer */
+static WCHAR LfnBuf[FF_MAX_LFN + 1];
 #define	DEFINE_NAMEBUF		BYTE sfn[12]
 #define INIT_BUF(dobj)		{ (dobj).fn = sfn; (dobj).lfn = LfnBuf; }
 #define	FREE_BUF()
-#elif _USE_LFN == 2 		/* LFN feature with dynamic working buffer on the stack */
-#define	DEFINE_NAMEBUF		BYTE sfn[12]; WCHAR lbuf[_MAX_LFN + 1]
+#elif FF_USE_LFN == 2 		/* LFN feature with dynamic working buffer on the stack */
+#define	DEFINE_NAMEBUF		BYTE sfn[12]; WCHAR lbuf[FF_MAX_LFN + 1]
 #define INIT_BUF(dobj)		{ (dobj).fn = sfn; (dobj).lfn = lbuf; }
 #define	FREE_BUF()
-#elif _USE_LFN == 3 		/* LFN feature with dynamic working buffer on the heap */
+#elif FF_USE_LFN == 3 		/* LFN feature with dynamic working buffer on the heap */
 #define	DEFINE_NAMEBUF		BYTE sfn[12]; WCHAR *lfn
-#define INIT_BUF(dobj)		{ lfn = ff_memalloc((_MAX_LFN + 1) * 2); if (!lfn) LEAVE_FF((dobj).fs, FR_NOT_ENOUGH_CORE); (dobj).lfn = lfn; (dobj).fn = sfn; }
+#define INIT_BUF(dobj)		{ lfn = ff_memalloc((FF_MAX_LFN + 1) * 2); if (!lfn) LEAVE_FF((dobj).fs, FR_NOT_ENOUGH_CORE); (dobj).lfn = lfn; (dobj).fn = sfn; }
 #define	FREE_BUF()			ff_memfree(lfn)
 #else
-#error Wrong _USE_LFN setting
+#error Wrong FF_USE_LFN setting
 #endif
 #endif
@@ -598,5 +598,5 @@
 	const BYTE *s = (const BYTE*)src;
 
-#if _WORD_ACCESS == 1
+#if FF_WORD_ACCESS == 1
 	while (cnt >= sizeof (int)) {
 		*(int*)d = *(int*)s;
@@ -641,5 +641,5 @@
 /* Request/Release grant to access the volume                            */
 /*-----------------------------------------------------------------------*/
-#if _FS_REENTRANT
+#if FF_FS_REENTRANT
 static
 int lock_fs (
@@ -673,9 +673,9 @@
 /* File lock control functions                                           */
 /*-----------------------------------------------------------------------*/
-#if _FS_LOCK
+#if FF_FS_LOCK != 0
 
 static
 FRESULT chk_lock (	/* Check if the file can be accessed */
-	DIR* dp,		/* Directory object pointing the file to be checked */
+	FATFS_DIR* dp,		/* Directory object pointing the file to be checked */
 	int acc			/* Desired access type (0:Read, 1:Write, 2:Delete/Rename) */
 )
@@ -684,5 +684,5 @@
 
 	/* Search file semaphore table */
-	for (i = be = 0; i < _FS_LOCK; i++) {
+	for (i = be = 0; i < FF_FS_LOCK; i++) {
 		if (Files[i].fs) {	/* Existing entry */
 			if (Files[i].fs == dp->fs &&	 	/* Check if the object matched with an open object */
@@ -693,5 +693,5 @@
 		}
 	}
-	if (i == _FS_LOCK)	/* The object is not opened */
+	if (i == FF_FS_LOCK)	/* The object is not opened */
 		return (be || acc == 2) ? FR_OK : FR_TOO_MANY_OPEN_FILES;	/* Is there a blank entry for new object? */
 
@@ -706,6 +706,6 @@
 	UINT i;
 
-	for (i = 0; i < _FS_LOCK && Files[i].fs; i++) ;
-	return (i == _FS_LOCK) ? 0 : 1;
+	for (i = 0; i < FF_FS_LOCK && Files[i].fs; i++) ;
+	return (i == FF_FS_LOCK) ? 0 : 1;
 }
 
@@ -713,5 +713,5 @@
 static
 UINT inc_lock (	/* Increment object open counter and returns its index (0:Internal error) */
-	DIR* dp,	/* Directory object pointing the file to register or increment */
+	FATFS_DIR* dp,	/* Directory object pointing the file to register or increment */
 	int acc		/* Desired access (0:Read, 1:Write, 2:Delete/Rename) */
 )
@@ -720,5 +720,5 @@
 
 
-	for (i = 0; i < _FS_LOCK; i++) {	/* Find the object */
+	for (i = 0; i < FF_FS_LOCK; i++) {	/* Find the object */
 		if (Files[i].fs == dp->fs &&
 			Files[i].clu == dp->sclust &&
@@ -726,7 +726,7 @@
 	}
 
-	if (i == _FS_LOCK) {				/* Not opened. Register it as new. */
-		for (i = 0; i < _FS_LOCK && Files[i].fs; i++) ;
-		if (i == _FS_LOCK) return 0;	/* No free entry to register (int err) */
+	if (i == FF_FS_LOCK) {				/* Not opened. Register it as new. */
+		for (i = 0; i < FF_FS_LOCK && Files[i].fs; i++) ;
+		if (i == FF_FS_LOCK) return 0;	/* No free entry to register (int err) */
 		Files[i].fs = dp->fs;
 		Files[i].clu = dp->sclust;
@@ -752,5 +752,5 @@
 
 
-	if (--i < _FS_LOCK) {	/* Shift index number origin from 0 */
+	if (--i < FF_FS_LOCK) {	/* Shift index number origin from 0 */
 		n = Files[i].ctr;
 		if (n == 0x100) n = 0;		/* If write mode open, delete the entry */
@@ -773,5 +773,5 @@
 	UINT i;
 
-	for (i = 0; i < _FS_LOCK; i++) {
+	for (i = 0; i < FF_FS_LOCK; i++) {
 		if (Files[i].fs == fs) Files[i].fs = 0;
 	}
@@ -785,5 +785,5 @@
 /* Move/Flush disk access window in the file system object               */
 /*-----------------------------------------------------------------------*/
-#if !_FS_READONLY
+#if !FF_FS_READONLY
 static
 FRESULT sync_window (	/* FR_OK:succeeded, !=0:error */
@@ -825,5 +825,5 @@
 
 	if (sector != fs->winsect) {	/* Window offset changed? */
-#if !_FS_READONLY
+#if !FF_FS_READONLY
 		res = sync_window(fs);		/* Write-back changes */
 #endif
@@ -845,5 +845,5 @@
 /* Synchronize file system and strage device                             */
 /*-----------------------------------------------------------------------*/
-#if !_FS_READONLY
+#if !FF_FS_READONLY
 static
 FRESULT sync_fs (	/* FR_OK:succeeded, !=0:error */
@@ -959,5 +959,5 @@
 /* Hidden API for hacks and disk tools */
 
-#if !_FS_READONLY
+#if !FF_FS_READONLY
 FRESULT put_fat (	/* FR_OK(0):succeeded, !=0:error */
 	FATFS* fs,		/* File system object */
@@ -1014,5 +1014,5 @@
 	return res;
 }
-#endif /* !_FS_READONLY */
+#endif /* !FF_FS_READONLY */
 
 
@@ -1022,5 +1022,5 @@
 /* FAT handling - Remove a cluster chain                                 */
 /*-----------------------------------------------------------------------*/
-#if !_FS_READONLY
+#if !FF_FS_READONLY
 static
 FRESULT remove_chain (	/* FR_OK(0):succeeded, !=0:error */
@@ -1031,5 +1031,5 @@
 	FRESULT res;
 	DWORD nxt;
-#if _USE_TRIM
+#if FF_USE_TRIM
 	DWORD scl = clst, ecl = clst, rt[2];
 #endif
@@ -1051,5 +1051,5 @@
 				fs->fsi_flag |= 1;
 			}
-#if _USE_TRIM
+#if FF_USE_TRIM
 			if (ecl + 1 == nxt) {	/* Is next cluster contiguous? */
 				ecl = nxt;
@@ -1075,5 +1075,5 @@
 /* FAT handling - Stretch or Create a cluster chain                      */
 /*-----------------------------------------------------------------------*/
-#if !_FS_READONLY
+#if !FF_FS_READONLY
 static
 DWORD create_chain (	/* 0:No free cluster, 1:Internal error, 0xFFFFFFFF:Disk error, >=2:New cluster# */
@@ -1128,5 +1128,5 @@
 	return ncl;		/* Return new cluster number or error code */
 }
-#endif /* !_FS_READONLY */
+#endif /* !FF_FS_READONLY */
 
 
@@ -1137,5 +1137,5 @@
 /*-----------------------------------------------------------------------*/
 
-#if _USE_FASTSEEK
+#if FF_USE_FASTSEEK
 static
 DWORD clmt_clust (	/* <2:Error, >=2:Cluster number */
@@ -1157,5 +1157,5 @@
 	return cl + *tbl;	/* Return the cluster number */
 }
-#endif	/* _USE_FASTSEEK */
+#endif	/* FF_USE_FASTSEEK */
 
 
@@ -1168,5 +1168,5 @@
 static
 FRESULT dir_sdi (	/* FR_OK(0):succeeded, !=0:error */
-	DIR* dp,		/* Pointer to directory object */
+	FATFS_DIR* dp,		/* Pointer to directory object */
 	UINT idx		/* Index of directory table */
 )
@@ -1216,5 +1216,5 @@
 static
 FRESULT dir_next (	/* FR_OK(0):succeeded, FR_NO_FILE:End of table, FR_DENIED:Could not stretch */
-	DIR* dp,		/* Pointer to the directory object */
+	FATFS_DIR* dp,		/* Pointer to the directory object */
 	int stretch		/* 0: Do not stretch table, 1: Stretch table if needed */
 )
@@ -1222,5 +1222,5 @@
 	DWORD clst;
 	UINT i;
-#if !_FS_READONLY
+#if !FF_FS_READONLY
 	UINT c;
 #endif
@@ -1244,5 +1244,5 @@
 				if (clst == 0xFFFFFFFF) return FR_DISK_ERR;
 				if (clst >= dp->fs->n_fatent) {					/* If it reached end of dynamic table, */
-#if !_FS_READONLY
+#if !FF_FS_READONLY
 					if (!stretch) return FR_NO_FILE;			/* If do not stretch, report EOT */
 					clst = create_chain(dp->fs, dp->clust);		/* Stretch cluster chain */
@@ -1284,8 +1284,8 @@
 /*-----------------------------------------------------------------------*/
 
-#if !_FS_READONLY
+#if !FF_FS_READONLY
 static
 FRESULT dir_alloc (	/* FR_OK(0):succeeded, !=0:error */
-	DIR* dp,		/* Pointer to the directory object */
+	FATFS_DIR* dp,		/* Pointer to the directory object */
 	UINT nent		/* Number of contiguous entries to allocate (1-21) */
 )
@@ -1337,5 +1337,5 @@
 
 
-#if !_FS_READONLY
+#if !FF_FS_READONLY
 static
 void st_clust (
@@ -1355,5 +1355,5 @@
 /* LFN handling - Test/Pick/Fit an LFN segment from/to directory entry   */
 /*-----------------------------------------------------------------------*/
-#if _USE_LFN
+#if FF_USE_LFN
 static
 const BYTE LfnOfs[] = {1,3,5,7,9,14,16,18,20,22,24,28,30};	/* Offset of LFN characters in the directory entry */
@@ -1377,5 +1377,5 @@
 		uc = LD_WORD(dir + LfnOfs[s]);		/* Pick an LFN character */
 		if (wc) {
-			if (i >= _MAX_LFN || ff_wtoupper(uc) != ff_wtoupper(lfnbuf[i++]))	/* Compare it */
+			if (i >= FF_MAX_LFN || ff_wtoupper(uc) != ff_wtoupper(lfnbuf[i++]))	/* Compare it */
 				return 0;					/* Not matched */
 			wc = uc;
@@ -1410,5 +1410,5 @@
 		uc = LD_WORD(dir + LfnOfs[s]);		/* Pick an LFN character */
 		if (wc) {
-			if (i >= _MAX_LFN) return 0;	/* Buffer overflow? */
+			if (i >= FF_MAX_LFN) return 0;	/* Buffer overflow? */
 			lfnbuf[i++] = wc = uc;			/* Store it */
 		} else {
@@ -1418,5 +1418,5 @@
 
 	if (dir[LDIR_Ord] & LLEF) {				/* Put terminator if it is the last LFN part */
-		if (i >= _MAX_LFN) return 0;		/* Buffer overflow? */
+		if (i >= FF_MAX_LFN) return 0;		/* Buffer overflow? */
 		lfnbuf[i] = 0;
 	}
@@ -1426,5 +1426,5 @@
 
 
-#if !_FS_READONLY
+#if !FF_FS_READONLY
 static
 void fit_lfn (
@@ -1464,5 +1464,5 @@
 /* Create numbered name                                                  */
 /*-----------------------------------------------------------------------*/
-#if _USE_LFN
+#if FF_USE_LFN
 static
 void gen_numname (
@@ -1523,5 +1523,5 @@
 /* Calculate checksum of an SFN entry                                    */
 /*-----------------------------------------------------------------------*/
-#if _USE_LFN
+#if FF_USE_LFN
 static
 BYTE sum_sfn (
@@ -1546,10 +1546,10 @@
 static
 FRESULT dir_find (	/* FR_OK(0):succeeded, !=0:error */
-	DIR* dp			/* Pointer to the directory object linked to the file name */
+	FATFS_DIR* dp			/* Pointer to the directory object linked to the file name */
 )
 {
 	FRESULT res;
 	BYTE c, *dir;
-#if _USE_LFN
+#if FF_USE_LFN
 	BYTE a, ord, sum;
 #endif
@@ -1558,5 +1558,5 @@
 	if (res != FR_OK) return res;
 
-#if _USE_LFN
+#if FF_USE_LFN
 	ord = sum = 0xFF; dp->lfn_idx = 0xFFFF;	/* Reset LFN sequence */
 #endif
@@ -1567,5 +1567,5 @@
 		c = dir[DIR_Name];
 		if (c == 0) { res = FR_NO_FILE; break; }	/* Reached to end of table */
-#if _USE_LFN	/* LFN configuration */
+#if FF_USE_LFN	/* LFN configuration */
 		a = dir[DIR_Attr] & AM_MASK;
 		if (c == DDEM || ((a & AM_VOL) && a != AM_LFN)) {	/* An entry without valid data */
@@ -1604,8 +1604,8 @@
 /* Read an object from the directory                                     */
 /*-----------------------------------------------------------------------*/
-#if _FS_MINIMIZE <= 1 || _USE_LABEL || _FS_RPATH >= 2
+#if FF_FS_MINIMIZE <= 1 || FF_USE_LABEL || FF_FS_RPATH >= 2
 static
 FRESULT dir_read (
-	DIR* dp,		/* Pointer to the directory object */
+	FATFS_DIR* dp,		/* Pointer to the directory object */
 	int vol			/* Filtered by 0:file/directory or 1:volume label */
 )
@@ -1613,5 +1613,5 @@
 	FRESULT res;
 	BYTE a, c, *dir;
-#if _USE_LFN
+#if FF_USE_LFN
 	BYTE ord = 0xFF, sum = 0xFF;
 #endif
@@ -1625,6 +1625,6 @@
 		if (c == 0) { res = FR_NO_FILE; break; }	/* Reached to end of table */
 		a = dir[DIR_Attr] & AM_MASK;
-#if _USE_LFN	/* LFN configuration */
-		if (c == DDEM || (!_FS_RPATH && c == '.') || (int)((a & ~AM_ARC) == AM_VOL) != vol) {	/* An entry without valid data */
+#if FF_USE_LFN	/* LFN configuration */
+		if (c == DDEM || (!FF_FS_RPATH && c == '.') || (int)((a & ~AM_ARC) == AM_VOL) != vol) {	/* An entry without valid data */
 			ord = 0xFF;
 		} else {
@@ -1644,5 +1644,5 @@
 		}
 #else		/* Non LFN configuration */
-		if (c != DDEM && (_FS_RPATH || c != '.') && a != AM_LFN && (int)((a & ~AM_ARC) == AM_VOL) == vol)	/* Is it a valid entry? */
+		if (c != DDEM && (FF_FS_RPATH || c != '.') && a != AM_LFN && (int)((a & ~AM_ARC) == AM_VOL) == vol)	/* Is it a valid entry? */
 			break;
 #endif
@@ -1655,5 +1655,5 @@
 	return res;
 }
-#endif	/* _FS_MINIMIZE <= 1 || _USE_LABEL || _FS_RPATH >= 2 */
+#endif	/* FF_FS_MINIMIZE <= 1 || FF_USE_LABEL || FF_FS_RPATH >= 2 */
 
 
@@ -1663,12 +1663,12 @@
 /* Register an object to the directory                                   */
 /*-----------------------------------------------------------------------*/
-#if !_FS_READONLY
+#if !FF_FS_READONLY
 static
 FRESULT dir_register (	/* FR_OK:succeeded, FR_DENIED:no free entry or too many SFN collision, FR_DISK_ERR:disk error */
-	DIR* dp				/* Target directory with object name to be created */
+	FATFS_DIR* dp				/* Target directory with object name to be created */
 )
 {
 	FRESULT res;
-#if _USE_LFN	/* LFN configuration */
+#if FF_USE_LFN	/* LFN configuration */
 	UINT n, nent;
 	BYTE sn[12], *fn, sum;
@@ -1679,5 +1679,5 @@
 	mem_cpy(sn, fn, 12);
 
-	if (_FS_RPATH && (sn[NSFLAG] & NS_DOT))		/* Cannot create dot entry */
+	if (FF_FS_RPATH && (sn[NSFLAG] & NS_DOT))		/* Cannot create dot entry */
 		return FR_INVALID_NAME;
 
@@ -1724,5 +1724,5 @@
 			mem_set(dp->dir, 0, SZ_DIRE);	/* Clean the entry */
 			mem_cpy(dp->dir, dp->fn, 11);	/* Put SFN */
-#if _USE_LFN
+#if FF_USE_LFN
 			dp->dir[DIR_NTres] = dp->fn[NSFLAG] & (NS_BODY | NS_EXT);	/* Put NT flag */
 #endif
@@ -1733,5 +1733,5 @@
 	return res;
 }
-#endif /* !_FS_READONLY */
+#endif /* !FF_FS_READONLY */
 
 
@@ -1741,12 +1741,12 @@
 /* Remove an object from the directory                                   */
 /*-----------------------------------------------------------------------*/
-#if !_FS_READONLY && !_FS_MINIMIZE
+#if !FF_FS_READONLY && !FF_FS_MINIMIZE
 static
 FRESULT dir_remove (	/* FR_OK:Succeeded, FR_DISK_ERR:A disk error */
-	DIR* dp				/* Directory object pointing the entry to be removed */
+	FATFS_DIR* dp				/* Directory object pointing the entry to be removed */
 )
 {
 	FRESULT res;
-#if _USE_LFN	/* LFN configuration */
+#if FF_USE_LFN	/* LFN configuration */
 	UINT i;
 
@@ -1780,5 +1780,5 @@
 	return res;
 }
-#endif /* !_FS_READONLY */
+#endif /* !FF_FS_READONLY */
 
 
@@ -1788,8 +1788,8 @@
 /* Get file information from directory entry                             */
 /*-----------------------------------------------------------------------*/
-#if _FS_MINIMIZE <= 1 || _FS_RPATH >= 2
+#if FF_FS_MINIMIZE <= 1 || FF_FS_RPATH >= 2
 static
 void get_fileinfo (		/* No return code */
-	DIR* dp,			/* Pointer to the directory object */
+	FATFS_DIR* dp,			/* Pointer to the directory object */
 	FILINFO* fno	 	/* Pointer to the file information to be filled */
 )
@@ -1798,8 +1798,8 @@
 	TCHAR *p, c;
 	BYTE *dir;
-#if _USE_LFN
+#if FF_USE_LFN
 	WCHAR w, *lfn;
 #endif
-#if _CODE_PAGE == 65001
+#if FF_CODE_PAGE == 65001
 	unsigned char utf8_code[6];
 	int code_size;
@@ -1815,8 +1815,8 @@
 			if (c == RDDEM) c = (TCHAR)DDEM;	/* Restore replaced DDEM character */
 			if (i == 9) *p++ = '.';				/* Insert a . if extension is exist */
-#if _USE_LFN
+#if FF_USE_LFN
 			if (IsUpper(c) && (dir[DIR_NTres] & (i >= 9 ? NS_EXT : NS_BODY)))
 				c += 0x20;			/* To lower */
-#if _LFN_UNICODE
+#if FF_LFN_UNICODE
 			if (IsDBCS1(c) && i != 8 && i != 11 && IsDBCS2(dir[i]))
 				c = c << 8 | dir[i++];
@@ -1834,5 +1834,5 @@
 	*p = 0;		/* Terminate SFN string by a \0 */
 
-#if _USE_LFN
+#if FF_USE_LFN
 	if (fno->lfname) {
 		i = 0; p = fno->lfname;
@@ -1840,6 +1840,6 @@
 			lfn = dp->lfn;
 			while ((w = *lfn++) != 0) {		/* Get an LFN character */
-#if !_LFN_UNICODE
-#if _CODE_PAGE == 65001
+#if !FF_LFN_UNICODE
+#if FF_CODE_PAGE == 65001
 				Utf16_to_Utf8(utf8_code, &code_size, w);
 				for (int j = 0; j < code_size - 1; j++) {
@@ -1862,5 +1862,5 @@
 #endif
 }
-#endif /* _FS_MINIMIZE <= 1 || _FS_RPATH >= 2 */
+#endif /* FF_FS_MINIMIZE <= 1 || FF_FS_RPATH >= 2 */
 
 
@@ -1870,5 +1870,5 @@
 /* Pattern matching                                                      */
 /*-----------------------------------------------------------------------*/
-#if _USE_FIND && _FS_MINIMIZE <= 1
+#if FF_USE_FIND && FF_FS_MINIMIZE <= 1
 static
 WCHAR get_achar (		/* Get a character and advances ptr 1 or 2 */
@@ -1878,6 +1878,6 @@
 	WCHAR chr;
 
-#if !_LFN_UNICODE
-#if _CODE_PAGE == 65001
+#if !FF_LFN_UNICODE
+#if FF_CODE_PAGE == 65001
 	int code_size;
 	chr = Utf8_to_Utf16(*ptr, &code_size);
@@ -1938,5 +1938,5 @@
 	return 0;
 }
-#endif /* _USE_FIND && _FS_MINIMIZE <= 1 */
+#endif /* FF_USE_FIND && FF_FS_MINIMIZE <= 1 */
 
 
@@ -1949,15 +1949,15 @@
 static
 FRESULT create_name (	/* FR_OK: successful, FR_INVALID_NAME: could not create */
-	DIR* dp,			/* Pointer to the directory object */
+	FATFS_DIR* dp,			/* Pointer to the directory object */
 	const TCHAR** path	/* Pointer to pointer to the segment in the path string */
 )
 {
-#if _USE_LFN	/* LFN configuration */
+#if FF_USE_LFN	/* LFN configuration */
 	BYTE b, cf;
 	WCHAR w, *lfn;
 	UINT i, ni, si, di;
 	const TCHAR *p;
-#if _CODE_PAGE == 65001
-	char utf8_code[6];
+#if FF_CODE_PAGE == 65001
+	unsigned char utf8_code[6];
 	int code_size;
 #endif
@@ -1969,8 +1969,8 @@
 		w = p[si++];					/* Get a character */
 		if (w < ' ' || w == '/' || w == '\\') break;	/* Break on end of segment */
-		if (di >= _MAX_LFN)				/* Reject too long name */
+		if (di >= FF_MAX_LFN)				/* Reject too long name */
 			return FR_INVALID_NAME;
-#if !_LFN_UNICODE
-#if _CODE_PAGE == 65001
+#if !FF_LFN_UNICODE
+#if FF_CODE_PAGE == 65001
 		w = Utf8_to_Utf16(&p[si - 1], &code_size);
 		si += code_size - 1;
@@ -1993,5 +1993,5 @@
 	*path = &p[si];						/* Return pointer to the next segment */
 	cf = (w < ' ') ? NS_LAST : 0;		/* Set last segment flag if end of path */
-#if _FS_RPATH
+#if FF_FS_RPATH
 	if ((di == 1 && lfn[di - 1] == '.') ||
 		(di == 2 && lfn[di - 1] == '.' && lfn[di - 2] == '.')) {	/* Is this segment a dot entry? */
@@ -2040,5 +2040,5 @@
 			if (w) w = ExCvt[w - 0x80];	/* Convert extended character to upper (SBCS) */
 #else
-#if _CODE_PAGE == 65001
+#if FF_CODE_PAGE == 65001
 			Utf16_to_Utf8(utf8_code, &code_size, ff_wtoupper(w));
 #else
@@ -2048,10 +2048,10 @@
 			cf |= NS_LFN;				/* Force create LFN entry */
 		}
-#if _CODE_PAGE == 65001
+#if FF_CODE_PAGE == 65001
 		else
 			code_size = 1;
 #endif
 
-#if _CODE_PAGE == 65001
+#if FF_CODE_PAGE == 65001
 		if (code_size > 1) {		/* Is this DBC? (always false at SBCS cfg) */
 			if (i >= ni - 1) {
@@ -2126,5 +2126,5 @@
 	mem_set(sfn, ' ', 11);
 	si = i = b = 0; ni = 8;
-#if _FS_RPATH
+#if FF_FS_RPATH
 	if (p[si] == '.') { /* Is this a dot entry? */
 		for (;;) {
@@ -2201,5 +2201,5 @@
 static
 FRESULT follow_path (	/* FR_OK(0): successful, !=0: error code */
-	DIR* dp,			/* Directory object to return last directory and found object */
+	FATFS_DIR* dp,			/* Directory object to return last directory and found object */
 	const TCHAR* path	/* Full-path string to find a file or directory */
 )
@@ -2209,5 +2209,5 @@
 
 
-#if _FS_RPATH
+#if FF_FS_RPATH
 	if (*path == '/' || *path == '\\') {	/* There is a heading separator */
 		path++;	dp->sclust = 0;				/* Strip it and start from the root directory */
@@ -2232,5 +2232,5 @@
 			if (res != FR_OK) {				/* Failed to find the object */
 				if (res == FR_NO_FILE) {	/* Object is not found */
-					if (_FS_RPATH && (ns & NS_DOT)) {	/* If dot entry is not exist, */
+					if (FF_FS_RPATH && (ns & NS_DOT)) {	/* If dot entry is not exist, */
 						dp->sclust = 0; dp->dir = 0;	/* it is the root directory and stay there */
 						if (!(ns & NS_LAST)) continue;	/* Continue to follow if not last segment */
@@ -2269,6 +2269,6 @@
 	UINT i;
 	int vol = -1;
-#if _STR_VOLUME_ID		/* Find string drive id */
-	static const char* const str[] = {_VOLUME_STRS};
+#if FF_STR_VOLUME_ID		/* Find string drive id */
+	static const char* const str[] = {FF_VOLUME_STRS};
 	const char *sp;
 	char c;
@@ -2278,15 +2278,15 @@
 
 	if (*path) {	/* If the pointer is not a null */
-		for (tt = *path; (UINT)*tt >= (_USE_LFN ? ' ' : '!') && *tt != ':'; tt++) ;	/* Find ':' in the path */
+		for (tt = *path; (UINT)*tt >= (FF_USE_LFN ? ' ' : '!') && *tt != ':'; tt++) ;	/* Find ':' in the path */
 		if (*tt == ':') {	/* If a ':' is exist in the path name */
 			tp = *path;
 			i = *tp++ - '0'; 
 			if (i < 10 && tp == tt) {	/* Is there a numeric drive id? */
-				if (i < _VOLUMES) {	/* If a drive id is found, get the value and strip it */
+				if (i < FF_VOLUMES) {	/* If a drive id is found, get the value and strip it */
 					vol = (int)i;
 					*path = ++tt;
 				}
 			}
-#if _STR_VOLUME_ID
+#if FF_STR_VOLUME_ID
 			 else {	/* No numeric drive number, find string drive id */
 				i = 0; tt++;
@@ -2297,6 +2297,6 @@
 						if (IsLower(tc)) tc -= 0x20;
 					} while (c && (TCHAR)c == tc);
-				} while ((c || tp != tt) && ++i < _VOLUMES);	/* Repeat for each id until pattern match */
-				if (i < _VOLUMES) {	/* If a drive id is found, get the value and strip it */
+				} while ((c || tp != tt) && ++i < FF_VOLUMES);	/* Repeat for each id until pattern match */
+				if (i < FF_VOLUMES) {	/* If a drive id is found, get the value and strip it */
 					vol = (int)i;
 					*path = tt;
@@ -2306,5 +2306,5 @@
 			return vol;
 		}
-#if _FS_RPATH && _VOLUMES >= 2
+#if FF_FS_RPATH && FF_VOLUMES >= 2
 		vol = CurrVol;	/* Current drive */
 #else
@@ -2381,5 +2381,5 @@
 		stat = disk_status(fs->drv);
 		if (!(stat & STA_NOINIT)) {		/* and the physical drive is kept initialized */
-			if (!_FS_READONLY && wmode && (stat & STA_PROTECT))	/* Check write protection if needed */
+			if (!FF_FS_READONLY && wmode && (stat & STA_PROTECT))	/* Check write protection if needed */
 				return FR_WRITE_PROTECTED;
 			return FR_OK;				/* The file system object is valid */
@@ -2395,9 +2395,9 @@
 	if (stat & STA_NOINIT)				/* Check if the initialization succeeded */
 		return FR_NOT_READY;			/* Failed to initialize due to no medium or hard error */
-	if (!_FS_READONLY && wmode && (stat & STA_PROTECT))	/* Check disk write protection if needed */
+	if (!FF_FS_READONLY && wmode && (stat & STA_PROTECT))	/* Check disk write protection if needed */
 		return FR_WRITE_PROTECTED;
-#if _MAX_SS != _MIN_SS						/* Get sector size (multiple sector size cfg only) */
+#if FF_MAX_SS != FF_MIN_SS						/* Get sector size (multiple sector size cfg only) */
 	if (disk_ioctl(fs->drv, GET_SECTOR_SIZE, &SS(fs)) != RES_OK
-		|| SS(fs) < _MIN_SS || SS(fs) > _MAX_SS) return FR_DISK_ERR;
+		|| SS(fs) < FF_MIN_SS || SS(fs) > FF_MAX_SS) return FR_DISK_ERR;
 #endif
 	/* Find an FAT partition on the drive. Supports only generic partitioning, FDISK and SFD. */
@@ -2448,5 +2448,5 @@
 
 	/* Determine the FAT sub type */
-	sysect = nrsv + fasize + fs->n_rootdir / (SS(fs) / SZ_DIRE);	/* RSV + FAT + DIR */
+	sysect = nrsv + fasize + fs->n_rootdir / (SS(fs) / SZ_DIRE);	/* RSV + FAT + FATFS_DIR */
 	if (tsect < sysect) return FR_NO_FILESYSTEM;		/* (Invalid volume size) */
 	nclst = (tsect - sysect) / fs->csize;				/* Number of clusters */
@@ -2474,5 +2474,5 @@
 		return FR_NO_FILESYSTEM;
 
-#if !_FS_READONLY
+#if !FF_FS_READONLY
 	/* Initialize cluster allocation information */
 	fs->last_clust = fs->free_clust = 0xFFFFFFFF;
@@ -2480,5 +2480,5 @@
 	/* Get fsinfo if available */
 	fs->fsi_flag = 0x80;
-#if (_FS_NOFSINFO & 3) != 3
+#if (FF_FS_NOFSINFO & 3) != 3
 	if (fmt == FS_FAT32				/* Enable FSINFO only if FAT32 and BPB_FSInfo == 1 */
 		&& LD_WORD(fs->win + BPB_FSInfo) == 1
@@ -2490,8 +2490,8 @@
 			&& LD_DWORD(fs->win + FSI_StrucSig) == 0x61417272)
 		{
-#if (_FS_NOFSINFO & 1) == 0
+#if (FF_FS_NOFSINFO & 1) == 0
 			fs->free_clust = LD_DWORD(fs->win + FSI_Free_Count);
 #endif
-#if (_FS_NOFSINFO & 2) == 0
+#if (FF_FS_NOFSINFO & 2) == 0
 			fs->last_clust = LD_DWORD(fs->win + FSI_Nxt_Free);
 #endif
@@ -2502,8 +2502,8 @@
 	fs->fs_type = fmt;	/* FAT sub-type */
 	fs->id = ++Fsid;	/* File system mount ID */
-#if _FS_RPATH
+#if FF_FS_RPATH
 	fs->cdir = 0;		/* Set current directory to root */
 #endif
-#if _FS_LOCK			/* Clear file lock semaphores */
+#if FF_FS_LOCK != 0		/* Clear file lock semaphores */
 	clear_lock(fs);
 #endif
@@ -2521,8 +2521,8 @@
 static
 FRESULT validate (	/* FR_OK(0): The object is valid, !=0: Invalid */
-	void* obj		/* Pointer to the object FIL/DIR to check validity */
-)
-{
-	FIL *fil = (FIL*)obj;	/* Assuming offset of .fs and .id in the FIL/DIR structure is identical */
+	void* obj		/* Pointer to the object FIL/FATFS_DIR to check validity */
+)
+{
+	FIL *fil = (FIL*)obj;	/* Assuming offset of .fs and .id in the FIL/FATFS_DIR structure is identical */
 
 
@@ -2567,8 +2567,8 @@
 
 	if (cfs) {
-#if _FS_LOCK
+#if FF_FS_LOCK != 0
 		clear_lock(cfs);
 #endif
-#if _FS_REENTRANT						/* Discard sync object of the current volume */
+#if FF_FS_REENTRANT						/* Discard sync object of the current volume */
 		if (!ff_del_syncobj(cfs->sobj)) return FR_INT_ERR;
 #endif
@@ -2578,5 +2578,5 @@
 	if (fs) {
 		fs->fs_type = 0;				/* Clear new fs object */
-#if _FS_REENTRANT						/* Create sync object for the new volume */
+#if FF_FS_REENTRANT						/* Create sync object for the new volume */
 		if (!ff_cre_syncobj((BYTE)vol, &fs->sobj)) return FR_INT_ERR;
 #endif
@@ -2604,8 +2604,8 @@
 {
 	FRESULT res;
-	DIR dj;
+	FATFS_DIR dj;
 	BYTE *dir;
 	DEFINE_NAMEBUF;
-#if !_FS_READONLY
+#if !FF_FS_READONLY
 	DWORD dw, cl;
 #endif
@@ -2616,5 +2616,5 @@
 
 	/* Get logical drive number */
-#if !_FS_READONLY
+#if !FF_FS_READONLY
 	mode &= FA_READ | FA_WRITE | FA_CREATE_ALWAYS | FA_OPEN_ALWAYS | FA_CREATE_NEW;
 	res = find_volume(&dj.fs, &path, (BYTE)(mode & ~FA_READ));
@@ -2627,9 +2627,9 @@
 		res = follow_path(&dj, path);	/* Follow the file path */
 		dir = dj.dir;
-#if !_FS_READONLY	/* R/W configuration */
+#if !FF_FS_READONLY	/* R/W configuration */
 		if (res == FR_OK) {
 			if (!dir)	/* Default directory itself */
 				res = FR_INVALID_NAME;
-#if _FS_LOCK
+#if FF_FS_LOCK != 0
 			else
 				res = chk_lock(&dj, (mode & ~FA_READ) ? 1 : 0);
@@ -2640,5 +2640,5 @@
 			if (res != FR_OK) {					/* No file, create new */
 				if (res == FR_NO_FILE)			/* There is no file to open, create a new entry */
-#if _FS_LOCK
+#if FF_FS_LOCK != 0
 					res = enq_lock() ? dir_register(&dj) : FR_TOO_MANY_OPEN_FILES;
 #else
@@ -2649,5 +2649,5 @@
 			}
 			else {								/* Any object is already existing */
-				if (dir[DIR_Attr] & (AM_RDO | AM_DIR)) {	/* Cannot overwrite it (R/O or DIR) */
+				if (dir[DIR_Attr] & (AM_RDO | AM_DIR)) {	/* Cannot overwrite it (R/O or FATFS_DIR) */
 					res = FR_DENIED;
 				} else {
@@ -2687,8 +2687,8 @@
 		if (res == FR_OK) {
 			if (mode & FA_CREATE_ALWAYS)		/* Set file change flag if created or overwritten */
-				mode |= FA__WRITTEN;
+				mode |= FA_MODIFIED;
 			fp->dir_sect = dj.fs->winsect;		/* Pointer to the directory entry */
 			fp->dir_ptr = dir;
-#if _FS_LOCK
+#if FF_FS_LOCK != 0
 			fp->lockid = inc_lock(&dj, (mode & ~FA_READ) ? 1 : 0);
 			if (!fp->lockid) res = FR_INT_ERR;
@@ -2716,5 +2716,5 @@
 			fp->fptr = 0;						/* File pointer */
 			fp->dsect = 0;
-#if _USE_FASTSEEK
+#if FF_USE_FASTSEEK
 			fp->cltbl = 0;						/* Normal seek mode */
 #endif
@@ -2766,5 +2766,5 @@
 					clst = fp->sclust;			/* Follow from the origin */
 				} else {						/* Middle or end of the file */
-#if _USE_FASTSEEK
+#if FF_USE_FASTSEEK
 					if (fp->cltbl)
 						clst = clmt_clust(fp, fp->fptr);	/* Get cluster# from the CLMT */
@@ -2786,10 +2786,10 @@
 				if (disk_read(fp->fs->drv, rbuff, sect, cc) != RES_OK)
 					ABORT(fp->fs, FR_DISK_ERR);
-#if !_FS_READONLY && _FS_MINIMIZE <= 2			/* Replace one of the read sectors with cached data if it contains a dirty sector */
-#if _FS_TINY
+#if !FF_FS_READONLY && FF_FS_MINIMIZE <= 2			/* Replace one of the read sectors with cached data if it contains a dirty sector */
+#if FF_FS_TINY
 				if (fp->fs->wflag && fp->fs->winsect - sect < cc)
 					mem_cpy(rbuff + ((fp->fs->winsect - sect) * SS(fp->fs)), fp->fs->win, SS(fp->fs));
 #else
-				if ((fp->flag & FA__DIRTY) && fp->dsect - sect < cc)
+				if ((fp->flag & FA_DIRTY) && fp->dsect - sect < cc)
 					mem_cpy(rbuff + ((fp->dsect - sect) * SS(fp->fs)), fp->buf, SS(fp->fs));
 #endif
@@ -2798,11 +2798,11 @@
 				continue;
 			}
-#if !_FS_TINY
+#if !FF_FS_TINY
 			if (fp->dsect != sect) {			/* Load data sector if not in cache */
-#if !_FS_READONLY
-				if (fp->flag & FA__DIRTY) {		/* Write-back dirty sector cache */
+#if !FF_FS_READONLY
+				if (fp->flag & FA_DIRTY) {		/* Write-back dirty sector cache */
 					if (disk_write(fp->fs->drv, fp->buf, fp->dsect, 1) != RES_OK)
 						ABORT(fp->fs, FR_DISK_ERR);
-					fp->flag &= ~FA__DIRTY;
+					fp->flag &= ~FA_DIRTY;
 				}
 #endif
@@ -2815,5 +2815,5 @@
 		rcnt = SS(fp->fs) - ((UINT)fp->fptr % SS(fp->fs));	/* Get partial sector data from sector buffer */
 		if (rcnt > btr) rcnt = btr;
-#if _FS_TINY
+#if FF_FS_TINY
 		if (move_window(fp->fs, fp->dsect) != FR_OK)		/* Move sector window */
 			ABORT(fp->fs, FR_DISK_ERR);
@@ -2830,5 +2830,5 @@
 
 
-#if !_FS_READONLY
+#if !FF_FS_READONLY
 /*-----------------------------------------------------------------------*/
 /* Write File                                                            */
@@ -2869,5 +2869,5 @@
 						clst = create_chain(fp->fs, 0);	/* Create a new cluster chain */
 				} else {					/* Middle or end of the file */
-#if _USE_FASTSEEK
+#if FF_USE_FASTSEEK
 					if (fp->cltbl)
 						clst = clmt_clust(fp, fp->fptr);	/* Get cluster# from the CLMT */
@@ -2882,12 +2882,12 @@
 				if (fp->sclust == 0) fp->sclust = clst;	/* Set start cluster if the first write */
 			}
-#if _FS_TINY
+#if FF_FS_TINY
 			if (fp->fs->winsect == fp->dsect && sync_window(fp->fs))	/* Write-back sector cache */
 				ABORT(fp->fs, FR_DISK_ERR);
 #else
-			if (fp->flag & FA__DIRTY) {		/* Write-back sector cache */
+			if (fp->flag & FA_DIRTY) {		/* Write-back sector cache */
 				if (disk_write(fp->fs->drv, fp->buf, fp->dsect, 1) != RES_OK)
 					ABORT(fp->fs, FR_DISK_ERR);
-				fp->flag &= ~FA__DIRTY;
+				fp->flag &= ~FA_DIRTY;
 			}
 #endif
@@ -2901,6 +2901,6 @@
 				if (disk_write(fp->fs->drv, wbuff, sect, cc) != RES_OK)
 					ABORT(fp->fs, FR_DISK_ERR);
-#if _FS_MINIMIZE <= 2
-#if _FS_TINY
+#if FF_FS_MINIMIZE <= 2
+#if FF_FS_TINY
 				if (fp->fs->winsect - sect < cc) {	/* Refill sector cache if it gets invalidated by the direct write */
 					mem_cpy(fp->fs->win, wbuff + ((fp->fs->winsect - sect) * SS(fp->fs)), SS(fp->fs));
@@ -2910,5 +2910,5 @@
 				if (fp->dsect - sect < cc) { /* Refill sector cache if it gets invalidated by the direct write */
 					mem_cpy(fp->buf, wbuff + ((fp->dsect - sect) * SS(fp->fs)), SS(fp->fs));
-					fp->flag &= ~FA__DIRTY;
+					fp->flag &= ~FA_DIRTY;
 				}
 #endif
@@ -2917,5 +2917,5 @@
 				continue;
 			}
-#if _FS_TINY
+#if FF_FS_TINY
 			if (fp->fptr >= fp->fsize) {	/* Avoid silly cache filling at growing edge */
 				if (sync_window(fp->fs)) ABORT(fp->fs, FR_DISK_ERR);
@@ -2933,5 +2933,5 @@
 		wcnt = SS(fp->fs) - ((UINT)fp->fptr % SS(fp->fs));/* Put partial sector into file I/O buffer */
 		if (wcnt > btw) wcnt = btw;
-#if _FS_TINY
+#if FF_FS_TINY
 		if (move_window(fp->fs, fp->dsect) != FR_OK)	/* Move sector window */
 			ABORT(fp->fs, FR_DISK_ERR);
@@ -2940,10 +2940,10 @@
 #else
 		mem_cpy(&fp->buf[fp->fptr % SS(fp->fs)], wbuff, wcnt);	/* Fit partial sector */
-		fp->flag |= FA__DIRTY;
+		fp->flag |= FA_DIRTY;
 #endif
 	}
 
 	if (fp->fptr > fp->fsize) fp->fsize = fp->fptr;	/* Update file size if needed */
-	fp->flag |= FA__WRITTEN;						/* Set file change flag */
+	fp->flag |= FA_MODIFIED;						/* Set file change flag */
 
 	LEAVE_FF(fp->fs, FR_OK);
@@ -2968,10 +2968,10 @@
 	res = validate(fp);					/* Check validity of the object */
 	if (res == FR_OK) {
-		if (fp->flag & FA__WRITTEN) {	/* Is there any change to the file? */
-#if !_FS_TINY
-			if (fp->flag & FA__DIRTY) {	/* Write-back cached data if needed */
+		if (fp->flag & FA_MODIFIED) {	/* Is there any change to the file? */
+#if !FF_FS_TINY
+			if (fp->flag & FA_DIRTY) {	/* Write-back cached data if needed */
 				if (disk_write(fp->fs->drv, fp->buf, fp->dsect, 1) != RES_OK)
 					LEAVE_FF(fp->fs, FR_DISK_ERR);
-				fp->flag &= ~FA__DIRTY;
+				fp->flag &= ~FA_DIRTY;
 			}
 #endif
@@ -2986,5 +2986,5 @@
 				ST_DWORD(dir + DIR_WrtTime, tm);
 				ST_WORD(dir + DIR_LstAccDate, 0);
-				fp->flag &= ~FA__WRITTEN;
+				fp->flag &= ~FA_MODIFIED;
 				fp->fs->wflag = 1;
 				res = sync_fs(fp->fs);
@@ -2996,5 +2996,5 @@
 }
 
-#endif /* !_FS_READONLY */
+#endif /* !FF_FS_READONLY */
 
 
@@ -3012,5 +3012,5 @@
 
 
-#if !_FS_READONLY
+#if !FF_FS_READONLY
 	res = f_sync(fp);					/* Flush cached data */
 	if (res == FR_OK)
@@ -3019,13 +3019,13 @@
 		res = validate(fp);				/* Lock volume */
 		if (res == FR_OK) {
-#if _FS_REENTRANT
+#if FF_FS_REENTRANT
 			FATFS *fs = fp->fs;
 #endif
-#if _FS_LOCK
+#if FF_FS_LOCK != 0
 			res = dec_lock(fp->lockid);	/* Decrement file open counter */
 			if (res == FR_OK)
 #endif
 				fp->fs = 0;				/* Invalidate file object */
-#if _FS_REENTRANT
+#if FF_FS_REENTRANT
 			unlock_fs(fs, FR_OK);		/* Unlock volume */
 #endif
@@ -3042,6 +3042,6 @@
 /*-----------------------------------------------------------------------*/
 
-#if _FS_RPATH >= 1
-#if _VOLUMES >= 2
+#if FF_FS_RPATH >= 1
+#if FF_VOLUMES >= 2
 FRESULT f_chdrive (
 	const TCHAR* path		/* Drive number */
@@ -3066,5 +3066,5 @@
 {
 	FRESULT res;
-	DIR dj;
+	FATFS_DIR dj;
 	DEFINE_NAMEBUF;
 
@@ -3093,5 +3093,5 @@
 
 
-#if _FS_RPATH >= 2
+#if FF_FS_RPATH >= 2
 FRESULT f_getcwd (
 	TCHAR* buff,	/* Pointer to the directory path */
@@ -3100,5 +3100,5 @@
 {
 	FRESULT res;
-	DIR dj;
+	FATFS_DIR dj;
 	UINT i, n;
 	DWORD ccl;
@@ -3131,5 +3131,5 @@
 			if (res == FR_NO_FILE) res = FR_INT_ERR;/* It cannot be 'not found'. */
 			if (res != FR_OK) break;
-#if _USE_LFN
+#if FF_USE_LFN
 			fno.lfname = buff;
 			fno.lfsize = i;
@@ -3137,5 +3137,5 @@
 			get_fileinfo(&dj, &fno);		/* Get the directory name and push it to the buffer */
 			tp = fno.fname;
-#if _USE_LFN
+#if FF_USE_LFN
 			if (*buff) tp = buff;
 #endif
@@ -3149,5 +3149,5 @@
 		tp = buff;
 		if (res == FR_OK) {
-#if _VOLUMES >= 2
+#if FF_VOLUMES >= 2
 			*tp++ = '0' + CurrVol;			/* Put drive number */
 			*tp++ = ':';
@@ -3167,10 +3167,10 @@
 	LEAVE_FF(dj.fs, res);
 }
-#endif /* _FS_RPATH >= 2 */
-#endif /* _FS_RPATH >= 1 */
-
-
-
-#if _FS_MINIMIZE <= 2
+#endif /* FF_FS_RPATH >= 2 */
+#endif /* FF_FS_RPATH >= 1 */
+
+
+
+#if FF_FS_MINIMIZE <= 2
 /*-----------------------------------------------------------------------*/
 /* Seek File R/W Pointer                                                 */
@@ -3184,5 +3184,5 @@
 	FRESULT res;
 	DWORD clst, bcs, nsect, ifptr;
-#if _USE_FASTSEEK
+#if FF_USE_FASTSEEK
 	DWORD cl, pcl, ncl, tcl, dsc, tlen, ulen, *tbl;
 #endif
@@ -3194,5 +3194,5 @@
 		LEAVE_FF(fp->fs, (FRESULT)fp->err);
 
-#if _USE_FASTSEEK
+#if FF_USE_FASTSEEK
 	if (fp->cltbl) {	/* Fast seek */
 		if (ofs == CREATE_LINKMAP) {	/* Create CLMT */
@@ -3231,10 +3231,10 @@
 				dsc += (ofs - 1) / SS(fp->fs) & (fp->fs->csize - 1);
 				if (fp->fptr % SS(fp->fs) && dsc != fp->dsect) {	/* Refill sector cache if needed */
-#if !_FS_TINY
-#if !_FS_READONLY
-					if (fp->flag & FA__DIRTY) {		/* Write-back dirty sector cache */
+#if !FF_FS_TINY
+#if !FF_FS_READONLY
+					if (fp->flag & FA_DIRTY) {		/* Write-back dirty sector cache */
 						if (disk_write(fp->fs->drv, fp->buf, fp->dsect, 1) != RES_OK)
 							ABORT(fp->fs, FR_DISK_ERR);
-						fp->flag &= ~FA__DIRTY;
+						fp->flag &= ~FA_DIRTY;
 					}
 #endif
@@ -3252,5 +3252,5 @@
 	{
 		if (ofs > fp->fsize					/* In read-only mode, clip offset with the file size */
-#if !_FS_READONLY
+#if !FF_FS_READONLY
 			 && !(fp->flag & FA_WRITE)
 #endif
@@ -3268,5 +3268,5 @@
 			} else {									/* When seek to back cluster, */
 				clst = fp->sclust;						/* start from the first cluster */
-#if !_FS_READONLY
+#if !FF_FS_READONLY
 				if (clst == 0) {						/* If no cluster chain, create a new chain */
 					clst = create_chain(fp->fs, 0);
@@ -3280,5 +3280,5 @@
 			if (clst != 0) {
 				while (ofs > bcs) {						/* Cluster following loop */
-#if !_FS_READONLY
+#if !FF_FS_READONLY
 					if (fp->flag & FA_WRITE) {			/* Check if in write mode or not */
 						clst = create_chain(fp->fs, clst);	/* Force stretch if in write mode */
@@ -3304,10 +3304,10 @@
 		}
 		if (fp->fptr % SS(fp->fs) && nsect != fp->dsect) {	/* Fill sector cache if needed */
-#if !_FS_TINY
-#if !_FS_READONLY
-			if (fp->flag & FA__DIRTY) {			/* Write-back dirty sector cache */
+#if !FF_FS_TINY
+#if !FF_FS_READONLY
+			if (fp->flag & FA_DIRTY) {			/* Write-back dirty sector cache */
 				if (disk_write(fp->fs->drv, fp->buf, fp->dsect, 1) != RES_OK)
 					ABORT(fp->fs, FR_DISK_ERR);
-				fp->flag &= ~FA__DIRTY;
+				fp->flag &= ~FA_DIRTY;
 			}
 #endif
@@ -3317,8 +3317,8 @@
 			fp->dsect = nsect;
 		}
-#if !_FS_READONLY
+#if !FF_FS_READONLY
 		if (fp->fptr > fp->fsize) {			/* Set file change flag if the file size is extended */
 			fp->fsize = fp->fptr;
-			fp->flag |= FA__WRITTEN;
+			fp->flag |= FA_MODIFIED;
 		}
 #endif
@@ -3342,5 +3342,5 @@
 }
 
-#if _FS_MINIMIZE <= 1
+#if FF_FS_MINIMIZE <= 1
 /*-----------------------------------------------------------------------*/
 /* Create a Directory Object                                             */
@@ -3348,5 +3348,5 @@
 
 FRESULT f_opendir (
-	DIR* dp,			/* Pointer to directory object to create */
+	FATFS_DIR* dp,			/* Pointer to directory object to create */
 	const TCHAR* path	/* Pointer to the directory path */
 )
@@ -3376,5 +3376,5 @@
 				dp->id = fs->id;
 				res = dir_sdi(dp, 0);			/* Rewind directory */
-#if _FS_LOCK
+#if FF_FS_LOCK != 0
 				if (res == FR_OK) {
 					if (dp->sclust) {
@@ -3404,5 +3404,5 @@
 
 FRESULT f_closedir (
-	DIR *dp		/* Pointer to the directory object to be closed */
+	FATFS_DIR *dp		/* Pointer to the directory object to be closed */
 )
 {
@@ -3412,8 +3412,8 @@
 	res = validate(dp);
 	if (res == FR_OK) {
-#if _FS_REENTRANT
+#if FF_FS_REENTRANT
 		FATFS *fs = dp->fs;
 #endif
-#if _FS_LOCK
+#if FF_FS_LOCK != 0
 		if (dp->lockid)				/* Decrement sub-directory open counter */
 			res = dec_lock(dp->lockid);
@@ -3421,5 +3421,5 @@
 #endif
 			dp->fs = 0;				/* Invalidate directory object */
-#if _FS_REENTRANT
+#if FF_FS_REENTRANT
 		unlock_fs(fs, FR_OK);		/* Unlock volume */
 #endif
@@ -3436,5 +3436,5 @@
 
 FRESULT f_readdir (
-	DIR* dp,			/* Pointer to the open directory object */
+	FATFS_DIR* dp,			/* Pointer to the open directory object */
 	FILINFO* fno		/* Pointer to file information to return */
 )
@@ -3472,5 +3472,5 @@
 
 
-#if _USE_FIND
+#if FF_USE_FIND
 /*-----------------------------------------------------------------------*/
 /* Find next file                                                        */
@@ -3478,5 +3478,5 @@
 
 FRESULT f_findnext (
-	DIR* dp,		/* Pointer to the open directory object */
+	FATFS_DIR* dp,		/* Pointer to the open directory object */
 	FILINFO* fno	/* Pointer to the file information structure */
 )
@@ -3488,5 +3488,5 @@
 		res = f_readdir(dp, fno);		/* Get a directory item */
 		if (res != FR_OK || !fno || !fno->fname[0]) break;	/* Terminate if any error or end of directory */
-#if _USE_LFN
+#if FF_USE_LFN
 		if (fno->lfname && pattern_matching(dp->pat, fno->lfname, 0, 0)) break;	/* Test for LFN if exist */
 #endif
@@ -3504,5 +3504,5 @@
 
 FRESULT f_findfirst (
-	DIR* dp,				/* Pointer to the blank directory object */
+	FATFS_DIR* dp,				/* Pointer to the blank directory object */
 	FILINFO* fno,			/* Pointer to the file information structure */
 	const TCHAR* path,		/* Pointer to the directory to open */
@@ -3520,9 +3520,9 @@
 }
 
-#endif	/* _USE_FIND */
-
-
-
-#if _FS_MINIMIZE == 0
+#endif	/* FF_USE_FIND */
+
+
+
+#if FF_FS_MINIMIZE == 0
 /*-----------------------------------------------------------------------*/
 /* Get File Status                                                       */
@@ -3535,5 +3535,5 @@
 {
 	FRESULT res;
-	DIR dj;
+	FATFS_DIR dj;
 	DEFINE_NAMEBUF;
 
@@ -3559,5 +3559,5 @@
 
 
-#if !_FS_READONLY
+#if !FF_FS_READONLY
 /*-----------------------------------------------------------------------*/
 /* Get Number of Free Clusters                                           */
@@ -3650,5 +3650,5 @@
 		if (fp->fsize > fp->fptr) {
 			fp->fsize = fp->fptr;	/* Set file size to current R/W point */
-			fp->flag |= FA__WRITTEN;
+			fp->flag |= FA_MODIFIED;
 			if (fp->fptr == 0) {	/* When set file size to zero, remove entire cluster chain */
 				res = remove_chain(fp->fs, fp->sclust);
@@ -3664,10 +3664,10 @@
 				}
 			}
-#if !_FS_TINY
-			if (res == FR_OK && (fp->flag & FA__DIRTY)) {
+#if !FF_FS_TINY
+			if (res == FR_OK && (fp->flag & FA_DIRTY)) {
 				if (disk_write(fp->fs->drv, fp->buf, fp->dsect, 1) != RES_OK)
 					res = FR_DISK_ERR;
 				else
-					fp->flag &= ~FA__DIRTY;
+					fp->flag &= ~FA_DIRTY;
 			}
 #endif
@@ -3691,5 +3691,5 @@
 {
 	FRESULT res;
-	DIR dj, sdj;
+	FATFS_DIR dj, sdj;
 	BYTE *dir;
 	DWORD dclst = 0;
@@ -3702,7 +3702,7 @@
 		INIT_BUF(dj);
 		res = follow_path(&dj, path);		/* Follow the file path */
-		if (_FS_RPATH && res == FR_OK && (dj.fn[NSFLAG] & NS_DOT))
+		if (FF_FS_RPATH && res == FR_OK && (dj.fn[NSFLAG] & NS_DOT))
 			res = FR_INVALID_NAME;			/* Cannot remove dot entry */
-#if _FS_LOCK
+#if FF_FS_LOCK != 0
 		if (res == FR_OK) res = chk_lock(&dj, 2);	/* Cannot remove open object */
 #endif
@@ -3718,5 +3718,5 @@
 				dclst = ld_clust(dj.fs, dir);
 				if (dclst && (dir[DIR_Attr] & AM_DIR)) {	/* Is it a sub-directory ? */
-#if _FS_RPATH
+#if FF_FS_RPATH
 					if (dclst == dj.fs->cdir) {		 		/* Is it the current directory? */
 						res = FR_DENIED;
@@ -3724,5 +3724,5 @@
 #endif
 					{
-						mem_cpy(&sdj, &dj, sizeof (DIR));	/* Open the sub-directory */
+						mem_cpy(&sdj, &dj, sizeof (FATFS_DIR));	/* Open the sub-directory */
 						sdj.sclust = dclst;
 						res = dir_sdi(&sdj, 2);
@@ -3760,5 +3760,5 @@
 {
 	FRESULT res;
-	DIR dj;
+	FATFS_DIR dj;
 	BYTE *dir, n;
 	DWORD dsc, dcl, pcl, tm = GET_FATTIME();
@@ -3772,5 +3772,5 @@
 		res = follow_path(&dj, path);			/* Follow the file path */
 		if (res == FR_OK) res = FR_EXIST;		/* Any object with same name is already existing */
-		if (_FS_RPATH && res == FR_NO_FILE && (dj.fn[NSFLAG] & NS_DOT))
+		if (FF_FS_RPATH && res == FR_NO_FILE && (dj.fn[NSFLAG] & NS_DOT))
 			res = FR_INVALID_NAME;
 		if (res == FR_NO_FILE) {				/* Can create a new directory */
@@ -3836,5 +3836,5 @@
 {
 	FRESULT res;
-	DIR dj;
+	FATFS_DIR dj;
 	BYTE *dir;
 	DEFINE_NAMEBUF;
@@ -3846,5 +3846,5 @@
 		res = follow_path(&dj, path);		/* Follow the file path */
 		FREE_BUF();
-		if (_FS_RPATH && res == FR_OK && (dj.fn[NSFLAG] & NS_DOT))
+		if (FF_FS_RPATH && res == FR_OK && (dj.fn[NSFLAG] & NS_DOT))
 			res = FR_INVALID_NAME;
 		if (res == FR_OK) {
@@ -3877,5 +3877,5 @@
 {
 	FRESULT res;
-	DIR djo, djn;
+	FATFS_DIR djo, djn;
 	BYTE buf[21], *dir;
 	DWORD dw;
@@ -3890,7 +3890,7 @@
 		INIT_BUF(djo);
 		res = follow_path(&djo, path_old);		/* Check old object */
-		if (_FS_RPATH && res == FR_OK && (djo.fn[NSFLAG] & NS_DOT))
+		if (FF_FS_RPATH && res == FR_OK && (djo.fn[NSFLAG] & NS_DOT))
 			res = FR_INVALID_NAME;
-#if _FS_LOCK
+#if FF_FS_LOCK != 0
 		if (res == FR_OK) res = chk_lock(&djo, 2);
 #endif
@@ -3900,5 +3900,5 @@
 			} else {
 				mem_cpy(buf, djo.dir + DIR_Attr, 21);	/* Save information about object except name */
-				mem_cpy(&djn, &djo, sizeof (DIR));		/* Duplicate the directory object */
+				mem_cpy(&djn, &djo, sizeof (FATFS_DIR));		/* Duplicate the directory object */
 				if (get_ldnumber(&path_new) >= 0)		/* Snip drive number off and ignore it */
 					res = follow_path(&djn, path_new);	/* and make sure if new object name is not conflicting */
@@ -3909,6 +3909,6 @@
 					dir = djn.dir;
 					if (dir[DIR_Attr] & AM_DIR) {	/* The new object is a directory */
-						temp_new_path = (TCHAR *)ff_memalloc((_MAX_LFN + 1) * sizeof(WCHAR));
-						ntstdio_snprintf(temp_new_path, _MAX_LFN, "%s/%s", path_new, basename((char *)path_old));
+						temp_new_path = (TCHAR *)ff_memalloc((FF_MAX_LFN + 1) * sizeof(WCHAR));
+						ntstdio_snprintf(temp_new_path, FF_MAX_LFN, "%s/%s", path_new, basename((char *)path_old));
 						res = follow_path(&djn, temp_new_path);
 					}
@@ -3966,5 +3966,5 @@
 {
 	FRESULT res;
-	DIR dj;
+	FATFS_DIR dj;
 	BYTE *dir;
 	DEFINE_NAMEBUF;
@@ -3977,5 +3977,5 @@
 		res = follow_path(&dj, path);	/* Follow the file path */
 		FREE_BUF();
-		if (_FS_RPATH && res == FR_OK && (dj.fn[NSFLAG] & NS_DOT))
+		if (FF_FS_RPATH && res == FR_OK && (dj.fn[NSFLAG] & NS_DOT))
 			res = FR_INVALID_NAME;
 		if (res == FR_OK) {
@@ -3995,13 +3995,13 @@
 }
 
-#endif /* !_FS_READONLY */
-#endif /* _FS_MINIMIZE == 0 */
-#endif /* _FS_MINIMIZE <= 1 */
-#endif /* _FS_MINIMIZE <= 2 */
-
-
-
-
-#if _USE_LABEL
+#endif /* !FF_FS_READONLY */
+#endif /* FF_FS_MINIMIZE == 0 */
+#endif /* FF_FS_MINIMIZE <= 1 */
+#endif /* FF_FS_MINIMIZE <= 2 */
+
+
+
+
+#if FF_USE_LABEL
 /*-----------------------------------------------------------------------*/
 /* Get volume label                                                      */
@@ -4015,7 +4015,7 @@
 {
 	FRESULT res;
-	DIR dj;
+	FATFS_DIR dj;
 	UINT i, j;
-#if _USE_LFN && _LFN_UNICODE
+#if FF_USE_LFN && FF_LFN_UNICODE
 	WCHAR w;
 #endif
@@ -4032,5 +4032,5 @@
 			res = dir_read(&dj, 1);		/* Get an entry with AM_VOL */
 			if (res == FR_OK) {			/* A volume label is exist */
-#if _USE_LFN && _LFN_UNICODE
+#if FF_USE_LFN && FF_LFN_UNICODE
 				i = j = 0;
 				do {
@@ -4070,5 +4070,5 @@
 
 
-#if !_FS_READONLY
+#if !FF_FS_READONLY
 /*-----------------------------------------------------------------------*/
 /* Set volume label                                                      */
@@ -4080,12 +4080,12 @@
 {
 	FRESULT res;
-	DIR dj;
+	FATFS_DIR dj;
 	BYTE vn[11];
 	UINT i, j, sl;
 	WCHAR w;
 	DWORD tm;
-#if _CODE_PAGE == 65001
+#if FF_CODE_PAGE == 65001
 	int code_size;
-	char utf8_code[6];
+	unsigned char utf8_code[6];
 #endif
 
@@ -4101,5 +4101,5 @@
 		i = j = 0;
 		do {
-#if _CODE_PAGE == 65001
+#if FF_CODE_PAGE == 65001
 			w = ff_wtoupper(Utf8_to_Utf16(&label[i], &code_size));
 			i += code_size;
@@ -4110,5 +4110,5 @@
 				vn[j++] = utf8_code[k];
 #else
-#if _USE_LFN && _LFN_UNICODE
+#if FF_USE_LFN && FF_LFN_UNICODE
 			w = ff_convert(ff_wtoupper(label[i++]), 0);
 #else
@@ -4116,5 +4116,5 @@
 			if (IsDBCS1(w))
 				w = (j < 10 && i < sl && IsDBCS2(label[i])) ? w << 8 | (BYTE)label[i++] : 0;
-#if _USE_LFN
+#if FF_USE_LFN
 			w = ff_convert(ff_wtoupper(ff_convert(w, 1)), 0);
 #else
@@ -4174,6 +4174,6 @@
 }
 
-#endif /* !_FS_READONLY */
-#endif /* _USE_LABEL */
+#endif /* !FF_FS_READONLY */
+#endif /* FF_USE_LABEL */
 
 
@@ -4182,5 +4182,5 @@
 /* Forward data to the stream directly (available on only tiny cfg)      */
 /*-----------------------------------------------------------------------*/
-#if _USE_FORWARD && _FS_TINY
+#if FF_USE_FORWARD && FF_FS_TINY
 
 FRESULT f_forward (
@@ -4235,9 +4235,9 @@
 	LEAVE_FF(fp->fs, FR_OK);
 }
-#endif /* _USE_FORWARD */
-
-
-
-#if _USE_MKFS && !_FS_READONLY
+#endif /* FF_USE_FORWARD */
+
+
+
+#if FF_USE_MKFS && !FF_FS_READONLY
 /*-----------------------------------------------------------------------*/
 /* Create file system on the logical drive                               */
@@ -4263,5 +4263,5 @@
 	FATFS *fs;
 	DSTATUS stat;
-#if _USE_TRIM
+#if FF_USE_TRIM
 	DWORD eb[2];
 #endif
@@ -4282,9 +4282,9 @@
 	if (stat & STA_NOINIT) return FR_NOT_READY;
 	if (stat & STA_PROTECT) return FR_WRITE_PROTECTED;
-#if _MAX_SS != _MIN_SS		/* Get disk sector size */
-	if (disk_ioctl(pdrv, GET_SECTOR_SIZE, &SS(fs)) != RES_OK || SS(fs) > _MAX_SS || SS(fs) < _MIN_SS)
+#if FF_MAX_SS != FF_MIN_SS		/* Get disk sector size */
+	if (disk_ioctl(pdrv, GET_SECTOR_SIZE, &SS(fs)) != RES_OK || SS(fs) > FF_MAX_SS || SS(fs) < FF_MIN_SS)
 		return FR_DISK_ERR;
 #endif
-	if (_MULTI_PARTITION && part) {
+	if (FF_MULTI_PARTITION && part) {
 		/* Get partition information from partition table in the MBR */
 		if (disk_read(pdrv, fs->win, 0, 1) != RES_OK) return FR_DISK_ERR;
@@ -4308,5 +4308,5 @@
 		au = cst[i];
 	}
-	if (au >= _MIN_SS) au /= SS(fs);	/* Number of sectors per cluster */
+	if (au >= FF_MIN_SS) au /= SS(fs);	/* Number of sectors per cluster */
 	if (!au) au = 1;
 	if (au > 128) au = 128;
@@ -4362,5 +4362,5 @@
 	}
 
-	if (_MULTI_PARTITION && part) {
+	if (FF_MULTI_PARTITION && part) {
 		/* Update system ID in the partition table */
 		tbl = &fs->win[MBR_Table + (part - 1) * SZ_PTE];
@@ -4465,5 +4465,5 @@
 	} while (--i);
 
-#if _USE_TRIM	/* Erase data area if needed */
+#if FF_USE_TRIM	/* Erase data area if needed */
 	{
 		eb[0] = wsect; eb[1] = wsect + (n_clst - ((fmt == FS_FAT32) ? 1 : 0)) * au - 1;
@@ -4488,5 +4488,5 @@
 
 
-#if _MULTI_PARTITION
+#if FF_MULTI_PARTITION
 /*-----------------------------------------------------------------------*/
 /* Create partition table on the physical drive                          */
@@ -4518,5 +4518,5 @@
 
 	/* Create partition table */
-	mem_set(buf, 0, _MAX_SS);
+	mem_set(buf, 0, FF_MAX_SS);
 	p = buf + MBR_Table; b_cyl = 0;
 	for (i = 0; i < 4; i++, p += SZ_PTE) {
@@ -4555,11 +4555,11 @@
 
 
-#endif /* _MULTI_PARTITION */
-#endif /* _USE_MKFS && !_FS_READONLY */
-
-
-
-
-#if _USE_STRFUNC
+#endif /* FF_MULTI_PARTITION */
+#endif /* FF_USE_MKFS && !FF_FS_READONLY */
+
+
+
+
+#if FF_USE_STRFUNC
 /*-----------------------------------------------------------------------*/
 /* Get a string from the file                                            */
@@ -4579,6 +4579,6 @@
 
 	while (n < len - 1) {	/* Read characters until buffer gets filled */
-#if _USE_LFN && _LFN_UNICODE
-#if _STRF_ENCODE == 3		/* Read a character in UTF-8 */
+#if FF_USE_LFN && FF_LFN_UNICODE
+#if FF_STRF_ENCODE == 3		/* Read a character in UTF-8 */
 		f_read(fp, s, 1, &rc);
 		if (rc != 1) break;
@@ -4602,9 +4602,9 @@
 			}
 		}
-#elif _STRF_ENCODE == 2		/* Read a character in UTF-16BE */
+#elif FF_STRF_ENCODE == 2		/* Read a character in UTF-16BE */
 		f_read(fp, s, 2, &rc);
 		if (rc != 2) break;
 		c = s[1] + (s[0] << 8);
-#elif _STRF_ENCODE == 1		/* Read a character in UTF-16LE */
+#elif FF_STRF_ENCODE == 1		/* Read a character in UTF-16LE */
 		f_read(fp, s, 2, &rc);
 		if (rc != 2) break;
@@ -4627,5 +4627,5 @@
 		c = s[0];
 #endif
-		if (_USE_STRFUNC == 2 && c == '\r') continue;	/* Strip '\r' */
+		if (FF_USE_STRFUNC == 2 && c == '\r') continue;	/* Strip '\r' */
 		*p++ = c;
 		n++;
@@ -4639,5 +4639,5 @@
 
 
-#if !_FS_READONLY
+#if !FF_FS_READONLY
 #include <stdarg.h>
 /*-----------------------------------------------------------------------*/
@@ -4662,5 +4662,5 @@
 
 
-	if (_USE_STRFUNC == 2 && c == '\n')	 /* LF -> CRLF conversion */
+	if (FF_USE_STRFUNC == 2 && c == '\n')	 /* LF -> CRLF conversion */
 		putc_bfd(pb, '\r');
 
@@ -4668,6 +4668,6 @@
 	if (i < 0) return;
 
-#if _USE_LFN && _LFN_UNICODE
-#if _STRF_ENCODE == 3			/* Write a character in UTF-8 */
+#if FF_USE_LFN && FF_LFN_UNICODE
+#if FF_STRF_ENCODE == 3			/* Write a character in UTF-8 */
 	if (c < 0x80) {				/* 7-bit */
 		pb->buf[i++] = (BYTE)c;
@@ -4681,8 +4681,8 @@
 		pb->buf[i++] = (BYTE)(0x80 | (c & 0x3F));
 	}
-#elif _STRF_ENCODE == 2			/* Write a character in UTF-16BE */
+#elif FF_STRF_ENCODE == 2			/* Write a character in UTF-16BE */
 	pb->buf[i++] = (BYTE)(c >> 8);
 	pb->buf[i++] = (BYTE)c;
-#elif _STRF_ENCODE == 1			/* Write a character in UTF-16LE */
+#elif FF_STRF_ENCODE == 1			/* Write a character in UTF-16LE */
 	pb->buf[i++] = (BYTE)c;
 	pb->buf[i++] = (BYTE)(c >> 8);
@@ -4871,4 +4871,4 @@
 }
 
-#endif /* !_FS_READONLY */
-#endif /* _USE_STRFUNC */
+#endif /* !FF_FS_READONLY */
+#endif /* FF_USE_STRFUNC */
Index: EcnlProtoTool/trunk/ntshell/fatfs/ff.h
===================================================================
--- EcnlProtoTool/trunk/ntshell/fatfs/ff.h	(revision 433)
+++ EcnlProtoTool/trunk/ntshell/fatfs/ff.h	(revision 434)
@@ -28,5 +28,5 @@
 #include "ffconf.h"		/* FatFs configuration options */
 #include "diskio.h"
-#if _FATFS != _FFCONF
+#if _FATFS != FFCONF_DEF
 #error Wrong configuration file (ffconf.h).
 #endif
@@ -36,5 +36,5 @@
 /* Definitions of volume management */
 
-#if _MULTI_PARTITION		/* Multiple partition configuration */
+#if FF_MULTI_PARTITION		/* Multiple partition configuration */
 typedef struct {
 	BYTE pd;	/* Physical drive number */
@@ -55,7 +55,7 @@
 /* Type of path name strings on FatFs API */
 
-#if _LFN_UNICODE			/* Unicode string */
-#if !_USE_LFN
-#error _LFN_UNICODE must be 0 at non-LFN cfg.
+#if FF_LFN_UNICODE			/* Unicode string */
+#if !FF_USE_LFN
+#error FF_LFN_UNICODE must be 0 at non-LFN cfg.
 #endif
 #ifndef _INC_TCHAR
@@ -87,15 +87,15 @@
 	WORD	id;				/* File system mount ID */
 	WORD	n_rootdir;		/* Number of root directory entries (FAT12/16) */
-#if _MAX_SS != _MIN_SS
+#if FF_MAX_SS != FF_MIN_SS
 	WORD	ssize;			/* Bytes per sector (512, 1024, 2048 or 4096) */
 #endif
-#if _FS_REENTRANT
-	_SYNC_t	sobj;			/* Identifier of sync object */
-#endif
-#if !_FS_READONLY
+#if FF_FS_REENTRANT
+	FF_SYNC_t	sobj;			/* Identifier of sync object */
+#endif
+#if !FF_FS_READONLY
 	DWORD	last_clust;		/* Last allocated cluster */
 	DWORD	free_clust;		/* Number of free clusters */
 #endif
-#if _FS_RPATH
+#if FF_FS_RPATH
 	DWORD	cdir;			/* Current directory start cluster (0:root) */
 #endif
@@ -107,5 +107,5 @@
 	DWORD	database;		/* Data start sector */
 	DWORD	winsect;		/* Current sector appearing in the win[] */
-	BYTE	win[_MAX_SS];	/* Disk access window for Directory, FAT (and file data at tiny cfg) */
+	BYTE	win[FF_MAX_SS];	/* Disk access window for Directory, FAT (and file data at tiny cfg) */
 } FATFS;
 
@@ -124,16 +124,16 @@
 	DWORD	clust;			/* Current cluster of fpter (not valid when fprt is 0) */
 	DWORD	dsect;			/* Sector number appearing in buf[] (0:invalid) */
-#if !_FS_READONLY
+#if !FF_FS_READONLY
 	DWORD	dir_sect;		/* Sector number containing the directory entry */
 	BYTE*	dir_ptr;		/* Pointer to the directory entry in the win[] */
 #endif
-#if _USE_FASTSEEK
+#if FF_USE_FASTSEEK
 	DWORD*	cltbl;			/* Pointer to the cluster link map table (Nulled on file open) */
 #endif
-#if _FS_LOCK
+#if FF_FS_LOCK != 0
 	UINT	lockid;			/* File lock ID origin from 1 (index of file semaphore table Files[]) */
 #endif
-#if !_FS_TINY
-	BYTE	buf[_MAX_SS];	/* File private data read/write window */
+#if !FF_FS_TINY
+	BYTE	buf[FF_MAX_SS];	/* File private data read/write window */
 #endif
 } FIL;
@@ -141,5 +141,5 @@
 
 
-/* Directory object structure (DIR) */
+/* Directory object structure (FATFS_DIR) */
 
 typedef struct __dirstream {
@@ -152,15 +152,15 @@
 	BYTE*	dir;			/* Pointer to the current SFN entry in the win[] */
 	BYTE*	fn;				/* Pointer to the SFN (in/out) {file[8],ext[3],status[1]} */
-#if _FS_LOCK
+#if FF_FS_LOCK != 0
 	UINT	lockid;			/* File lock ID (index of file semaphore table Files[]) */
 #endif
-#if _USE_LFN
+#if FF_USE_LFN
 	WCHAR*	lfn;			/* Pointer to the LFN working buffer */
 	WORD	lfn_idx;		/* Last matched LFN index number (0xFFFF:No LFN) */
 #endif
-#if _USE_FIND
+#if FF_USE_FIND
 	const TCHAR*	pat;	/* Pointer to the name matching pattern */
 #endif
-} DIR;
+} FATFS_DIR;
 
 
@@ -174,5 +174,5 @@
 	BYTE	fattrib;		/* Attribute */
 	TCHAR	fname[13];		/* Short file name (8.3 format) */
-#if _USE_LFN
+#if FF_USE_LFN
 	TCHAR*	lfname;			/* Pointer to the LFN buffer */
 	UINT 	lfsize;			/* Size of LFN buffer in TCHAR */
@@ -203,5 +203,5 @@
 	FR_LOCKED,				/* (16) The operation is rejected according to the file sharing policy */
 	FR_NOT_ENOUGH_CORE,		/* (17) LFN working buffer could not be allocated */
-	FR_TOO_MANY_OPEN_FILES,	/* (18) Number of open files > _FS_LOCK */
+	FR_TOO_MANY_OPEN_FILES,	/* (18) Number of open files > FF_FS_LOCK */
 	FR_INVALID_PARAMETER	/* (19) Given parameter is invalid */
 } FRESULT;
@@ -220,9 +220,9 @@
 FRESULT f_truncate (FIL* fp);										/* Truncate file */
 FRESULT f_sync (FIL* fp);											/* Flush cached data of a writing file */
-FRESULT f_opendir (DIR* dp, const TCHAR* path);						/* Open a directory */
-FRESULT f_closedir (DIR* dp);										/* Close an open directory */
-FRESULT f_readdir (DIR* dp, FILINFO* fno);							/* Read a directory item */
-FRESULT f_findfirst (DIR* dp, FILINFO* fno, const TCHAR* path, const TCHAR* pattern);	/* Find first file */
-FRESULT f_findnext (DIR* dp, FILINFO* fno);							/* Find next file */
+FRESULT f_opendir (FATFS_DIR* dp, const TCHAR* path);						/* Open a directory */
+FRESULT f_closedir (FATFS_DIR* dp);										/* Close an open directory */
+FRESULT f_readdir (FATFS_DIR* dp, FILINFO* fno);							/* Read a directory item */
+FRESULT f_findfirst (FATFS_DIR* dp, FILINFO* fno, const TCHAR* path, const TCHAR* pattern);	/* Find first file */
+FRESULT f_findnext (FATFS_DIR* dp, FILINFO* fno);							/* Find next file */
 FRESULT f_mkdir (const TCHAR* path);								/* Create a sub directory */
 FRESULT f_unlink (const TCHAR* path);								/* Delete an existing file or directory */
@@ -270,13 +270,13 @@
 
 /* RTC function */
-#if !_FS_READONLY && !_FS_NORTC
+#if !FF_FS_READONLY && !FF_FS_NORTC
 DWORD get_fattime (void);
 #endif
 
 /* Unicode support functions */
-#if _USE_LFN							/* Unicode - OEM code conversion */
+#if FF_USE_LFN							/* Unicode - OEM code conversion */
 WCHAR ff_convert (WCHAR chr, UINT dir);	/* OEM-Unicode bidirectional conversion */
 WCHAR ff_wtoupper (WCHAR chr);			/* Unicode upper-case conversion */
-#if _USE_LFN == 3						/* Memory functions */
+#if FF_USE_LFN == 3						/* Memory functions */
 void* ff_memalloc (UINT msize);			/* Allocate memory block */
 void ff_memfree (void* mblock);			/* Free memory block */
@@ -285,9 +285,9 @@
 
 /* Sync functions */
-#if _FS_REENTRANT
-int ff_cre_syncobj (BYTE vol, _SYNC_t* sobj);	/* Create a sync object */
-int ff_req_grant (_SYNC_t sobj);				/* Lock sync object */
-void ff_rel_grant (_SYNC_t sobj);				/* Unlock sync object */
-int ff_del_syncobj (_SYNC_t sobj);				/* Delete a sync object */
+#if FF_FS_REENTRANT
+int ff_cre_syncobj (BYTE vol, FF_SYNC_t* sobj);	/* Create a sync object */
+int ff_req_grant (FF_SYNC_t sobj);				/* Lock sync object */
+void ff_rel_grant (FF_SYNC_t sobj);				/* Unlock sync object */
+int ff_del_syncobj (FF_SYNC_t sobj);				/* Delete a sync object */
 #endif
 
@@ -304,11 +304,11 @@
 #define	FA_OPEN_EXISTING	0x00
 
-#if !_FS_READONLY
+#if !FF_FS_READONLY
 #define	FA_WRITE			0x02
 #define	FA_CREATE_NEW		0x04
 #define	FA_CREATE_ALWAYS	0x08
 #define	FA_OPEN_ALWAYS		0x10
-#define FA__WRITTEN			0x20
-#define FA__DIRTY			0x40
+#define FA_MODIFIED			0x20
+#define FA_DIRTY			0x40
 #endif
 
@@ -341,5 +341,5 @@
 /* Multi-byte word access macros  */
 
-#if _WORD_ACCESS == 1	/* Enable word access to the FAT structure */
+#if FF_WORD_ACCESS == 1	/* Enable word access to the FAT structure */
 #define	LD_WORD(ptr)		(WORD)(*(WORD*)(BYTE*)(ptr))
 #define	LD_DWORD(ptr)		(DWORD)(*(DWORD*)(BYTE*)(ptr))
Index: EcnlProtoTool/trunk/ntshell/fatfs/ffarch.c
===================================================================
--- EcnlProtoTool/trunk/ntshell/fatfs/ffarch.c	(revision 433)
+++ EcnlProtoTool/trunk/ntshell/fatfs/ffarch.c	(revision 434)
@@ -1,6 +1,6 @@
 /*
- *  TOPPERS ECHONET Lite Communication Middleware
+ *  TOPPERS PROJECT Home Network Working Group Software
  * 
- *  Copyright (C) 2014-2017 Cores Co., Ltd. Japan
+ *  Copyright (C) 2014-2019 Cores Co., Ltd. Japan
  * 
  *  上記著作権者は，以下の(1)～(4)の条件を満たす場合に限り，本ソフトウェ
@@ -279,10 +279,10 @@
 }
 
-int ff_cre_syncobj(BYTE vol, _SYNC_t* sobj)
+int ff_cre_syncobj(BYTE vol, FF_SYNC_t* sobj)
 {
 	return 1;
 }
 
-int ff_req_grant(_SYNC_t sobj)
+int ff_req_grant(FF_SYNC_t sobj)
 {
 	ER ret;
@@ -291,10 +291,10 @@
 }
 
-void ff_rel_grant(_SYNC_t sobj)
+void ff_rel_grant(FF_SYNC_t sobj)
 {
 	sig_sem(SEM_FILESYSTEM);
 }
 
-int ff_del_syncobj(_SYNC_t sobj)
+int ff_del_syncobj(FF_SYNC_t sobj)
 {
 	return 1;
Index: EcnlProtoTool/trunk/ntshell/fatfs/ffarch.cfg
===================================================================
--- EcnlProtoTool/trunk/ntshell/fatfs/ffarch.cfg	(revision 433)
+++ EcnlProtoTool/trunk/ntshell/fatfs/ffarch.cfg	(revision 434)
@@ -1,6 +1,6 @@
 /*
- *  TOPPERS ECHONET Lite Communication Middleware
+ *  TOPPERS PROJECT Home Network Working Group Software
  * 
- *  Copyright (C) 2016 Cores Co., Ltd. Japan
+ *  Copyright (C) 2016-2019 Cores Co., Ltd. Japan
  * 
  *  上記著作権者は，以下の(1)～(4)の条件を満たす場合に限り，本ソフトウェ
Index: EcnlProtoTool/trunk/ntshell/fatfs/ffarch.h
===================================================================
--- EcnlProtoTool/trunk/ntshell/fatfs/ffarch.h	(revision 433)
+++ EcnlProtoTool/trunk/ntshell/fatfs/ffarch.h	(revision 434)
@@ -1,6 +1,6 @@
 /*
- *  TOPPERS ECHONET Lite Communication Middleware
+ *  TOPPERS PROJECT Home Network Working Group Software
  * 
- *  Copyright (C) 2014-2016 Cores Co., Ltd. Japan
+ *  Copyright (C) 2014-2019 Cores Co., Ltd. Japan
  * 
  *  上記著作権者は，以下の(1)～(4)の条件を満たす場合に限り，本ソフトウェ
@@ -35,9 +35,9 @@
  */
 
-#ifndef _MRUBY_ARDUINO_H_
-#define _MRUBY_ARDUINO_H_
+#ifndef _FFARCH_H_
+#define _FFARCH_H_
 
 int mruby_arduino_init();
 void sdfs_cychdr(intptr_t exinf);
 
-#endif	/* of #ifndef _MRUBY_ARDUINO_H_ */
+#endif	/* of #ifndef _FFARCH_H_ */
Index: EcnlProtoTool/trunk/ntshell/fatfs/ffconf.h
===================================================================
--- EcnlProtoTool/trunk/ntshell/fatfs/ffconf.h	(revision 433)
+++ EcnlProtoTool/trunk/ntshell/fatfs/ffconf.h	(revision 434)
@@ -3,5 +3,5 @@
 /---------------------------------------------------------------------------*/
 
-#define _FFCONF 64180	/* Revision ID */
+#define FFCONF_DEF 64180	/* Revision ID */
 
 /*---------------------------------------------------------------------------/
@@ -9,5 +9,5 @@
 /---------------------------------------------------------------------------*/
 
-#define _FS_READONLY	0
+#define FF_FS_READONLY	0
 /* This option switches read-only configuration. (0:Read/Write or 1:Read-only)
 /  Read-only configuration removes writing API functions, f_write(), f_sync(),
@@ -16,5 +16,5 @@
 
 
-#define _FS_MINIMIZE	0
+#define FF_FS_MINIMIZE	0
 /* This option defines minimization level to remove some basic API functions.
 /
@@ -26,5 +26,5 @@
 
 
-#define	_USE_STRFUNC	1
+#define	FF_USE_STRFUNC	1
 /* This option switches string functions, f_gets(), f_putc(), f_puts() and
 /  f_printf().
@@ -35,25 +35,25 @@
 
 
-#define _USE_FIND		1
+#define FF_USE_FIND		1
 /* This option switches filtered directory read feature and related functions,
 /  f_findfirst() and f_findnext(). (0:Disable or 1:Enable) */
 
 
-#define	_USE_MKFS		1
+#define	FF_USE_MKFS		1
 /* This option switches f_mkfs() function. (0:Disable or 1:Enable) */
 
 
-#define	_USE_FASTSEEK	0
+#define	FF_USE_FASTSEEK	0
 /* This option switches fast seek feature. (0:Disable or 1:Enable) */
 
 
-#define _USE_LABEL		1
+#define FF_USE_LABEL		1
 /* This option switches volume label functions, f_getlabel() and f_setlabel().
 /  (0:Disable or 1:Enable) */
 
 
-#define	_USE_FORWARD	1
+#define	FF_USE_FORWARD	1
 /* This option switches f_forward() function. (0:Disable or 1:Enable)
-/  To enable it, also _FS_TINY need to be set to 1. */
+/  To enable it, also FF_FS_TINY need to be set to 1. */
 
 
@@ -62,5 +62,5 @@
 /---------------------------------------------------------------------------*/
 
-#define _CODE_PAGE 65001
+#define FF_CODE_PAGE 65001
 /* This option specifies the OEM code page to be used on the target system.
 /  Incorrect setting of the code page can cause a file open failure.
@@ -91,9 +91,9 @@
 
 
-#define	_USE_LFN	3
-#define	_MAX_LFN	255
-/* The _USE_LFN option switches the LFN feature.
-/
-/   0: Disable LFN feature. _MAX_LFN has no effect.
+#define	FF_USE_LFN	3
+#define	FF_MAX_LFN	255
+/* The FF_USE_LFN option switches the LFN feature.
+/
+/   0: Disable LFN feature. FF_MAX_LFN has no effect.
 /   1: Enable LFN with static working buffer on the BSS. Always NOT thread-safe.
 /   2: Enable LFN with dynamic working buffer on the STACK.
@@ -101,5 +101,5 @@
 /
 /  When enable the LFN feature, Unicode handling functions (option/unicode.c) must
-/  be added to the project. The LFN working buffer occupies (_MAX_LFN + 1) * 2 bytes.
+/  be added to the project. The LFN working buffer occupies (FF_MAX_LFN + 1) * 2 bytes.
 /  When use stack for the working buffer, take care on stack overflow. When use heap
 /  memory for the working buffer, memory management functions, ff_memalloc() and
@@ -107,12 +107,12 @@
 
 
-#define	_LFN_UNICODE	0
+#define	FF_LFN_UNICODE	0
 /* This option switches character encoding on the API. (0:ANSI/OEM or 1:Unicode)
-/  To use Unicode string for the path name, enable LFN feature and set _LFN_UNICODE
+/  To use Unicode string for the path name, enable LFN feature and set FF_LFN_UNICODE
 /  to 1. This option also affects behavior of string I/O functions. */
 
 
-#define _STRF_ENCODE	3
-/* When _LFN_UNICODE is 1, this option selects the character encoding on the file to
+#define FF_STRF_ENCODE	3
+/* When FF_LFN_UNICODE is 1, this option selects the character encoding on the file to
 /  be read/written via string I/O functions, f_gets(), f_putc(), f_puts and f_printf().
 /
@@ -122,8 +122,8 @@
 /  3: UTF-8
 /
-/  When _LFN_UNICODE is 0, this option has no effect. */
-
-
-#define _FS_RPATH	2
+/  When FF_LFN_UNICODE is 0, this option has no effect. */
+
+
+#define FF_FS_RPATH	2
 /* This option configures relative path feature.
 /
@@ -139,18 +139,18 @@
 /---------------------------------------------------------------------------*/
 
-#define _VOLUMES	2
+#define FF_VOLUMES	2
 /* Number of volumes (logical drives) to be used. */
 
 
-#define _STR_VOLUME_ID	0
-#define _VOLUME_STRS	"RAM","NAND","CF","SD1","SD2","USB1","USB2","USB3"
-/* _STR_VOLUME_ID option switches string volume ID feature.
-/  When _STR_VOLUME_ID is set to 1, also pre-defined strings can be used as drive
-/  number in the path name. _VOLUME_STRS defines the drive ID strings for each
-/  logical drives. Number of items must be equal to _VOLUMES. Valid characters for
+#define FF_STR_VOLUME_ID	0
+#define FF_VOLUME_STRS	"RAM","NAND","CF","SD1","SD2","USB1","USB2","USB3"
+/* FF_STR_VOLUME_ID option switches string volume ID feature.
+/  When FF_STR_VOLUME_ID is set to 1, also pre-defined strings can be used as drive
+/  number in the path name. FF_VOLUME_STRS defines the drive ID strings for each
+/  logical drives. Number of items must be equal to FF_VOLUMES. Valid characters for
 /  the drive ID strings are: A-Z and 0-9. */
 
 
-#define	_MULTI_PARTITION	0
+#define	FF_MULTI_PARTITION	0
 /* This option switches multi-partition feature. By default (0), each logical drive
 /  number is bound to the same physical drive number and only an FAT volume found on
@@ -160,15 +160,15 @@
 
 
-#define	_MIN_SS		512
-#define	_MAX_SS		512
+#define	FF_MIN_SS		512
+#define	FF_MAX_SS		512
 /* These options configure the range of sector size to be supported. (512, 1024,
 /  2048 or 4096) Always set both 512 for most systems, all type of memory cards and
 /  harddisk. But a larger value may be required for on-board flash memory and some
-/  type of optical media. When _MAX_SS is larger than _MIN_SS, FatFs is configured
+/  type of optical media. When FF_MAX_SS is larger than FF_MIN_SS, FatFs is configured
 /  to variable sector size and GET_SECTOR_SIZE command must be implemented to the
 /  disk_ioctl() function. */
 
 
-#define	_USE_TRIM	0
+#define	FF_USE_TRIM	0
 /* This option switches ATA-TRIM feature. (0:Disable or 1:Enable)
 /  To enable Trim feature, also CTRL_TRIM command should be implemented to the
@@ -176,5 +176,5 @@
 
 
-#define _FS_NOFSINFO	0
+#define FF_FS_NOFSINFO	0
 /* If you need to know correct free space on the FAT32 volume, set bit 0 of this
 /  option, and f_getfree() function at first time after volume mount will force
@@ -193,7 +193,7 @@
 /---------------------------------------------------------------------------*/
 
-#define	_FS_TINY	1
+#define	FF_FS_TINY	1
 /* This option switches tiny buffer configuration. (0:Normal or 1:Tiny)
-/  At the tiny configuration, size of the file object (FIL) is reduced _MAX_SS
+/  At the tiny configuration, size of the file object (FIL) is reduced FF_MAX_SS
 /  bytes. Instead of private sector buffer eliminated from the file object,
 /  common sector buffer in the file system object (FATFS) is used for the file
@@ -201,21 +201,21 @@
 
 
-#define _FS_NORTC	0
-#define _NORTC_MON	1
-#define _NORTC_MDAY	1
-#define _NORTC_YEAR	2015
-/* The _FS_NORTC option switches timestamp feature. If the system does not have
-/  an RTC function or valid timestamp is not needed, set _FS_NORTC to 1 to disable
+#define FF_FS_NORTC	0
+#define FF_NORTC_MON	1
+#define FF_NORTC_MDAY	1
+#define FF_NORTC_YEAR	2015
+/* The FF_FS_NORTC option switches timestamp feature. If the system does not have
+/  an RTC function or valid timestamp is not needed, set FF_FS_NORTC to 1 to disable
 /  the timestamp feature. All objects modified by FatFs will have a fixed timestamp
-/  defined by _NORTC_MON, _NORTC_MDAY and _NORTC_YEAR.
-/  When timestamp feature is enabled (_FS_NORTC == 0), get_fattime() function need
-/  to be added to the project to read current time form RTC. _NORTC_MON,
-/  _NORTC_MDAY and _NORTC_YEAR have no effect. 
-/  These options have no effect at read-only configuration (_FS_READONLY == 1). */
-
-
-#define	_FS_LOCK	0
-/* The _FS_LOCK option switches file lock feature to control duplicated file open
-/  and illegal operation to open objects. This option must be 0 when _FS_READONLY
+/  defined by FF_NORTC_MON, FF_NORTC_MDAY and FF_NORTC_YEAR.
+/  When timestamp feature is enabled (FF_FS_NORTC == 0), get_fattime() function need
+/  to be added to the project to read current time form RTC. FF_NORTC_MON,
+/  FF_NORTC_MDAY and FF_NORTC_YEAR have no effect. 
+/  These options have no effect at read-only configuration (FF_FS_READONLY == 1). */
+
+
+#define	FF_FS_LOCK	0
+/* The FF_FS_LOCK option switches file lock feature to control duplicated file open
+/  and illegal operation to open objects. This option must be 0 when FF_FS_READONLY
 /  is 1.
 /
@@ -227,8 +227,8 @@
 
 
-#define _FS_REENTRANT	1
-#define _FS_TIMEOUT		1000
-#define	_SYNC_t			unsigned int
-/* The _FS_REENTRANT option switches the re-entrancy (thread safe) of the FatFs
+#define FF_FS_REENTRANT	1
+#define FF_FS_TIMEOUT		1000
+#define	FF_SYNC_t			unsigned int
+/* The FF_FS_REENTRANT option switches the re-entrancy (thread safe) of the FatFs
 /  module itself. Note that regardless of this option, file access to different
 /  volume is always re-entrant and volume control functions, f_mount(), f_mkfs()
@@ -236,5 +236,5 @@
 /  to the same volume is under control of this feature.
 /
-/   0: Disable re-entrancy. _FS_TIMEOUT and _SYNC_t have no effect.
+/   0: Disable re-entrancy. FF_FS_TIMEOUT and FF_SYNC_t have no effect.
 /   1: Enable re-entrancy. Also user provided synchronization handlers,
 /      ff_req_grant(), ff_rel_grant(), ff_del_syncobj() and ff_cre_syncobj()
@@ -242,12 +242,12 @@
 /      option/syscall.c.
 /
-/  The _FS_TIMEOUT defines timeout period in unit of time tick.
-/  The _SYNC_t defines O/S dependent sync object type. e.g. HANDLE, ID, OS_EVENT*,
+/  The FF_FS_TIMEOUT defines timeout period in unit of time tick.
+/  The FF_SYNC_t defines O/S dependent sync object type. e.g. HANDLE, ID, OS_EVENT*,
 /  SemaphoreHandle_t and etc.. A header file for O/S definitions needs to be
 /  included somewhere in the scope of ff.c. */
 
 
-#define _WORD_ACCESS	1
-/* The _WORD_ACCESS option is an only platform dependent option. It defines
+#define FF_WORD_ACCESS	1
+/* The FF_WORD_ACCESS option is an only platform dependent option. It defines
 /  which access method is used to the word data on the FAT volume.
 /
@@ -258,5 +258,5 @@
 /  * Byte order on the memory is little-endian.
 /
-/  If it is the case, _WORD_ACCESS can also be set to 1 to reduce code size.
+/  If it is the case, FF_WORD_ACCESS can also be set to 1 to reduce code size.
 /  Following table shows allowable settings of some type of processors.
 /
Index: EcnlProtoTool/trunk/ntshell/ntshell/usrcmd.c
===================================================================
--- EcnlProtoTool/trunk/ntshell/ntshell/usrcmd.c	(revision 433)
+++ EcnlProtoTool/trunk/ntshell/ntshell/usrcmd.c	(revision 434)
@@ -249,5 +249,5 @@
 	char *fn;
 
-#if _USE_LFN
+#if FF_USE_LFN
 	fn = *fno->lfname ? fno->lfname : fno->fname;
 #else
@@ -289,5 +289,5 @@
 }
 
-#define LFN_BUF_SIZE (_MAX_LFN + 1)
+#define LFN_BUF_SIZE (FF_MAX_LFN + 1)
 /* lsコマンド dir内 表示 */
 void print_ls(char *path_p, char *pattern_p, BYTE list_option)
@@ -295,5 +295,5 @@
 	FRESULT res;
 	FILINFO fno;
-	DIR dir;
+	FATFS_DIR dir;
 	char *fn;   /* This function assumes non-Unicode configuration */
 
@@ -308,5 +308,5 @@
 	}
 
-#if _USE_LFN
+#if FF_USE_LFN
 	char *lfn = NULL;
 	lfn = ff_memalloc(LFN_BUF_SIZE);
@@ -330,6 +330,6 @@
 
 	while ((res == FR_OK) && (fno.fname[0] != 0)) {
-		if (pattern_p != NULL && (fno.fattrib & AM_DIR) && ((fno.fname[0] == '.') ? (pattern_p[0] == '.') : 1)) {/* DIR とパターンマッチしている場合は DIR 内部を ls する */
-#if _USE_LFN
+		if (pattern_p != NULL && (fno.fattrib & AM_DIR) && ((fno.fname[0] == '.') ? (pattern_p[0] == '.') : 1)) {/* FATFS_DIR とパターンマッチしている場合は FATFS_DIR 内部を ls する */
+#if FF_USE_LFN
 			fn = *fno.lfname ? fno.lfname : fno.fname;
 #else
@@ -381,5 +381,5 @@
 {
 	char *pattern_p = NULL, *basename_p = NULL, *dirname_p = NULL;
-	char default_pattern[_MAX_LFN] = "";
+	char default_pattern[FF_MAX_LFN] = "";
 	int c;
 	BYTE list_option = 0;
@@ -443,5 +443,5 @@
 		return 0;
 
-#if _USE_LFN
+#if FF_USE_LFN
 	/* LFN buffer alloc */
 	lfn = ff_memalloc(LFN_BUF_SIZE);
Index: EcnlProtoTool/trunk/ntshell/src/fdtable.c
===================================================================
--- EcnlProtoTool/trunk/ntshell/src/fdtable.c	(revision 433)
+++ EcnlProtoTool/trunk/ntshell/src/fdtable.c	(revision 434)
@@ -1,6 +1,6 @@
 /*
- *  TOPPERS ECHONET Lite Communication Middleware
+ *  TOPPERS PROJECT Home Network Working Group Software
  * 
- *  Copyright (C) 2017 Cores Co., Ltd. Japan
+ *  Copyright (C) 2017-2019 Cores Co., Ltd. Japan
  * 
  *  上記著作権者は，以下の(1)～(4)の条件を満たす場合に限り，本ソフトウェ
Index: EcnlProtoTool/trunk/ntshell/src/fdtable.h
===================================================================
--- EcnlProtoTool/trunk/ntshell/src/fdtable.h	(revision 433)
+++ EcnlProtoTool/trunk/ntshell/src/fdtable.h	(revision 434)
@@ -119,5 +119,5 @@
 		FIL file;
 		struct {
-			DIR dir;
+			FATFS_DIR dir;
 			struct dirent dirent;
 		};
Index: EcnlProtoTool/trunk/ntshell/src/io_stub.c
===================================================================
--- EcnlProtoTool/trunk/ntshell/src/io_stub.c	(revision 433)
+++ EcnlProtoTool/trunk/ntshell/src/io_stub.c	(revision 434)
@@ -1,6 +1,6 @@
 /*
- *  TOPPERS ECHONET Lite Communication Middleware
+ *  TOPPERS PROJECT Home Network Working Group Software
  * 
- *  Copyright (C) 2017 Cores Co., Ltd. Japan
+ *  Copyright (C) 2017-2019 Cores Co., Ltd. Japan
  * 
  *  上記著作権者は，以下の(1)～(4)の条件を満たす場合に限り，本ソフトウェ
@@ -100,5 +100,5 @@
 			return -ENOMEM;
 
-		DIR *dir = &fp->dir;
+		FATFS_DIR *dir = &fp->dir;
 		FRESULT res;
 		if ((res = f_opendir(dir, path)) != FR_OK) {
@@ -405,11 +405,11 @@
 	FILINFO fi;
 	FRESULT ret;
-#if _USE_LFN
-	static char lfn[_MAX_LFN + 1];   /* Buffer to store the LFN */
+#if FF_USE_LFN
+	static char lfn[FF_MAX_LFN + 1];   /* Buffer to store the LFN */
 	fi.lfname = lfn;
 	fi.lfsize = sizeof lfn;
 #endif
 	if (ntlibc_strcmp(path, ".") == 0) {
-		char cwd[_MAX_LFN];
+		char cwd[FF_MAX_LFN];
 		if ((ret = f_getcwd(cwd, sizeof(cwd))) != FR_OK) {
 			return fresult2errno(ret);
@@ -578,6 +578,6 @@
 
 	FILINFO fno;
-#if _USE_LFN
-	static char lfn[_MAX_LFN + 1];   /* Buffer to store the LFN */
+#if FF_USE_LFN
+	static char lfn[FF_MAX_LFN + 1];   /* Buffer to store the LFN */
 	fno.lfname = lfn;
 	fno.lfsize = sizeof lfn;
@@ -589,5 +589,5 @@
 
 	memset(de, 0, sizeof(*de));
-#if _USE_LFN
+#if FF_USE_LFN
 	ntlibc_strlcpy(de->d_name, *fno.lfname ? fno.lfname : fno.fname, sizeof(de->d_name));
 #else
@@ -622,6 +622,6 @@
 	else {
 		FILINFO fno;
-#if _USE_LFN
-		static char lfn[_MAX_LFN + 1];   /* Buffer to store the LFN */
+#if FF_USE_LFN
+		static char lfn[FF_MAX_LFN + 1];   /* Buffer to store the LFN */
 		fno.lfname = lfn;
 		fno.lfsize = sizeof lfn;
Index: EcnlProtoTool/trunk/ntshell/src/main.c
===================================================================
--- EcnlProtoTool/trunk/ntshell/src/main.c	(revision 433)
+++ EcnlProtoTool/trunk/ntshell/src/main.c	(revision 434)
@@ -185,8 +185,8 @@
 {
 	FILINFO fno;
-#if _USE_LFN
-	char lfn[_MAX_LFN + 1];
+#if FF_USE_LFN
+	char lfn[FF_MAX_LFN + 1];
 	fno.lfname = lfn;
-	fno.lfsize = _MAX_LFN + 1;
+	fno.lfsize = FF_MAX_LFN + 1;
 #endif
 	ER ret;
Index: EcnlProtoTool/trunk/ntshell/src/main.cfg
===================================================================
--- EcnlProtoTool/trunk/ntshell/src/main.cfg	(revision 433)
+++ EcnlProtoTool/trunk/ntshell/src/main.cfg	(revision 434)
@@ -1,6 +1,6 @@
 /*
- *  TOPPERS ECHONET Lite Communication Middleware
+ *  TOPPERS PROJECT Home Network Working Group Software
  * 
- *  Copyright (C) 2014-2016 Cores Co., Ltd. Japan
+ *  Copyright (C) 2014-2019 Cores Co., Ltd. Japan
  * 
  *  上記著作権者は，以下の(1)～(4)の条件を満たす場合に限り，本ソフトウェ
@@ -37,5 +37,5 @@
 
 /*
- *  サンプルプログラム(1)のシステムコンフィギュレーションファイル
+ *  ntshellのシステムコンフィギュレーションファイル
  */
 #include "main.h"
Index: EcnlProtoTool/trunk/ntshell/src/shellif.h
===================================================================
--- EcnlProtoTool/trunk/ntshell/src/shellif.h	(revision 433)
+++ EcnlProtoTool/trunk/ntshell/src/shellif.h	(revision 434)
@@ -111,5 +111,5 @@
 
 // dirent.h
-typedef struct __dirstream DIR;
+typedef struct __dirstream FATFS_DIR;
 
 int shell_getdents(int, struct dirent *, size_t);
Index: EcnlProtoTool/trunk/ntshell/webserver/httpd-fs.c
===================================================================
--- EcnlProtoTool/trunk/ntshell/webserver/httpd-fs.c	(revision 433)
+++ EcnlProtoTool/trunk/ntshell/webserver/httpd-fs.c	(revision 434)
@@ -69,5 +69,5 @@
 	FRESULT res;
 	FILINFO fno;
-	DIR dir;
+	FATFS_DIR dir;
 	int i;
 	char *fn;   /* This function assumes non-Unicode configuration */
@@ -102,5 +102,5 @@
 	FIL *fd = (FIL *)&file->fd;
 	FILINFO fno;
-	DIR dir;
+	FATFS_DIR dir;
 
 	file->pos = 0;
