cd86040da7e16723e8029a7a83884921b8e4da28
[platform/core/system/tizen-platform-wrapper.git] / src / buffer.h
1 /*
2  * Copyright (C) 2013 Intel Corporation.
3  * 
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
17  *
18  * Authors:
19  *   José Bollo <jose.bollo@open.eurogiciel.org>
20  *   Stéphane Desneux <stephane.desneux@open.eurogiciel.org>
21  *   Jean-Benoit Martin <jean-benoit.martin@open.eurogiciel.org>
22  *
23  */
24 #ifndef BUFFER_H
25 #define BUFFER_H
26
27 /* structure of the buffer */
28 struct buffer {
29     char    *buffer;    /* start address */
30     size_t   length;    /* length in byte */
31     int      mapped;    /* is memory mapped */
32 };
33
34 /*
35    Create the 'buffer' from reading content of the file of 'pathname'.
36    Returns 0 if success, -1 if error occured (see then errno)
37 */
38 int buffer_create( struct buffer *buffer, const char *pathname);
39
40 /*
41    Destroy the 'buffer'.
42    Returns 0 if success, -1 if error occured (see then errno)
43 */
44 int buffer_destroy( struct buffer *buffer);
45
46 #endif
47