/* filedescriptor.h - file handling Copyright (C) Lumiera.org 2008, Christian Thaeter This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef LUMIERA_FILEDESCRIPTOR_H #define LUMIERA_FILEDESCRIPTOR_H #include "lib/mutex.h" #include typedef struct lumiera_filedescriptor_struct lumiera_filedescriptor; typedef lumiera_filedescriptor* LumieraFiledescriptor; #include "backend/filehandle.h" #include "backend/file.h" struct lumiera_filedescriptor_struct { struct stat stat; /* create after first open, maintained metadata, MUST BE FIRST! */ int flags; /* open flags, must be masked for reopen */ lumiera_mutex lock; /* locks operations on this file descriptor */ unsigned reopened; /* count for reopens 0=not yet opened, 1=first, 2..=reopened*/ //LumieraFileMap mappings; //LumieraWriteBuffer writebuffer; }; LumieraReference lumiera_filedescriptor_acquire (LumieraReference descriptor, const char* name, int flags); LumieraFiledescriptor lumiera_filedescriptor_new (LumieraFiledescriptor template); void lumiera_filedescriptor_delete (LumieraFiledescriptor self); #endif