1 /******************************************************************************
2 Copyright 2006 Palmsource, Inc (an ACCESS company).
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
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 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser 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
18 *****************************************************************************/
24 int main(int argc, char *argv[])
26 char *data = "this is a string";
27 char *data2 = malloc(sizeof(char) * 32000);
29 struct fuse_file_info fi = { 0 };
32 memset(data2, '2', 32000);
34 sqlfs_open(argv[1], &sqlfs);
36 sqlfs_proc_mkdir(sqlfs, "/test", 0666);
37 sqlfs_proc_mkdir(sqlfs, "/test/1", 0666);
38 sqlfs_proc_mkdir(sqlfs, "/test/2", 0666);
39 sqlfs_proc_mkdir(sqlfs, "/a/b/c/d/e/f/g", 0666);
41 sqlfs_proc_write(sqlfs, "/test/2/file", data, strlen(data), 0, &fi);
42 sqlfs_proc_rmdir(sqlfs, "/test");
45 i = sqlfs_proc_read(sqlfs, "/test/2/file", buf, sizeof(buf), 0, &fi);
47 assert(!strcmp(buf, data));
49 sqlfs_proc_write(sqlfs, "/app/data/file", data, strlen(data), 0, &fi);
50 sqlfs_proc_write(sqlfs, "/big/a/b/c/file", data2, 32000, 0, &fi);
52 i = sqlfs_proc_read(sqlfs, "/big/a/b/c/file", buf, sizeof(buf), 400, &fi);
53 assert(buf[97] == '2');