Hello,
I am compiling the BSP for M52259demo for the first time, and didn't make it very far.
After editing user_config.h and opening build_libs.mcp, I got this error:
Error : undefined identifier 'IO_IOCTL_CHECK_DIR_EXIST'
ftpd.c line 220 error = ioctl(session_ptr->CURRENT_FS, IO_IOCTL_CHECK_DIR_EXIST,(pointer)FTPd_rootdir );
Error : undefined identifier 'IO_IOCTL_CHECK_DIR_EXIST'
ftpd.c line 220 error = ioctl(session_ptr->CURRENT_FS, IO_IOCTL_CHECK_DIR_EXIST,(pointer)FTPd_rootdir );
Upon examining the source code, it looks like the intent was to allow for compilation of RTCS without MQX, but I don't see evidence of support for RTCS without MFS.
Is that a valid assumption?
Thanks,
Glen
Solved! Go to Solution.
Hi Glen,
it is bug in 3.1.0.
Description : In case FTPDCFG_USES_MFS is set to 0 in MQX user_config.h all references to MFS have to be leave out from compilation. Ftp server root directory is of such cases.
Problem will be fixed in 3.2.0 but in meantime you can fix it in if you use following version of ftpd_task function in ftpd.c file :
/*TASK*----------------------------------------------------------------- * * Function Name : FTPd_task * Returned Value : none * Comments : FTP server. * *END*-----------------------------------------------------------------*/ void FTPd_task ( pointer init_ptr, pointer creator ) { /* Body */ FTPd_CONTEXT ftpd_context = { 0 }; sockaddr_in laddr; uint_32 sock, listensock; uint_32 error=RTCS_OK; uint_16 remote_addr_len; sockaddr_in remote_addr = {0}; TASK_TEMPLATE_STRUCT_PTR t_ptr; FTPd_SESSION_PTR session_ptr; uint_32 option; boolean dev_in_path = FALSE; int_16 devlen = 0, rootdirlen = 0; FTPd_task_id = RTCS_task_getid(); #ifdef __MQX__ /* Set up exit handler and context so that we can clean up if the FTP Server is terminated */ _task_set_environment( _task_get_id(), (pointer) &ftpd_context ); _task_set_exit_handler( _task_get_id(), FTPd_Exit_handler ); #endif t_ptr = _task_get_template_ptr(MQX_NULL_TASK_ID); laddr.sin_family = AF_INET; laddr.sin_port = IPPORT_FTP; laddr.sin_addr.s_addr = INADDR_ANY; /* Listen on TCP port */ ftpd_context.LISTENSOCK = socket(PF_INET, SOCK_STREAM, 0); listensock = ftpd_context.LISTENSOCK; if (listensock == RTCS_SOCKET_ERROR) { error = RTCSERR_OUT_OF_SOCKETS; } if (!error) { option = FTPd_window_size; error = setsockopt(listensock, SOL_TCP, OPT_TBSIZE, &option, sizeof(option)); } if (!error) { option = FTPd_window_size; error = setsockopt(listensock, SOL_TCP, OPT_RBSIZE, &option, sizeof(option)); } if (!error) { option = FTPDCFG_SEND_TIMEOUT; error = setsockopt(listensock, SOL_TCP, OPT_SEND_TIMEOUT, &option, sizeof(option)); } if (!error) { option = FTPDCFG_CONNECT_TIMEOUT; error = setsockopt(listensock, SOL_TCP, OPT_CONNECT_TIMEOUT, &option, sizeof(option)); } if (!error) { option = FTPDCFG_TIMEWAIT_TIMEOUT; error = setsockopt(listensock, SOL_TCP, OPT_TIMEWAIT_TIMEOUT, &option, sizeof(option)); } if (!error) { error = bind(listensock, &laddr, sizeof(laddr)); } if (!error) { error = listen(listensock, 0); } if (error) { RTCS_task_exit(creator, error); } RTCS_task_resume_creator(creator, RTCS_OK); for (;;) { /* Connection requested; accept it */ remote_addr_len = sizeof(remote_addr); sock = accept(listensock, &remote_addr, &remote_addr_len); if ((sock != 0) && (sock!=RTCS_SOCKET_ERROR)) { session_ptr = (FTPd_SESSION_PTR) RTCS_mem_alloc_zero(sizeof (FTPd_SESSION_STRUCT)); if ( session_ptr ) { _mem_set_type(session_ptr, MEM_TYPE_FTPd_SESSION_PTR); session_ptr->DATA_BUFFER_SIZE = FTPd_buffer_size; session_ptr->DATA_BUFFER_PTR = RTCS_mem_alloc_zero(session_ptr->DATA_BUFFER_SIZE); if (session_ptr->DATA_BUFFER_PTR == NULL) { _mem_free(session_ptr); session_ptr = NULL; } else { _mem_set_type(session_ptr->DATA_BUFFER_PTR, MEM_TYPE_FTPd_DATA_BUFFER); } } if (session_ptr == NULL) { shutdown((uint_32)sock, FTPDCFG_SHUTDOWN_OPTION); } else { session_ptr->CONTROL_SOCK = (uint_32) sock; session_ptr->CONNECTED = TRUE; /* set default data ports */ session_ptr->SERVER_DATA_SOCKADDR.sin_family = AF_INET; session_ptr->SERVER_DATA_SOCKADDR.sin_port = IPPORT_FTPDATA; session_ptr->SERVER_DATA_SOCKADDR.sin_addr.s_addr = INADDR_ANY; session_ptr->USER_DATA_SOCKADDR.sin_family = remote_addr.sin_family; session_ptr->USER_DATA_SOCKADDR.sin_port = remote_addr.sin_port; session_ptr->USER_DATA_SOCKADDR.sin_addr.s_addr = remote_addr.sin_addr.s_addr; #if FTPDCFG_USES_MFS //initialize current directory and current filesystem devlen = _io_get_dev_for_path(session_ptr->CURRENT_FS_NAME, &dev_in_path, FTPD_DEVLEN, (char *)FTPd_rootdir, NULL); session_ptr->CURRENT_FS = _io_get_fs_by_name(session_ptr->CURRENT_FS_NAME); error = ioctl(session_ptr->CURRENT_FS, IO_IOCTL_CHECK_DIR_EXIST,(pointer)FTPd_rootdir ); if (error) { #endif session_ptr->CURRENT_FS = NULL; session_ptr->CURRENT_FTP_DIR = NULL; session_ptr->CURRENT_FS_DIR[0] = '\0'; #if FTPDCFG_USES_MFS } else { // set current fs dir (including root dir) strcpy(session_ptr->CURRENT_FS_DIR,FTPd_rootdir+devlen); rootdirlen = strlen(session_ptr->CURRENT_FS_DIR); // set current FTP dir session_ptr->CURRENT_FTP_DIR = session_ptr->CURRENT_FS_DIR + rootdirlen - 1; //check if there is / at the end of root dir name if(*(session_ptr->CURRENT_FTP_DIR) != '\\' && *(session_ptr->CURRENT_FTP_DIR) != '/') { session_ptr->CURRENT_FTP_DIR++; } session_ptr->CURRENT_FTP_DIR[0] = '\\'; session_ptr->CURRENT_FTP_DIR[1] = '\0'; } #endif #if FTPDCFG_ENABLE_MULTIPLE_CLIENTS /* Create a task to look after it */ RTCS_detachsock(sock); if (RTCS_task_create("FTPd_child", t_ptr->TASK_PRIORITY, t_ptr->TASK_STACKSIZE, FTPd_child, (pointer) session_ptr) != RTCS_OK ) { RTCS_attachsock(sock); shutdown(sock, FLAG_ABORT_CONNECTION); _mem_free(session_ptr->DATA_BUFFER_PTR); _mem_free(session_ptr); #else FTPd_child((pointer) session_ptr,0); #endif } } } }
PetrL