Python fuse.Stat() Examples
The following are 4
code examples of fuse.Stat().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
fuse
, or try the search function
.
Example #1
Source File: address_space_fuse.py From rekall with GNU General Public License v2.0 | 6 votes |
def make_stat(pid): """ Return a stat structure from TSK metadata struct """ s = fuse.Stat() try: s.st_ino = int(pid) except ValueError: s.st_ino = 0 s.st_dev = 0 s.st_nlink = 1 s.st_uid = 0 s.st_gid = 0 s.st_size = 1 s.st_atime = 0 s.st_mtime = 0 s.st_ctime = 0 s.st_blocks = 2 s.st_rdev = 0 return s
Example #2
Source File: pcachefs.py From pcachefs with Apache License 2.0 | 6 votes |
def __init__(self, st): fuse.Stat.__init__(self) self.st_mode = st.st_mode self.st_nlink = st.st_nlink self.st_size = st.st_size self.st_atime = st.st_atime self.st_mtime = st.st_mtime self.st_ctime = st.st_ctime self.st_dev = st.st_dev self.st_gid = st.st_gid self.st_ino = st.st_ino self.st_uid = st.st_uid self.st_rdev = st.st_rdev self.st_blksize = st.st_blksize
Example #3
Source File: fuse-cmd.py From honeything with GNU General Public License v3.0 | 5 votes |
def getattr(self, path): log('--getattr(%r)\n' % path) try: node = cache_get(self.top, path) st = Stat() st.st_mode = node.mode st.st_nlink = node.nlinks() st.st_size = node.size() st.st_mtime = node.mtime st.st_ctime = node.ctime st.st_atime = node.atime return st except vfs.NoSuchFile: return -errno.ENOENT
Example #4
Source File: vfs.py From pcachefs with Apache License 2.0 | 5 votes |
def fake_stat(virtual_file): """Create fuse stat from file.""" if virtual_file is None: return E_NO_SUCH_FILE result = fuse.Stat() if virtual_file.is_read_only(): result.st_mode = stat.S_IFREG | 0o444 else: result.st_mode = stat.S_IFREG | 0o644 # Always 1 for now (seems to be safe for files and dirs) result.st_nlink = 1 result.st_size = virtual_file.size() # Must return seconds-since-epoch timestamps result.st_atime = virtual_file.atime() result.st_mtime = virtual_file.mtime() result.st_ctime = virtual_file.ctime() # You can set these to anything, they're set by FUSE result.st_dev = 1 result.st_ino = 1 # GetContext() returns uid/gid of the process that # initiated the syscall currently being handled context = fuse.FuseGetContext() if virtual_file.uid() is None: result.st_uid = context['uid'] else: result.st_uid = virtual_file.uid() if virtual_file.gid() is None: result.st_gid = context['gid'] else: result.st_gid = virtual_file.gid() return result