xref: /haiku/headers/os/storage/SymLink.h (revision 4f2fd49bdc6078128b1391191e4edac647044c3d)
1 /*
2  * Copyright 2002-2007, Haiku, Inc. All Rights Reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef _SYM_LINK_H
6 #define _SYM_LINK_H
7 
8 
9 #include <Node.h>
10 #include <StorageDefs.h>
11 
12 class BDirectory;
13 class BPath;
14 
15 
16 /*!
17 	\class BSymLink
18 	\brief A symbolic link in the filesystem
19 
20 	Provides an interface for manipulating symbolic links.
21 
22 	\author <a href='mailto:bonefish@users.sf.net'>Ingo Weinhold</a>
23 
24 	\version 0.0.0
25 */
26 class BSymLink : public BNode {
27 public:
28 	BSymLink();
29 	BSymLink(const BSymLink &link);
30 	BSymLink(const entry_ref *ref);
31 	BSymLink(const BEntry *entry);
32 	BSymLink(const char *path);
33 	BSymLink(const BDirectory *dir, const char *path);
34 	virtual ~BSymLink();
35 
36 	ssize_t ReadLink(char *buf, size_t size);
37 
38 	ssize_t MakeLinkedPath(const char *dirPath, BPath *path);
39 	ssize_t MakeLinkedPath(const BDirectory *dir, BPath *path);
40 
41 	bool IsAbsolute();
42 
43 private:
44 	virtual void _MissingSymLink1();
45 	virtual void _MissingSymLink2();
46 	virtual void _MissingSymLink3();
47 	virtual void _MissingSymLink4();
48 	virtual void _MissingSymLink5();
49 	virtual void _MissingSymLink6();
50 
51 	uint32 _reservedData[4];
52 	BEntry *fSecretEntry;
53 
54 private:
55 	int get_fd() const;
56 };
57 
58 #endif	// _SYM_LINK_H
59