3 * - By John Hodge (thePowersGang)
6 * - High level actions that call the VFS
7 * # Kernel-space compiled
10 #include <disktool_common.h>
14 extern int NativeFS_Install(char **Arguments);
17 void DiskTool_Initialise(void) __attribute__((constructor(101)));
18 size_t DiskTool_int_TranslatePath(char *Buffer, const char *Path);
19 int DiskTool_int_TranslateOpen(const char *File, int Mode);
22 void DiskTool_Initialise(void)
25 NativeFS_Install(NULL);
27 VFS_Mount("/", "/Native", "nativefs", "");
30 int DiskTool_MountImage(const char *Identifier, const char *Path)
32 // Validate Identifier and make mountpoint string
33 char mountpoint[sizeof("/Mount/") + strlen(Identifier) + 1];
34 strcpy(mountpoint, "/Mount/");
35 strcat(mountpoint, Identifier);
38 size_t tpath_len = DiskTool_int_TranslatePath(NULL, Path);
41 char tpath[tpath_len-1];
42 DiskTool_int_TranslatePath(tpath, Path);
45 // TODO: Detect filesystem?
46 return VFS_Mount(tpath, mountpoint, "fat", "");
49 int DiskTool_Copy(const char *Source, const char *Destination)
54 // --- Internal helpers ---
55 size_t DiskTool_int_TranslatePath(char *Buffer, const char *Path)
57 const char *colon = strchr(Path, ':');
61 for(pos = Path; pos < colon; pos ++)
71 int len = strlen("/Native");
72 len += strlen( getenv("PWD") ) + 1;
75 strcpy(Buffer, "/Native");
76 strcat(Buffer, getenv("PWD"));
84 int DiskTool_int_TranslateOpen(const char *File, int Mode)
86 // Determine if the source is a mounted image or a file on the source FS