Added some very pedantic warning flags
[tpg/acess2.git] / Kernel / vfs / dir.c
index 52e9f80..43cc0b5 100644 (file)
@@ -3,7 +3,7 @@
  * - Directory Management Functions
  */
 #define DEBUG  0
-#include <common.h>
+#include <acess.h>
 #include <vfs.h>
 #include <vfs_int.h>
 
 extern tVFS_Mount      *gRootMount;
 
 // === PROTOTYPES ===
- int   VFS_MkDir(char *Path);
- int   VFS_MkNod(char *Path, Uint Flags);
+#if 0
+ int   VFS_MkDir(const char *Path);
+#endif
+ int   VFS_MkNod(const char *Path, Uint Flags);
 
 // === CODE ===
 /**
@@ -20,7 +22,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 +33,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;
@@ -61,7 +63,12 @@ int VFS_MkNod(char *Path, Uint Flags)
        else
                parent = VFS_ParsePath(absPath, NULL);
        
-       if(!parent)     return -1;      // Error Check
+       LOG("parent = %p", parent);
+       
+       if(!parent) {
+               LEAVE('i', -1);
+               return -1;      // Error Check
+       }
        
        // Permissions Check
        if( !VFS_CheckACL(parent, VFS_PERM_EXECUTE|VFS_PERM_WRITE) ) {
@@ -99,29 +106,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) {

UCC git Repository :: git.ucc.asn.au