def __init__(self, path, flags, *mode): print "**********************XXXXXXXXXXXXX MUSICFSFILE **************" realFile = TreeNodes.processTree(path, GlobalConfig.getTree(), TreeNodes.Node.LookupFile, []) self.file = os.fdopen(os.open(realFile, flags, *mode), flag2mode(flags)) self.fd = self.file.fileno()
def readdir(self, path, offset): print "READING DIR", path items = TreeNodes.processTree(path, self.config.getTree(), TreeNodes.Node.ReadDir, []) for item in items: if (item != ""): yield fuse.Direntry(item)
def visit(tree): if DEBUG: print(f"step--{tree}") print(f"type:{type(tree)}") print(f"children:{len(tree.children)}") if isinstance(tree, Tree): # rule matches that propagate the visitor down to the actual rules / operations if tree.data == "start": return get_operations.visit(tree.children[0]) if tree.data == "orexpr": return get_operations.visit(tree.children[0]) if tree.data == "andexpr": return get_operations.visit(tree.children[0]) if tree.data == "notexpr": return get_operations.visit(tree.children[0]) if tree.data == "implyexpr": return get_operations.visit(tree.children[0]) if tree.data == "bicondexpr": return get_operations.visit(tree.children[0]) # return the value of the variable to the last operation if tree.data == "variable": opvar = TreeNodes.OP_VAR(tree.children[0].value) if not opvar in get_operations.operations: get_operations.operations.append(opvar) return opvar # the operations if tree.data == "not": opnot = TreeNodes.OP_NOT(get_operations.visit(tree.children[0])) if not opnot in get_operations.operations: get_operations.operations.append(opnot) return opnot if tree.data == "and": opand = TreeNodes.OP_AND(get_operations.visit(tree.children[0]), get_operations.visit(tree.children[1])) if not opand in get_operations.operations: get_operations.operations.append(opand) return opand if tree.data == "or": opor = TreeNodes.OP_OR(get_operations.visit(tree.children[0]), get_operations.visit(tree.children[1])) if not opor in get_operations.operations: get_operations.operations.append(opor) return opor if tree.data == "bicondition": bicondop = TreeNodes.OP_BICOND(get_operations.visit(tree.children[0]), get_operations.visit(tree.children[1])) if not bicondop in get_operations.operations: get_operations.operations.append(bicondop) return bicondop if tree.data == "imply": opimply = TreeNodes.OP_IMPLY(get_operations.visit(tree.children[0]), get_operations.visit(tree.children[1])) if not opimply in get_operations.operations: get_operations.operations.append(opimply) return opimply if tree.data == "parentesis": paren = TreeNodes.OP_PAREN(get_operations.visit(tree.children[0])) return paren
def getattr(self, path): print "GETATTR -%s-" % path return TreeNodes.processTree(path, self.config.getTree(), TreeNodes.Node.GetAttr, [])
def readdir(self, path, offset): print "READING DIR",path items = TreeNodes.processTree(path,self.config.getTree(),TreeNodes.Node.ReadDir,[]) for item in items: if ( item != "" ): yield fuse.Direntry(item)
def getattr(self, path): print "GETATTR -%s-"%path return TreeNodes.processTree(path,self.config.getTree(),TreeNodes.Node.GetAttr,[])
def __init__(self, path, flags, *mode): print "**********************XXXXXXXXXXXXX MUSICFSFILE **************" realFile = TreeNodes.processTree(path,GlobalConfig.getTree(),TreeNodes.Node.LookupFile,[]) self.file = os.fdopen(os.open(realFile, flags, *mode), flag2mode(flags)) self.fd = self.file.fileno()