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:
@@ -1,7 +1,16 @@
|
|||||||
SubDir OBOS_TOP src add-ons kernel file_systems bfs ;
|
SubDir OBOS_TOP src add-ons kernel file_systems bfs ;
|
||||||
|
|
||||||
if $(DEBUG) {
|
# set some additional defines
|
||||||
local defines = [ FDefines DEBUG ] ;
|
{
|
||||||
|
local defines =
|
||||||
|
KEEP_WRONG_DIRENT_RECLEN
|
||||||
|
;
|
||||||
|
|
||||||
|
if $(DEBUG) {
|
||||||
|
defines += DEBUG ;
|
||||||
|
}
|
||||||
|
|
||||||
|
defines = [ FDefines $(defines) ] ;
|
||||||
SubDirCcFlags $(defines) ;
|
SubDirCcFlags $(defines) ;
|
||||||
SubDirC++Flags $(defines) ;
|
SubDirC++Flags $(defines) ;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -779,7 +779,7 @@ Equation::Match(Inode *inode,const char *attributeName,int32 type,const uint8 *k
|
|||||||
// get a pointer to the attribute in question
|
// get a pointer to the attribute in question
|
||||||
union value value;
|
union value value;
|
||||||
uint8 *buffer;
|
uint8 *buffer;
|
||||||
|
|
||||||
// first, check if we are matching for a live query and use that value
|
// first, check if we are matching for a live query and use that value
|
||||||
if (attributeName != NULL && !strcmp(fAttribute,attributeName)) {
|
if (attributeName != NULL && !strcmp(fAttribute,attributeName)) {
|
||||||
if (key == NULL) {
|
if (key == NULL) {
|
||||||
@@ -807,7 +807,7 @@ Equation::Match(Inode *inode,const char *attributeName,int32 type,const uint8 *k
|
|||||||
// then for attributes in the small_data section, and finally for the
|
// then for attributes in the small_data section, and finally for the
|
||||||
// real attributes
|
// real attributes
|
||||||
Inode *attribute;
|
Inode *attribute;
|
||||||
|
|
||||||
inode->SmallDataLock().Lock();
|
inode->SmallDataLock().Lock();
|
||||||
small_data *smallData = inode->FindSmallData(fAttribute);
|
small_data *smallData = inode->FindSmallData(fAttribute);
|
||||||
if (smallData != NULL) {
|
if (smallData != NULL) {
|
||||||
@@ -823,10 +823,10 @@ Equation::Match(Inode *inode,const char *attributeName,int32 type,const uint8 *k
|
|||||||
buffer = (uint8 *)&value;
|
buffer = (uint8 *)&value;
|
||||||
type = attribute->Node()->type;
|
type = attribute->Node()->type;
|
||||||
size = attribute->Size();
|
size = attribute->Size();
|
||||||
|
|
||||||
if (size > INODE_FILE_NAME_LENGTH)
|
if (size > INODE_FILE_NAME_LENGTH)
|
||||||
size = INODE_FILE_NAME_LENGTH;
|
size = INODE_FILE_NAME_LENGTH;
|
||||||
|
|
||||||
if (attribute->ReadAt(0,buffer,&size) < B_OK) {
|
if (attribute->ReadAt(0,buffer,&size) < B_OK) {
|
||||||
inode->ReleaseAttribute(attribute);
|
inode->ReleaseAttribute(attribute);
|
||||||
return B_IO_ERROR;
|
return B_IO_ERROR;
|
||||||
@@ -870,7 +870,7 @@ Equation::CalculateScore(Index &index)
|
|||||||
// least one character to set your index to
|
// least one character to set your index to
|
||||||
fScore = 5;
|
fScore = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
// take index size into account (1024 is the current node size
|
// take index size into account (1024 is the current node size
|
||||||
// in our B+trees)
|
// in our B+trees)
|
||||||
// 2048 * 2048 == 4194304 is the maximum score (for an empty
|
// 2048 * 2048 == 4194304 is the maximum score (for an empty
|
||||||
@@ -884,7 +884,7 @@ Equation::PrepareQuery(Volume */*volume*/, Index &index, TreeIterator **iterator
|
|||||||
{
|
{
|
||||||
type_code type;
|
type_code type;
|
||||||
status_t status = index.SetTo(fAttribute);
|
status_t status = index.SetTo(fAttribute);
|
||||||
|
|
||||||
// special case for OP_UNEQUAL - it will always operate through the whole index
|
// special case for OP_UNEQUAL - it will always operate through the whole index
|
||||||
// but we need the call to the original index to get the correct type
|
// but we need the call to the original index to get the correct type
|
||||||
if (status < B_OK || fOp == OP_UNEQUAL) {
|
if (status < B_OK || fOp == OP_UNEQUAL) {
|
||||||
@@ -895,7 +895,7 @@ Equation::PrepareQuery(Volume */*volume*/, Index &index, TreeIterator **iterator
|
|||||||
|
|
||||||
if (index.SetTo("name") < B_OK)
|
if (index.SetTo("name") < B_OK)
|
||||||
return B_ENTRY_NOT_FOUND;
|
return B_ENTRY_NOT_FOUND;
|
||||||
|
|
||||||
fHasIndex = false;
|
fHasIndex = false;
|
||||||
} else {
|
} else {
|
||||||
fHasIndex = true;
|
fHasIndex = true;
|
||||||
@@ -1045,7 +1045,15 @@ Equation::GetNextMatching(Volume *volume, TreeIterator *iterator,
|
|||||||
dirent->d_pdev = volume->ID();
|
dirent->d_pdev = volume->ID();
|
||||||
dirent->d_pino = volume->ToVnode(inode->Parent());
|
dirent->d_pino = volume->ToVnode(inode->Parent());
|
||||||
strcpy(dirent->d_name,inode->Name());
|
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);
|
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());
|
put_vnode(volume->ID(), inode->ID());
|
||||||
|
|||||||
@@ -1403,7 +1403,12 @@ bfs_read_dir(void *_ns, void *_node, void *_cookie, long *num,
|
|||||||
|
|
||||||
dirent->d_dev = volume->ID();
|
dirent->d_dev = volume->ID();
|
||||||
dirent->d_ino = id;
|
dirent->d_ino = id;
|
||||||
|
|
||||||
|
#ifdef KEEP_WRONG_DIRENT_RECLEN
|
||||||
dirent->d_reclen = length;
|
dirent->d_reclen = length;
|
||||||
|
#else
|
||||||
|
dirent->d_reclen = sizeof(struct dirent) + length;
|
||||||
|
#endif
|
||||||
|
|
||||||
*num = 1;
|
*num = 1;
|
||||||
return B_OK;
|
return B_OK;
|
||||||
@@ -1526,7 +1531,11 @@ bfs_read_attrdir(void *_ns, void *node, void *_cookie, long *num, struct dirent
|
|||||||
Volume *volume = (Volume *)_ns;
|
Volume *volume = (Volume *)_ns;
|
||||||
|
|
||||||
dirent->d_dev = volume->ID();
|
dirent->d_dev = volume->ID();
|
||||||
|
#ifdef KEEP_WRONG_DIRENT_RECLEN
|
||||||
dirent->d_reclen = length;
|
dirent->d_reclen = length;
|
||||||
|
#else
|
||||||
|
dirent->d_reclen = sizeof(struct dirent) + length;
|
||||||
|
#endif
|
||||||
|
|
||||||
*num = 1;
|
*num = 1;
|
||||||
return B_OK;
|
return B_OK;
|
||||||
|
|||||||
Reference in New Issue
Block a user