Main
[MySQL FS Deamon]


Functions

void exit_deamon (int sig)
 Deamon finalizing function.
int fsd_write_message (int fsc_device, const char *data, int len)
 Wrapper function for writting to char device.
int fsd_write_read_dir (rd_item **rd_list, int len, char *return_text)
 Make string from rd_item structure.
int main ()
 Main function.

Variables

MYSQL * conn
int fsc_device = 0

Detailed Description

MySQL FS deamon waiting in loop to message. Parse message, execute command and return message Commands are described in file protokol.txt
See also:
doc/protokol/protokol.txt

Function Documentation

void exit_deamon ( int  sig  ) 

Deamon finalizing function.

Function closes open char device for communicating between FS Deamon and FS. It closes DB connection too. It's set as signal handler.

Parameters:
sig Signal for defined terminating the deamon. Should be e.g. SIGINT.

Definition at line 51 of file fsd_main.c.

References conn, fsc_device, fsd_chardevice_close(), and fsd_db_close().

Referenced by main().

int fsd_write_message ( int  fsc_device,
const char *  data,
int  len 
)

Wrapper function for writting to char device.

Adds a protokol version to message and write it to the chardevice.

Parameters:
fsc_device Device to write to.
data Data which may be written.
len Max len of the string.
Returns:
Code returned by fsd_chardevice_write.
See also:
fsd_chardevice_write

Definition at line 75 of file fsd_main.c.

References fsd_chardevice_write(), FSD_VERSION, MAX_MESSAGE_LENGTH, and PINFO.

Referenced by main().

int fsd_write_read_dir ( rd_item **  rd_list,
int  len,
char *  return_text 
)

Make string from rd_item structure.

Write name/id/name2/id2/... list of directory items. This list has max size defined by param len.

Parameters:
rd_list Pointer to list of directory items.
len Max len of the string.
return_text Output buffer.
Returns:
1 list isnt empty.

0 list is empty.

Definition at line 108 of file fsd_main.c.

References read_dir_item::next.

Referenced by main().

int main (  ) 

Main function.

At first function open device and connect to database. Main section of this function is infinite loop where new message is delivered, parsed and perform. After performed the outgoing message is sent. At the end of function device and connection to database are closed.

Returns:
0 if was succesfully stopped.

Error number on error.

Definition at line 163 of file fsd_main.c.

References ADD_BLOCK_NR, CLEAR_FILE_NR, struct_command::command, struct_command::command_nr, conn, CREATE_NR, struct_command::data, struct_command::data_len, database, DIR_INFO_NR, EDB_CONNECT_ERROR, EFSC_DEVICE_OPEN_ERROR, EPROTOKOL_VERSION_ERROR, exit_deamon(), FILE_INFO_NR, fsc_device, fsd_add_block(), fsd_chardevice_open(), fsd_chardevice_read(), fsd_clear_file(), fsd_create(), fsd_db_connect(), fsd_dir_info(), fsd_file_info(), fsd_get_block(), fsd_lookup(), fsd_mkdir(), fsd_move_file(), fsd_read_dir(), fsd_read_inode(), fsd_remove_dir(), fsd_remove_file(), fsd_rename_dir(), fsd_rename_file(), fsd_replace_block(), fsd_test(), fsd_truncate_file(), FSD_VERSION, fsd_write_message(), fsd_write_read_dir(), GET_BLOCK_NR, LOOKUP_NR, MAX_BLOCK_LENGTH, MAX_ID_LENGTH, MAX_MESSAGE_LENGTH, MKDIR_NR, MOVE_FILE_NR, OK, struct_command::param, parse_message(), password, PDEBUG, PINFO, READ_DIR_NR, READ_INODE_NR, REMOVE_DIR_NR, REMOVE_FILE_NR, RENAME_DIR_NR, RENAME_FILE_NR, REPLACE_BLOCK_NR, result, server, TEST_NR, TRUNCATE_FILE_NR, user, and struct_command::version.


Variable Documentation

MYSQL* conn

handler for connection to database

Definition at line 37 of file fsd_main.c.

Referenced by exit_deamon(), fsd_db_connect(), and main().

int fsc_device = 0

handler for device - char device

Definition at line 39 of file fsd_main.c.

Referenced by exit_deamon(), and main().


Generated on Mon May 28 13:33:08 2007 for MYSQLFS by  doxygen 1.5.0