Lumiera  0.pre.03
»edityourfreedom«
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
filehandle.h
Go to the documentation of this file.
1 /*
2  FILEHANDLE - filehandle management and caching
3 
4  Copyright (C) Lumiera.org
5  2008, Christian Thaeter <ct@pipapo.org>
6 
7  This program is free software; you can redistribute it and/or
8  modify it under the terms of the GNU General Public License as
9  published by the Free Software Foundation; either version 2 of
10  the License, or (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 
21 */
22 
23 
31 #ifndef BACKEND_FILEHANDLE_H
32 #define BACKEND_FILEHANDLE_H
33 
34 #include "lib/error.h"
35 #include "lib/llist.h"
36 
37 typedef struct lumiera_filehandle_struct lumiera_filehandle;
38 typedef lumiera_filehandle* LumieraFilehandle;
39 
40 #include "backend/filedescriptor.h"
41 
42 //NOBUG_DECLARE_FLAG (filehandle);
43 
44 
45 
50 {
51  llist cachenode;
52  int fd;
53  unsigned use_cnt;
55 };
56 
57 
66 
67 
75 
76 
83 void*
85 
86 
87 int
89 
90 
94 static inline int
96 {
97  REQUIRE (self->descriptor);
98  return self->fd;
99 }
100 
101 #endif /*BACKEND_FILEHANDLE_H*/
void * lumiera_filehandle_destroy_node(LList node)
destroy the resources associated either a filehandle structure.
Definition: filehandle.c:66
File descriptors are the underlying working horse in accessing files.
static int lumiera_filehandle_get(LumieraFilehandle self)
just accessor, no safety net
Definition: filehandle.h:95
lumiera_filehandle * LumieraFilehandle
Definition: filehandle.h:38
Lumiera error handling (C interface).
int lumiera_filehandle_handle(LumieraFilehandle self)
Definition: filehandle.c:81
LumieraFiledescriptor descriptor
Definition: filehandle.h:54
lumiera_filedescriptor * LumieraFiledescriptor
Intrusive cyclic double linked list There is only one node type which contains a forward and a backwa...
LumieraFilehandle lumiera_filehandle_new(LumieraFiledescriptor descriptor)
Allocate a new filehandle structure.
Definition: filehandle.c:58
LumieraFilehandle lumiera_filehandle_init(LumieraFilehandle self, LumieraFiledescriptor descriptor)
Initialise filehandle structure.
Definition: filehandle.c:43
llist * LList
Definition: llist.h:91