* Even more cleanup.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30742 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2009-05-13 07:59:00 +00:00
parent 27f23ba2df
commit 7cec697c0b
@@ -75,7 +75,7 @@ enum attr_mode {
}; };
class Volume { class Volume {
public: public:
Volume(fs_volume* fsVolume); Volume(fs_volume* fsVolume);
~Volume(); ~Volume();
@@ -105,7 +105,7 @@ class Volume {
static void DetermineName(uint32 cddbId, int device, char* name, static void DetermineName(uint32 cddbId, int device, char* name,
size_t length); size_t length);
private: private:
Inode* _CreateNode(Inode* parent, const char* name, Inode* _CreateNode(Inode* parent, const char* name,
off_t start, off_t frames, int32 type); off_t start, off_t frames, int32 type);
int _OpenAttributes(int mode, int _OpenAttributes(int mode,
@@ -131,16 +131,20 @@ class Volume {
}; };
class Attribute : public DoublyLinkedListLinkImpl<Attribute> { class Attribute : public DoublyLinkedListLinkImpl<Attribute> {
public: public:
Attribute(const char* name, type_code type); Attribute(const char* name, type_code type);
~Attribute(); ~Attribute();
status_t InitCheck() const { return fName != NULL ? B_OK : B_NO_MEMORY; } status_t InitCheck() const
{ return fName != NULL ? B_OK : B_NO_MEMORY; }
status_t SetTo(const char* name, type_code type); status_t SetTo(const char* name, type_code type);
void SetType(type_code type) { fType = type; } void SetType(type_code type)
{ fType = type; }
status_t ReadAt(off_t offset, uint8* buffer, size_t* _length); status_t ReadAt(off_t offset, uint8* buffer,
status_t WriteAt(off_t offset, const uint8* buffer, size_t* _length); size_t* _length);
status_t WriteAt(off_t offset, const uint8* buffer,
size_t* _length);
void Truncate(); void Truncate();
status_t SetSize(off_t size); status_t SetSize(off_t size);
@@ -152,7 +156,7 @@ class Attribute : public DoublyLinkedListLinkImpl<Attribute> {
bool IsProtectedNamespace(); bool IsProtectedNamespace();
static bool IsProtectedNamespace(const char* name); static bool IsProtectedNamespace(const char* name);
private: private:
char* fName; char* fName;
type_code fType; type_code fType;
uint8* fData; uint8* fData;
@@ -160,9 +164,10 @@ class Attribute : public DoublyLinkedListLinkImpl<Attribute> {
}; };
class Inode { class Inode {
public: public:
Inode(Volume* volume, Inode* parent, const char* name, off_t start, Inode(Volume* volume, Inode* parent,
off_t frames, int32 type); const char* name, off_t start, off_t frames,
int32 type);
~Inode(); ~Inode();
status_t InitCheck(); status_t InitCheck();
@@ -186,12 +191,14 @@ class Inode {
off_t FrameCount() const off_t FrameCount() const
{ return fFrameCount; } { return fFrameCount; }
off_t Size() const off_t Size() const
{ return fFrameCount * kFrameSize /* + WAV header */; } { return fFrameCount * kFrameSize; }
// does not include the WAV header
Attribute* FindAttribute(const char* name) const; Attribute* FindAttribute(const char* name) const;
status_t AddAttribute(Attribute* attribute, bool overwrite); status_t AddAttribute(Attribute* attribute, bool overwrite);
status_t AddAttribute(const char* name, type_code type, status_t AddAttribute(const char* name, type_code type,
bool overwrite, const uint8* data, size_t length); bool overwrite, const uint8* data,
size_t length);
status_t AddAttribute(const char* name, type_code type, status_t AddAttribute(const char* name, type_code type,
const char* string); const char* string);
status_t AddAttribute(const char* name, type_code type, status_t AddAttribute(const char* name, type_code type,
@@ -206,16 +213,17 @@ class Inode {
AttributeList::ConstIterator Attributes() const AttributeList::ConstIterator Attributes() const
{ return fAttributes.GetIterator(); } { return fAttributes.GetIterator(); }
const wav_header* WAVHeader() const { return &fWAVHeader; } const wav_header* WAVHeader() const
{ return &fWAVHeader; }
Inode* Next() const { return fNext; } Inode* Next() const { return fNext; }
void SetNext(Inode *inode) { fNext = inode; } void SetNext(Inode *inode) { fNext = inode; }
private: private:
Inode* fNext; Inode* fNext;
ino_t fID; ino_t fID;
int32 fType; int32 fType;
char *fName; char* fName;
gid_t fGroupID; gid_t fGroupID;
uid_t fUserID; uid_t fUserID;
time_t fCreationTime; time_t fCreationTime;
@@ -228,7 +236,7 @@ class Inode {
}; };
struct dir_cookie { struct dir_cookie {
Inode *current; Inode* current;
int state; // iteration state int state; // iteration state
}; };
@@ -241,13 +249,13 @@ enum {
}; };
struct attr_cookie : DoublyLinkedListLinkImpl<attr_cookie> { struct attr_cookie : DoublyLinkedListLinkImpl<attr_cookie> {
Attribute *current; Attribute* current;
}; };
struct file_cookie { struct file_cookie {
int open_mode; int open_mode;
off_t buffer_offset; off_t buffer_offset;
void *buffer; void* buffer;
}; };
static const uint32 kMaxAttributeSize = 65536; static const uint32 kMaxAttributeSize = 65536;