summaryrefslogtreecommitdiff
path: root/mystat.py
diff options
context:
space:
mode:
authorLudovic Pouzenc <lpouzenc@lud-GB1>2015-06-12 08:34:26 +0200
committerLudovic Pouzenc <lpouzenc@lud-GB1>2015-06-12 08:34:26 +0200
commit5943acb92ce0159e9f482748e4fa4aadddae6851 (patch)
treee4fc66dabda439f8a98535f10287018e871c2e41 /mystat.py
parent49c830d2d70547c31cab1b1f0bc9f26d77d62a7e (diff)
downloadraidguessfs-5943acb92ce0159e9f482748e4fa4aadddae6851.tar.gz
raidguessfs-5943acb92ce0159e9f482748e4fa4aadddae6851.tar.bz2
raidguessfs-5943acb92ce0159e9f482748e4fa4aadddae6851.zip
Initial import.
RAID 5 xor parity checking is working, data reading on left-assymetric RAID 5 is working. Nothing done on other RAID types.
Diffstat (limited to 'mystat.py')
-rw-r--r--mystat.py57
1 files changed, 57 insertions, 0 deletions
diff --git a/mystat.py b/mystat.py
new file mode 100644
index 0000000..719c7e3
--- /dev/null
+++ b/mystat.py
@@ -0,0 +1,57 @@
+#!/usr/bin/env python
+
+# RaidGuessFS, a FUSE pseudo-filesystem to guess RAID parameters of a damaged device
+# Copyright (C) 2015 Ludovic Pouzenc <ludovic@pouzenc.fr>
+#
+# This file is part of RaidGuessFS.
+#
+# RaidGuessFS is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# RaidGuessFS is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with RaidGuessFS. If not, see <http://www.gnu.org/licenses/>
+
+import stat, os, time, copy, fuse
+
+class MyStat(fuse.Stat):
+ """Handy class to produce fake file or dir attributes"""
+
+ def __init__(self):
+ self.st_mode = stat.S_IFDIR | 0555
+ self.st_ino = 0
+ self.st_dev = 0
+ self.st_nlink = 2
+ self.st_uid = os.getuid()
+ self.st_gid = os.getgid()
+ self.st_size = 0
+ self.st_atime = time.time()
+ self.st_mtime = self.st_atime
+ self.st_ctime = self.st_atime
+
+ def __str__(self):
+ return str(self.__dict__)
+
+ def make_fake_dir(self):
+ return copy.copy(self)
+
+ def make_fake_file(self,size,mode=0444):
+ st = copy.copy(self)
+ st.st_size = size
+ st.st_mode = stat.S_IFREG | mode
+ st.st_nlink = 1
+ return st
+
+#def main():
+# st = MyStat()
+# print st.make_fake_dir()
+# print st.make_fake_file(12)
+#
+#if __name__ == '__main__':
+# main()