some pending cosmetics, comments and checks

This commit is contained in:
Christian Thaeter 2008-11-13 17:08:56 +01:00
parent da7fd1242b
commit c2e2a0e525
7 changed files with 19 additions and 9 deletions

View file

@ -49,9 +49,15 @@ typedef lumiera_file* LumieraFile;
#include "backend/filehandle.h"
#include "backend/file.h"
#include "backend/mmapings.h"
/**
* File modes:
* LUMIERA_FILE_READONLY existing file for reading only
* LUMIERA_FILE_READWRITE existing file for reading and writing
* LUMIERA_FILE_CREATE non-existing file for reading and writing
* LUMIERA_FILE_RECREATE remove and recreated existing, file for reading and writing
*/
#define LUMIERA_FILE_READONLY (O_RDONLY | O_LARGEFILE | O_NOATIME)
#define LUMIERA_FILE_READWRITE (O_RDWR | O_LARGEFILE | O_NOATIME)
#define LUMIERA_FILE_CREATE (O_RDWR | O_LARGEFILE | O_NOATIME | O_CREAT | O_EXCL)

View file

@ -261,7 +261,7 @@ lumiera_filedescriptor_new (LumieraFiledescriptor template)
self->realsize = template->stat.st_size;
self->flags = template->flags;
self->handle = NULL;
self->handle = NULL;
self->mmapings = NULL;
llist_init (&self->files);

View file

@ -103,5 +103,6 @@ lumiera_filehandle_handle (LumieraFilehandle self)
}
self->fd = fd;
}
return self->fd;
}

View file

@ -116,6 +116,7 @@ lumiera_filehandlecache_checkout (LumieraFilehandlecache self, LumieraFilehandle
return handle;
}
void
lumiera_filehandlecache_checkin (LumieraFilehandlecache self, LumieraFilehandle handle)
{

View file

@ -28,7 +28,6 @@
#include <unistd.h>
#include <sys/mman.h>
/**
* @file
*
@ -206,7 +205,7 @@ lumiera_mmap_init (LumieraMMap self, LumieraFile file, LList acquirer, off_t sta
ewrite:
efile:
lumiera_file_handle_release (file);
free (self);
lumiera_free (self);
return NULL;
}
@ -233,10 +232,11 @@ lumiera_mmap_delete (LumieraMMap self)
TRACE (mmap);
if (self)
{
//LUMIERA_MUTEX_SECTION (mmapings, self->rh, &self->lock)
lumiera_mmapcache_forget (lumiera_mcache, self);
llist_unlink (&self->searchnode); TODO ("must lock mmapings -> deadlock");
/* The matching mappings->lock must be hold or being unrelevant (mappings destructor) here, we can't asset this from here, good luck */
llist_unlink (&self->searchnode);
munmap (self->address, self->size);
free (self->refmap);
free (self);

View file

@ -37,6 +37,7 @@ typedef lumiera_mmap* LumieraMMap;
NOBUG_DECLARE_FLAG (mmap);
/**
* @file
* MMap objects cover a memory maped range in a file
@ -53,14 +54,14 @@ struct lumiera_mmap_struct
/** used for the mrucache when checked in the cache OR for attaching owners when checked out **/
llist cachenode;
/** all mmaps of a file are chained in this list, used to find ranges **/
/** all mmaps of a filedescriptor are chained in this list, used to find ranges **/
llist searchnode;
off_t start;
size_t size;
void* address;
/** array with refcounters per page **/
/** array with refcounters per chunk **/
unsigned short* refmap;
};

View file

@ -106,6 +106,7 @@ lumiera_mmapcache_forget (LumieraMMapcache self, LumieraMMap map)
if (!llist_is_empty (&map->cachenode))
{
TODO ("cached stats");
REQUIRE (llist_is_member (&self->cache.cache_list, &map->cachenode), "Map object not in cache");
llist_unlink (&map->cachenode);
}
self->total -= map->size;