[ext2] Fix up some warnings

This commit is contained in:
Kevin Lange 2011-02-05 13:27:04 -06:00
parent 8c818ea064
commit 09f530604e
4 changed files with 15 additions and 9 deletions

View File

@ -28,6 +28,11 @@ kernel: start.o link.ld main.o core
@${LD} -T link.ld -o kernel *.o core/*.o core/fs/*.o
@${ECHO} "\r\e[32;1m LD $<\e[0m"
start.o: start.asm
@${ECHO} -n "\e[32m nasm start.asm\e[0m"
@nasm -f elf -o start.o start.asm
@${ECHO} "\r\e[32;1m nasm start.asm\e[0m"
%.o: %.c
@${ECHO} -n "\e[32m CC $<\e[0m"
@${CC} ${CFLAGS} -I./include -c -o $@ $<
@ -36,11 +41,6 @@ kernel: start.o link.ld main.o core
core:
@cd core; ${MAKE} ${MFLAGS}
start.o: start.asm
@${ECHO} -n "\e[32m nasm start.asm\e[0m"
@nasm -f elf -o start.o start.asm
@${ECHO} "\r\e[32;1m nasm start.asm\e[0m"
initrd: fs
@${ECHO} -n "\e[32m initrd Generating initial RAM disk\e[0m"
@-rm -f initrd

View File

@ -1,4 +1,6 @@
include ../Makefile.inc
DIRS = fs
.PHONY: all clean install fs
all: system.o multiboot.o gdt.o idt.o irq.o isrs.o kbd.o kprintf.o timer.o vga.o mem.o panic.o alloc.o vfs.o fs
@ -13,3 +15,4 @@ fs:
clean:
@-rm -f *.o
@-for d in ${DIRS}; do (cd $$d; ${MAKE} clean); done

View File

@ -4,7 +4,9 @@ include ../../Makefile.inc
all: ext2_initrd.o
%.o: %.c
${CC} ${CFLAGS} -I../../include -c -o $@ $<
@${ECHO} -n "\e[32m CC core/fs/$<\e[0m"
@${CC} ${CFLAGS} -I../../include -c -o $@ $<
@${ECHO} "\r\e[32;1m CC core/fs/$<\e[0m"
clean:
-rm -f *.o

View File

@ -43,20 +43,20 @@ read_initrd(
uint32_t end_size = end % block_size;
uint32_t size_to_read = end - offset;
if (start_block == end_block) {
memcpy(buffer, ext2_get_inode_block(inode, start_block) + offset % block_size, size_to_read);
memcpy(buffer, (void *)((uintptr_t)ext2_get_inode_block(inode, start_block) + offset % block_size), size_to_read);
return size_to_read;
} else {
uint32_t block_offset = start_block;
uint32_t blocks_read = 0;
for (block_offset = start_block; block_offset < end_block; ++block_offset) {
if (block_offset == start_block) {
memcpy(buffer, ext2_get_inode_block(inode, block_offset) + (offset % block_size), (block_size - (offset % block_size)));
memcpy(buffer, (void *)((uintptr_t)ext2_get_inode_block(inode, block_offset) + (offset % block_size)), (block_size - (offset % block_size)));
} else {
memcpy(buffer + block_size * blocks_read - (offset % block_size), ext2_get_inode_block(inode, block_offset), block_size);
}
blocks_read++;
}
memcpy(buffer + block_size * blocks_read - (offset % block_size), ext2_get_inode_block(inode, end_block), (end % block_size));
memcpy(buffer + block_size * blocks_read - (offset % block_size), ext2_get_inode_block(inode, end_block), end_size);
}
return size_to_read;
}
@ -325,6 +325,7 @@ ext2_get_inode_block(
} else if (block < 12 + (1024 << initrd_superblock->log_block_size) / sizeof(uint32_t)) {
return ext2_get_block(*(uint32_t*)((uintptr_t)ext2_get_block(inode->block[12]) + (block - 12) * sizeof(uint32_t)));
}
return NULL;
}
void *