Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'master' of github.com:klange/osdev

  • Loading branch information...
commit decf3158266c89fee1fe95f7350c45d2cffbd23c 2 parents b934f0f + ed233ca
@klange authored
View
0  hdd/dev/zero
No changes.
View
6 kernel/fs/nulldev.c
@@ -11,15 +11,11 @@ void open_null(fs_node_t *node, uint8_t read, uint8_t write);
void close_null(fs_node_t *node);
uint32_t read_null(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffer) {
- if (size < 1) {
- return 0;
- }
- memset(buffer, 0x00, 1);
return 0;
}
uint32_t write_null(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffer) {
- return size;
+ return 0;
}
void open_null(fs_node_t * node, uint8_t read, uint8_t write) {
View
47 kernel/fs/zerodev.c
@@ -0,0 +1,47 @@
+/* vim: tabstop=4 shiftwidth=4 noexpandtab
+ * zero Device
+ */
+
+#include <system.h>
+#include <fs.h>
+
+uint32_t read_zero(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffer);
+uint32_t write_zero(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffer);
+void open_zero(fs_node_t *node, uint8_t read, uint8_t write);
+void close_zero(fs_node_t *node);
+
+uint32_t read_zero(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffer) {
+ memset(buffer, 0x00, size);
+ return 1;
+}
+
+uint32_t write_zero(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffer) {
+ return 0;
+}
+
+void open_zero(fs_node_t * node, uint8_t read, uint8_t write) {
+ return;
+}
+
+void close_zero(fs_node_t * node) {
+ return;
+}
+
+fs_node_t * zero_device_create() {
+ fs_node_t * fnode = malloc(sizeof(fs_node_t));
+ memset(fnode, 0x00, sizeof(fs_node_t));
+ fnode->inode = 0;
+ strcpy(fnode->name, "zero");
+ fnode->uid = 0;
+ fnode->gid = 0;
+ fnode->flags = FS_CHARDEVICE;
+ fnode->read = read_zero;
+ fnode->write = write_zero;
+ fnode->open = open_zero;
+ fnode->close = close_zero;
+ fnode->readdir = NULL;
+ fnode->finddir = NULL;
+ fnode->ioctl = NULL;
+ return fnode;
+}
+
View
1  kernel/include/fs.h
@@ -95,6 +95,7 @@ struct stat {
extern fs_node_t *fs_root;
extern fs_node_t * null_device_create();
+extern fs_node_t * zero_device_create();
extern fs_node_t * serial_device_create(int device);
extern fs_node_t * procfs_create();
extern void serial_mount_devices();
View
1  kernel/main.c
@@ -143,6 +143,7 @@ int main(struct multiboot *mboot, uint32_t mboot_mag, uintptr_t esp) {
serial_mount_devices();
vfs_mount("/dev/null", null_device_create());
+ vfs_mount("/dev/zero", zero_device_create());
vfs_mount("/dev/hello", hello_device_create());
vfs_mount("/dev/random", random_device_create());
View
2  userspace/core/login.c
@@ -115,7 +115,9 @@ void set_path() {
int main(int argc, char ** argv) {
+ printf("\n");
system("uname -a");
+ printf("\n");
syscall_signal(2, sig_int);
syscall_signal(11, sig_segv);
View
2  userspace/gui/terminal/terminal.c
@@ -256,6 +256,8 @@ static void _ansi_put(char c) {
state.buflen = 0;
ansi_buf_add(c);
return;
+ } else if (c == 0) {
+ return;
} else {
ansi_writer(c);
}
Please sign in to comment.
Something went wrong with that request. Please try again.