diff --git a/src/apps/diskprobe/DataEditor.cpp b/src/apps/diskprobe/DataEditor.cpp index 5749ffd9f5..4c2c51eee8 100644 --- a/src/apps/diskprobe/DataEditor.cpp +++ b/src/apps/diskprobe/DataEditor.cpp @@ -399,17 +399,21 @@ status_t DataEditor::SetTo(BEntry &entry, const char *attribute) { fSize = 0; + fLastChange = fFirstChange = NULL; + fChangesFromSaved = 0; + fView = NULL; + fRealViewOffset = 0; + fViewOffset = 0; + fRealViewSize = fViewSize = fBlockSize = 512; struct stat stat; - stat.st_mode = 0; - status_t status = entry.GetStat(&stat); if (status < B_OK) return status; - bool isFileSystem = false; + entry.GetRef(&fAttributeRef); - fBlockSize = 512; + bool isFileSystem = false; if (entry.IsDirectory()) { // we redirect root directories to their volumes @@ -443,7 +447,6 @@ DataEditor::SetTo(BEntry &entry, const char *attribute) fIsReadOnly = false; entry.GetRef(&fRef); - fIsDevice = S_ISBLK(stat.st_mode) || S_ISCHR(stat.st_mode); if (attribute != NULL) @@ -452,8 +455,9 @@ DataEditor::SetTo(BEntry &entry, const char *attribute) fAttribute = NULL; if (IsAttribute()) { + BNode node(&fAttributeRef); attr_info info; - status = fFile.GetAttrInfo(fAttribute, &info); + status = node.GetAttrInfo(fAttribute, &info); if (status != B_OK) { fFile.Unset(); return status; @@ -488,11 +492,6 @@ DataEditor::SetTo(BEntry &entry, const char *attribute) } } - fLastChange = fFirstChange = NULL; - fChangesFromSaved = 0; - fView = NULL; - fRealViewOffset = 0; - fViewOffset = 0; fRealViewSize = fViewSize = fBlockSize; fNeedsUpdate = true; @@ -921,9 +920,10 @@ status_t DataEditor::Update() { ssize_t bytesRead; - if (IsAttribute()) - bytesRead = fFile.ReadAttr(fAttribute, fType, fRealViewOffset, fView, fRealViewSize); - else + if (IsAttribute()) { + BNode node(&fAttributeRef); + bytesRead = node.ReadAttr(fAttribute, fType, fRealViewOffset, fView, fRealViewSize); + } else bytesRead = fFile.ReadAt(fRealViewOffset, fView, fRealViewSize); if (bytesRead < B_OK) diff --git a/src/apps/diskprobe/DataEditor.h b/src/apps/diskprobe/DataEditor.h index ce44b82448..cace088965 100644 --- a/src/apps/diskprobe/DataEditor.h +++ b/src/apps/diskprobe/DataEditor.h @@ -1,7 +1,7 @@ -/* -** Copyright 2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved. -** Distributed under the terms of the OpenBeOS License. -*/ +/* + * Copyright 2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved. + * Distributed under the terms of the MIT License. + */ #ifndef DATA_EDITOR_H #define DATA_EDITOR_H @@ -78,6 +78,7 @@ class DataEditor : public BLocker { BMessenger progressMessenger, volatile bool *stop = NULL); BFile &File() { return fFile; } + const entry_ref &AttributeRef() const { return fAttributeRef; } const entry_ref &Ref() const { return fRef; } private: @@ -94,7 +95,7 @@ class DataEditor : public BLocker { BObjectList fObservers; - entry_ref fRef; + entry_ref fRef, fAttributeRef; BFile fFile; const char *fAttribute; type_code fType;