@Override
	public int getdir(String path, FuseDirFiller dirFiller) throws FuseException {
		Iterable<EntityInfo> iterator;
		try {
			iterator = fileSystem.listDirectory(path);
			if (iterator == null)
				System.err.println("Your file system returned null for readDirectory(" + path + ")");
		} catch (PathNotFoundException e) {
			return Errno.ENOENT;
		} catch (AccessDeniedException e) {
			return Errno.EACCES;
		} catch (NotADirectoryException e) {
			return Errno.ENOTDIR;
		}
        dirFiller.add(".", 0, 0);
        dirFiller.add("..", 0, 0);
		for (EntityInfo info : iterator)
		{
			UnixPermissions perms;
			try {
				perms = fileSystem.getUnixPermissions(info.getFullPath());
			} catch (PathNotFoundException e) {
				System.err.println("readDirectory and getUnixPermissions inconsistent for " + info.getFullPath());
				e.printStackTrace();
				continue;
			}
			int mode = 0;
			
			if (FileInfo.class.isInstance(info))
				mode |= FuseFtypeConstants.TYPE_FILE;
			
			if (DirectoryInfo.class.isInstance(info))
				mode |= FuseFtypeConstants.TYPE_DIR; 
			
			if (SymbolicLinkInfo.class.isInstance(info))
			{
//				SymbolicLinkInfo sym = (SymbolicLinkInfo)info;
				mode |= FuseFtypeConstants.TYPE_SYMLINK;
			}
			
			mode |= perms.getPermissions();
			
            dirFiller.add(info.getFileName(), info.hashCode(), mode);
		}
		return 0;
	}