From: John Hodge Date: Sat, 14 Jul 2012 12:28:44 +0000 (+0800) Subject: Merge branch 'master' of ted.mutabah.net:acess2 X-Git-Tag: rel0.15~611^2~25^2~6 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=3a8670fa06b6be062caead81737848fcb01b0c60;hp=bcca3ff7d0debfcc084acb4bbfaed89e20d3610d;p=tpg%2Facess2.git Merge branch 'master' of ted.mutabah.net:acess2 --- diff --git a/AcessNative/acesskernel_src/nativefs.c b/AcessNative/acesskernel_src/nativefs.c index e51f2862..7c20b69e 100644 --- a/AcessNative/acesskernel_src/nativefs.c +++ b/AcessNative/acesskernel_src/nativefs.c @@ -48,9 +48,9 @@ tVFS_NodeType gNativeFS_DirNodeType = { .Close = NativeFS_Close }; tVFS_Driver gNativeFS_Driver = { - "nativefs", 0, - NativeFS_Mount, NativeFS_Unmount, - NULL, + .Name = "nativefs", + .InitDevice = NativeFS_Mount, + .Unmount = NativeFS_Unmount }; // === CODE === diff --git a/KernelLand/Kernel/drvutil_disk.c b/KernelLand/Kernel/drvutil_disk.c index db4d631a..49dc7b23 100644 --- a/KernelLand/Kernel/drvutil_disk.c +++ b/KernelLand/Kernel/drvutil_disk.c @@ -49,6 +49,7 @@ Uint64 DrvUtil_ReadBlock(Uint64 Start, Uint64 Length, void *Buffer, else { num = Length / BlockSize; tailings = Length % BlockSize; + leading = 0; } // Read central blocks @@ -57,6 +58,7 @@ Uint64 DrvUtil_ReadBlock(Uint64 Start, Uint64 Length, void *Buffer, LOG("Reading %i blocks", num); ret = ReadBlocks(block, num, Buffer, Argument); if(ret != num ) { + LOG("Incomplete read (%i != %i)", ret, num); LEAVE('X', leading + ret * BlockSize); return leading + ret * BlockSize; } diff --git a/KernelLand/Kernel/include/vfs.h b/KernelLand/Kernel/include/vfs.h index 91dcd693..9cb9e5de 100644 --- a/KernelLand/Kernel/include/vfs.h +++ b/KernelLand/Kernel/include/vfs.h @@ -339,6 +339,15 @@ typedef struct sVFS_Driver */ Uint Flags; + /** + * \brief Detect if a volume is accessible using this driver + * \return Boolean success (with higher numbers being higher priority) + * + * E.g. FAT would return 1 as it's the lowest common denominator while ext2 might return 2, + * because it can be embedded in a FAT volume (and is a more fully featured filesystem). + */ + int (*Detect)(int FD); + /** * \brief Callback to mount a device */ diff --git a/KernelLand/Kernel/include/vfs_int.h b/KernelLand/Kernel/include/vfs_int.h index f48e277b..1f67f4b9 100644 --- a/KernelLand/Kernel/include/vfs_int.h +++ b/KernelLand/Kernel/include/vfs_int.h @@ -48,6 +48,7 @@ typedef struct sVFS_MMapPage { // === GLOBALS === extern tRWLock glVFS_MountList; extern tVFS_Mount *gVFS_Mounts; +extern tVFS_Driver *gVFS_Drivers; // === PROTOTYPES === // --- open.c --- diff --git a/KernelLand/Kernel/vfs/fs/devfs.c b/KernelLand/Kernel/vfs/fs/devfs.c index 354f4020..9ab2b7b4 100644 --- a/KernelLand/Kernel/vfs/fs/devfs.c +++ b/KernelLand/Kernel/vfs/fs/devfs.c @@ -20,7 +20,9 @@ tVFS_Node *DevFS_FindDir(tVFS_Node *Node, const char *Name); // === GLOBALS === tVFS_Driver gDevFS_Info = { - "devfs", 0, DevFS_InitDevice, DevFS_Unmount, NULL + .Name = "devfs", + .InitDevice = DevFS_InitDevice, + .Unmount = DevFS_Unmount }; tVFS_NodeType gDevFS_DirType = { .TypeName = "DevFS-Dir", diff --git a/KernelLand/Kernel/vfs/fs/root.c b/KernelLand/Kernel/vfs/fs/root.c index 5da13fa6..abe59457 100644 --- a/KernelLand/Kernel/vfs/fs/root.c +++ b/KernelLand/Kernel/vfs/fs/root.c @@ -22,7 +22,8 @@ tRamFS_File *Root_int_AllocFile(void); // === GLOBALS === tVFS_Driver gRootFS_Info = { - "rootfs", 0, Root_InitDevice, NULL, NULL + .Name = "rootfs", + .InitDevice = Root_InitDevice }; tRamFS_File RootFS_Files[MAX_FILES]; tVFS_ACL RootFS_DirACLs[3] = { diff --git a/KernelLand/Kernel/vfs/mount.c b/KernelLand/Kernel/vfs/mount.c index c49e6d95..5ac67a58 100644 --- a/KernelLand/Kernel/vfs/mount.c +++ b/KernelLand/Kernel/vfs/mount.c @@ -1,7 +1,7 @@ /* * Acess Micro - VFS Server version 1 */ -#define DEBUG 1 +#define DEBUG 0 #include #include #include @@ -15,6 +15,7 @@ extern char *gsVFS_MountFile; #if 0 int VFS_Mount(const char *Device, const char *MountPoint, const char *Filesystem, const char *Options); #endif +void VFS_int_Unmount(tVFS_Mount *Mount); void VFS_UpdateMountFile(void); // === GLOBALS === @@ -45,18 +46,43 @@ int VFS_Mount(const char *Device, const char *MountPoint, const char *Filesystem int argLen = strlen(Options); // Get the filesystem - fs = VFS_GetFSByName(Filesystem); - if(!fs) { - Log_Warning("VFS", "VFS_Mount - Unknown FS Type '%s'", Filesystem); - return -1; + if( Filesystem && Filesystem[0] ) + { + fs = VFS_GetFSByName(Filesystem); + if(!fs) { + Log_Warning("VFS", "VFS_Mount - Unknown FS Type '%s'", Filesystem); + return -ENOENT; + } } - - // Create mount information - mnt = malloc( sizeof(tVFS_Mount)+deviceLen+1+mountLen+1+argLen+1 ); - if(!mnt) { - return -2; + else + { + int fd = VFS_Open(Device, VFS_OPENFLAG_READ); + if( fd == -1 ) { + Log_Warning("VFS", "VFS_Mount - Unable to open '%s' for autodetect", Device); + return -ENOENT; + } + + tVFS_Driver *bestfs = NULL; + int bestrank, rank; + for( fs = gVFS_Drivers; fs; fs = fs->Next ) + { + if(!fs->Detect) continue ; + rank = fs->Detect(fd); + if(!rank) continue ; + if(!bestfs || rank > bestrank) { + bestfs = fs; + bestrank = rank; + } + } + VFS_Close(fd); + if( bestfs == NULL ) { + Log_Warning("VFS", "VFS_Mount - Filesystem autodetection failed"); + return -1; + } + + fs = bestfs; } - + // Validate the mountpoint target // - Only if / is mounted if( gVFS_Mounts ) @@ -75,6 +101,13 @@ int VFS_Mount(const char *Device, const char *MountPoint, const char *Filesystem } } + // Create mount information + mnt = malloc( sizeof(tVFS_Mount)+deviceLen+1+mountLen+1+argLen+1 ); + if(!mnt) { + parent_mnt->OpenHandleCount --; + return -2; + } + // HACK: Forces VFS_ParsePath to fall back on root if(mountLen == 1 && MountPoint[0] == '/') mnt->MountPointLen = 0; @@ -149,13 +182,41 @@ int VFS_Mount(const char *Device, const char *MountPoint, const char *Filesystem } RWLock_Release( &glVFS_MountList ); - Log_Log("VFS", "Mounted '%s' to '%s' ('%s')", Device, MountPoint, Filesystem); + Log_Log("VFS", "Mounted '%s' to '%s' ('%s')", Device, MountPoint, fs->Name); VFS_UpdateMountFile(); return 0; } +void VFS_int_Unmount(tVFS_Mount *Mount) +{ + // Decrease the open handle count for the mountpoint filesystem. + if( Mount != gVFS_RootMount ) + { + tVFS_Mount *mpmnt; + for( mpmnt = gVFS_Mounts; mpmnt; mpmnt = mpmnt->Next ) + { + if( strncmp(mpmnt->MountPoint, Mount->MountPoint, mpmnt->MountPointLen) != 0 ) + continue ; + if( Mount->MountPoint[ mpmnt->MountPointLen ] != '/' ) + continue ; + break; + } + if(mpmnt) { + mpmnt->OpenHandleCount -= 1; + } + else { + Log_Notice("VFS", "Mountpoint '%s' has no parent", Mount->MountPoint); + } + } + + if( Mount->Filesystem->Unmount ) + Mount->Filesystem->Unmount( Mount->RootNode ); + LOG("%p (%s) unmounted", Mount, Mount->MountPoint); + free(Mount); +} + int VFS_Unmount(const char *Mountpoint) { tVFS_Mount *mount, *prev = NULL; @@ -180,20 +241,11 @@ int VFS_Unmount(const char *Mountpoint) LOG("Mountpoint not found"); return ENOENT; } - - Log_Warning("VFS", "TODO: Impliment unmount"); - - // Decrease the open handle count for the mountpoint filesystem. - tVFS_Mount *mpmnt; - tVFS_Node *mpnode = VFS_ParsePath(mount->MountPoint, NULL, &mpmnt); - if(mpnode) - { - mpmnt->OpenHandleCount -= 2; // -1 for _ParsePath here, -1 for in _Mount - } - mount->Filesystem->Unmount( mount->RootNode ); - free(mount); + VFS_int_Unmount(mount); + VFS_UpdateMountFile(); + return EOK; } @@ -224,19 +276,14 @@ int VFS_UnmountAll(void) else gVFS_Mounts = mount->Next; - if( mount->Filesystem->Unmount ) { - mount->Filesystem->Unmount( mount->RootNode ); - } - else { - Log_Error("VFS", "%s (%s) does not have an unmount method, not calling it", - mount->MountPoint, mount->Filesystem->Name); - } - free(mount); + VFS_int_Unmount(mount); mount = prev; nUnmounted ++; } RWLock_Release( &glVFS_MountList ); + VFS_UpdateMountFile(); + return nUnmounted; } diff --git a/KernelLand/Kernel/vfs/nodecache.c b/KernelLand/Kernel/vfs/nodecache.c index ffad2437..0d238941 100644 --- a/KernelLand/Kernel/vfs/nodecache.c +++ b/KernelLand/Kernel/vfs/nodecache.c @@ -142,7 +142,7 @@ int Inode_UncacheNode(int Handle, Uint64 Inode) // Search Cache ent = cache->FirstNode; - prev = (tCachedInode*) &cache->FirstNode; // Special case removal + prev = NULL; for( ; ent; prev = ent, ent = ent->Next ) { if(ent->Node.Inode < Inode) continue; @@ -164,10 +164,13 @@ int Inode_UncacheNode(int Handle, Uint64 Inode) // Check if node needs to be freed if(ent->Node.ReferenceCount == 0) { - prev->Next = ent->Next; + if( prev ) + prev->Next = ent->Next; + else + cache->FirstNode = ent->Next; if(ent->Node.Inode == cache->MaxCached) { - if(ent != cache->FirstNode) + if(ent != cache->FirstNode && prev) cache->MaxCached = prev->Node.Inode; else cache->MaxCached = 0; diff --git a/KernelLand/Kernel/vfs/open.c b/KernelLand/Kernel/vfs/open.c index e7d6e1e8..12a8f8d1 100644 --- a/KernelLand/Kernel/vfs/open.c +++ b/KernelLand/Kernel/vfs/open.c @@ -201,6 +201,7 @@ restart_parse: *TruePath = malloc( gVFS_RootMount->MountPointLen+1 ); strcpy(*TruePath, gVFS_RootMount->MountPoint); } + gVFS_RootMount->OpenHandleCount ++; if(MountPoint) *MountPoint = gVFS_RootMount; LEAVE('p', gVFS_RootMount->RootNode); return gVFS_RootMount->RootNode; diff --git a/KernelLand/Modules/Filesystems/Ext2/ext2.c b/KernelLand/Modules/Filesystems/Ext2/ext2.c index f40689e0..971ef28e 100644 --- a/KernelLand/Modules/Filesystems/Ext2/ext2.c +++ b/KernelLand/Modules/Filesystems/Ext2/ext2.c @@ -17,6 +17,7 @@ extern tVFS_NodeType gExt2_DirType; int Ext2_Install(char **Arguments); int Ext2_Cleanup(void); // - Interface Functions + int Ext2_Detect(int FD); tVFS_Node *Ext2_InitDevice(const char *Device, const char **Options); void Ext2_Unmount(tVFS_Node *Node); void Ext2_CloseFile(tVFS_Node *Node); @@ -31,7 +32,11 @@ MODULE_DEFINE(0, VERSION, FS_Ext2, Ext2_Install, Ext2_Cleanup); tExt2_Disk gExt2_disks[6]; int giExt2_count = 0; tVFS_Driver gExt2_FSInfo = { - "ext2", 0, Ext2_InitDevice, Ext2_Unmount, NULL + .Name = "ext2", + .Detect = Ext2_Detect, + .InitDevice = Ext2_InitDevice, + .Unmount = Ext2_Unmount, + .GetNodeFromINode = NULL }; // === CODE === @@ -53,6 +58,31 @@ int Ext2_Cleanup(void) return 0; } +/** + * Detect if a volume is Ext2 formatted + */ +int Ext2_Detect(int FD) +{ + tExt2_SuperBlock sb; + size_t len; + + len = VFS_ReadAt(FD, 1024, 1024, &sb); + + if( len != 1024 ) { + Log_Debug("Ext2", "_Detect: Read failed? (0x%x != 1024)", len); + return 0; + } + + switch(sb.s_magic) + { + case 0xEF53: + return 2; + default: + Log_Debug("Ext2", "_Detect: s_magic = 0x%x", sb.s_magic); + return 0; + } +} + /** \brief Initializes a device to be read by by the driver \param Device String - Device to read from diff --git a/KernelLand/Modules/Filesystems/FAT/fat.c b/KernelLand/Modules/Filesystems/FAT/fat.c index ab91fcb3..f7ebafe5 100644 --- a/KernelLand/Modules/Filesystems/FAT/fat.c +++ b/KernelLand/Modules/Filesystems/FAT/fat.c @@ -27,6 +27,7 @@ // === PROTOTYPES === // --- Driver Core int FAT_Install(char **Arguments); + int FAT_Detect(int FD); tVFS_Node *FAT_InitDevice(const char *device, const char **options); void FAT_Unmount(tVFS_Node *Node); // --- Helpers @@ -46,7 +47,13 @@ void FAT_CloseFile(tVFS_Node *node); MODULE_DEFINE(0, VER2(0,80) /*v0.80*/, VFAT, FAT_Install, NULL, NULL); tFAT_VolInfo gFAT_Disks[8]; int giFAT_PartCount = 0; -tVFS_Driver gFAT_FSInfo = {"fat", 0, FAT_InitDevice, FAT_Unmount, FAT_GetNodeFromINode, NULL}; +tVFS_Driver gFAT_FSInfo = { + .Name = "fat", + .Detect = FAT_Detect, + .InitDevice = FAT_InitDevice, + .Unmount = FAT_Unmount, + .GetNodeFromINode = FAT_GetNodeFromINode +}; tVFS_NodeType gFAT_DirType = { .TypeName = "FAT-Dir", .ReadDir = FAT_ReadDir, @@ -78,6 +85,22 @@ int FAT_Install(char **Arguments) return MODULE_ERR_OK; } +/** + * \brief Detect if a file is a FAT device + */ +int FAT_Detect(int FD) +{ + fat_bootsect bs; + + if( VFS_ReadAt(FD, 0, 512, &bs) != 512) { + return 0; + } + + if(bs.bps == 0 || bs.spc == 0) + return 0; + + return 1; +} /** * \brief Reads the boot sector of a disk and prepares the structures for it */ diff --git a/KernelLand/Modules/Filesystems/NTFS/main.c b/KernelLand/Modules/Filesystems/NTFS/main.c index dbda06e1..87f2a09a 100644 --- a/KernelLand/Modules/Filesystems/NTFS/main.c +++ b/KernelLand/Modules/Filesystems/NTFS/main.c @@ -23,7 +23,12 @@ void NTFS_DumpEntry(tNTFS_Disk *Disk, Uint32 Entry); // === GLOBALS === MODULE_DEFINE(0, 0x0A /*v0.1*/, FS_NTFS, NTFS_Install, NULL); -tVFS_Driver gNTFS_FSInfo = {"ntfs", 0, NTFS_InitDevice, NTFS_Unmount, NULL}; +tVFS_Driver gNTFS_FSInfo = { + .Name = "ntfs", + .InitDevice = NTFS_InitDevice, + .Unmount = NTFS_Unmount, + .GetNodeFromINode = NULL +}; tVFS_NodeType gNTFS_DirType = { .TypeName = "NTFS-File", .ReadDir = NTFS_ReadDir, diff --git a/KernelLand/Modules/Storage/LVM/main.c b/KernelLand/Modules/Storage/LVM/main.c index b3b9c6ca..d4e9aa40 100644 --- a/KernelLand/Modules/Storage/LVM/main.c +++ b/KernelLand/Modules/Storage/LVM/main.c @@ -5,7 +5,7 @@ * lvm.h * - LVM Core definitions */ -#define DEBUG 1 +#define DEBUG 0 #define VERSION VER2(0,1) #include "lvm_int.h" #include @@ -25,6 +25,7 @@ size_t LVM_Vol_Read(tVFS_Node *Node, off_t Offset, size_t Length, void *Buffer); size_t LVM_Vol_Write(tVFS_Node *Node, off_t Offset, size_t Length, const void *Buffer); size_t LVM_SubVol_Read(tVFS_Node *Node, off_t Offset, size_t Length, void *Buffer); size_t LVM_SubVol_Write(tVFS_Node *Node, off_t Offset, size_t Length, const void *Buffer); +void LVM_CloseNode(tVFS_Node *Node); Uint LVM_int_DrvUtil_ReadBlock(Uint64 Address, Uint Count, void *Buffer, void *Argument); Uint LVM_int_DrvUtil_WriteBlock(Uint64 Address, Uint Count, const void *Buffer, void *Argument); @@ -39,11 +40,13 @@ tVFS_NodeType gLVM_VolNodeType = { .ReadDir = LVM_Vol_ReadDir, .FindDir = LVM_Vol_FindDir, .Read = LVM_Vol_Read, - .Write = LVM_Vol_Write + .Write = LVM_Vol_Write, + .Close = LVM_CloseNode }; tVFS_NodeType gLVM_SubVolNodeType = { .Read = LVM_SubVol_Read, - .Write = LVM_SubVol_Write + .Write = LVM_SubVol_Write, + .Close = LVM_CloseNode }; tDevFS_Driver gLVM_DevFS = { NULL, "LVM", @@ -84,9 +87,13 @@ int LVM_Cleanup(void) if(sv->Node.ReferenceCount == 0) { nFree ++; vol->SubVolumes[i] = NULL; + Mutex_Release(&sv->Node.Lock); } - Mutex_Release(&sv->Node.Lock); - + else { + Mutex_Release(&sv->Node.Lock); + continue ; + } + Mutex_Acquire(&sv->Node.Lock); LOG("Removed subvolume %s:%s", vol->Name, sv->Name); free(sv); @@ -137,6 +144,7 @@ tVFS_Node *LVM_Root_FindDir(tVFS_Node *Node, const char *Name) { if( strcmp(vol->Name, Name) == 0 ) { + vol->DirNode.ReferenceCount ++; return &vol->DirNode; } } @@ -166,6 +174,7 @@ tVFS_Node *LVM_Vol_FindDir(tVFS_Node *Node, const char *Name) { if( strcmp(vol->SubVolumes[i]->Name, Name) == 0 ) { + vol->SubVolumes[i]->Node.ReferenceCount ++; return &vol->SubVolumes[i]->Node; } } @@ -241,6 +250,11 @@ size_t LVM_SubVol_Write(tVFS_Node *Node, off_t Offset, size_t Length, const void ); } +void LVM_CloseNode(tVFS_Node *Node) +{ + Node->ReferenceCount --; +} + Uint LVM_int_DrvUtil_ReadBlock(Uint64 Address, Uint Count, void *Buffer, void *Argument) { return LVM_int_ReadVolume( Argument, Address, Count, Buffer ); diff --git a/Tools/DiskTool/src/Makefile b/Tools/DiskTool/src/Makefile index b2325672..a1282ac1 100644 --- a/Tools/DiskTool/src/Makefile +++ b/Tools/DiskTool/src/Makefile @@ -19,7 +19,7 @@ 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 += drvutil_disk.o drv/proc.o # Modules -MODULES := Storage/LVM Filesystems/FAT Filesystems/Ext2 +MODULES := Storage/LVM Filesystems/FAT Filesystems/Ext2 Filesystems/NTFS # 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) diff --git a/Tools/DiskTool/src/actions.c b/Tools/DiskTool/src/actions.c index 377608de..d1fb7034 100644 --- a/Tools/DiskTool/src/actions.c +++ b/Tools/DiskTool/src/actions.c @@ -65,10 +65,13 @@ void DiskTool_Cleanup(void) int DiskTool_RegisterLVM(const char *Identifier, const char *Path) { int fd = DiskTool_int_TranslateOpen(Path, VFS_OPENFLAG_READ|VFS_OPENFLAG_WRITE); - if(fd == -1) + if(fd == -1) { + Log_Notice("DiskTool", "Can't open '%s' for LVM %s", Path, Identifier); return -1; + } VFS_Seek(fd, 0, SEEK_END); LVM_AddVolume( &gDiskTool_VolumeType, Identifier, (void*)(tVAddr)fd, 512, VFS_Tell(fd)/512); + Log_Debug("DiskTool", "Registered '%s' for LVM %s", Path, Identifier); return 0; } @@ -89,7 +92,7 @@ int DiskTool_MountImage(const char *Identifier, const char *Path) // Call mount VFS_MkDir(mountpoint); // TODO: Detect filesystem? - return VFS_Mount(tpath, mountpoint, "fat", ""); + return VFS_Mount(tpath, mountpoint, "", ""); } int DiskTool_Copy(const char *Source, const char *Destination) @@ -145,13 +148,11 @@ int DiskTool_ListDirectory(const char *Directory) int DiskTool_LVM_Read(void *Handle, Uint64 Block, size_t BlockCount, void *Dest) { - VFS_ReadAt( (int)(tVAddr)Handle, Block*512, BlockCount*512, Dest); - return 0; + return VFS_ReadAt( (int)(tVAddr)Handle, Block*512, BlockCount*512, Dest) / 512; } int DiskTool_LVM_Write(void *Handle, Uint64 Block, size_t BlockCount, const void *Dest) { - VFS_WriteAt( (int)(tVAddr)Handle, Block*512, BlockCount*512, Dest); - return 0; + return VFS_WriteAt( (int)(tVAddr)Handle, Block*512, BlockCount*512, Dest) / 512; } void DiskTool_LVM_Cleanup(void *Handle) { diff --git a/Tools/DiskTool/src/logging.c b/Tools/DiskTool/src/logging.c index fde90552..2b03c6ff 100644 --- a/Tools/DiskTool/src/logging.c +++ b/Tools/DiskTool/src/logging.c @@ -7,6 +7,7 @@ #include #include #include +#include #define LOGHDR(col,type) fprintf(stderr, "\e["col"m[%-8.8s]"type" ", Ident) #define LOGTAIL() fprintf(stderr, "\e[0m\n") @@ -22,7 +23,7 @@ // === CODE === void Log_KernelPanic(const char *Ident, const char *Message, ...) { PUTERR("35", "k") - exit(-1); + abort(); } void Log_Panic(const char *Ident, const char *Message, ...) PUTERR("34", "p") @@ -116,6 +117,9 @@ void Debug_TraceEnter(const char *Function, const char *Format, ...) case 'x': fprintf(stderr, "0x%x", va_arg(args,unsigned int)); break; + case 'X': + fprintf(stderr, "0x%"PRIx64, va_arg(args,uint64_t)); + break; default: va_arg(args,uintptr_t); fprintf(stderr, "?"); @@ -177,6 +181,9 @@ void Debug_TraceLeave(const char *Function, char Type, ...) case 'x': fprintf(stderr, " 0x%x", va_arg(args, unsigned int)); break; + case 'X': + fprintf(stderr, " 0x%"PRIx64, va_arg(args,uint64_t)); + break; case 's': fprintf(stderr, " \"%s\"", va_arg(args, const char *)); break; diff --git a/Tools/DiskTool/src/main.c b/Tools/DiskTool/src/main.c index 823bb2b1..c3c4166d 100644 --- a/Tools/DiskTool/src/main.c +++ b/Tools/DiskTool/src/main.c @@ -68,6 +68,8 @@ int main(int argc, char *argv[]) i += 2; continue ; } + + fprintf(stderr, "Unknown command '%s'\n", argv[i]); } DiskTool_Cleanup();