Implementing Mkdir Basic C File System Given Following Directory Block Struct Dirblockt Un Q37154475

implementing mkdir in a basic c++ file system:

Given the following directory block:

struct dirblock_t {
unsigned int magic;       // magic number,must be DIR_MAGIC_NUM
unsigned int num_entries;   // number of files indirectory
struct {
char name[MAX_FNAME_SIZE + 1]; // file name (extra space fornull)
short block_num;       // block number offile (0 – unused)
} dir_entries[MAX_DIR_ENTRIES]; // list of directory entries
};

and the following functions:

// Gets a free block from the disk.
short get_free_block();
  
// Reclaims block making it available for future use.
void reclaim_block(short block_num);

// Reads block from disk. Output parameter block points to newblock.
void read_block(short block_num, void *block);
  
// Writes block to disk. Input block points to block towrite.
void write_block(short

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.