pull master
[hh.org.git] / lab / modules / labmkdir.c
blob686ba314b153114982cb5b75dcf38ecc3c85d1e7
1 /*
2 * labmkdir.c
3 * A mkdir module for LAB - Linux As Bootldr.
4 */
6 #include <linux/kernel.h>
7 #include <linux/module.h>
8 #include <linux/init.h>
9 #include <linux/syscalls.h>
10 #include <linux/lab/lab.h>
11 #include <linux/lab/commands.h>
13 void lab_cmd_mkdir(int argc,const char** argv);
15 int labmkdir_init(void)
17 lab_addcommand("mkdir", lab_cmd_mkdir, "Create a directory");
19 return 0;
22 void labmkdir_cleanup(void)
24 lab_delcommand("mkdir");
27 void lab_cmd_mkdir(int argc,const char** argv)
29 int err;
31 if (argc != 2) {
32 lab_puts("mkdir: syntax: mkdir dirname\r\n");
33 return;
36 err = sys_mkdir(argv[1], 0000);
37 if (err)
38 lab_printf("mkdir: failed to create %s (errno %d)\n", argv[1], err);
41 MODULE_AUTHOR("Joshua Wise");
42 MODULE_DESCRIPTION("LAB mkdir Module");
43 MODULE_LICENSE("GPL");
44 module_init(labmkdir_init);
45 module_exit(labmkdir_cleanup);