- (IDDNode*)_fetchChild:(char**)entry_start :(NSString*)parentPath :(uint64)pnode {
IDDNodeAttribute attribute;
char* field = *entry_start;
attribute.length = *(uint32_t *)field;
field += sizeof(uint32_t);
*entry_start += attribute.length;
attribute.returned = *(attribute_set_t *)field;
field += sizeof(attribute_set_t);
if (attribute.returned.commonattr & ATTR_CMN_NAME) {
attribute.name = field;
attribute.name_info = *(attrreference_t *)field;
field += sizeof(attrreference_t);
// DEBUG
NSString* childPath = [parentPath stringByAppendingPathComponent:[NSString stringWithUTF8String:(attribute.name + attribute.name_info.attr_dataoffset)]];
_logInfo(NSStringFromSelector(_cmd), [NSString stringWithFormat:@"filePath: '%@'", childPath]);
}
if (attribute.returned.commonattr & ATTR_CMN_FSID) {
attribute.fsid = *(fsid_t *)field;
field += sizeof(fsid_t);
int32_t fileSystemID = (int32_t)attribute.fsid.val[0];
// DEBUG
NSString* childPath = [parentPath stringByAppendingPathComponent:[NSString stringWithUTF8String:(attribute.name + attribute.name_info.attr_dataoffset)]];
_logInfo(NSStringFromSelector(_cmd), [NSString stringWithFormat:@"filePath: '%@' fileSystemID: '%d'", childPath, fileSystemID]);
}
if (attribute.returned.commonattr & ATTR_CMN_OBJTYPE) {
attribute.obj_type = *(fsobj_type_t *)field;
field += sizeof(fsobj_type_t);
// DEBUG
NSString* childPath = [parentPath stringByAppendingPathComponent:[NSString stringWithUTF8String:(attribute.name + attribute.name_info.attr_dataoffset)]];
_logInfo(NSStringFromSelector(_cmd), [NSString stringWithFormat:@"filePath: '%@' type: '%@'", childPath, [self _fileType:attribute.obj_type]]);
}
if (attribute.returned.commonattr & ATTR_CMN_MODTIME) {
struct timespec time = *(struct timespec*)field;
field += sizeof(struct timespec);
NSDate* modificationDate = [NSDate dateWithTimeIntervalSince1970:time.tv_sec];
// DEBUG
NSString* childPath = [parentPath stringByAppendingPathComponent:[NSString stringWithUTF8String:(attribute.name + attribute.name_info.attr_dataoffset)]];
_logInfo(NSStringFromSelector(_cmd), [NSString stringWithFormat:@"filePath: '%@' modificationDate: '%@'", childPath, modificationDate]);
}
if (attribute.returned.commonattr & ATTR_CMN_FILEID) {
attribute.inode = *(uint64_t *)field;
// DEDA DEBUG
struct stat file_status;
NSString* childPath = [parentPath stringByAppendingPathComponent:[NSString stringWithUTF8String:(attribute.name + attribute.name_info.attr_dataoffset)]];
_logInfo(NSStringFromSelector(_cmd), [NSString stringWithFormat:@"filePath: '%@' inode: '%lld'", childPath, attribute.inode]);
if (lstat((const char *)[childPath fileSystemRepresentation], &file_status) == 0) {
int64_t inode2 = file_status.st_ino;
if (attribute.inode != inode2) {
_logError(NSStringFromSelector(_cmd), [NSString stringWithFormat:@"filePath: '%@' inode mismatch: '%lld'", childPath, inode2]);
} else {
_logInfo(NSStringFromSelector(_cmd), [NSString stringWithFormat:@"filePath: '%@' inode match: '%lld'", childPath, inode2]);
}
}
field += sizeof(uint64_t);
}
return nil;
}