Kernel - Slight reworks to timer code
[tpg/acess2.git] / Kernel / vfs / mount.c
index d0d7290..1773218 100644 (file)
@@ -11,13 +11,16 @@ extern int  giVFS_MountFileID;
 extern char    *gsVFS_MountFile;
 
 // === PROTOTYPES ===
+#if 0
  int   VFS_Mount(const char *Device, const char *MountPoint, const char *Filesystem, const char *Options);
+#endif
 void   VFS_UpdateMountFile(void);
 
 // === GLOBALS ===
 tMutex glVFS_MountList;
 tVFS_Mount     *gVFS_Mounts;
 tVFS_Mount     *gVFS_RootMount = NULL;
+Uint32 giVFS_NextMountIdent = 1;
 
 // === CODE ===
 /**
@@ -77,6 +80,14 @@ int VFS_Mount(const char *Device, const char *MountPoint, const char *Filesystem
                free(mnt);
                return -2;
        }
+
+       mnt->Identifier = giVFS_NextMountIdent++;
+       #if 0
+       // Ensure identifiers don't repeat
+       // - Only a problem if there have been 4 billion mounts
+       while( giVFS_NextMountIdent == 0 || VFS_GetMountByIdent(giVFS_NextMountIdent) )
+               giVFS_NextMountIdent ++;
+       #endif
        
        // Set root
        if(!gVFS_RootMount)     gVFS_RootMount = mnt;
@@ -103,6 +114,20 @@ int VFS_Mount(const char *Device, const char *MountPoint, const char *Filesystem
        return 0;
 }
 
+/**
+ * \brief Gets a mount point given the identifier
+ */
+tVFS_Mount *VFS_GetMountByIdent(Uint32 MountID)
+{
+       tVFS_Mount      *mnt;
+       for(mnt = gVFS_Mounts; mnt; mnt = mnt->Next)
+       {
+               if(mnt->Identifier == MountID)
+                       return mnt;
+       }
+       return NULL;
+}
+
 /**
  * \brief Updates the mount file buffer
  * 

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