K_OBJ += vfs/main.o vfs/open.o vfs/acls.o vfs/io.o vfs/dir.o
K_OBJ += vfs/nodecache.o vfs/mount.o vfs/memfile.o # vfs/select.o
K_OBJ += vfs/fs/root.o vfs/fs/devfs.o
-K_OBJ += drv/proc.o
+K_OBJ += drvutil_disk.o drv/proc.o
# Modules
-MODULES := Filesystems/FAT Filesystems/Ext2
+MODULES := Storage/LVM Filesystems/FAT Filesystems/Ext2
# Local kernel soruces (same as above, but located in same directory as Makefile)
L_OBJ = vfs_handles.o threads.o nativefs.o time.o actions.o
# Native Sources (compiled as usual)
# Compilation Options
CFLAGS := -Wall -std=gnu99 -g -Werror
CPPFLAGS := -I include/
-K_CPPFLAGS := -I $(KERNEL_SRC)include
+K_CPPFLAGS := -I $(KERNEL_SRC)include -I $(MODULE_SRC)
LDFLAGS += -Wl,--defsym,__buildnum=$(BUILD_NUM) -g
BUILDINFO_OBJ := obj/$(TARGET)/buildinfo.o
*/
#include <acess.h>
#include <disktool_common.h>
+#include <Storage/LVM/include/lvm.h>
// === IMPORTS ===
extern int NativeFS_Install(char **Arguments);
// === PROTOTYPES ===
void DiskTool_Initialise(void) __attribute__((constructor(101)));
int DiskTool_int_TranslateOpen(const char *File, int Mode);
+ int DiskTook_LVM_Read(void *Handle, Uint64 Block, size_t BlockCount, void *Dest);
+ int DiskTook_LVM_Write(void *Handle, Uint64 Block, size_t BlockCount, const void *Dest);
+
+// === GLOBALS ===
+tLVM_VolType gDiskTool_VolumeType = {
+ .Name = "DiskTool",
+ .Read = DiskTook_LVM_Read,
+ .Write = DiskTook_LVM_Write
+};
// === CODE ===
void DiskTool_Initialise(void)
VFS_Mount("/", "/Native", "nativefs", "");
}
+int DiskTool_RegisterLVM(const char *Identifier, const char *Path)
+{
+ int fd = DiskTool_int_TranslateOpen(Path, VFS_OPENFLAG_READ|VFS_OPENFLAG_WRITE);
+ if(fd == -1)
+ return -1;
+ VFS_Seek(fd, 0, SEEK_END);
+ LVM_AddVolume( &gDiskTool_VolumeType, Identifier, (void*)(tVAddr)fd, 512, VFS_Tell(fd)/512);
+ return 0;
+}
+
int DiskTool_MountImage(const char *Identifier, const char *Path)
{
// Validate Identifier and make mountpoint string
return 0;
}
+int DiskTook_LVM_Read(void *Handle, Uint64 Block, size_t BlockCount, void *Dest)
+{
+ VFS_ReadAt( (int)(tVAddr)Handle, Block*512, BlockCount*512, Dest);
+ return 0;
+}
+int DiskTook_LVM_Write(void *Handle, Uint64 Block, size_t BlockCount, const void *Dest)
+{
+ VFS_WriteAt( (int)(tVAddr)Handle, Block*512, BlockCount*512, Dest);
+ return 0;
+}
+
// --- Internal helpers ---
int DiskTool_int_TranslateOpen(const char *File, int Flags)
{
continue ;
}
+ if( strcmp("mountlvm", argv[i]) == 0 ) {
+
+ if( argc - i < 3 ) {
+ fprintf(stderr, "mountlvm takes 2 arguments (ident and path)\n");
+ exit(-1);
+ }
+
+ if( DiskTool_RegisterLVM(argv[i+1], argv[i+2]) ) {
+ fprintf(stderr, "Unable to register '%s' as LVM '%s'\n", argv[i+2], argv[i+1]);
+ exit(-1);
+ }
+
+ i += 2;
+ continue ;
+ }
+
if( strcmp("ls", argv[i]) == 0 ) {
if( argc - i < 2 ) {
fprintf(stderr, "ls 1 argument (path)\n");
continue ;
}
}
+
+ // Unmount all
+ // Clear LVM
+
return 0;
}