From: John Hodge Date: Fri, 14 Oct 2011 07:49:25 +0000 (+0800) Subject: Modules/InitRD - Added inode number lookup support X-Git-Tag: rel0.13~70 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=3545d4228478c0bd19b2426366b2f2af5a06ee07;p=tpg%2Facess2.git Modules/InitRD - Added inode number lookup support --- diff --git a/Modules/Filesystems/InitRD/GenerateInitRD.php b/Modules/Filesystems/InitRD/GenerateInitRD.php index a7152cc0..03b7d81a 100644 --- a/Modules/Filesystems/InitRD/GenerateInitRD.php +++ b/Modules/Filesystems/InitRD/GenerateInitRD.php @@ -65,12 +65,15 @@ function hd8($fp) return "0x".str_pad( dechex(ord(fgetc($fp))), 2, "0", STR_PAD_LEFT ); } +$inode = 0; function ProcessFolder($prefix, $items) { global $gOutput, $gDependencies; global $ACESSDIR, $ARCH; + global $inode; foreach($items as $i=>$item) { + $inode ++; if(is_array($item[1])) { ProcessFolder("{$prefix}_{$i}", $item[1]); @@ -90,6 +93,7 @@ tVFS_Node {$prefix}_{$i} = { .ACLs = &gVFS_ACL_EveryoneRX, .Flags = VFS_FFLAG_DIRECTORY, .Size = $size, + .Inode = {$inode}, .ImplPtr = {$prefix}_{$i}_entries, .ReadDir = InitRD_ReadDir, .FindDir = InitRD_FindDir @@ -142,6 +146,7 @@ tVFS_Node {$prefix}_{$i} = { .ACLs = &gVFS_ACL_EveryoneRX, .Flags = 0, .Size = $size, + .Inode = {$inode}, .ImplPtr = {$prefix}_{$i}_data, .Read = InitRD_ReadFile }; @@ -176,6 +181,34 @@ tVFS_Node gInitRD_RootNode = { }; EOF; +$gOutput .= <<$item) + { + $gOutput .= ",&{$prefix}_{$i}"; + if(is_array($item[1])) + { + PutNodePointers("{$prefix}_{$i}", $item[1]); + } + } +} + +PutNodePointers("gInitRD_Files", $lStack[0][1]); + +$gOutput .= <<= giInitRD_NumFiles ) return NULL; + return gInitRD_FileList[Inode]; +} + /** * \brief Read from a file */