The Pedigree Project 0.1
RawFsFile.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_FILE_H
21#define RAWFS_FILE_H
22
23#include "pedigree/kernel/process/Mutex.h"
24#include "pedigree/kernel/processor/types.h"
25#include "pedigree/kernel/utilities/Cache.h"
26#include "pedigree/kernel/utilities/String.h"
27
28#include "modules/system/vfs/File.h"
29
30class Disk;
31
32class RawFsFile : public File {
33 private:
35 RawFsFile(const RawFsFile& file);
36 RawFsFile& operator=(const RawFsFile&);
37
38 public:
40 RawFsFile(String name, class RawFs* pFs, File* pParent, Disk* pDisk);
41 ~RawFsFile();
42 virtual bool sync();
43 virtual bool sync(size_t offset, bool async);
44 bool shutdown();
45
46 virtual uintptr_t readBlock(uint64_t location);
47 virtual void writeBlock(uint64_t location, uintptr_t address);
48 virtual bool pinBlock(uint64_t location);
49 virtual void unpinBlock(uint64_t location);
50
51 virtual size_t getBlockSize() const;
52
53 virtual void fileAttributeChanged() {}
54
55 private:
56 static bool cacheCallback(CacheConstants::CallbackCause cause, uintptr_t location, uintptr_t page,
57 void* context);
58 Disk* m_pDisk;
59 Cache m_PageCache;
60 Mutex m_PageCacheLock;
61};
62
63#endif
Definition Cache.h:207
Definition Disk.h:35
Definition File.h:75
Definition Mutex.h:56
RawFsFile(const RawFsFile &file)
virtual size_t getBlockSize() const
Definition RawFsFile.cc:87
virtual bool pinBlock(uint64_t location)
Definition RawFsFile.cc:164
virtual bool sync()
Definition RawFsFile.cc:56
virtual uintptr_t readBlock(uint64_t location)
Definition RawFsFile.cc:93
virtual void writeBlock(uint64_t location, uintptr_t address)
Definition RawFsFile.cc:146
virtual void unpinBlock(uint64_t location)
Definition RawFsFile.cc:172
Definition RawFs.h:33