[3949e8a0] | 1 | /*
|
---|
| 2 | * Copyright (c) 2011 Martin Sucha
|
---|
| 3 | * All rights reserved.
|
---|
| 4 | *
|
---|
| 5 | * Redistribution and use in source and binary forms, with or without
|
---|
| 6 | * modification, are permitted provided that the following conditions
|
---|
| 7 | * are met:
|
---|
| 8 | *
|
---|
| 9 | * - Redistributions of source code must retain the above copyright
|
---|
| 10 | * notice, this list of conditions and the following disclaimer.
|
---|
| 11 | * - Redistributions in binary form must reproduce the above copyright
|
---|
| 12 | * notice, this list of conditions and the following disclaimer in the
|
---|
| 13 | * documentation and/or other materials provided with the distribution.
|
---|
| 14 | * - The name of the author may not be used to endorse or promote products
|
---|
| 15 | * derived from this software without specific prior written permission.
|
---|
| 16 | *
|
---|
| 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
---|
| 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
---|
| 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
---|
| 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
---|
| 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
---|
| 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
---|
| 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
---|
| 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
---|
| 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
---|
| 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
---|
| 27 | */
|
---|
| 28 |
|
---|
| 29 | /** @addtogroup libext2
|
---|
| 30 | * @{
|
---|
| 31 | */
|
---|
| 32 | /**
|
---|
| 33 | * @file
|
---|
| 34 | */
|
---|
| 35 |
|
---|
| 36 | #ifndef LIBEXT2_LIBEXT2_FILESYSTEM_H_
|
---|
| 37 | #define LIBEXT2_LIBEXT2_FILESYSTEM_H_
|
---|
| 38 |
|
---|
[f73b291] | 39 | #include <block.h>
|
---|
[3949e8a0] | 40 | #include "libext2_superblock.h"
|
---|
[d241aae] | 41 | #include "libext2_block_group.h"
|
---|
[ce13577] | 42 | #include "libext2_inode.h"
|
---|
[3949e8a0] | 43 |
|
---|
| 44 | typedef struct ext2_filesystem {
|
---|
[15f3c3f] | 45 | service_id_t device;
|
---|
[3949e8a0] | 46 | ext2_superblock_t * superblock;
|
---|
| 47 | } ext2_filesystem_t;
|
---|
| 48 |
|
---|
| 49 | // allow maximum this block size
|
---|
| 50 | #define EXT2_MAX_BLOCK_SIZE 8096
|
---|
| 51 | #define EXT2_REV0_FIRST_INODE 11
|
---|
| 52 | #define EXT2_REV0_INODE_SIZE 128
|
---|
| 53 |
|
---|
[eef306c] | 54 | #define EXT2_FEATURE_RO_SPARSE_SUPERBLOCK 1
|
---|
| 55 | #define EXT2_FEATURE_RO_LARGE_FILE 2
|
---|
| 56 | #define EXT2_FEATURE_I_TYPE_IN_DIR 2
|
---|
| 57 |
|
---|
| 58 | #define EXT2_SUPPORTED_INCOMPATIBLE_FEATURES EXT2_FEATURE_I_TYPE_IN_DIR
|
---|
| 59 | #define EXT2_SUPPORTED_READ_ONLY_FEATURES 0
|
---|
| 60 |
|
---|
[15f3c3f] | 61 | extern int ext2_filesystem_init(ext2_filesystem_t *, service_id_t);
|
---|
[1d6f507] | 62 | extern int ext2_filesystem_check_sanity(ext2_filesystem_t *);
|
---|
[eef306c] | 63 | extern int ext2_filesystem_check_flags(ext2_filesystem_t *, bool *);
|
---|
[d241aae] | 64 | extern int ext2_filesystem_get_block_group_ref(ext2_filesystem_t *, uint32_t,
|
---|
| 65 | ext2_block_group_ref_t **);
|
---|
| 66 | extern int ext2_filesystem_put_block_group_ref(ext2_block_group_ref_t *);
|
---|
[ce13577] | 67 | extern int ext2_filesystem_get_inode_ref(ext2_filesystem_t *, uint32_t,
|
---|
| 68 | ext2_inode_ref_t **);
|
---|
| 69 | extern int ext2_filesystem_put_inode_ref(ext2_inode_ref_t *);
|
---|
[ad34feb] | 70 | extern int ext2_filesystem_get_inode_data_block_index(ext2_filesystem_t *, ext2_inode_t*,
|
---|
| 71 | aoff64_t, uint32_t*);
|
---|
[f8c60f5] | 72 | extern int ext2_filesystem_allocate_blocks(ext2_filesystem_t *, uint32_t *, size_t, uint32_t);
|
---|
[3949e8a0] | 73 | extern void ext2_filesystem_fini(ext2_filesystem_t *);
|
---|
| 74 |
|
---|
| 75 | #endif
|
---|
| 76 |
|
---|
| 77 | /** @}
|
---|
| 78 | */
|
---|