PDA上的CF CARD 文件系统的建立程式
源代码在线查看: rename.c
/*************************************************************
File Name: rename.C *
**************************************************************
Programmer: MSC
Last Modified Date: 2000/02/26
Compiler : GNU Cross-compiler/SDS
Platform : X86 protection mode, MIPS, Dragonball
Usage :
int rename(const char *oldname, const char *newname)
*************************************************************/
/*************************************************************
Header Files
**************************************************************/
#include
//#include "myansi.h"
#include
#include
#ifdef RAMDISK_ID
/* basic.c */
extern int InitRD;
//extern int RDerrno;
extern int RD_SemaphoreID;
/* fio.c */
extern struct RD_FILE **RD_HandleTable;
#ifdef CURRENT_DIR_ENABLE
extern unsigned char RD_CurrentPathname[MAX_PATH_LENGTH];
#endif
/*************************************************************
Function: RD_rename(oldname, newname)
Description:
rename an existing file/dir
Input:
oldname - old file/dir name
newname - new file/dir name
Output:
0: Success
-1: Failure
Note: oldname/newname can't be '\\'(root)
newname can't be duplicated
**************************************************************/
int RD_rename(unsigned char *oldname, unsigned char *newname)
{
int status;
if (InitRD == FALSE)
{
RDerrno = ERROR_FILE_SYSTEM_NOT_INIT;
return -1;
}
sc_waitSemaphore(RD_SemaphoreID);
status = RD_rename_r(oldname, newname);
sc_signalSemaphore(RD_SemaphoreID);
return status;
}
/*************************************************************
Function: RD_rename_r(oldname, newname)
Description:
rename an existing file/dir
Input:
oldname - old file/dir name
newname - new file/dir name
Output:
0: Success
-1: Failure
Note: oldname/newname can'be '\\'(root)
newname can't be duplicated
ThreadSafe:
**************************************************************/
/* 虫