The Pedigree Project
0.1
src
modules
system
vfs
Symlink.h
1
/*
2
* Copyright (c) 2008-2014, Pedigree Developers
3
*
4
* Please see the CONTRIB file in the root of the source tree for a full
5
* list of contributors.
6
*
7
* Permission to use, copy, modify, and distribute this software for any
8
* purpose with or without fee is hereby granted, provided that the above
9
* copyright notice and this permission notice appear in all copies.
10
*
11
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18
*/
19
20
#ifndef SYMLINK_H
21
#define SYMLINK_H
22
23
#include "pedigree/kernel/Log.h"
24
#include "pedigree/kernel/compiler.h"
25
#include "pedigree/kernel/process/FilesystemContext.h"
26
#include "pedigree/kernel/processor/types.h"
27
#include "pedigree/kernel/time/Time.h"
28
#include "pedigree/kernel/utilities/String.h"
29
30
#include "Directory.h"
31
33
class
EXPORTED_PUBLIC
Symlink
:
public
File
{
34
friend
class
Filesystem
;
35
36
public
:
38
static
Symlink
*
fromFile
(
File
* pF) {
39
if
(!pF->
isSymlink
())
40
FATAL(
"Casting non-symlink File to Symlink!"
);
41
return
reinterpret_cast<
Symlink
*
>
(pF);
42
}
43
45
Symlink
();
46
48
Symlink
(
const
Symlink
& file);
49
50
private
:
51
Symlink
& operator=(
const
Symlink
&);
52
53
public
:
55
Symlink
(
const
String
& name, Time::Timestamp accessedTime, Time::Timestamp modifiedTime,
56
Time::Timestamp creationTime, uintptr_t inode,
class
Filesystem
* pFs,
size_t
size,
57
File
* pParent);
59
virtual
~Symlink
();
60
62
virtual
bool
isSymlink
() {
63
return
true
;
64
}
65
68
virtual
int
followLink(
char
* pBuffer,
size_t
bufLen);
69
71
virtual
File
* followLinkRetained(
Directory::ChildLease
& result);
72
74
virtual
bool
isPathLink
()
const
{
75
return
false
;
76
}
77
virtual
bool
followPath(
FilesystemPathRef
&) {
78
return
false
;
79
}
80
81
protected
:
83
static
File
* retainTarget(
File
* target,
Directory::ChildLease
& result);
84
85
String
m_sTarget;
86
88
Mutex
m_TargetLock
;
89
91
void
initialise(
bool
bForce =
false
);
92
95
virtual
bool
isBytewise
()
const
;
96
};
97
98
#endif
Directory::ChildLease
Definition
Directory.h:81
File
Definition
File.h:74
File::isSymlink
virtual bool isSymlink()
Definition
File.cc:688
File::isBytewise
virtual bool isBytewise() const
Definition
File.cc:1229
Filesystem
Definition
Filesystem.h:40
Mutex
Definition
Mutex.h:56
SharedPointer< FilesystemPath >
String
Definition
String.h:49
Symlink
Definition
Symlink.h:33
Symlink::fromFile
static Symlink * fromFile(File *pF)
Definition
Symlink.h:38
Symlink::isSymlink
virtual bool isSymlink()
Definition
Symlink.h:62
Symlink::Symlink
Symlink(const Symlink &file)
Symlink::m_TargetLock
Mutex m_TargetLock
Definition
Symlink.h:88
Symlink::isPathLink
virtual bool isPathLink() const
Definition
Symlink.h:74
Generated on Tue Sep 22 2026 05:04:54 for The Pedigree Project by
1.9.8