kernel: ~Stack can grow now (upto 4MB)
[meinos.git] / apps / ext2 / ext2_cdi.h
blobff73b35d05a0702f40dbf5fd605ebf57f621f8bf
1 /*
2 * Copyright (c) 2008 The LOST Project. All rights reserved.
4 * This code is derived from software contributed to the LOST Project
5 * by Antoine Kaufmann.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. All advertising materials mentioning features or use of this software
16 * must display the following acknowledgement:
17 * This product includes software developed by the LOST Project
18 * and its contributors.
19 * 4. Neither the name of the LOST Project nor the names of its
20 * contributors may be used to endorse or promote products derived
21 * from this software without specific prior written permission.
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
25 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
26 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
27 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
28 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
29 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
30 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
31 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
32 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
33 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 #ifndef _EXT2_CDI_H_
37 #define _EXT2_CDI_H_
39 #include <stdint.h>
41 #include "ext2.h"
42 #include "cdi/fs.h"
45 /**
46 * Dateisystemressource fuer ext2
48 struct ext2_fs_res {
49 struct cdi_fs_res res;
51 /// Inode
52 ext2_inode_t* inode;
54 /// Inode Nummer
55 uint32_t inode_num;
59 // CDI-IF
60 int ext2_fs_init(struct cdi_fs_filesystem* fs);
61 int ext2_fs_destroy(struct cdi_fs_filesystem* fs);
63 // CDI Res
64 int ext2_fs_res_load(struct cdi_fs_stream* stream);
65 int ext2_fs_res_unload(struct cdi_fs_stream* stream);
66 int ext2_fs_res_remove(struct cdi_fs_stream* stream);
67 int ext2_fs_res_rename(struct cdi_fs_stream* stream, const char* name);
68 int ext2_fs_res_move(struct cdi_fs_stream* stream, struct cdi_fs_res* dest);
69 int ext2_fs_res_assign_class(struct cdi_fs_stream* stream,
70 cdi_fs_res_class_t class);
71 int ext2_fs_res_remove_class(struct cdi_fs_stream* stream,
72 cdi_fs_res_class_t class);
73 int64_t ext2_fs_res_meta_read(struct cdi_fs_stream* stream, cdi_fs_meta_t meta);
74 int ext2_fs_res_meta_write(struct cdi_fs_stream* stream, cdi_fs_meta_t meta,
75 int64_t value);
77 // CDI File
78 size_t ext2_fs_file_read(struct cdi_fs_stream* stream, uint64_t start,
79 size_t size, void* data);
80 size_t ext2_fs_file_write(struct cdi_fs_stream* stream, uint64_t start,
81 size_t size, const void* data);
82 int ext2_fs_file_truncate(struct cdi_fs_stream* stream, uint64_t size);
84 // CDI Dir
85 cdi_list_t ext2_fs_dir_list(struct cdi_fs_stream* stream);
86 int ext2_fs_dir_create_child(struct cdi_fs_stream* stream,
87 const char* name, struct cdi_fs_res* parent);
89 // CDI Link
90 const char* ext2_fs_link_read(struct cdi_fs_stream* stream);
91 int ext2_fs_link_write(struct cdi_fs_stream* stream, const char* path);
93 // Cachefunktionen fuer libext2
94 void* cache_create(struct ext2_fs* fs, size_t block_size);
95 void cache_destroy(void* handle);
96 ext2_cache_block_t* cache_block(void* handle, uint64_t block, int noread);
97 void cache_block_dirty(ext2_cache_block_t* b);
98 void cache_block_free(ext2_cache_block_t* b, int dirty);
101 // Pointer auf die ext2-Ressourcen
102 extern struct cdi_fs_res_res ext2_fs_res;
103 extern struct cdi_fs_res_file ext2_fs_file;
104 extern struct cdi_fs_res_dir ext2_fs_dir;
105 extern struct cdi_fs_res_link ext2_fs_link;
107 #endif