Fixed the dirent.d_reclen calculation - define KEEP_WRONG_DIRENT_RECLEN to

enable the old and compatible behaviour (on BeOS R5, all available file
systems seem to do that wrong).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@826 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2002-08-19 13:31:04 +00:00
parent 599a8de01a
commit ba04be1db0
3 changed files with 35 additions and 9 deletions

View File

@ -1,7 +1,16 @@
SubDir OBOS_TOP src add-ons kernel file_systems bfs ;
# set some additional defines
{
local defines =
KEEP_WRONG_DIRENT_RECLEN
;
if $(DEBUG) {
local defines = [ FDefines DEBUG ] ;
defines += DEBUG ;
}
defines = [ FDefines $(defines) ] ;
SubDirCcFlags $(defines) ;
SubDirC++Flags $(defines) ;
}

View File

@ -1045,7 +1045,15 @@ Equation::GetNextMatching(Volume *volume, TreeIterator *iterator,
dirent->d_pdev = volume->ID();
dirent->d_pino = volume->ToVnode(inode->Parent());
strcpy(dirent->d_name,inode->Name());
#ifdef KEEP_WRONG_DIRENT_RECLEN
// ToDo: The available file systems in BeOS apparently don't set the
// correct d_reclen - we are copying that behaviour if requested, but
// if it doesn't break compatibility, we will remove it.
dirent->d_reclen = strlen(dirent->d_name);
#else
dirent->d_reclen = sizeof(struct dirent) + strlen(dirent->d_name);
#endif
}
put_vnode(volume->ID(), inode->ID());

View File

@ -1403,7 +1403,12 @@ bfs_read_dir(void *_ns, void *_node, void *_cookie, long *num,
dirent->d_dev = volume->ID();
dirent->d_ino = id;
#ifdef KEEP_WRONG_DIRENT_RECLEN
dirent->d_reclen = length;
#else
dirent->d_reclen = sizeof(struct dirent) + length;
#endif
*num = 1;
return B_OK;
@ -1526,7 +1531,11 @@ bfs_read_attrdir(void *_ns, void *node, void *_cookie, long *num, struct dirent
Volume *volume = (Volume *)_ns;
dirent->d_dev = volume->ID();
#ifdef KEEP_WRONG_DIRENT_RECLEN
dirent->d_reclen = length;
#else
dirent->d_reclen = sizeof(struct dirent) + length;
#endif
*num = 1;
return B_OK;