1 /* 2 * Copyright 2009-2013, Ingo Weinhold, ingo_weinhold@gmx.de. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef UNPACKING_DIRECTORY_H 6 #define UNPACKING_DIRECTORY_H 7 8 9 #include "Directory.h" 10 #include "PackageDirectory.h" 11 #include "UnpackingNode.h" 12 13 14 class UnpackingDirectory : public Directory, public UnpackingNode { 15 public: 16 static void* operator new(size_t size); 17 static void operator delete(void* block); 18 19 UnpackingDirectory(ino_t id); 20 virtual ~UnpackingDirectory(); 21 22 virtual status_t VFSInit(dev_t deviceID); 23 virtual void VFSUninit(); 24 25 virtual mode_t Mode() const; 26 virtual uid_t UserID() const; 27 virtual gid_t GroupID() const; 28 virtual timespec ModifiedTime() const; 29 virtual off_t FileSize() const; 30 31 virtual Node* GetNode(); 32 33 virtual status_t AddPackageNode(PackageNode* packageNode, 34 dev_t deviceID); 35 virtual void RemovePackageNode(PackageNode* packageNode, 36 dev_t deviceID); 37 38 virtual PackageNode* GetPackageNode(); 39 virtual bool IsOnlyPackageNode(PackageNode* node) const; 40 virtual bool WillBeFirstPackageNode( 41 PackageNode* packageNode) const; 42 43 virtual void PrepareForRemoval(); 44 45 virtual status_t OpenAttributeDirectory( 46 AttributeDirectoryCookie*& _cookie); 47 virtual status_t OpenAttribute(const StringKey& name, 48 int openMode, AttributeCookie*& _cookie); 49 50 virtual status_t IndexAttribute(AttributeIndexer* indexer); 51 virtual void* IndexCookieForAttribute(const StringKey& name) 52 const; 53 54 private: 55 PackageDirectoryList fPackageDirectories; 56 }; 57 58 59 class RootDirectory final : public UnpackingDirectory { 60 public: 61 static void* operator new(size_t size); 62 static void operator delete(void* block); 63 64 RootDirectory(ino_t id, 65 const timespec& modifiedTime); 66 67 virtual status_t OpenAttributeDirectory( 68 AttributeDirectoryCookie*& _cookie) override; 69 70 virtual timespec ModifiedTime() const; 71 72 private: 73 timespec fModifiedTime; 74 }; 75 76 77 #endif // UNPACKING_DIRECTORY_H 78