source: trunk/debathena/debathena/pyhesiodfs/debian/patches/no-hello.patch @ 23260

Revision 23260, 2.9 KB checked in by broder, 15 years ago (diff)
Pull new pyHesiodFS that includes per-user caches and the ability to manually remove and create symlinks.
  • debathena-pyhesiodfs-0.0.r162

    old new  
    6969 
    7070fuse.fuse_python_api = (0, 2) 
    7171 
    72 hello_path = '/README.txt' 
    73 hello_str = """This is the pyhesiodfs FUSE autmounter. To access a Hesiod filsys, just access 
    74 %(mountpoint)s/name. 
    75  
    76 If you're using the Finder, try pressing Cmd+Shift+G and then entering 
    77 %(mountpoint)s/name""" 
    78  
    7972if not hasattr(fuse, 'Stat'): 
    8073    fuse.Stat = object 
    8174 
     
    128121        if path == '/': 
    129122            st.st_mode = stat.S_IFDIR | 0777 
    130123            st.st_nlink = 2 
    131         elif path == hello_path: 
    132             st.st_mode = stat.S_IFREG | 0444 
    133             st.st_nlink = 1 
    134             st.st_size = len(hello_str) 
    135124        elif '/' not in path[1:]: 
    136125            if path[1:] not in self.negcache and self.findLocker(path[1:]): 
    137126                st.st_mode = stat.S_IFLNK | 0777 
     
    178167                return None 
    179168 
    180169    def getdir(self, path): 
    181         return [(i, 0) for i in (['.', '..', hello_path[1:]] + self.getCachedLockers())] 
     170        return [(i, 0) for i in (['.', '..'] + self.getCachedLockers())] 
    182171 
    183172    def readdir(self, path, offset): 
    184173        for (r, zero) in self.getdir(path): 
     
    187176    def readlink(self, path): 
    188177        return self.findLocker(path[1:]) 
    189178 
    190     def open(self, path, flags): 
    191         if path != hello_path: 
    192             return -errno.ENOENT 
    193         accmode = os.O_RDONLY | os.O_WRONLY | os.O_RDWR 
    194         if (flags & accmode) != os.O_RDONLY: 
    195             return -errno.EACCES 
    196  
    197     def read(self, path, size, offset): 
    198         if path != hello_path: 
    199             return -errno.ENOENT 
    200         slen = len(hello_str) 
    201         if offset < slen: 
    202             if offset + size > slen: 
    203                 size = slen - offset 
    204             buf = hello_str[offset:offset+size] 
    205         else: 
    206             buf = '' 
    207         return buf 
    208      
    209179    def symlink(self, src, path): 
    210         if path == '/' or path == hello_path: 
     180        if path == '/': 
    211181            return -errno.EPERM 
    212182        elif '/' not in path[1:]: 
    213183            self.mounts[self._user()][path[1:]] = src 
     
    217187            return -errno.EPERM 
    218188     
    219189    def unlink(self, path): 
    220         if path == '/' or path == hello_path: 
     190        if path == '/': 
    221191            return -errno.EPERM 
    222192        elif '/' not in path[1:]: 
    223193            del self.mounts[self._user()][path[1:]] 
     
    226196            return -errno.EPERM 
    227197 
    228198def main(): 
    229     global hello_str 
    230199    try: 
    231200        usage = Fuse.fusage 
    232201        server = PyHesiodFS(version="%prog " + fuse.__version__, 
     
    242211            sys.argv.pop(1) 
    243212        server = PyHesiodFS() 
    244213 
    245     hello_str = hello_str % {'mountpoint': server.parse(errex=1).mountpoint} 
    246214    server.main() 
    247215 
    248216if __name__ == '__main__': 
Note: See TracBrowser for help on using the repository browser.