Download A Secure File System Based on
Transcript
Function: gdbm_file_info * gdbm_open ( char * name, int block_size, int flags, int mode, void(* fatal_func)() ); This function is used to create a new database or to open an existing database. When the name of the data file designated by the parameter name does not exist, it will create a new database. The parameter block_size is a basic unit of data file I/O operations. It is also used to determine the size of various data structures in GDBM. If the given value is less than 512, the file system block size is used. The parameter flags has several options like GDBM_READER, GDBM_WRITER, GDBM_WRCREAT and GDBM_NEWDB. It decides how user can access a database. If no error occurs, a pointer to the “gdbm file descriptor” will be returned. This descriptor will be used later by all other GDBM functions to access this opened database. Function: void gdbm_close ( gdbm_file_info * dbf ); Whenever a data file is not needed any longer, it must be closed. It is required to update the reader / writer count on a specific data file. This function will close a database pointed by the given descriptor and free all memory spaces associated with the database. Function: int gdbm_store ( gdbm_file_info * dbf, datum key, datum content, int flag ); This function is used to actually store key / data pairs into a database. The parameter flag is used to decide what happens if the given key exists already. If its value is GDBM_REPLACE, the old data associated with the given key is replaced by the new content. If its value is GDBM_INSERT, an error will be returned and no action is taken if 52