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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

whence : One <strong>of</strong> the following codes<br />

Returns:<br />

The new <strong>of</strong>fset. In case <strong>of</strong> error, ((<strong>of</strong>f_t)-1) is returned.<br />

Description:<br />

The lseek() function sets the file <strong>of</strong>fset <strong>for</strong> the file description associated with<br />

fildes as follows:<br />

SEEK_SET Set <strong>of</strong>fset to <strong>of</strong>fset.<br />

SEEK_CUR Add <strong>of</strong>fset to current position.<br />

SEEK_END Add <strong>of</strong>fset to current file size.<br />

7. mkdir() : Makes a directory.<br />

Arguments:<br />

int mkdir(const char *path, mode_t mode);<br />

path : Pointer to name <strong>of</strong> the directory to create.<br />

mode : Directory permission bits.<br />

Returns:<br />

Zero on success <strong>and</strong> -1 on failure.<br />

If an error occurs, a code is stored in errno to identify the error.<br />

Description:<br />

The mkdir() function creates a new directory named path. The permission bits<br />

are set from mode.<br />

8. rmdir() : Removes a directory.<br />

Arguments:<br />

int rmdir(const char *path);<br />

path : Pointer to the path name <strong>of</strong> the directory to remove.<br />

Returns:<br />

Zero on success <strong>and</strong> -1 on failure.<br />

Description:<br />

It removes an exist directory.<br />

9. opendir() : Opens a directory.<br />

Arguments:<br />

DIR *opendir(const char *dirname);<br />

dirname :Pointer to the name <strong>of</strong> the directory to read.<br />

Returns:<br />

A pointer <strong>for</strong> use with readdir() <strong>and</strong> closedir() or, if an error took place, NULL.<br />

Description:<br />

The opendir() function opens a directory stream corresponding to the directory<br />

named in the dirname argument. The stream is positioned at the first entry.<br />

65

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

Saved successfully!

Ooh no, something went wrong!