def statfs(self): """ statistics about the filesystem. We will perform statvfs on metadata file, which holds the inodes and can determine the number of blocks available to user etc. """ try: #self.__write_log("statfs","called") metavfs = os.statvfs(self.metaDBPath) #Total number of blocks totalBlocks = (metavfs.f_blocks * metavfs.f_frsize) / self.defaultBlockSize #Total number of free blocks in file system totalFree = (metavfs.f_bfree * metavfs.f_frsize) / self.defaultBlockSize #Total number of free blocks that are available totalFreeAvail = (metavfs.f_bavail * metavfs.f_frsize) / self.defaultBlockSize output = fuse.StatVfs(f_bsize = self.defaultBlockSize, f_frsize = self.defaultBlockSize, f_blocks = totalBlocks, f_bfree = totalFree, f_bavail = totalFreeAvail, f_files = 0, f_ffree = 0, f_favail = 0, f_flag = 0, f_namemax = metavfs.f_namemax) #self.__write_log("statfs","ended") return output except Exception, e: self.__write_log("statfs","exception",e) return -EIO
def statfs(self): tracing.trace('called') client_name = self.obnam.app.settings['client-name'] total_data = sum( self.obnam.repo.get_generation_key( gen, obnamlib.REPO_GENERATION_TOTAL_DATA) for gen in self.obnam.repo.get_client_generation_ids(client_name)) files = sum( self.obnam.repo.get_generation_key( gen, obnamlib.REPO_GENERATION_FILE_COUNT) for gen in self.obnam.repo.get_client_generation_ids(client_name)) stv = fuse.StatVfs() stv.f_bsize = 65536 stv.f_frsize = 0 stv.f_blocks = total_data / 65536 stv.f_bfree = 0 stv.f_bavail = 0 stv.f_files = files stv.f_ffree = 0 stv.f_favail = 0 stv.f_flag = 0 stv.f_namemax = 255 # raise OSError(errno.ENOSYS, 'Unimplemented') return stv
def statfs(self): logging.debug('FUSE statfs') try: repo = self.obnam.repo if self.obnam.app.settings['viewmode'] == 'multiple': blocks = sum( repo.client.get_generation_data(gen) for gen in repo.list_generations()) files = sum( repo.client.get_generation_file_count(gen) for gen in repo.list_generations()) else: gen = self.get_gen_path('/')[0] blocks = repo.client.get_generation_data(gen) files = repo.client.get_generation_file_count(gen) stv = fuse.StatVfs() stv.f_bsize = 65536 stv.f_frsize = 0 stv.f_blocks = blocks / 65536 stv.f_bfree = 0 stv.f_bavail = 0 stv.f_files = files stv.f_ffree = 0 stv.f_favail = 0 stv.f_flag = 0 stv.f_namemax = 255 #raise OSError(errno.ENOSYS, 'Unimplemented') return stv except: logging.error('Unexpected exception', exc_info=True) raise
def statfs(self): """ Should return an object with statvfs attributes (f_bsize, f_frsize...). Eg., the return value of os.statvfs() is such a thing (since py 2.2). If you are not reusing an existing statvfs object, start with fuse.StatVFS(), and define the attributes. To provide usable information (ie., you want sensible df(1) output, you are suggested to specify the following attributes: - f_bsize - preferred size of file blocks, in bytes - f_frsize - fundamental size of file blcoks, in bytes [if you have no idea, use the same as blocksize] - f_blocks - total number of blocks in the filesystem - f_bfree - number of free blocks - f_files - total number of file inodes - f_ffree - nunber of free file inodes """ s = fuse.StatVfs() info = self.fs.info s.f_bsize = 4096 s.f_frsize = 0 s.f_blocks = sys.maxint s.f_bfree = 0 s.f_files = len(self.tasks) s.f_ffree = 0 return s
def statfs(self): """ Should return a tuple with the following 6 elements: - blocksize - size of file blocks, in bytes - totalblocks - total number of blocks in the filesystem - freeblocks - number of free blocks - availblocks - number of blocks available to non-superuser - totalfiles - total number of file inodes - freefiles - nunber of free file inodes Feel free to set any of the above values to 0, which tells the kernel that the info is not available. """ st = fuse.StatVfs() block_size = 1024 blocks = 1024 * 1024 blocks_free = blocks blocks_avail = blocks_free files = 0 files_free = 0 st.f_bsize = block_size st.f_frsize = block_size st.f_blocks = blocks st.f_bfree = blocks_free st.f_bavail = blocks_avail st.f_files = files st.f_ffree = files_free return st
def statfs(self): ret_st = fuse.StatVfs() st = NfSpy.statfs(self) ret_st.f_tsize = ret_st.f_bsize = st.f_bsize ret_st.f_blocks = st.f_blocks ret_st.f_bfree = st.f_bfree ret_st.f_bavail = st.f_bavail ret_st.f_files = st.f_files ret_st.f_ffree = st.f_ffree ret_st.f_favail = st.f_favail return ret_st
def statfs(self): st = fuse.StatVfs() st.f_bsize = 1024 st.f_frsize = 0x7fffffff st.f_blocks = 0x7fffffff st.f_bfree = 0x7fffffff st.f_bavail = 0x7fffffff st.f_files = 0x7fffffff st.f_ffree = 0x7fffffff st.f_namelen = 255 return st
def statfs(self): st = fuse.StatVfs() st.f_bsize = 1024 st.f_blocks = 0 st.f_bfree = 0 st.f_files = 0 st.f_ffree = 0 st.f_namelen = 80 # TODO return st
def statfs ( self ): return fuse.StatVfs( f_type = 0x664C6942, f_bsize = 1048576, f_blocks = 0, f_bfree = 0, f_bavail = 0, f_files = self.count, f_ffree = 0, f_fsid = self.fs.id, f_namelen = 2047 );
def statfs(self): st = os.statvfs(self.backing_dir) st_dict = {} for k in ('bsize', 'frsize', 'blocks', 'bfree', 'bavail', 'files', 'ffree', 'favail', 'namemax'): k = 'f_' + k st_dict[k] = getattr(st, k) freeblocks = self.freespace / st_dict['f_bsize'] st_dict['f_bfree'] += freeblocks st_dict['f_bavail'] += freeblocks st_dict['f_blocks'] += freeblocks return fuse.StatVfs(**st_dict)
def statfs(self): """ statfs(const char* path, struct statvfs* stbuf) Return statistics about the filesystem. See statvfs(2) for a description of the structure contents. Usually, you can ignore the path. Not required, but handy for read/write filesystems since this is how programs like df determine the free space. """ self.logger.debug( '[FuseFSCore.statfs] Request FileSystem Info. Context: %s', self.GetContext()) stv = fuse.StatVfs() setattr(stv, 'f_bsize', 512) setattr(stv, 'f_frsize', 512) return stv
def statfs (self): """ ファイルシステム自体ã®stat 以下ã®6ã¤ã®è¦ç´ ã‚’æŒã£ãŸã‚¿ãƒ—ルを返ã™; ブãƒãƒƒã‚¯ã‚µã‚¤ã‚ºã€€ãƒã‚¤ãƒˆå˜ä½ã®ãƒ–ãƒãƒƒã‚¯ã‚µã‚¤ã‚º 全ブãƒãƒƒã‚¯æ•°ã€€ç¢ºä¿ã—ã¦ã„るブãƒãƒƒã‚¯æ•° 空ãブãƒãƒƒã‚¯æ•°ã€€ä½¿ã‚ã‚Œã¦ã„ãªã„ブãƒãƒƒã‚¯æ•° 全ファイル数 確ä¿ã—ã¦ã„ã‚‹i-nodeæ•° 空ãファイル数 使用ã—ã¦ã„ãªã„i-nodeæ•° ファイルåã®é•·ã•ã€€ãƒ•ã‚¡ã‚¤ãƒ«åã«ä½¿ãˆã‚‹æœ€å¤§é•·ã• 未定義ãªã‚‰ãã®è¦ç´ ã‚’0ã«ã—ã¦è¿”ã™ """ print '*** statfs' stvfs = fuse.StatVfs() stvfs.f_bsize = self.block_size return stvfs
def statfs(self): # Вернем информацию в объекте класса fuse.StatVfs st = fuse.StatVfs() # Размер блока st.f_bsize = 1024 st.f_frsize = 1024 st.f_bfree = 0 st.f_bavail = 0 # Количество файлов st.f_files = 2 # Количество блоков # Если f_blocks == 0, то 'df' не включит ФС в свой список - понадобится сделать 'df -a' st.f_blocks = 4 st.f_ffree = 0 st.f_favail = 0 st.f_namelen = 255 return st
def statfs(self): """ Should return an object with statvfs attributes (f_bsize, f_frsize...). Eg., the return value of os.statvfs() is such a thing (since py 2.2). If you are not reusing an existing statvfs object, start with fuse.StatVFS(), and define the attributes. To provide usable information (ie., you want sensible df(1) output, you are suggested to specify the following attributes: - f_bsize - preferred size of file blocks, in bytes - f_frsize - fundamental size of file blcoks, in bytes [if you have no idea, use the same as blocksize] - f_blocks - total number of blocks in the filesystem - f_bfree - number of free blocks - f_files - total number of file inodes - f_ffree - nunber of free file inodes """ logging.debug("PyDedupFS.statfs()") # from https://github.com/xolox/dedupfs/blob/master/dedupfs.py # TODO make this a parameter host_fs = os.statvfs(self.base) return fuse.StatVfs( f_bavail=(host_fs.f_bsize * host_fs.f_bavail) / self.blocksize, # The total number of free blocks available to a non privileged process. f_bfree=(host_fs.f_frsize * host_fs.f_bfree) / self.blocksize, # The total number of free blocks in the file system. f_blocks=(host_fs.f_frsize * host_fs.f_blocks) / self.blocksize, # The total number of blocks in the file system in terms of f_frsize. f_bsize=self.blocksize, # The file system block size in bytes. f_favail=0, # The number of free file serial numbers available to a non privileged process. f_ffree=0, # The total number of free file serial numbers. f_files=0, # The total number of file serial numbers. f_flag=0, # File system flags. Symbols are defined in the <sys/statvfs.h> header file to refer to bits in this field (see The f_flags field). f_frsize=self.blocksize, # The fundamental file system block size in bytes. f_namemax=4294967295)
def statfs(self): """ Retrieves information about the mounted filesystem. Returns a fuse.StatVfs object containing the details. This is optional. If omitted, Fuse will simply report a bunch of 0s. The StatVfs should have the same fields as described in man 2 statfs (Linux Programmer's Manual), except for f_type. This includes the following: f_bsize (optimal transfer block size) f_blocks (number of blocks total) f_bfree (number of free blocks) f_bavail (number of free blocks available to non-root) f_files (number of file nodes in system) f_ffree (number of free file nodes) f_namemax (max length of filenames) Note f_type, f_frsize, f_favail, f_fsid and f_flag are ignored. """ logging.info("statfs") stats = fuse.StatVfs() # Fill it in here. All fields take on a default value of 0. return stats
def statfs(self): return fuse.StatVfs(**loads(db.get(b'vfs')))
def statfs(self): st = fuse.StatVfs() st.f_bsize = file.FS_BLOCK_SIZE st.f_frsize = file.FS_BLOCK_SIZE return st
def statfs(self): return fuse.StatVfs()
def _statfs(self): stat = fuse.StatVfs() # TODO: fill it return stat
def statfs(self): stats = fuse.StatVfs() return stats