allocate.h revision ec0a2e83dc66d67addeb90e83144187691852a3e
15985e7c4d13b04d6b819bfff3df44f1dd3eb35b8robertphillips@google.com/*
25985e7c4d13b04d6b819bfff3df44f1dd3eb35b8robertphillips@google.com * Copyright (C) 2010 The Android Open Source Project
35985e7c4d13b04d6b819bfff3df44f1dd3eb35b8robertphillips@google.com *
45985e7c4d13b04d6b819bfff3df44f1dd3eb35b8robertphillips@google.com * Licensed under the Apache License, Version 2.0 (the "License");
55985e7c4d13b04d6b819bfff3df44f1dd3eb35b8robertphillips@google.com * you may not use this file except in compliance with the License.
65985e7c4d13b04d6b819bfff3df44f1dd3eb35b8robertphillips@google.com * You may obtain a copy of the License at
75985e7c4d13b04d6b819bfff3df44f1dd3eb35b8robertphillips@google.com *
85985e7c4d13b04d6b819bfff3df44f1dd3eb35b8robertphillips@google.com *      http://www.apache.org/licenses/LICENSE-2.0
95985e7c4d13b04d6b819bfff3df44f1dd3eb35b8robertphillips@google.com *
105985e7c4d13b04d6b819bfff3df44f1dd3eb35b8robertphillips@google.com * Unless required by applicable law or agreed to in writing, software
115985e7c4d13b04d6b819bfff3df44f1dd3eb35b8robertphillips@google.com * distributed under the License is distributed on an "AS IS" BASIS,
125985e7c4d13b04d6b819bfff3df44f1dd3eb35b8robertphillips@google.com * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
135985e7c4d13b04d6b819bfff3df44f1dd3eb35b8robertphillips@google.com * See the License for the specific language governing permissions and
144ed0fb768409bf97b79899c3990d8c15f5e9d784reed@google.com * limitations under the License.
1520e3cd2c9fbc049eae8bcedc591c2cc8d4bed656scroggo@google.com */
164ed0fb768409bf97b79899c3990d8c15f5e9d784reed@google.com
175985e7c4d13b04d6b819bfff3df44f1dd3eb35b8robertphillips@google.com#define EXT4_ALLOCATE_FAILED (u32)(~0)
185985e7c4d13b04d6b819bfff3df44f1dd3eb35b8robertphillips@google.com
195985e7c4d13b04d6b819bfff3df44f1dd3eb35b8robertphillips@google.com#include "ext4_utils.h"
205985e7c4d13b04d6b819bfff3df44f1dd3eb35b8robertphillips@google.com#include "ext4.h"
215985e7c4d13b04d6b819bfff3df44f1dd3eb35b8robertphillips@google.com
225985e7c4d13b04d6b819bfff3df44f1dd3eb35b8robertphillips@google.comstruct block_allocation;
235985e7c4d13b04d6b819bfff3df44f1dd3eb35b8robertphillips@google.com
245985e7c4d13b04d6b819bfff3df44f1dd3eb35b8robertphillips@google.comvoid block_allocator_init();
255985e7c4d13b04d6b819bfff3df44f1dd3eb35b8robertphillips@google.comvoid block_allocator_free();
265985e7c4d13b04d6b819bfff3df44f1dd3eb35b8robertphillips@google.comu32 allocate_block();
275985e7c4d13b04d6b819bfff3df44f1dd3eb35b8robertphillips@google.comstruct block_allocation *allocate_blocks(u32 len);
285985e7c4d13b04d6b819bfff3df44f1dd3eb35b8robertphillips@google.comint block_allocation_num_regions(struct block_allocation *alloc);
2914e50ae2a1b1cccdace599247b8c788b8db33ef4commit-bot@chromium.orgint block_allocation_len(struct block_allocation *alloc);
305985e7c4d13b04d6b819bfff3df44f1dd3eb35b8robertphillips@google.comstruct ext4_inode *get_inode(u32 inode);
315985e7c4d13b04d6b819bfff3df44f1dd3eb35b8robertphillips@google.comvoid reduce_allocation(struct block_allocation *alloc, u32 len);
325985e7c4d13b04d6b819bfff3df44f1dd3eb35b8robertphillips@google.comu32 get_block(struct block_allocation *alloc, u32 block);
33c3d7d90973528527131c72549b10c2a21300e0acskia.committer@gmail.comu32 get_oob_block(struct block_allocation *alloc, u32 block);
345985e7c4d13b04d6b819bfff3df44f1dd3eb35b8robertphillips@google.comvoid get_next_region(struct block_allocation *alloc);
355985e7c4d13b04d6b819bfff3df44f1dd3eb35b8robertphillips@google.comvoid get_region(struct block_allocation *alloc, u32 *block, u32 *len);
365985e7c4d13b04d6b819bfff3df44f1dd3eb35b8robertphillips@google.comu32 get_free_blocks(u32 bg);
37c3d7d90973528527131c72549b10c2a21300e0acskia.committer@gmail.comu32 get_free_inodes(u32 bg);
38c3d7d90973528527131c72549b10c2a21300e0acskia.committer@gmail.comu32 reserve_inodes(int bg, u32 inodes);
39c3d7d90973528527131c72549b10c2a21300e0acskia.committer@gmail.comvoid add_directory(u32 inode);
405985e7c4d13b04d6b819bfff3df44f1dd3eb35b8robertphillips@google.comu16 get_directories(int bg);
415985e7c4d13b04d6b819bfff3df44f1dd3eb35b8robertphillips@google.comu32 allocate_inode();
42c3d7d90973528527131c72549b10c2a21300e0acskia.committer@gmail.comvoid free_alloc(struct block_allocation *alloc);
435985e7c4d13b04d6b819bfff3df44f1dd3eb35b8robertphillips@google.comint reserve_oob_blocks(struct block_allocation *alloc, int blocks);
44c3d7d90973528527131c72549b10c2a21300e0acskia.committer@gmail.comint advance_blocks(struct block_allocation *alloc, int blocks);
455985e7c4d13b04d6b819bfff3df44f1dd3eb35b8robertphillips@google.comint advance_oob_blocks(struct block_allocation *alloc, int blocks);
465985e7c4d13b04d6b819bfff3df44f1dd3eb35b8robertphillips@google.comint last_region(struct block_allocation *alloc);
475985e7c4d13b04d6b819bfff3df44f1dd3eb35b8robertphillips@google.comvoid rewind_alloc(struct block_allocation *alloc);
485985e7c4d13b04d6b819bfff3df44f1dd3eb35b8robertphillips@google.comvoid append_region(struct block_allocation *alloc,
495985e7c4d13b04d6b819bfff3df44f1dd3eb35b8robertphillips@google.com        u32 block, u32 len, int bg);
50c3d7d90973528527131c72549b10c2a21300e0acskia.committer@gmail.comstruct block_allocation *create_allocation();
515985e7c4d13b04d6b819bfff3df44f1dd3eb35b8robertphillips@google.comint append_oob_allocation(struct block_allocation *alloc, u32 len);
525985e7c4d13b04d6b819bfff3df44f1dd3eb35b8robertphillips@google.com