The Pedigree Project  0.1
DiskImage.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 DISKIMAGE_H
21 #define DISKIMAGE_H
22 
23 #include "pedigree/kernel/machine/Disk.h"
24 #include "pedigree/kernel/utilities/Cache.h"
25 
27 class DiskImage : public Disk
28 {
29  public:
30  DiskImage() : Disk(), m_pBase(0), m_nSize(0), m_Cache()
31  {
32  }
33 
34  virtual ~DiskImage()
35  {
36  }
37 
38  bool initialise();
39 
40  virtual void getName(String &str)
41  {
42  str = "Hosted disk image";
43  }
44 
45  virtual void dump(String &str)
46  {
47  str = "Hosted disk image";
48  }
49 
50  virtual uintptr_t read(uint64_t location);
51 
52  virtual size_t getSize() const;
53 
54  virtual size_t getBlockSize() const
55  {
56  return 0x10000;
57  }
58 
59  virtual void pin(uint64_t location);
60 
61  virtual void unpin(uint64_t location);
62 
63  private:
64  void *m_pBase;
65  size_t m_nSize;
66 
67  Cache m_Cache;
68 };
69 
70 #endif
virtual void getName(String &str)
Definition: DiskImage.h:40
virtual size_t getBlockSize() const
Gets the block size of the disk.
Definition: DiskImage.h:54
Definition: String.h:49
Definition: Disk.h:32
Definition: Cache.h:118
virtual uintptr_t read(uint64_t location)
Definition: DiskImage.cc:42
virtual void unpin(uint64_t location)
Definition: DiskImage.cc:80
virtual void pin(uint64_t location)
Pins a cache page.
Definition: DiskImage.cc:75
virtual size_t getSize() const
Gets the size of the disk.
Definition: DiskImage.cc:70
virtual void dump(String &str)
Definition: DiskImage.h:45