From: John Hodge Date: Fri, 10 Dec 2010 09:00:37 +0000 (+0800) Subject: Fixed places where char* was used in place of const char* X-Git-Tag: rel0.07~35 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=4e949acb1c98bc071af2d5d9038b4a3e703bf33d;p=tpg%2Facess2.git Fixed places where char* was used in place of const char* > Still need to update filesystem Write functions to take const void* > Also started on AcessNative threads.c clone --- diff --git a/.gitignore b/.gitignore index aeb90690..0f64f8bd 100644 --- a/.gitignore +++ b/.gitignore @@ -15,9 +15,14 @@ *.dmp *.kmd.* Map*.txt +map.txt Doxylog*.txt LineCounts.*.txt bochs*.txt serial.txt *.gz *.img +SrcDoc/ +ApiDoc/ +Usermode/Output/ +gitstats/ diff --git a/AcessNative/acesskernel_src/Makefile b/AcessNative/acesskernel_src/Makefile index d7bfcb8a..1ec22b38 100644 --- a/AcessNative/acesskernel_src/Makefile +++ b/AcessNative/acesskernel_src/Makefile @@ -7,12 +7,12 @@ endif KERNEL_SRC = ../../Kernel/ -KERNEL_OBJ := logging.o adt.o -KERNEL_OBJ += vfs/main.o vfs/open.o vfs/acls.o vfs/io.o vfs/dir.o vfs/nodecache.o vfs/mount.o +KERNEL_OBJ := logging.o adt.o lib.o +KERNEL_OBJ += vfs/main.o vfs/open.o vfs/acls.o vfs/io.o vfs/dir.o vfs/nodecache.o vfs/mount.o vfs/memfile.o KERNEL_OBJ += vfs/fs/root.o vfs/fs/devfs.o -KERNEL_OBJ += drv/vterm.o drv/fifo.o +KERNEL_OBJ += drv/vterm.o drv/fifo.o drv/proc.o -OBJ := main.o video.o keyboard.o mouse.o nativefs.o vfs_handle.o +OBJ := main.o threads.o video.o keyboard.o mouse.o nativefs.o vfs_handle.o OBJ += $(addprefix $(KERNEL_SRC),$(KERNEL_OBJ)) OBJ := $(addsuffix .$(PLATFORM),$(OBJ)) diff --git a/AcessNative/acesskernel_src/main.c b/AcessNative/acesskernel_src/main.c index 45e6aa02..93127408 100644 --- a/AcessNative/acesskernel_src/main.c +++ b/AcessNative/acesskernel_src/main.c @@ -4,9 +4,9 @@ * * Kernel Main */ +#include #include #include -#include int main(int argc, char *argv[]) { @@ -41,12 +41,17 @@ void Warning(const char *Fmt, ...) printf("\n"); } -int CheckMem(void *Mem, int Count) +void *Heap_Allocate(int Count, const char *File, int Line) { - return 1; + return malloc(Count); } -int CheckString(const char *String) +tPAddr MM_GetPhysAddr(tVAddr VAddr) { - return 1; + return VAddr; // HACK! +} + +Uint MM_GetFlags(tVAddr VAddr) +{ + return 0; } diff --git a/AcessNative/acesskernel_src/threads.c b/AcessNative/acesskernel_src/threads.c new file mode 100644 index 00000000..f7e1cb83 --- /dev/null +++ b/AcessNative/acesskernel_src/threads.c @@ -0,0 +1,38 @@ +/* + * Acess2 Native Kernel + * - Acess kernel emulation on another OS using SDL and UDP + * + * threads.c + * - Thread and process handling + */ +#include + +// === STRUCTURES === +typedef struct sThread +{ + struct sThread *Next; + tTID TID, PID; + tUID UID, GID; + + struct sThread *Parent; + + char *ThreadName; + + // Config? + Uint Config[NUM_CFG_ENTRIES]; +} tThread; + +// === GLOBALS === +tThread *gpThreads; +__thread tThread *gpCurrentThread; + +// === CODE === +tUID Threads_GetUID() { return gpCurrentThread->UID; } +tGID Threads_GetGID() { return gpCurrentThread->GID; } +tTID Threads_GetTID() { return gpCurrentThread->TID; } +tPID Threads_GetPID() { return gpCurrentThread->PID; } + +Uint *Threads_GetCfgPtr(int Index) +{ + return &gpCurrentThread->Config[Index]; +} diff --git a/Kernel/debug.c b/Kernel/debug.c index 6bea250e..c05efa0b 100644 --- a/Kernel/debug.c +++ b/Kernel/debug.c @@ -24,7 +24,7 @@ extern void KernelPanic_PutChar(char Ch); int putDebugChar(char ch); int getDebugChar(void); static void Debug_Putchar(char ch); -static void Debug_Puts(int DbgOnly, char *Str); +static void Debug_Puts(int DbgOnly, const char *Str); void Debug_Fmt(const char *format, va_list args); // === GLOBALS === @@ -108,7 +108,7 @@ static void Debug_Putchar(char ch) KernelPanic_PutChar(ch); } -static void Debug_Puts(int UseKTerm, char *Str) +static void Debug_Puts(int UseKTerm, const char *Str) { int len = 0; while( *Str ) @@ -170,9 +170,10 @@ void Debug_KernelPanic() } /** - * \fn void LogF(char *Msg, ...) + * \fn void LogF(const char *Msg, ...) + * \brief Raw debug log (no new line, no prefix) */ -void LogF(char *Fmt, ...) +void LogF(const char *Fmt, ...) { va_list args; @@ -191,10 +192,10 @@ void LogF(char *Fmt, ...) #endif } /** - * \fn void Debug(char *Msg, ...) + * \fn void Debug(const char *Msg, ...) * \brief Print only to the debug channel */ -void Debug(char *Fmt, ...) +void Debug(const char *Fmt, ...) { va_list args; @@ -213,9 +214,9 @@ void Debug(char *Fmt, ...) #endif } /** - * \fn void Log(char *Msg, ...) + * \fn void Log(const char *Msg, ...) */ -void Log(char *Fmt, ...) +void Log(const char *Fmt, ...) { va_list args; @@ -234,7 +235,7 @@ void Log(char *Fmt, ...) SHORTREL(&glDebug_Lock); #endif } -void Warning(char *Fmt, ...) +void Warning(const char *Fmt, ...) { va_list args; @@ -253,7 +254,7 @@ void Warning(char *Fmt, ...) SHORTREL(&glDebug_Lock); #endif } -void Panic(char *Fmt, ...) +void Panic(const char *Fmt, ...) { va_list args; @@ -278,7 +279,7 @@ void Panic(char *Fmt, ...) for(;;) __asm__ __volatile__ ("hlt"); } -void Debug_SetKTerminal(char *File) +void Debug_SetKTerminal(const char *File) { int tmp; if(giDebug_KTerm != -1) { @@ -292,7 +293,7 @@ void Debug_SetKTerminal(char *File) Log_Log("Debug", "Returning to %p", __builtin_return_address(0)); } -void Debug_Enter(char *FuncName, char *ArgTypes, ...) +void Debug_Enter(const char *FuncName, const char *ArgTypes, ...) { va_list args; int i; @@ -316,12 +317,15 @@ void Debug_Enter(char *FuncName, char *ArgTypes, ...) while(*ArgTypes) { pos = strpos(ArgTypes, ' '); - if(pos != -1) ArgTypes[pos] = '\0'; if(pos == -1 || pos > 1) { - Debug_Puts(1, ArgTypes+1); + if(pos == -1) + Debug_Puts(1, ArgTypes+1); + else { + for( i = 1; i < pos; i ++ ) + Debug_Putchar(ArgTypes[i]); + } Debug_Putchar('='); } - if(pos != -1) ArgTypes[pos] = ' '; switch(*ArgTypes) { case 'p': LogF("%p", va_arg(args, void*)); break; @@ -349,7 +353,7 @@ void Debug_Enter(char *FuncName, char *ArgTypes, ...) #endif } -void Debug_Log(char *FuncName, char *Fmt, ...) +void Debug_Log(const char *FuncName, const char *Fmt, ...) { va_list args; int i = gDebug_Level; @@ -377,7 +381,7 @@ void Debug_Log(char *FuncName, char *Fmt, ...) #endif } -void Debug_Leave(char *FuncName, char RetType, ...) +void Debug_Leave(const char *FuncName, char RetType, ...) { va_list args; int i; @@ -434,9 +438,9 @@ void Debug_Leave(char *FuncName, char RetType, ...) #endif } -void Debug_HexDump(char *Header, void *Data, Uint Length) +void Debug_HexDump(const char *Header, const void *Data, Uint Length) { - Uint8 *cdat = Data; + const Uint8 *cdat = Data; Uint pos = 0; Debug_Puts(1, Header); LogF(" (Hexdump of %p)\r\n", Data); diff --git a/Kernel/include/acess.h b/Kernel/include/acess.h index 861fd301..a27ebd61 100644 --- a/Kernel/include/acess.h +++ b/Kernel/include/acess.h @@ -123,16 +123,16 @@ extern void Log_Debug(char *Ident, char *Message, ...); * \{ */ extern void Debug_KernelPanic(void); //!< Initiate a kernel panic -extern void Panic(char *Msg, ...); //!< Print a panic message (initiates a kernel panic) -extern void Warning(char *Msg, ...); //!< Print a warning message -extern void LogF(char *Fmt, ...); //!< Print a log message without a trailing newline -extern void Log(char *Fmt, ...); //!< Print a log message -extern void Debug(char *Fmt, ...); //!< Print a debug message (doesn't go to KTerm) -extern void LogV(char *Fmt, va_list Args); //!< va_list Log message -extern void Debug_Enter(char *FuncName, char *ArgTypes, ...); -extern void Debug_Log(char *FuncName, char *Fmt, ...); -extern void Debug_Leave(char *FuncName, char RetType, ...); -extern void Debug_HexDump(char *Header, void *Data, Uint Length); +extern void Panic(const char *Msg, ...); //!< Print a panic message (initiates a kernel panic) +extern void Warning(const char *Msg, ...); //!< Print a warning message +extern void LogF(const char *Fmt, ...); //!< Print a log message without a trailing newline +extern void Log(const char *Fmt, ...); //!< Print a log message +extern void Debug(const char *Fmt, ...); //!< Print a debug message (doesn't go to KTerm) +extern void LogV(const char *Fmt, va_list Args); //!< va_list Log message +extern void Debug_Enter(const char *FuncName, const char *ArgTypes, ...); +extern void Debug_Log(const char *FuncName, const char *Fmt, ...); +extern void Debug_Leave(const char *FuncName, char RetType, ...); +extern void Debug_HexDump(const char *Header, const void *Data, Uint Length); #define UNIMPLEMENTED() Warning("'%s' unimplemented", __func__) #if DEBUG # define ENTER(_types...) Debug_Enter((char*)__func__, _types) diff --git a/Kernel/include/vfs.h b/Kernel/include/vfs.h index c2f2e35b..c0e9705c 100644 --- a/Kernel/include/vfs.h +++ b/Kernel/include/vfs.h @@ -270,7 +270,7 @@ typedef struct sVFS_Driver Uint Flags; //! \brief Callback to mount a device - tVFS_Node *(*InitDevice)(char *Device, char **Options); + tVFS_Node *(*InitDevice)(const char *Device, const char **Options); //! \brief Callback to unmount a device void (*Unmount)(tVFS_Node *Node); //! \brief Used internally (next driver in the chain) @@ -311,7 +311,7 @@ extern int VFS_AddDriver(tVFS_Driver *Info); * \brief Get the information structure of a driver given its name * \param Name Name of filesystem driver to find */ -extern tVFS_Driver *VFS_GetFSByName(char *Name); +extern tVFS_Driver *VFS_GetFSByName(const char *Name); /** * \fn tVFS_ACL *VFS_UnixToAcessACL(Uint Mode, Uint Owner, Uint Group) * \brief Transforms Unix Permssions into Acess ACLs diff --git a/Kernel/include/vfs_ext.h b/Kernel/include/vfs_ext.h index 1a5fab68..720bcbe0 100644 --- a/Kernel/include/vfs_ext.h +++ b/Kernel/include/vfs_ext.h @@ -117,7 +117,7 @@ extern int VFS_Init(void); * \param Mode Flags defining how to open the file * \return VFS Handle (an integer) or -1 if an error occured */ -extern int VFS_Open(char *Path, Uint Mode); +extern int VFS_Open(const char *Path, Uint Mode); /** * \brief Close a currently open file * \param FD Handle returned by ::VFS_Open @@ -191,7 +191,7 @@ extern Uint64 VFS_Read(int FD, Uint64 Length, void *Buffer); * \param Buffer Source of written data * \return Number of bytes written */ -extern Uint64 VFS_Write(int FD, Uint64 Length, void *Buffer); +extern Uint64 VFS_Write(int FD, Uint64 Length, const void *Buffer); /** * \brief Reads from a specific offset in the file @@ -210,7 +210,7 @@ extern Uint64 VFS_ReadAt(int FD, Uint64 Offset, Uint64 Length, void *Buffer); * \param Buffer Source of written data * \return Number of bytes written */ -extern Uint64 VFS_WriteAt(int FD, Uint64 Offset, Uint64 Length, void *Buffer); +extern Uint64 VFS_WriteAt(int FD, Uint64 Offset, Uint64 Length, const void *Buffer); /** * \brief Sends an IOCtl request to the driver @@ -234,7 +234,7 @@ extern void VFS_GetMemPath(char *Dest, void *Base, Uint Length); * \param Path File path (may contain symlinks, relative elements etc.) * \return Absolute path with no symlinks */ -extern char *VFS_GetTruePath(char *Path); +extern char *VFS_GetTruePath(const char *Path); /** * \brief Mounts a filesystem @@ -244,21 +244,21 @@ extern char *VFS_GetTruePath(char *Path); * \param Options Options string to pass the driver * \return 1 on succes, -1 on error */ -extern int VFS_Mount(char *Device, char *MountPoint, char *Filesystem, char *Options); +extern int VFS_Mount(const char *Device, const char *MountPoint, const char *Filesystem, const char *Options); /** * \brief Create a new directory * \param Path Path to new directory (absolute or relative) * \return Boolean success * \note The parent of the directory must exist */ -extern int VFS_MkDir(char *Path); +extern int VFS_MkDir(const char *Path); /** * \brief Create a symbolic link * \param Name Name of the symbolic link * \param Link File the symlink points to * \return Boolean success (\a Link is not tested for existence) */ -extern int VFS_Symlink(char *Name, char *Link); +extern int VFS_Symlink(const char *Name, const char *Link); /** * \brief Read from a directory * \param FD File handle returned by ::VFS_Open @@ -275,6 +275,6 @@ extern int VFS_ReadDir(int FD, char *Dest); * \param Mode Open mode * \return File handle (same as returned from VFS_Open) */ -extern int VFS_OpenChild(Uint *Errno, int FD, char *Name, Uint Mode); +extern int VFS_OpenChild(Uint *Errno, int FD, const char *Name, Uint Mode); #endif diff --git a/Kernel/lib.c b/Kernel/lib.c index b9e97344..bc32a0ce 100644 --- a/Kernel/lib.c +++ b/Kernel/lib.c @@ -36,7 +36,7 @@ char **str_split(const char *__str, char __ch); int DivUp(int num, int dem); Sint64 timestamp(int sec, int mins, int hrs, int day, int month, int year); -Uint rand(void); + int rand(void); int CheckString(char *String); int CheckMem(void *Mem, int NumBytes); @@ -292,9 +292,8 @@ int vsnprintf(char *__s, size_t __maxlen, const char *__format, va_list args) itoa(p, val, 10, minSize, pad); goto printString; case 'X': - #if BITS == 64 - isLongLong = 1; // TODO: Handle non-x86 64-bit archs - #endif + if(BITS == 64) + isLongLong = 1; // TODO: Handle non-x86 64-bit archs GETVAL(); itoa(p, val, 16, minSize, pad); goto printString; @@ -427,12 +426,12 @@ Uint8 ByteSum(void *Ptr, int Size) } /** - * \fn Uint strlen(const char *__str) + * \fn size_t strlen(const char *__str) * \brief Get the length of string */ -Uint strlen(const char *__str) +size_t strlen(const char *__str) { - Uint ret = 0; + size_t ret = 0; while(*__str++) ret++; return ret; } @@ -722,11 +721,10 @@ Sint64 timestamp(int sec, int mins, int hrs, int day, int month, int year) } /** - * \fn Uint rand() + * \fn int rand() * \brief Pseudo random number generator - * \note Unknown effectiveness (made up on the spot) */ -Uint rand(void) +int rand(void) { #if 0 static Uint state = RANDOM_SEED; diff --git a/Kernel/vfs/dir.c b/Kernel/vfs/dir.c index 3e004b91..0fa213d1 100644 --- a/Kernel/vfs/dir.c +++ b/Kernel/vfs/dir.c @@ -11,8 +11,8 @@ extern tVFS_Mount *gRootMount; // === PROTOTYPES === - int VFS_MkDir(char *Path); - int VFS_MkNod(char *Path, Uint Flags); + int VFS_MkDir(const char *Path); + int VFS_MkNod(const char *Path, Uint Flags); // === CODE === /** @@ -20,7 +20,7 @@ extern tVFS_Mount *gRootMount; * \brief Create a new node * \param Path Path of directory to create */ -int VFS_MkDir(char *Path) +int VFS_MkDir(const char *Path) { return VFS_MkNod(Path, VFS_FFLAG_DIRECTORY); } @@ -31,7 +31,7 @@ int VFS_MkDir(char *Path) * \param Path Path of new node * \param Flags Flags to apply to the node */ -int VFS_MkNod(char *Path, Uint Flags) +int VFS_MkNod(const char *Path, Uint Flags) { char *absPath, *name; int pos = 0, oldpos = 0; @@ -104,29 +104,31 @@ int VFS_MkNod(char *Path, Uint Flags) } /** - * \fn int VFS_Symlink(char *Name, char *Link) + * \fn int VFS_Symlink(const char *Name, const char *Link) * \brief Creates a symlink called \a Name to \a Link * \param Name Name of symbolic link * \param Link Destination of symbolic link */ -int VFS_Symlink(char *Name, char *Link) +int VFS_Symlink(const char *Name, const char *Link) { char *realLink; int fp; tVFS_Node *destNode; + char *_link; //ENTER("sName sLink", Name, Link); // Get absolue path name - Link = VFS_GetAbsPath( Link ); - if(!Link) { + _link = VFS_GetAbsPath( Link ); + if(!_link) { Warning("Path '%s' is badly formed", Link); return -1; } // Get true path and node - destNode = VFS_ParsePath( Link, &realLink ); - free(Link); + destNode = VFS_ParsePath( _link, &realLink ); + free(_link); + _link = NULL; // Check if destination exists if(!destNode) { diff --git a/Kernel/vfs/fs/devfs.c b/Kernel/vfs/fs/devfs.c index 39745733..be5a655a 100644 --- a/Kernel/vfs/fs/devfs.c +++ b/Kernel/vfs/fs/devfs.c @@ -10,7 +10,7 @@ // === PROTOTYPES === int DevFS_AddDevice(tDevFS_Driver *Device); void DevFS_DelDevice(tDevFS_Driver *Device); -tVFS_Node *DevFS_InitDevice(char *Device, char **Options); +tVFS_Node *DevFS_InitDevice(const char *Device, const char **Options); char *DevFS_ReadDir(tVFS_Node *Node, int Pos); tVFS_Node *DevFS_FindDir(tVFS_Node *Node, const char *Name); @@ -98,11 +98,10 @@ void DevFS_DelDevice(tDevFS_Driver *Device) } /** - * \fn tVFS_Node *DevFS_InitDevice(char *Device, char **Options) * \brief Initialise the DevFS and detect double-mounting, or just do nothing * \note STUB */ -tVFS_Node *DevFS_InitDevice(char *Device, char **Options) +tVFS_Node *DevFS_InitDevice(const char *Device, const char **Options) { return &gDevFS_RootNode; } diff --git a/Kernel/vfs/fs/root.c b/Kernel/vfs/fs/root.c index d9660419..e9c9f09c 100644 --- a/Kernel/vfs/fs/root.c +++ b/Kernel/vfs/fs/root.c @@ -10,7 +10,7 @@ #define MAX_FILES 64 // === PROTOTYPES === -tVFS_Node *Root_InitDevice(char *Device, char **Options); +tVFS_Node *Root_InitDevice(const char *Device, const char **Options); int Root_MkNod(tVFS_Node *Node, const char *Name, Uint Flags); tVFS_Node *Root_FindDir(tVFS_Node *Node, const char *Name); char *Root_ReadDir(tVFS_Node *Node, int Pos); @@ -36,10 +36,9 @@ tVFS_ACL RootFS_FileACLs[3] = { // === CODE === /** - * \fn tVFS_Node *Root_InitDevice(char *Device, char **Options) * \brief Initialise the root filesystem */ -tVFS_Node *Root_InitDevice(char *Device, char **Options) +tVFS_Node *Root_InitDevice(const char *Device, const char **Options) { tRamFS_File *root; if(strcmp(Device, "root") != 0) { diff --git a/Kernel/vfs/handle.c b/Kernel/vfs/handle.c index 7d679be2..4a8d4786 100644 --- a/Kernel/vfs/handle.c +++ b/Kernel/vfs/handle.c @@ -67,7 +67,7 @@ int VFS_AllocHandle(int bIsUser, tVFS_Node *Node, int Mode) for(i=0;iNode->Write) return 0; - ret = h->Node->Write(h->Node, h->Position, Length, Buffer); + // TODO: This is a hack, I need to change VFS_Node to have "const void*" + ret = h->Node->Write(h->Node, h->Position, Length, (void*)Buffer); if(ret == -1) return -1; h->Position += ret; return ret; } /** - * \fn Uint64 VFS_WriteAt(int FD, Uint64 Offset, Uint64 Length, void *Buffer) + * \fn Uint64 VFS_WriteAt(int FD, Uint64 Offset, Uint64 Length, const void *Buffer) * \brief Write data to a file at a given offset */ -Uint64 VFS_WriteAt(int FD, Uint64 Offset, Uint64 Length, void *Buffer) +Uint64 VFS_WriteAt(int FD, Uint64 Offset, Uint64 Length, const void *Buffer) { tVFS_Handle *h; Uint64 ret; @@ -117,7 +118,8 @@ Uint64 VFS_WriteAt(int FD, Uint64 Offset, Uint64 Length, void *Buffer) if( h->Node->Flags & VFS_FFLAG_DIRECTORY ) return -1; if(!h->Node->Write) return 0; - ret = h->Node->Write(h->Node, Offset, Length, Buffer); + // TODO: This is a hack, I need to change VFS_Node to have "const void*" + ret = h->Node->Write(h->Node, Offset, Length, (void*)Buffer); if(ret == -1) return -1; return ret; } diff --git a/Kernel/vfs/main.c b/Kernel/vfs/main.c index ef1cd569..dc43fbf0 100644 --- a/Kernel/vfs/main.c +++ b/Kernel/vfs/main.c @@ -14,9 +14,9 @@ extern tVFS_Driver gDevFS_Info; // === PROTOTYPES === int VFS_Init(void); -char *VFS_GetTruePath(char *Path); +char *VFS_GetTruePath(const char *Path); void VFS_GetMemPath(char *Dest, void *Base, Uint Length); -tVFS_Driver *VFS_GetFSByName(char *Name); +tVFS_Driver *VFS_GetFSByName(const char *Name); int VFS_AddDriver(tVFS_Driver *Info); void VFS_UpdateDriverFile(void); @@ -62,10 +62,10 @@ int VFS_Init(void) } /** - * \fn char *VFS_GetTruePath(char *Path) + * \fn char *VFS_GetTruePath(const char *Path) * \brief Gets the true path (non-symlink) of a file */ -char *VFS_GetTruePath(char *Path) +char *VFS_GetTruePath(const char *Path) { tVFS_Node *node; char *ret, *tmp; @@ -97,10 +97,10 @@ void VFS_GetMemPath(char *Dest, void *Base, Uint Length) } /** - * \fn tVFS_Driver *VFS_GetFSByName(char *Name) + * \fn tVFS_Driver *VFS_GetFSByName(const char *Name) * \brief Gets a filesystem structure given a name */ -tVFS_Driver *VFS_GetFSByName(char *Name) +tVFS_Driver *VFS_GetFSByName(const char *Name) { tVFS_Driver *drv = gVFS_Drivers; diff --git a/Kernel/vfs/mount.c b/Kernel/vfs/mount.c index 0436043b..d0d7290c 100644 --- a/Kernel/vfs/mount.c +++ b/Kernel/vfs/mount.c @@ -11,7 +11,7 @@ extern int giVFS_MountFileID; extern char *gsVFS_MountFile; // === PROTOTYPES === - int VFS_Mount(char *Device, char *MountPoint, char *Filesystem, char *Options); + int VFS_Mount(const char *Device, const char *MountPoint, const char *Filesystem, const char *Options); void VFS_UpdateMountFile(void); // === GLOBALS === @@ -32,7 +32,7 @@ tVFS_Mount *gVFS_RootMount = NULL; * \a Filesystem. The options in the string \a Options is passed to the * driver's mount. */ -int VFS_Mount(char *Device, char *MountPoint, char *Filesystem, char *Options) +int VFS_Mount(const char *Device, const char *MountPoint, const char *Filesystem, const char *Options) { tVFS_Mount *mnt; tVFS_Driver *fs; diff --git a/Kernel/vfs/open.c b/Kernel/vfs/open.c index b0de7841..9aeca95b 100644 --- a/Kernel/vfs/open.c +++ b/Kernel/vfs/open.c @@ -442,10 +442,10 @@ tVFS_Node *VFS_ParsePath(const char *Path, char **TruePath) } /** - * \fn int VFS_Open(char *Path, Uint Mode) + * \fn int VFS_Open(const char *Path, Uint Mode) * \brief Open a file */ -int VFS_Open(char *Path, Uint Mode) +int VFS_Open(const char *Path, Uint Mode) { tVFS_Node *node; char *absPath; @@ -524,7 +524,7 @@ int VFS_Open(char *Path, Uint Mode) /** * \brief Open a file from an open directory */ -int VFS_OpenChild(Uint *Errno, int FD, char *Name, Uint Mode) +int VFS_OpenChild(Uint *Errno, int FD, const char *Name, Uint Mode) { tVFS_Handle *h; tVFS_Node *node; diff --git a/Modules/Filesystems/Ext2/ext2.c b/Modules/Filesystems/Ext2/ext2.c index 52793d01..ad96cc85 100644 --- a/Modules/Filesystems/Ext2/ext2.c +++ b/Modules/Filesystems/Ext2/ext2.c @@ -15,7 +15,7 @@ // === PROTOTYPES === int Ext2_Install(char **Arguments); // Interface Functions -tVFS_Node *Ext2_InitDevice(char *Device, char **Options); +tVFS_Node *Ext2_InitDevice(const char *Device, const char **Options); void Ext2_Unmount(tVFS_Node *Node); void Ext2_CloseFile(tVFS_Node *Node); // Internal Helpers @@ -44,13 +44,12 @@ int Ext2_Install(char **Arguments) } /** - \fn tVFS_Node *Ext2_InitDevice(char *Device, char **Options) \brief Initializes a device to be read by by the driver \param Device String - Device to read from \param Options NULL Terminated array of option strings \return Root Node */ -tVFS_Node *Ext2_InitDevice(char *Device, char **Options) +tVFS_Node *Ext2_InitDevice(const char *Device, const char **Options) { tExt2_Disk *disk; int fd; diff --git a/Modules/Filesystems/FAT/fat.c b/Modules/Filesystems/FAT/fat.c index 5502b5a0..936ca4a6 100644 --- a/Modules/Filesystems/FAT/fat.c +++ b/Modules/Filesystems/FAT/fat.c @@ -56,7 +56,7 @@ typedef struct sFAT_LFNCache // === PROTOTYPES === // --- Driver Core int FAT_Install(char **Arguments); -tVFS_Node *FAT_InitDevice(char *device, char **options); +tVFS_Node *FAT_InitDevice(const char *device, const char **options); void FAT_Unmount(tVFS_Node *Node); // --- Helpers int FAT_int_GetAddress(tVFS_Node *Node, Uint64 Offset, Uint64 *Addr, Uint32 *Cluster); @@ -102,10 +102,9 @@ int FAT_Install(char **Arguments) } /** - * \fn tVFS_Node *FAT_InitDevice(char *Device, char **Options) * \brief Reads the boot sector of a disk and prepares the structures for it */ -tVFS_Node *FAT_InitDevice(char *Device, char **Options) +tVFS_Node *FAT_InitDevice(const char *Device, const char **Options) { fat_bootsect *bs; int i; diff --git a/Modules/Filesystems/NTFS/main.c b/Modules/Filesystems/NTFS/main.c index ae70558c..f5f99c72 100644 --- a/Modules/Filesystems/NTFS/main.c +++ b/Modules/Filesystems/NTFS/main.c @@ -17,7 +17,7 @@ extern tVFS_Node *NTFS_FindDir(tVFS_Node *Node, const char *Name); // === PROTOTYPES === int NTFS_Install(char **Arguments); -tVFS_Node *NTFS_InitDevice(char *Devices, char **Options); +tVFS_Node *NTFS_InitDevice(const char *Devices, const char **Options); void NTFS_Unmount(tVFS_Node *Node); void NTFS_DumpEntry(tNTFS_Disk *Disk, Uint32 Entry); @@ -40,7 +40,7 @@ int NTFS_Install(char **Arguments) /** * \brief Mount a NTFS volume */ -tVFS_Node *NTFS_InitDevice(char *Device, char **Options) +tVFS_Node *NTFS_InitDevice(const char *Device, const char **Options) { tNTFS_Disk *disk; tNTFS_BootSector bs;