Update skipped files in previous commit
git-svn-id: svn://kolibrios.org@9766 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
@@ -1,42 +1,43 @@
|
||||
#include "stddef.h"
|
||||
#include <sys/ksys.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/ksys.h>
|
||||
|
||||
#define DEV_ADD_DISK 1
|
||||
|
||||
#define TMPDISK_SIZE 10 //Mb
|
||||
#define TMPDISK_SIZE 10 // Mb
|
||||
|
||||
#pragma pack(push, 1)
|
||||
struct{
|
||||
unsigned disk_size;
|
||||
unsigned char disk_id;
|
||||
}tmpdisk_add;
|
||||
struct {
|
||||
unsigned disk_size;
|
||||
unsigned char disk_id;
|
||||
} tmpdisk_add;
|
||||
#pragma pack(pop)
|
||||
|
||||
char *tmpdisk_res_text[]={
|
||||
"TmpDisk operation completed successfully",
|
||||
"Unknown IOCTL code, wrong input/output size...",
|
||||
"DiskId must be from 0 to 9",
|
||||
"DiskSize is too large",
|
||||
"DiskSize is too small, might be too little free RAM",
|
||||
"Memory allocation failed",
|
||||
"Unknown error O_o",
|
||||
0};
|
||||
char* tmpdisk_res_text[] = {
|
||||
"TmpDisk operation completed successfully",
|
||||
"Unknown IOCTL code, wrong input/output size...",
|
||||
"DiskId must be from 0 to 9",
|
||||
"DiskSize is too large",
|
||||
"DiskSize is too small, might be too little free RAM",
|
||||
"Memory allocation failed",
|
||||
"Unknown error O_o",
|
||||
0
|
||||
};
|
||||
|
||||
|
||||
int main(){
|
||||
int main()
|
||||
{
|
||||
ksys_drv_hand_t tmpdisk_drv = _ksys_load_driver("tmpdisk");
|
||||
if(!tmpdisk_drv){
|
||||
if (!tmpdisk_drv) {
|
||||
puts("tmpdisk.sys driver not load!");
|
||||
exit(0);
|
||||
}else{
|
||||
} else {
|
||||
puts("tmpdisk.sys driver is load!");
|
||||
}
|
||||
|
||||
tmpdisk_add.disk_size = TMPDISK_SIZE*1024*1024/512;
|
||||
|
||||
tmpdisk_add.disk_size = TMPDISK_SIZE * 1024 * 1024 / 512;
|
||||
tmpdisk_add.disk_id = 5;
|
||||
|
||||
|
||||
ksys_ioctl_t ioctl;
|
||||
ioctl.func_num = DEV_ADD_DISK;
|
||||
ioctl.handler = tmpdisk_drv;
|
||||
@@ -46,10 +47,10 @@ int main(){
|
||||
ioctl.out_data_size = 0;
|
||||
|
||||
printf("Create '/tmp%u/' disk a %u Mb size...\n", tmpdisk_add.disk_id, TMPDISK_SIZE);
|
||||
unsigned status =_ksys_driver_control(&ioctl);
|
||||
if(status<7){
|
||||
unsigned status = _ksys_driver_control(&ioctl);
|
||||
if (status < 7) {
|
||||
puts(tmpdisk_res_text[status]);
|
||||
}else{
|
||||
} else {
|
||||
puts(tmpdisk_res_text[6]);
|
||||
}
|
||||
exit(0);
|
||||
|
||||
Reference in New Issue
Block a user