I am working on assigning operating systems to one of my summer classes. The teacher provided an object file that provides functions that mimic the behavior of a disk device driver. Then we need to write a file system API that uses the disk driver in C.
I am working on my file system format function called Format (), which calls a function called DevFormat () from the teachers object file. My function should return 1 if it was able to successfully format the file system and 0 otherwise. DevFormat () returns 1 if it was able to successfully format the disk and 0 otherwise. Here is the code:
int Format()
{
if (!DevFormat())
{
printf("Disk drive wasn't formatted successfully\n");
return 0;
}
<Do some stuff to the file system here>
printf("File system successfully formatted\n");
return 1;
}
, Format() , . , : if (!DevFormat()). C, GNU ++ (g++) , , . , Format() , if (!DevFormat()), - ( . .). , , if (0 == DevFormat()). - DevFormat() int .
. , ++ ? - , ?
.