27 lines
410 B
C
27 lines
410 B
C
#include<stdint.h>
|
|
#include<stdio.h>
|
|
#include<stdlib.h>
|
|
#include<string.h>
|
|
#include<time.h>
|
|
#include"fs.h"
|
|
|
|
FsHdr vfs_mkfs(const size_t nblocks)
|
|
{
|
|
const size_t length=BLOCKSIZE*nblocks;
|
|
const FsHdr fs={
|
|
.id=VFS_GENID(),
|
|
.length=length,
|
|
.address=malloc(length),
|
|
};
|
|
return fs;
|
|
}
|
|
|
|
void vfs_free(FsHdr*const fs)
|
|
{
|
|
if(!fs)return;
|
|
if(fs->address)
|
|
free(fs->address);
|
|
fs->address=NULL;
|
|
fs->length=0;
|
|
}
|