The Pedigree Project 0.1
RawFs.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 RAWFS_H
21#define RAWFS_H
22
23#include "pedigree/kernel/processor/types.h"
24#include "pedigree/kernel/utilities/String.h"
25
26#include "modules/system/vfs/Filesystem.h"
27
28class Disk;
29class File;
30
33class RawFs : public Filesystem {
34 public:
35 RawFs();
36 virtual ~RawFs();
37
38 //
39 // Filesystem interface.
40 //
41 virtual bool initialise(Disk* pDisk) {
42 return false;
43 }
44 static Filesystem* probe(Disk* pDisk) {
45 return 0;
46 }
47 virtual File* getRoot() const;
48 virtual SyncStatus sync();
49 virtual SyncStatus shutdown();
50 virtual const String& getVolumeLabel() const {
51 static String volumeLabel("RawFs");
52 return volumeLabel;
53 }
54 virtual uint64_t read(File* pFile, uint64_t location, uint64_t size, uintptr_t buffer,
55 bool canBlock) {
56 return 0;
57 }
58 virtual uint64_t write(File* pFile, uint64_t location, uint64_t size, uintptr_t buffer,
59 bool canBlock) {
60 return 0;
61 }
62 virtual void truncate(File* pFile) {
63 return;
64 }
65 virtual void fileAttributeChanged(File* pFile) {
66 return;
67 }
68 virtual void cacheDirectoryContents(File* pFile) {
69 return;
70 }
71
72 protected:
73 virtual bool createFile(File* parent, const String& filename, uint32_t mask) {
74 return false;
75 }
76 virtual bool createDirectory(File* parent, const String& filename, uint32_t mask) {
77 return false;
78 }
79 virtual bool createSymlink(File* parent, const String& filename, const String& value) {
80 return false;
81 }
82 virtual bool removeNode(File*, const String&, File*) {
83 return false;
84 }
85
86 private:
87 RawFs(const RawFs&);
88 RawFs& operator=(const RawFs&);
89
90 class RawFsDir* m_pRoot;
91};
92
93#endif
Definition Disk.h:35
Definition File.h:75
Definition RawFs.h:33
virtual SyncStatus shutdown()
Definition RawFs.cc:54
virtual bool createSymlink(File *parent, const String &filename, const String &value)
Definition RawFs.h:79
virtual SyncStatus sync()
Definition RawFs.cc:50
virtual bool createDirectory(File *parent, const String &filename, uint32_t mask)
Definition RawFs.h:76
virtual bool createFile(File *parent, const String &filename, uint32_t mask)
Definition RawFs.h:73
virtual File * getRoot() const
Definition RawFs.cc:58
virtual bool initialise(Disk *pDisk)
Definition RawFs.h:41
virtual bool removeNode(File *, const String &, File *)
Definition RawFs.h:82
virtual const String & getVolumeLabel() const
Definition RawFs.h:50