[gegl/soc-2013-n-point-deformation] buffer: remove unused memory mapped file backend
- From: Marek Dvoroznak <dvoromar src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl/soc-2013-n-point-deformation] buffer: remove unused memory mapped file backend
- Date: Wed, 3 Jul 2013 17:23:10 +0000 (UTC)
commit 0fcb3910acac74a6e90c4484663c4b148f2d6503
Author: Ville Sokk <ville sokk gmail com>
Date: Thu Jun 27 12:29:05 2013 +0300
buffer: remove unused memory mapped file backend
configure.ac | 4 -
gegl/buffer/Makefile.am | 8 +-
gegl/buffer/gegl-buffer-index.h | 6 +-
gegl/buffer/gegl-buffer-load.c | 127 +--
gegl/buffer/gegl-tile-backend-file-async.c | 10 +-
gegl/buffer/gegl-tile-backend-file-mapped.c | 1224 ---------------------------
6 files changed, 49 insertions(+), 1330 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index a6b2bbf..474e151 100644
--- a/configure.ac
+++ b/configure.ac
@@ -219,7 +219,6 @@ case "$target_or_host" in
;;
x86_64-*-*)
have_x86=yes
- have_64_bit=yes
AC_DEFINE(ARCH_X86, 1, [Define to 1 if you are compiling for ix86.])
AC_DEFINE(ARCH_X86_64, 1, [Define to 1 if you are compiling for amd64.])
;;
@@ -229,7 +228,6 @@ case "$target_or_host" in
;;
ppc64-*-* | powerpc64-*)
have_ppc=yes
- have_64_bit=yes
AC_DEFINE(ARCH_PPC, 1, [Define to 1 if you are compiling for PowerPC.])
AC_DEFINE(ARCH_PPC64, 1, [Define to 1 if you are compiling for PowerPC64.])
;;
@@ -237,8 +235,6 @@ case "$target_or_host" in
;;
esac
-AM_CONDITIONAL(HAVE_64_BIT, test "x$have_64_bit" = "xyes")
-
####################################################
# Check how to generate plug-ins (with gcc at least)
diff --git a/gegl/buffer/Makefile.am b/gegl/buffer/Makefile.am
index d0e1cda..bc19f2e 100644
--- a/gegl/buffer/Makefile.am
+++ b/gegl/buffer/Makefile.am
@@ -36,6 +36,7 @@ libbuffer_la_SOURCES = \
gegl-tile-source.c \
gegl-tile-storage.c \
gegl-tile-backend.c \
+ gegl-tile-backend-file-async.c \
gegl-tile-backend-ram.c \
gegl-tile-handler.c \
gegl-tile-handler-private.h \
@@ -77,10 +78,3 @@ libbuffer_la_SOURCES = \
gegl-tile-handler-log.h \
gegl-tile-handler-zoom.h
-libbuffer_la_SOURCES += gegl-tile-backend-file-async.c
-#if HAVE_64_BIT
-#libbuffer_la_SOURCES += gegl-tile-backend-file-mapped.c
-#else
-#libbuffer_la_SOURCES += gegl-tile-backend-file-async.c
-#endif
-
diff --git a/gegl/buffer/gegl-buffer-index.h b/gegl/buffer/gegl-buffer-index.h
index ff0bda0..10116c4 100644
--- a/gegl/buffer/gegl-buffer-index.h
+++ b/gegl/buffer/gegl-buffer-index.h
@@ -125,11 +125,9 @@ void gegl_buffer_header_init (GeglBufferHeader *header,
void gegl_tile_entry_destroy (GeglBufferTile *entry);
GeglBufferItem *gegl_buffer_read_header(int i,
- goffset *offset,
- gchar *map);
+ goffset *offset);
GList *gegl_buffer_read_index (int i,
- goffset *offset,
- gchar *map);
+ goffset *offset);
#define struct_check_padding(type, size) \
if (sizeof (type) != size) \
diff --git a/gegl/buffer/gegl-buffer-load.c b/gegl/buffer/gegl-buffer-load.c
index b5c1562..b49a575 100644
--- a/gegl/buffer/gegl-buffer-load.c
+++ b/gegl/buffer/gegl-buffer-load.c
@@ -94,37 +94,25 @@ load_info_destroy (LoadInfo *info)
g_slice_free (LoadInfo, info);
}
-/* Reads buffer header from the file descriptor (first argument) or
- * memory mapped file if map argument is not NULL
- */
GeglBufferItem *
-gegl_buffer_read_header (int i,
- goffset *offset,
- gchar *map)
+gegl_buffer_read_header (int i,
+ goffset *offset)
{
goffset placeholder;
GeglBufferItem *ret;
-
if (offset==0)
offset = &placeholder;
- if (map == NULL)
- if(lseek(i, 0, SEEK_SET) == -1)
- g_warning ("failed seeking to %i", 0);
+ if(lseek(i, 0, SEEK_SET) == -1)
+ g_warning ("failed seeking to %i", 0);
*offset = 0;
ret = g_malloc (sizeof (GeglBufferHeader));
- if (map)
- {
- memcpy (ret, map, sizeof (GeglBufferHeader));
- *offset += sizeof (GeglBufferHeader);
- }
- else
- {
- ssize_t sz_read = read(i, ret, sizeof(GeglBufferHeader));
- if (sz_read != -1)
- *offset += sz_read;
- }
+ {
+ ssize_t sz_read = read(i, ret, sizeof(GeglBufferHeader));
+ if (sz_read != -1)
+ *offset += sz_read;
+ }
GEGL_NOTE (GEGL_DEBUG_BUFFER_LOAD, "read header: tile-width: %i tile-height: %i next:%i %ix%i\n",
ret->header.tile_width,
@@ -145,41 +133,30 @@ gegl_buffer_read_header (int i,
}
/* reads a block of information from a geglbuffer that resides in an GInputStream,
- * if offset is NULL it is read from the current offset of the stream. If offset
+ * if offset is NULL it is read from the current offsetition of the stream. If offset
* is passed in the offset stored at the location is used as the initial seeking
* point and will be updated with the offset after the read is completed.
- *
- * If the map argument is not NULL then the block is memcpyd from the passed in
- * memory mapped file.
*/
-static GeglBufferItem *read_block (int i,
- goffset *offset,
- gchar *map)
+static GeglBufferItem *read_block (int i,
+ goffset *offset)
{
- GeglBufferBlock block;
- GeglBufferItem *ret;
- gsize byte_read = 0;
- gint own_size = 0;
- gsize block_size = sizeof (GeglBufferBlock);
+ GeglBufferBlock block;
+ GeglBufferItem *ret;
+ gsize byte_read = 0;
+ gint own_size=0;
if (*offset==0)
return NULL;
- if (offset && map == NULL)
+ if (offset)
if(lseek(i, *offset, SEEK_SET) == -1)
g_warning ("failed seeking to %i", (gint)*offset);
- if (map)
- {
- memcpy (&block, map + *offset, block_size);
- byte_read += block_size;
- }
- else
- {
- ssize_t sz_read = read (i, &block, block_size);
- if(sz_read != -1)
- byte_read += sz_read;
- }
+ {
+ ssize_t sz_read = read (i, &block, sizeof (GeglBufferBlock));
+ if(sz_read != -1)
+ byte_read += sz_read;
+ }
GEGL_NOTE (GEGL_DEBUG_BUFFER_LOAD, "read block: length:%i next:%i",
block.length, (guint)block.next);
@@ -207,41 +184,25 @@ static GeglBufferItem *read_block (int i,
* versions
*/
ret = g_malloc (own_size);
- memcpy (ret, &block, block_size);
-
- if (map)
- {
- memcpy (((gchar*)ret) + block_size, map + *offset + byte_read,
- own_size - block_size);
- byte_read += own_size - block_size;
- }
- else
- {
- ssize_t sz_read = read (i, ((gchar*)ret) + block_size,
- own_size - block_size);
- if(sz_read != -1)
- byte_read += sz_read;
- }
+ memcpy (ret, &block, sizeof (GeglBufferBlock));
+ {
+ ssize_t sz_read = read (i, ((gchar*)ret) + sizeof(GeglBufferBlock),
+ own_size - sizeof(GeglBufferBlock));
+ if(sz_read != -1)
+ byte_read += sz_read;
+ }
ret->block.length = own_size;
}
else if (block.length < own_size)
{
ret = g_malloc (own_size);
- memcpy (ret, &block, block_size);
-
- if (map)
- {
- memcpy (((gchar*)ret) + block_size, map + *offset + byte_read,
- block.length - block_size);
- byte_read += block.length - block_size;
- }
- else
- {
- ssize_t sz_read = read (i, ((gchar*)ret) + block_size,
- block.length - block_size);
- if(sz_read != -1)
- byte_read += sz_read;
- }
+ memcpy (ret, &block, sizeof (GeglBufferBlock));
+ {
+ ssize_t sz_read = read (i, ret + sizeof(GeglBufferBlock),
+ block.length - sizeof (GeglBufferBlock));
+ if(sz_read != -1)
+ byte_read += sz_read;
+ }
ret->block.length = own_size;
}
else
@@ -254,21 +215,15 @@ static GeglBufferItem *read_block (int i,
return ret;
}
-/* Reads buffer index from the file descriptor (first argument) or
- * memory mapped file if map argument is not NULL
- */
GList *
-gegl_buffer_read_index (int i,
- goffset *offset,
- gchar *map)
+gegl_buffer_read_index (int i,
+ goffset *offset)
/* load the index */
{
GList *ret = NULL;
GeglBufferItem *item;
- for (item = read_block (i, offset, map);
- item;
- item = read_block (i, offset, map))
+ for (item = read_block (i, offset); item; item = read_block (i, offset))
{
g_assert (item);
GEGL_NOTE (GEGL_DEBUG_BUFFER_LOAD,"loaded item: %i, %i, %i offset:%i next:%i", item->tile.x,
@@ -312,7 +267,7 @@ gegl_buffer_load (const gchar *path)
}
{
- GeglBufferItem *header = gegl_buffer_read_header (info->i, &info->offset, NULL);
+ GeglBufferItem *header = gegl_buffer_read_header (info->i, &info->offset);
g_assert (header);
info->header = header->header;
info->offset = info->header.next;
@@ -339,7 +294,7 @@ gegl_buffer_load (const gchar *path)
*/
g_assert (babl_format_get_bytes_per_pixel (info->format) == info->header.bytes_per_pixel);
- info->tiles = gegl_buffer_read_index (info->i, &info->offset, NULL);
+ info->tiles = gegl_buffer_read_index (info->i, &info->offset);
/* load each tile */
{
diff --git a/gegl/buffer/gegl-tile-backend-file-async.c b/gegl/buffer/gegl-tile-backend-file-async.c
index 577021d..e3a76b8 100644
--- a/gegl/buffer/gegl-tile-backend-file-async.c
+++ b/gegl/buffer/gegl-tile-backend-file-async.c
@@ -1032,12 +1032,12 @@ gegl_tile_backend_file_load_index (GeglTileBackendFile *self,
* are added here
*/
/* reload header */
- new_header = gegl_buffer_read_header (self->i, &offset, NULL)->header;
+ new_header = gegl_buffer_read_header (self->i, &offset)->header;
while (new_header.flags & GEGL_FLAG_LOCKED)
{
g_usleep (50000);
- new_header = gegl_buffer_read_header (self->i, &offset, NULL)->header;
+ new_header = gegl_buffer_read_header (self->i, &offset)->header;
}
if (new_header.rev == self->header.rev)
@@ -1053,7 +1053,7 @@ gegl_tile_backend_file_load_index (GeglTileBackendFile *self,
tile_size = gegl_tile_backend_get_tile_size (GEGL_TILE_BACKEND (self));
offset = self->header.next;
- self->tiles = gegl_buffer_read_index (self->i, &offset, NULL);
+ self->tiles = gegl_buffer_read_index (self->i, &offset);
self->in_offset = self->out_offset = -1;
backend = GEGL_TILE_BACKEND (self);
@@ -1177,7 +1177,7 @@ gegl_tile_backend_file_constructor (GType type,
}
self->i = g_open (self->path, O_RDONLY, 0);
- self->header = gegl_buffer_read_header (self->i, &offset, NULL)->header;
+ self->header = gegl_buffer_read_header (self->i, &offset)->header;
self->header.rev = self->header.rev -1;
/* we are overriding all of the work of the actual constructor here,
@@ -1296,7 +1296,7 @@ gegl_tile_backend_file_try_lock (GeglTileBackendFile *self)
{
GeglBufferHeader new_header;
- new_header = gegl_buffer_read_header (self->i, NULL, NULL)->header;
+ new_header = gegl_buffer_read_header (self->i, NULL)->header;
if (new_header.flags & GEGL_FLAG_LOCKED)
{
return FALSE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]