Classes | |
struct | read_dir_item |
declaration of functions for communication with char device | |
int | fsd_chardevice_open () |
Open connection to FSC device. | |
int | fsd_chardevice_close (int fsc_device) |
Release device. | |
int | fsd_chardevice_read (int fsc_device, char *buffer) |
Read message from device. | |
int | fsd_chardevice_write (int fsc_device, const char *data, int count) |
Write message to device. | |
constants for symbols for commands | |
#define | TEST "TS" |
#define | CREATE "CF" |
#define | MKDIR "MD" |
#define | CLEAR_FILE "CR" |
#define | ADD_BLOCK "AB" |
#define | REMOVE_FILE "RF" |
#define | REMOVE_DIR "RD" |
#define | GET_BLOCK "GB" |
#define | LOOKUP "LU" |
#define | READ_DIR "RE" |
#define | FILE_INFO "FI" |
#define | DIR_INFO "DI" |
#define | READ_INODE "RI" |
#define | CMD_OK "OK" |
#define | CMD_ER "ER" |
#define | REPLACE_BLOCK "RB" |
#define | MOVE_FILE "MV" |
#define | RENAME_FILE "DN" |
#define | RENAME_DIR "DD" |
#define | TRUNCATE_FILE "TR" |
#define | APPEND_FILE "AP" |
constants for numbers of commands | |
#define | UNKNOWN_COMMAND_NR 1000 |
#define | TEST_NR 1001 |
#define | CREATE_NR 1002 |
#define | MKDIR_NR 1003 |
#define | CLEAR_FILE_NR 1004 |
#define | ADD_BLOCK_NR 1005 |
#define | REMOVE_FILE_NR 1006 |
#define | REMOVE_DIR_NR 1007 |
#define | GET_BLOCK_NR 1008 |
#define | LOOKUP_NR 1009 |
#define | READ_DIR_NR 1010 |
#define | CMD_OK_NR 1011 |
#define | CMD_ER_NR 1012 |
#define | DIR_INFO_NR 1013 |
#define | FILE_INFO_NR 1014 |
#define | READ_INODE_NR 1015 |
#define | REPLACE_BLOCK_NR 1016 |
#define | MOVE_FILE_NR 1017 |
#define | RENAME_FILE_NR 1018 |
#define | TRUNCATE_FILE_NR 1019 |
#define | RENAME_DIR_NR 1020 |
constants for restrictions of length | |
#define | MAX_NAME_LENGTH 64 |
#define | MAX_ID_LENGTH 11 |
#define | MAX_SIZE_LENGTH 11 |
#define | MAX_VERSION_LENGTH 10 |
#define | MAX_COMMAND_LENGTH 3 |
#define | MAX_PARAM_LENGTH 64 |
#define | MAX_BLOCK_LENGTH 4096 |
#define | MAX_MESSAGE_LENGTH 5192 |
#define | MAX_QUERY_LENGTH 300 |
constants for connection to char device | |
#define | CHAR_DEVICE_NAME "fsc_dev" |
#define | FSC_DEVICE_LOCATION "/dev/fsc_dev" |
constants for functions return values | |
#define | DEFINITION_BASE 100 |
#define | IS_FILE (+ (DEFINITION_BASE + 6)) |
#define | IS_DIR (+ (DEFINITION_BASE + 7)) |
#define | OK (+ (DEFINITION_BASE + 8)) |
#define | ENAME_NOT_EXISTS (- (DEFINITION_BASE + 11)) |
#define | EINODE_NOT_EXISTS (- (DEFINITION_BASE + 11)) |
#define | EDB_ERROR (- (DEFINITION_BASE + 1)) |
#define | ENAME_EXISTS (- (DEFINITION_BASE + 3)) |
#define | EDIR_NOT_EXISTS (- (DEFINITION_BASE + 2)) |
#define | EDIR_IS_NOT_EMPTY (- (DEFINITION_BASE + 4)) |
#define | EBLOCK_NOT_EXISTS (- (DEFINITION_BASE + 5)) |
#define | EFILE_NOT_EXISTS (- (DEFINITION_BASE + 9)) |
#define | EDB_CONNECT_ERROR (- (DEFINITION_BASE + 10)) |
#define | EFSC_DEVICE_OPEN_ERROR (- (DEFINITION_BASE + 12)) |
#define | EFSC_DEVICE_NOT_OPEN (- (DEFINITION_BASE + 13)) |
#define | EGENERAL_ERROR (- (DEFINITION_BASE + 14)) |
#define | EPROTOKOL_VERSION_ERROR (- (DEFINITION_BASE + 15)) |
#define | EDIR_NAME_NOT_EXISTS (- (DEFINITION_BASE + 16)) |
#define | EFILE_NAME_NOT_EXISTS (- (DEFINITION_BASE + 17)) |
#define | EPARENT_NOT_EXISTS (- (DEFINITION_BASE + 18)) |
Defines | |
#define | FSD_VERSION "MYSQL1.1" |
Typedefs | |
typedef read_dir_item | rd_item |
This file contents declaration of functions which provide connection to char device and communication with it.
#define FSD_VERSION "MYSQL1.1" |
definition of version of communication protocol
Definition at line 19 of file fsd_defines.h.
Referenced by fsd_write_message(), main(), and parse_message().
typedef struct read_dir_item rd_item |
int fsd_chardevice_close | ( | int | fsc_device | ) |
Release device.
Close connection to device.
fsc_device | Open char device file descriptor. |
Definition at line 53 of file fsd_device.c.
Referenced by exit_deamon().
int fsd_chardevice_open | ( | ) |
Open connection to FSC device.
This function opens connection to FSC device. The path to the device is defined in FSC_DEVICE_LOCATION.
Definition at line 39 of file fsd_device.c.
References FSC_DEVICE_LOCATION.
Referenced by main().
int fsd_chardevice_read | ( | int | fsc_device, | |
char * | buffer | |||
) |
Read message from device.
Read string from char_device.
fsc_device | Device to be read from. | |
buffer | Data buffer, storage for read message. |
Definition at line 67 of file fsd_device.c.
References EFSC_DEVICE_NOT_OPEN, MAX_MESSAGE_LENGTH, PDEBUG, and result.
Referenced by main().
int fsd_chardevice_write | ( | int | fsc_device, | |
const char * | data, | |||
int | count | |||
) |
Write message to device.
Write buffer content into FSC device. Number of chars in the buffer must be specified.
fsc_device | Device to be writen to. | |
data | Buffer containing the message. | |
count | Number of characters in the buffer. |
Definition at line 99 of file fsd_device.c.
References EFSC_DEVICE_NOT_OPEN, PDEBUG, and result.
Referenced by fsd_write_message().