/* Because the inode number is no longer relevant to finding the *underlyingmeta-dataforaninode,wearefreetochooseamore *convenient32-bitnumberastheinodenumber.Theinodenumbering
* scheme was recommended by Sergey Vlasov and Eric Lammerts. */ staticinlineunsignedlong isofs_get_ino(unsignedlong block, unsignedlong offset, unsignedlong bufbits)
{ return (block << (bufbits - 5)) | (offset >> 5);
}
/* Every directory can have many redundant directory entries scattered *throughoutthedirectorytree.Firstthereisthedirectoryentry *withthenameofthedirectorystoredintheparentdirectory. *Then,thereisthe"."directoryentrystoredinthedirectory *itself.Finally,therearepossiblymany".."directoryentries *storedinallthesubdirectories. * *InorderfortheNFSget_parent()methodtoworkandforthe *generalconsistencyofthedcache,weneedtomakesurethe *"i_iget5_block"and"i_iget5_offset"allpointtoexactlyoneof *themanyredundantentriesforeachdirectory.Wenormalizethe *blockandoffsetbyalwaysmakingthempointtothe"."directory. * *Noticethatwedonotusetheentryforthedirectorywiththename *thatislocatedintheparentdirectory.Eventhoughchoosingthis *firstdirectoryismorenatural,itismucheasiertofindthe"." *entryintheNFSget_parent()methodbecauseitisimplicitly *encodedinthe"extent+ext_attr_length"fieldsof_all_the *redundantentriesforthedirectory.Thus,itcanalwaysbe *reachedregardlessofwhichdirectoryentryyouhaveinhand. * *Thisworksbecausethe"."entryissimplythefirstdirectory *recordwhenyoustartreadingthefilethatholdsallthedirectory *records,andthisfilestartsat"extent+ext_attr_length"blocks. *Becausethe"."entryisalwaysthefirstentrylistedinthe *directoriesfile,thenormalized"offset"valueisalways0. * *Youshouldpassthedirectoryentryin"de".Onreturn,"block" *and"offset"willholdnormalizedvalues.Onlydirectoriesare *affectedmakingitsafetocallevenfornon-directoryfile
* types. */ staticinlinevoid
isofs_normalize_block_and_offset(struct iso_directory_record* de, unsignedlong *block, unsignedlong *offset)
{ /* Only directories are normalized. */ if (de->flags[0] & 2) {
*offset = 0;
*block = (unsignedlong)isonum_733(de->extent)
+ (unsignedlong)isonum_711(de->ext_attr_length);
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.