mirror of
https://github.com/KolibriOS/kolibrios.git
synced 2024-12-12 18:07:06 +03:00
88 lines
2.5 KiB
C
88 lines
2.5 KiB
C
|
/////////////////////////////////////////////////////////////////////////////////////////
|
|||
|
///////////////////////// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ////////////////////
|
|||
|
/////////////////////////////////////////////////////////////////////////////////////////
|
|||
|
|
|||
|
/*#ifdef LANG_RUS
|
|||
|
char *rezult_text[]={
|
|||
|
"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"w,
|
|||
|
"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> IOCTL, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>..."w,
|
|||
|
"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><> 0 <20><> 9"w,
|
|||
|
"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>"w,
|
|||
|
"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>"w,
|
|||
|
"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"w,
|
|||
|
"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> O_o"w,
|
|||
|
0};
|
|||
|
#else*/
|
|||
|
char *rezult_text[]={
|
|||
|
"operation compleated successfully",
|
|||
|
"unknown IOCTL code, wrong input/output size...",
|
|||
|
"DiskId must be from 0 to 9",
|
|||
|
"DiskSize is too large",
|
|||
|
"DiskSize is too small",
|
|||
|
"memory allocation failed",
|
|||
|
"unknown error O_o",
|
|||
|
0};
|
|||
|
//#endif
|
|||
|
|
|||
|
void Console_Work()
|
|||
|
{
|
|||
|
unsigned int disk_size, driver_rezult;
|
|||
|
char size_t[256];
|
|||
|
|
|||
|
strlwr(#param);
|
|||
|
|
|||
|
switch (param[0])
|
|||
|
{
|
|||
|
case '?': //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
case 'h':
|
|||
|
debug("tmpdisk command line parameters:");
|
|||
|
debug("a[number]s[size in MB] - add RAM disk");
|
|||
|
debug("d[number] - delete RAM disk");
|
|||
|
ExitProcess();
|
|||
|
break;
|
|||
|
case 'd': //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
|||
|
debug("trying to delete disk");
|
|||
|
del_disk.DiskId = param[1]-'0';
|
|||
|
ioctl.handle = driver_handle;
|
|||
|
ioctl.io_code = DEV_DEL_DISK;
|
|||
|
ioctl.input = #del_disk;
|
|||
|
ioctl.inp_size = sizeof(del_disk);
|
|||
|
ioctl.output = 0;
|
|||
|
ioctl.out_size = 0;
|
|||
|
break;
|
|||
|
case 'a': //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
|||
|
debug("trying to add disk");
|
|||
|
disk_size= strchr(#param, 's');
|
|||
|
if (!disk_size)
|
|||
|
{
|
|||
|
add_disk.DiskSize = GetFreeRAM() / 5;
|
|||
|
debug("disk size is not specified");
|
|||
|
strcpy(#size_t, "10% from free RAM will be used, new DiskSize: ");
|
|||
|
driver_rezult=itoa(add_disk.DiskSize/2048);
|
|||
|
strcat(#size_t, driver_rezult);
|
|||
|
//strcat(#size_t, itoa(add_disk.DiskSize/2048));
|
|||
|
strcat(#size_t, " MB");
|
|||
|
debug(#size_t);
|
|||
|
}
|
|||
|
else
|
|||
|
add_disk.DiskSize = atoi(#param+disk_size)*2048;
|
|||
|
|
|||
|
add_disk.DiskId = param[1]-'0';
|
|||
|
ioctl.handle = driver_handle;
|
|||
|
ioctl.io_code = DEV_ADD_DISK;
|
|||
|
ioctl.input = #add_disk;
|
|||
|
ioctl.inp_size = sizeof(add_disk);
|
|||
|
ioctl.output = 0;
|
|||
|
ioctl.out_size = 0;
|
|||
|
break;
|
|||
|
default:
|
|||
|
debug("unknown command line parameters");
|
|||
|
debug("use 'h' or '?' for help");
|
|||
|
ExitProcess();
|
|||
|
}
|
|||
|
|
|||
|
driver_rezult = RuleDriver(#ioctl);
|
|||
|
if (driver_rezult<7) debug(rezult_text[driver_rezult]);
|
|||
|
}
|
|||
|
|