diff options
Diffstat (limited to 'e2fsprogs/ext2fs/brel_ma.c')
-rw-r--r-- | e2fsprogs/ext2fs/brel_ma.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/e2fsprogs/ext2fs/brel_ma.c b/e2fsprogs/ext2fs/brel_ma.c index d422bb2e9..4dcfded37 100644 --- a/e2fsprogs/ext2fs/brel_ma.c +++ b/e2fsprogs/ext2fs/brel_ma.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * brel_ma.c | 2 | * brel_ma.c |
3 | * | 3 | * |
4 | * Copyright (C) 1996, 1997 Theodore Ts'o. | 4 | * Copyright (C) 1996, 1997 Theodore Ts'o. |
5 | * | 5 | * |
6 | * TODO: rewrite to not use a direct array!!! (Fortunately this | 6 | * TODO: rewrite to not use a direct array!!! (Fortunately this |
@@ -48,7 +48,7 @@ errcode_t ext2fs_brel_memarray_create(char *name, blk_t max_block, | |||
48 | { | 48 | { |
49 | ext2_brel brel = 0; | 49 | ext2_brel brel = 0; |
50 | errcode_t retval; | 50 | errcode_t retval; |
51 | struct brel_ma *ma = 0; | 51 | struct brel_ma *ma = 0; |
52 | size_t size; | 52 | size_t size; |
53 | 53 | ||
54 | *new_brel = 0; | 54 | *new_brel = 0; |
@@ -61,18 +61,18 @@ errcode_t ext2fs_brel_memarray_create(char *name, blk_t max_block, | |||
61 | if (retval) | 61 | if (retval) |
62 | goto errout; | 62 | goto errout; |
63 | memset(brel, 0, sizeof(struct ext2_block_relocation_table)); | 63 | memset(brel, 0, sizeof(struct ext2_block_relocation_table)); |
64 | 64 | ||
65 | retval = ext2fs_get_mem(strlen(name)+1, &brel->name); | 65 | retval = ext2fs_get_mem(strlen(name)+1, &brel->name); |
66 | if (retval) | 66 | if (retval) |
67 | goto errout; | 67 | goto errout; |
68 | strcpy(brel->name, name); | 68 | strcpy(brel->name, name); |
69 | 69 | ||
70 | retval = ext2fs_get_mem(sizeof(struct brel_ma), &ma); | 70 | retval = ext2fs_get_mem(sizeof(struct brel_ma), &ma); |
71 | if (retval) | 71 | if (retval) |
72 | goto errout; | 72 | goto errout; |
73 | memset(ma, 0, sizeof(struct brel_ma)); | 73 | memset(ma, 0, sizeof(struct brel_ma)); |
74 | brel->priv_data = ma; | 74 | brel->priv_data = ma; |
75 | 75 | ||
76 | size = (size_t) (sizeof(struct ext2_block_relocate_entry) * | 76 | size = (size_t) (sizeof(struct ext2_block_relocate_entry) * |
77 | (max_block+1)); | 77 | (max_block+1)); |
78 | retval = ext2fs_get_mem(size, &ma->entries); | 78 | retval = ext2fs_get_mem(size, &ma->entries); |
@@ -91,7 +91,7 @@ errcode_t ext2fs_brel_memarray_create(char *name, blk_t max_block, | |||
91 | brel->move = bma_move; | 91 | brel->move = bma_move; |
92 | brel->delete = bma_delete; | 92 | brel->delete = bma_delete; |
93 | brel->free = bma_free; | 93 | brel->free = bma_free; |
94 | 94 | ||
95 | *new_brel = brel; | 95 | *new_brel = brel; |
96 | return 0; | 96 | return 0; |
97 | 97 | ||
@@ -103,7 +103,7 @@ errout: | |||
103 | static errcode_t bma_put(ext2_brel brel, blk_t old, | 103 | static errcode_t bma_put(ext2_brel brel, blk_t old, |
104 | struct ext2_block_relocate_entry *ent) | 104 | struct ext2_block_relocate_entry *ent) |
105 | { | 105 | { |
106 | struct brel_ma *ma; | 106 | struct brel_ma *ma; |
107 | 107 | ||
108 | ma = brel->priv_data; | 108 | ma = brel->priv_data; |
109 | if (old > ma->max_block) | 109 | if (old > ma->max_block) |
@@ -115,7 +115,7 @@ static errcode_t bma_put(ext2_brel brel, blk_t old, | |||
115 | static errcode_t bma_get(ext2_brel brel, blk_t old, | 115 | static errcode_t bma_get(ext2_brel brel, blk_t old, |
116 | struct ext2_block_relocate_entry *ent) | 116 | struct ext2_block_relocate_entry *ent) |
117 | { | 117 | { |
118 | struct brel_ma *ma; | 118 | struct brel_ma *ma; |
119 | 119 | ||
120 | ma = brel->priv_data; | 120 | ma = brel->priv_data; |
121 | if (old > ma->max_block) | 121 | if (old > ma->max_block) |
@@ -135,7 +135,7 @@ static errcode_t bma_start_iter(ext2_brel brel) | |||
135 | static errcode_t bma_next(ext2_brel brel, blk_t *old, | 135 | static errcode_t bma_next(ext2_brel brel, blk_t *old, |
136 | struct ext2_block_relocate_entry *ent) | 136 | struct ext2_block_relocate_entry *ent) |
137 | { | 137 | { |
138 | struct brel_ma *ma; | 138 | struct brel_ma *ma; |
139 | 139 | ||
140 | ma = brel->priv_data; | 140 | ma = brel->priv_data; |
141 | while (++brel->current < ma->max_block) { | 141 | while (++brel->current < ma->max_block) { |
@@ -151,7 +151,7 @@ static errcode_t bma_next(ext2_brel brel, blk_t *old, | |||
151 | 151 | ||
152 | static errcode_t bma_move(ext2_brel brel, blk_t old, blk_t new) | 152 | static errcode_t bma_move(ext2_brel brel, blk_t old, blk_t new) |
153 | { | 153 | { |
154 | struct brel_ma *ma; | 154 | struct brel_ma *ma; |
155 | 155 | ||
156 | ma = brel->priv_data; | 156 | ma = brel->priv_data; |
157 | if ((old > ma->max_block) || (new > ma->max_block)) | 157 | if ((old > ma->max_block) || (new > ma->max_block)) |
@@ -165,7 +165,7 @@ static errcode_t bma_move(ext2_brel brel, blk_t old, blk_t new) | |||
165 | 165 | ||
166 | static errcode_t bma_delete(ext2_brel brel, blk_t old) | 166 | static errcode_t bma_delete(ext2_brel brel, blk_t old) |
167 | { | 167 | { |
168 | struct brel_ma *ma; | 168 | struct brel_ma *ma; |
169 | 169 | ||
170 | ma = brel->priv_data; | 170 | ma = brel->priv_data; |
171 | if (old > ma->max_block) | 171 | if (old > ma->max_block) |
@@ -178,7 +178,7 @@ static errcode_t bma_delete(ext2_brel brel, blk_t old) | |||
178 | 178 | ||
179 | static errcode_t bma_free(ext2_brel brel) | 179 | static errcode_t bma_free(ext2_brel brel) |
180 | { | 180 | { |
181 | struct brel_ma *ma; | 181 | struct brel_ma *ma; |
182 | 182 | ||
183 | if (!brel) | 183 | if (!brel) |
184 | return 0; | 184 | return 0; |