xref: /haiku/headers/os/storage/SymLink.h (revision 2f470aec1c92ce6917b8a903e343795dc77af41f)
1 //----------------------------------------------------------------------
2 //  This software is part of the OpenBeOS distribution and is covered
3 //  by the OpenBeOS license.
4 //
5 //  File Name: SymLink.h
6 //---------------------------------------------------------------------
7 /*!
8 	\file SymLink.h
9 	BSymLink interface declaration.
10 */
11 
12 #ifndef _SYM_LINK_H
13 #define _SYM_LINK_H
14 
15 #include <Node.h>
16 #include <StorageDefs.h>
17 
18 #ifdef USE_OPENBEOS_NAMESPACE
19 namespace OpenBeOS {
20 #endif
21 
22 /*!
23 	\class BSymLink
24 	\brief A symbolic link in the filesystem
25 
26 	Provides an interface for manipulating symbolic links.
27 
28 	\author <a href='mailto:bonefish@users.sf.net'>Ingo Weinhold</a>
29 
30 	\version 0.0.0
31 */
32 class BSymLink : public BNode {
33 public:
34 	BSymLink();
35 	BSymLink(const BSymLink &link);
36 	BSymLink(const entry_ref *ref);
37 	BSymLink(const BEntry *entry);
38 	BSymLink(const char *path);
39 	BSymLink(const BDirectory *dir, const char *path);
40 	virtual ~BSymLink();
41 
42 	ssize_t ReadLink(char *buf, size_t size);
43 
44 	ssize_t MakeLinkedPath(const char *dirPath, BPath *path);
45 	ssize_t MakeLinkedPath(const BDirectory *dir, BPath *path);
46 
47 	bool IsAbsolute();
48 
49 private:
50 	virtual void _MissingSymLink1();
51 	virtual void _MissingSymLink2();
52 	virtual void _MissingSymLink3();
53 	virtual void _MissingSymLink4();
54 	virtual void _MissingSymLink5();
55 	virtual void _MissingSymLink6();
56 
57 	uint32 _reservedData[4];
58 	BEntry *fSecretEntry;
59 
60 private:
61 	int get_fd() const;
62 };
63 
64 #ifdef USE_OPENBEOS_NAMESPACE
65 };		// namespace OpenBeOS
66 #endif
67 
68 #endif	// _SYM_LINK_H
69