fmc->min_free_size = fmc->sector_size << 2;
fmc->mtd = mtd;
fmc->c = c;
- fmc->head = 0;
- fmc->tail = 0;
- fmc->head_extra = 0;
- fmc->tail_extra = 0;
+ fmc->head = NULL;
+ fmc->tail = NULL;
+ fmc->head_extra = NULL;
+ fmc->tail_extra = NULL;
init_MUTEX(&fmc->biglock);
return fmc;
}
fmc->head->prev = fmc->tail_extra;
fmc->head = fmc->head_extra;
}
- fmc->head_extra = 0; /* These two instructions should be omitted. */
- fmc->tail_extra = 0;
+ fmc->head_extra = NULL; /* These two instructions should be omitted. */
+ fmc->tail_extra = NULL;
D3(jffs_print_fmcontrol(fmc));
}
jffs_cleanup_fmcontrol(struct jffs_fmcontrol *fmc)
{
if (fmc) {
- struct jffs_fm *cur;
struct jffs_fm *next = fmc->head;
-
- while ((cur = next)) {
+ while (next) {
+ struct jffs_fm *cur = next;
next = next->next;
jffs_free_fm(cur);
}
D2(printk("jffs_fmalloc(): fmc = 0x%p, size = %d, "
"node = 0x%p\n", fmc, size, node));
- *result = 0;
+ *result = NULL;
if (!(fm = jffs_alloc_fm())) {
D(printk("jffs_fmalloc(): kmalloc() failed! (fm)\n"));
}
DJM(no_jffs_node_ref++);
fm->nodes->node = node;
- fm->nodes->next = 0;
+ fm->nodes->next = NULL;
if (fmc->tail) {
fm->offset = fmc->tail->offset + fmc->tail->size;
if (fm->offset == fmc->flash_size) {
else {
fm->offset = fmc->tail->offset + fmc->tail->size;
fm->size = free_chunk_size1;
- fm->nodes = 0;
+ fm->nodes = NULL;
fmc->free_size -= fm->size;
fmc->dirty_size += fm->size; /* Changed by simonk. This seemingly fixes a
bug that caused infinite garbage collection.
*/
}
- fm->next = 0;
+ fm->next = NULL;
if (!fmc->head) {
- fm->prev = 0;
+ fm->prev = NULL;
fmc->head = fm;
fmc->tail = fm;
}
ASSERT(if (!fmc || !fm || !fm->nodes) {
printk(KERN_ERR "jffs_fmfree(): fmc: 0x%p, fm: 0x%p, "
"fm->nodes: 0x%p\n",
- fmc, fm, (fm ? fm->nodes : 0));
+ fmc, fm, (fm ? fm->nodes : NULL));
return -1;
});
/* Find the reference to the node that is going to be removed
and remove it. */
- for (ref = fm->nodes, prev = 0; ref; ref = ref->next) {
+ for (ref = fm->nodes, prev = NULL; ref; ref = ref->next) {
if (ref->node == node) {
if (prev) {
prev->next = ref->next;
if (!(fm = jffs_alloc_fm())) {
D(printk("jffs_fmalloced(0x%p, %u, %u, 0x%p): failed!\n",
fmc, offset, size, node));
- return 0;
+ return NULL;
}
fm->offset = offset;
fm->size = size;
- fm->prev = 0;
- fm->next = 0;
- fm->nodes = 0;
+ fm->prev = NULL;
+ fm->next = NULL;
+ fm->nodes = NULL;
if (node) {
/* `node' exists and it should be associated with the
jffs_fm structure `fm'. */
GFP_KERNEL))) {
D(printk("jffs_fmalloced(): !fm->nodes\n"));
jffs_free_fm(fm);
- return 0;
+ return NULL;
}
DJM(no_jffs_node_ref++);
fm->nodes->node = node;
- fm->nodes->next = 0;
+ fm->nodes->next = NULL;
fmc->used_size += size;
fmc->free_size -= size;
}
if (fm->nodes) {
kfree(fm->nodes);
DJM(no_jffs_node_ref--);
- fm->nodes = 0;
+ fm->nodes = NULL;
}
fmc->used_size -= fm->size;
if (fm == fmc->tail) {
__u32 pos = 0;
if (size == 0) {
- return 0;
+ return NULL;
}
ASSERT(if (!fmc) {
printk(KERN_ERR "jffs_cut_node(): fmc == NULL\n");
- return 0;
+ return NULL;
});
fm = fmc->head;
break;
}
else {
- fm = 0;
+ fm = NULL;
break;
}
}
erased_size -= fm->size;
del = fm;
fm = fm->next;
- fm->prev = 0;
+ fm->prev = NULL;
fmc->head = fm;
jffs_free_fm(del);
}
{
struct jffs_fm *fm;
struct jffs_node_ref *nref;
- struct jffs_node *node = 0;
+ struct jffs_node *node = NULL;
ASSERT(if (!fmc) {
printk(KERN_ERR "jffs_get_oldest_node(): fmc == NULL\n");
- return 0;
+ return NULL;
});
for (fm = fmc->head; fm && !fm->nodes; fm = fm->next);
if (!fm) {
- return 0;
+ return NULL;
}
/* The oldest node is the last one in the reference list. This list