30.07.2013 Views

Development and Implementation of a File System for Gannet Virtual ...

Development and Implementation of a File System for Gannet Virtual ...

Development and Implementation of a File System for Gannet Virtual ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

ack onto the stack to be reused <strong>and</strong> the stat structure is erased from the file<br />

descriptor table.<br />

4.2.2 Directory Operations <strong>Implementation</strong><br />

<strong>Gannet</strong>FS file system provides full POSIX compliant interfaces <strong>for</strong> directory<br />

operation. There are three interfaces over files operation, namely mkdir(),<br />

opendir(), closedir() <strong>and</strong> readdir(). <strong>Gannet</strong>FS treats directory as a file. There<strong>for</strong>e,<br />

those interface is similar to creat(), open(), close(), <strong>and</strong> read() function on files<br />

operation, respectively.<br />

mkdir() function is similar to creat() function on file operation. However, mkdir()<br />

function does not allocate a slot on file descriptor table. As opendir() is called, a slot<br />

on file descriptor table is allocated. Unlike open() function on file operation, if the<br />

directory is not exist, instead <strong>of</strong> creating new directory, opendir() function<br />

terminates with error. Another difference between them, instead <strong>of</strong> returning a file<br />

descriptor, opendir() function returns a file DIR pointer which is used by readdir()<br />

to obtain an directory entry. Readdir() returns the next directory entry <strong>for</strong>m the<br />

data block on each call. Instead <strong>of</strong> reading data byte per byte on data blocks,<br />

Readdir() reads directory entry one by one. The closedir() function frees a slot on<br />

file descriptor table that allocated by opendir() <strong>and</strong> closes the directory.<br />

44

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!