(func, *args, **kwargs)
Decorator for the methods that follow
Decorator for the methods that follow
Decorator for the methods that follow
def _wrapper(func, *args, **kwargs):
        'Decorator for the methods that follow'

        try:
            if func.__name__ == "init":
                # init may not fail, as its return code is just stored as
                # private_data field of struct fuse_context
                return func(*args, **kwargs) or 0

            else:
                try:
                    return func(*args, **kwargs) or 0

                except OSError as e:
                    if e.errno > 0:
                        log.debug(
                            "FUSE operation %s raised a %s, returning errno %s.",
                            func.__name__, type(e), e.errno, exc_info=True)
                        return -e.errno
                    else:
                        log.error(
                            "FUSE operation %s raised an OSError with negative "
                            "errno %s, returning errno.EINVAL.",
                            func.__name__, e.errno, exc_info=True)
                        return -errno.EINVAL

                except Exception:
                    log.error("Uncaught exception from FUSE operation %s, "
                              "returning errno.EINVAL.",
                              func.__name__, exc_info=True)
                    return -errno.EINVAL

        except BaseException as e:
            self.__critical_exception = e
            log.critical(
                "Uncaught critical exception from FUSE operation %s, aborting.",
                func.__name__, exc_info=True)
            # the raised exception (even SystemExit) will be caught by FUSE
            # potentially causing SIGSEGV, so tell system to stop/interrupt FUSE
            fuse_exit()
            return -errno.EFAULT
def _wrapper ( func , * args , * * kwargs ) : try : if func . __name__ == "init" : # init may not fail, as its return code is just stored as # private_data field of struct fuse_context return func ( * args , * * kwargs ) or 0 else : try : return func ( * args , * * kwargs ) or 0 except OSError as e : if e . errno > 0 : log . debug ( "FUSE operation %s raised a %s, returning errno %s." , func . __name__ , type ( e ) , e . errno , exc_info = True ) return - e . errno else : log . error ( "FUSE operation %s raised an OSError with negative " "errno %s, returning errno.EINVAL." , func . __name__ , e . errno , exc_info = True ) return - errno . EINVAL except Exception : log . error ( "Uncaught exception from FUSE operation %s, " "returning errno.EINVAL." , func . __name__ , exc_info = True ) return - errno . EINVAL except BaseException as e : self . __critical_exception = e log . critical ( "Uncaught critical exception from FUSE operation %s, aborting." , func . __name__ , exc_info = True ) # the raised exception (even SystemExit) will be caught by FUSE # potentially causing SIGSEGV, so tell system to stop/interrupt FUSE fuse_exit ( ) return - errno . EFAULT