The Pedigree Project  0.1
Ext2File.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 EXT2_FILE_H
21 #define EXT2_FILE_H
22 
23 #include "Ext2Node.h"
24 #include "modules/system/vfs/File.h"
25 #include "pedigree/kernel/processor/types.h"
26 #include "pedigree/kernel/utilities/String.h"
27 
28 struct Inode;
29 
31 class Ext2File : public File, public Ext2Node
32 {
33  private:
35  Ext2File(const Ext2File &file);
36  Ext2File &operator=(const Ext2File &);
37 
38  public:
40  Ext2File(
41  const String &name, uintptr_t inode_num, Inode *inode,
42  class Ext2Filesystem *pFs, File *pParent = 0);
44  virtual ~Ext2File();
45 
46  virtual void preallocate(size_t expectedSize, bool zero=true);
47 
48  virtual void extend(size_t newSize);
49  virtual void extend(size_t newSize, uint64_t location, uint64_t size);
50 
51  virtual void truncate();
52 
54  void fileAttributeChanged();
55 
56  virtual uintptr_t readBlock(uint64_t location);
57  virtual void writeBlock(uint64_t location, uintptr_t addr);
58 
59  virtual void pinBlock(uint64_t location);
60  virtual void unpinBlock(uint64_t location);
61 
62  using File::sync;
63  virtual void sync(size_t offset, bool async);
64 
65  virtual size_t getBlockSize() const;
66 };
67 
68 #endif
virtual void pinBlock(uint64_t location)
Definition: Ext2File.cc:91
Ext2File(const Ext2File &file)
virtual void preallocate(size_t expectedSize, bool zero=true)
Definition: Ext2File.cc:48
void fileAttributeChanged()
Definition: Ext2File.cc:73
virtual void writeBlock(uint64_t location, uintptr_t addr)
Definition: Ext2File.cc:86
Definition: String.h:49
virtual void truncate()
Definition: Ext2File.cc:66
Definition: ext2.h:152
virtual void extend(size_t newSize)
Definition: Ext2File.cc:54
virtual ~Ext2File()
Definition: Ext2File.cc:44
virtual size_t getBlockSize() const
Definition: Ext2File.cc:106
virtual uintptr_t readBlock(uint64_t location)
Definition: Ext2File.cc:81
virtual void sync()
Definition: File.cc:351
virtual void unpinBlock(uint64_t location)
Definition: Ext2File.cc:96
Definition: File.h:66