def main(): fuse.fuse_python_api = (0, 2) fuse.feature_assert('stateful_files', 'has_init') fs = WallbaseFS() fs.parse(errex=1) fs.multithreaded = True fs.main()
def __init__ (self, _resolver, _mutator) : fuse.fuse_python_api = (0, 2) fuse.feature_assert (26) fuse.Fuse.__init__ (self) Base.__init__ (self) self.multithreaded = False self.resolver = _resolver self.mutator = _mutator
def main(): # Fuse sanity check if not hasattr(fuse, '__version__'): raise RuntimeError, \ "Your fuse python module doesn't know it's version, probably it's too old." # Setup fuse.fuse_python_api = (0, 2) fuse.feature_assert('stateful_files', 'has_init') syslog.openlog('fts', syslog.LOG_PID, syslog.LOG_USER) usage = """ TFTP supplicant: provide pxelinux configuration files based on external state information. """ + fuse.Fuse.fusage fs = PXEfs(version="%prog " + fuse.__version__, usage=usage, dash_s_do='setsingle') # Disable multithreading and set up the fs parser fs.multithreaded = False fs.parser.add_option( mountopt="root", metavar="PATH", default=os.sep, help="mirror filesystem from PATH [default: %default]") fs.parse(values=fs, errex=1) try: if fs.fuse_args.mount_expected(): os.chdir(fs.root) except OSError: syslog.syslog(syslog.LOG_ERR, "can't enter static filesystem") sys.exit(1) syslog.syslog(syslog.LOG_INFO, "fts is now mounted on %s" % fs.cfg_path) fs.main()
def main(): # Fuse sanity check if not hasattr(fuse, '__version__'): raise RuntimeError, \ "Your fuse python module doesn't know it's version, probably it's too old." # Setup fuse.fuse_python_api = (0, 2) fuse.feature_assert('stateful_files', 'has_init') syslog.openlog('fts', syslog.LOG_PID, syslog.LOG_USER) usage = """ TFTP supplicant: provide pxelinux configuration files based on external state information. """ + fuse.Fuse.fusage fs = PXEfs(version="%prog " + fuse.__version__, usage=usage, dash_s_do='setsingle') # Disable multithreading and set up the fs parser fs.multithreaded = False fs.parser.add_option(mountopt="root", metavar="PATH", default=os.sep, help="mirror filesystem from PATH [default: %default]") fs.parse(values=fs, errex=1) try: if fs.fuse_args.mount_expected(): os.chdir(fs.root) except OSError: syslog.syslog(syslog.LOG_ERR, "can't enter static filesystem") sys.exit(1) syslog.syslog(syslog.LOG_INFO, "fts is now mounted on %s" % fs.cfg_path) fs.main()
import workflow import storage import rebuild import clean import subprocess #import zk #cq #Check fuse version: if not hasattr(fuse, '__version__'): raise RuntimeError, \ "your fuse-py doesn't know of fuse.__version__, probably it's too old." #Use the stateful_files and has_init options to enable stateful file IO: fuse.fuse_python_api = (0, 2) fuse.feature_assert('stateful_files','has_init') #Get default path of system setting file: setting = common.Setting() settingpath = common.settingpath #Define global state for the system: globalstate = "normal" def flag2mode(flags): '''Convert file flag to mode.''' md = {os.O_RDONLY: 'r', os.O_WRONLY: 'w', os.O_RDWR: 'w+'} m = md[flags & (os.O_RDONLY | os.O_WRONLY | os.O_RDWR)] if flags & os.O_APPEND: m = m.replace('w', 'a', 1)
from errno import * from stat import * import fcntl from hashlib import md5 from subprocess import Popen, PIPE import fuse from fuse import Fuse if not hasattr(fuse, '__version__'): raise RuntimeError, \ "your fuse-py doesn't know of fuse.__version__, probably it's too old." fuse.fuse_python_api = (0, 2) fuse.feature_assert('stateful_files', 'has_init') def CreateRS(path): print "Creating Reed-solomon version of file " + path + " ..." os.system("freeze.sh '" + path + "' > '" + path + ".frozen.RS'") print "Created." def CheckCRC(path): print "Checking CRC of file " + path rsMD5 = md5() signal.signal(signal.SIGPIPE, signal.SIG_IGN) rsMD5.update( Popen("melt.sh '" + path + ".frozen.RS'", shell=True, stdout=PIPE).stdout.read())
import fuse import os fuse.fuse_python_api = (0, 2) fuse.feature_assert('stateful_files') class TimeMachineFS(fuse.Fuse): """ A fuse.Fuse subclass to interface with a mounted time machine backup. """ # FUSE API methods def getattr(self, path): return self.run_operation_on_real_path(path, os.lstat) def readdir(self, path, offset): entries = self.run_operation_on_real_path(path, os.listdir) for e in entries: yield fuse.Direntry(e) def statfs(self): return self.run_operation_on_real_path(path, os.statvfs) def access(self, path, mode): res = self.run_operation_on_real_path(path, lambda rp: os.access(rp, mode)) # convert True/False return to 0 or 1 as appropriate. if res: return 0 return 1 def readlink(self, path): return self.run_operation_on_real_path(path, os.readlink)
import fuse from fuse import Fuse from deeputil import Dummy DUMMY_LOG = Dummy() if not hasattr(fuse, "__version__"): raise RuntimeError( "your fuse-py doesn't know of fuse.__version__, probably it's too old." ) fuse.fuse_python_api = (0, 2) fuse.feature_assert("stateful_files", "has_init") def flag2mode(flags): md = {os.O_RDONLY: "r", os.O_WRONLY: "w", os.O_RDWR: "w+"} m = md[flags & (os.O_RDONLY | os.O_WRONLY | os.O_RDWR)] if flags | os.O_APPEND: m = m.replace("w", "a", 1) return m def logit(fn): def _fn(*args, **kwargs): self = args[0]
import serial, copy, traceback SEROPTS = { "port": "/dev/ttyUSB0", "baudrate": 9600, "timeout": 5 } import fuse from fuse import Fuse # Must specify Fuse API version fuse.fuse_python_api = (0, 2) fuse.feature_assert("has_fsinit", "has_fsdestroy") DIR = 0755 | stat.S_IFDIR FILE = 0644 | stat.S_IFREG LINK = 0644 | stat.S_IFLNK def closeIgnoringError(closeable): try: closeable.close() except: pass # ignore def reader(log, producer, callback, done): log("Consumer thread starting") is_open = False
import errno import fuse import exceptions import time import functools import view import threading import offline_update import notifyd import pyinotify if not hasattr(fuse, "__version__"): raise RuntimeError, "your fuse-py doesn't know of fuse.__version__, probably it's too old." fuse.fuse_python_api = (0, 2) fuse.feature_assert("stateful_files", "has_init") from cache import cache import item_access import node class Config(object): ENABLE_VALUE_FILTERS = False ENABLE_ROOT_ITEM_LINKS = False def __init__(self, enableValueFilters=ENABLE_VALUE_FILTERS, enableRootItemLinks=ENABLE_ROOT_ITEM_LINKS): self.enableValueFilters = enableValueFilters self.enableRootItemLinks = enableRootItemLinks
try: import _find_fuse_parts except ImportError: pass import fuse from fuse import Fuse if not hasattr(fuse, '__version__'): raise RuntimeError, "your fuse-py doesn't know of fuse.__version__, probably it's too old." fuse.fuse_python_api = (0, 2) fuse.feature_assert('has_init') class openFile: def __init__(self, owner, fd=-1, size=0, file=False, path=False, upload=False, uploadName=False, storeDir=False): self.owner = owner self.fd = int(fd) self.size = int(size) self.file = file self.path = path self.upload = upload self.uploadName = uploadName self.storeDir = storeDir class userFile:
# 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 this program. If not, see <http://www.gnu.org/licenses/>. import os import fuse import errno from django.conf import settings from django.core.urlresolvers import resolve, Resolver404 fuse.fuse_python_api = (0, 2) fuse.feature_assert("stateful_files") __all__ = ("DjangoFs",) def render(fn): def wrapped(self, path, *args, **kwargs): try: # Resolve requested URL to a view and "render" it. view_fn, view_args, view_kwargs = resolve(path, urlconf=settings.FUSE_URLCONF) response = view_fn(*view_args, **view_kwargs) # Pass the response as the first argument, replacing # 'path' from the callsite in fuse.py return fn(self, response, *args, **kwargs)
# You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. import os import fuse import stat import errno import shutil import itertools from .utils import BaseDirException, MyStat, get_package_info from .aptfile import AptFsFile from .download import download, DownloadError fuse.fuse_python_api = (0, 2) fuse.feature_assert('stateful_files', 'has_destroy') class AptFs(fuse.Fuse): def __init__(self, *args, **kwargs): fuse.Fuse.__init__(self, *args, **kwargs) self.source_packages = {} self.binary_packages = {} self.max_unpacked_packages = 3 self.secure = False self.temp_dir = None self.show_binary_symlinks = True self.window = []
# # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. import errno import os import stat import sys import time import fuse fuse.fuse_python_api = (0, 2) fuse.feature_assert(26) class Direntry(fuse.Direntry): def __init__(self, name, **kwargs): self.st_dev = 0 self.st_ino = 0 self.st_mode = kwargs.get('type', 0) self.st_nlink = 0 self.st_uid = os.getuid() self.st_gid = os.getgid() self.st_size = 0 self.st_rdev = 0 self.st_blksize = 4096 self.st_blocks = 0