xref: /haiku/src/add-ons/kernel/file_systems/packagefs/package_links/PackageLinkSymlink.h (revision 9a6a20d4689307142a7ed26a1437ba47e244e73f)
1 /*
2  * Copyright 2011, Ingo Weinhold, ingo_weinhold@gmx.de.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef PACKAGE_LINK_SYMLINK_H
6 #define PACKAGE_LINK_SYMLINK_H
7 
8 
9 #include <Referenceable.h>
10 
11 #include "Node.h"
12 
13 
14 class Package;
15 class PackageLinksListener;
16 
17 
18 class PackageLinkSymlink : public Node {
19 public:
20 			enum Type {
21 				TYPE_INSTALLATION_LOCATION,
22 				TYPE_SETTINGS,
23 
24 				TYPE_ENUM_COUNT
25 			};
26 
27 public:
28 								PackageLinkSymlink(Package* package,
29 									Type type);
30 	virtual						~PackageLinkSymlink();
31 
32 			void				Update(Package* package,
33 									PackageLinksListener* listener);
34 
35 	virtual	mode_t				Mode() const;
36 	virtual	timespec			ModifiedTime() const;
37 	virtual	off_t				FileSize() const;
38 
39 	virtual	status_t			Read(off_t offset, void* buffer,
40 									size_t* bufferSize);
41 	virtual	status_t			Read(io_request* request);
42 
43 	virtual	status_t			ReadSymlink(void* buffer, size_t* bufferSize);
44 
45 	virtual	status_t			OpenAttributeDirectory(
46 									AttributeDirectoryCookie*& _cookie);
47 	virtual	status_t			OpenAttribute(const StringKey& name,
48 									int openMode, AttributeCookie*& _cookie);
49 
50 private:
51 			struct OldAttributes;
52 
53 private:
54 			timespec			fModifiedTime;
55 			BReference<Package>	fPackage;
56 			const char*			fLinkPath;
57 			Type				fType;
58 };
59 
60 
61 #endif	// PACKAGE_LINK_SYMLINK_H
62