Example #1
0
/* initialise the persistent bitmap cache */
RD_BOOL
pstcache_init(uint8 cache_id)
{
	int fd;
	char filename[256];

	if (g_pstcache_enumerated)
		return True;

	g_pstcache_fd[cache_id] = 0;

	if (!(g_bitmap_cache && g_bitmap_cache_persist_enable))
		return False;

	if (!rd_pstcache_mkdir())
	{
		logger(Core, Error,
		       "pstcache_init(), failed to get/make cache directory, disabling feature");
		return False;
	}

	g_pstcache_Bpp = (g_server_depth + 7) / 8;
	sprintf(filename, "cache/pstcache_%d_%d", cache_id, g_pstcache_Bpp);
	logger(Core, Debug, "pstcache_init(), bitmap cache file %s", filename);

	fd = rd_open_file(filename);
	if (fd == -1)
		return False;

	if (!rd_lock_file(fd, 0, 0))
	{
		logger(Core, Error,
		       "pstcache_init(), failed to lock persistent cache file, disabling feature");
		rd_close_file(fd);
		return False;
	}

	g_pstcache_fd[cache_id] = fd;
	return True;
}
Example #2
0
/* initialise the persistent bitmap cache */
BOOL
pstcache_init(uint8 cache_id)
{
	int fd;
	char filename[256];

	if (g_pstcache_enumerated)
		return True;

	g_pstcache_fd[cache_id] = 0;

	if (!(g_bitmap_cache && g_bitmap_cache_persist_enable))
		return False;

	if (!rd_pstcache_mkdir())
	{
		//DEBUGSTR(("failed to get/make cache directory!\n"));
		DEBUGMSG(DBG_TEST, (L"failed to get/make cache directory!\n"));
		return False;
	}

	g_pstcache_Bpp = (g_server_depth + 7) / 8;
	sprintf(filename, "cache/pstcache_%d_%d", cache_id, g_pstcache_Bpp);
	//DEBUGSTR(("persistent bitmap cache file: %s\n", filename));
	DEBUGMSG(DBG_TEST, (L"persistent bitmap cache file: %s\n", filename));

	fd = rd_open_file(filename);
	if (fd == -1)
		return False;

	if (!rd_lock_file(fd, 0, 0))
	{
		warning("Persistent bitmap caching is disabled. (The file is already in use)\n");
		rd_close_file(fd);
		return False;
	}

	g_pstcache_fd[cache_id] = fd;
	return True;
}
Example #3
0
/* initialise the persistent bitmap cache */
RD_BOOL
pstcache_init(rdpPcache * pcache, uint8 cache_id)
{
	int fd;
	char filename[256];

	if (pcache->pstcache_enumerated)
		return True;

	pcache->pstcache_fd[cache_id] = 0;

	if (!(pcache->rdp->settings->bitmap_cache &&
	      pcache->rdp->settings->bitmap_cache_persist_enable))
		return False;

	if (!rd_pstcache_mkdir())
	{
		DEBUG("failed to get/make cache directory!\n");
		return False;
	}

	pcache->pstcache_Bpp = (pcache->rdp->settings->server_depth + 7) / 8;
	sprintf(filename, "cache/pstcache_%d_%d", cache_id, pcache->pstcache_Bpp);
	DEBUG("persistent bitmap cache file: %s\n", filename);

	fd = rd_open_file(filename);
	if (fd == -1)
		return False;

	if (!rd_lock_file(fd, 0, 0))
	{
		ui_warning(pcache->rdp->inst, "Persistent bitmap caching is disabled. (The file is already in use)\n");
		rd_close_file(fd);
		return False;
	}

	pcache->pstcache_fd[cache_id] = fd;
	return True;
}
Example #4
0
/* initialise the persistent bitmap cache */
BOOL
pstcache_init(RDPCLIENT * This, uint8 cache_id)
{
	int fd;
	char filename[256];

	if (This->pstcache_enumerated)
		return True;

	This->pstcache_fd[cache_id] = 0;

	if (!(This->bitmap_cache && This->bitmap_cache_persist_enable))
		return False;

	if (!rd_pstcache_mkdir())
	{
		DEBUG(("failed to get/make cache directory!\n"));
		return False;
	}

	This->pstcache_Bpp = (This->server_depth + 7) / 8;
	sprintf(filename, "cache/pstcache_%d_%d", cache_id, This->pstcache_Bpp);
	DEBUG(("persistent bitmap cache file: %s\n", filename));

	fd = rd_open_file(filename);
	if (fd == -1)
		return False;

	if (!rd_lock_file(fd, 0, 0))
	{
		warning("Persistent bitmap caching is disabled. (The file is already in use)\n");
		rd_close_file(fd);
		return False;
	}

	This->pstcache_fd[cache_id] = fd;
	return True;
}
Example #5
0
/* initialise the persistent bitmap cache */
RDCBOOL
pstcache_init(rdcConnection conn, uint8 cache_id)
{
	int fd;
	char filename[256];

	if (conn->pstcacheEnumerated)
		return True;

	conn->pstcacheFd[cache_id] = 0;

	if (!(conn->bitmapCache && conn->bitmapCachePersist))
		return False;

	if (!rd_pstcache_mkdir())
	{
		DEBUG(("failed to get/make cache directory!\n"));
		return False;
	}

	conn->pstcacheBpp = (conn->serverBpp + 7) / 8;
	sprintf(filename, "cache/pstcache_%d_%d", cache_id, conn->pstcacheBpp);
	DEBUG(("persistent bitmap cache file: %s\n", filename));

	fd = rd_open_file(filename);
	if (fd == -1)
		return False;

	if (!rd_lock_file(fd, 0, 0))
	{
		warning("Persistent bitmap caching is disabled. (The file is already in use)\n");
		rd_close_file(fd);
		return False;
	}

	conn->pstcacheFd[cache_id] = fd;
	return True;
}