⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tcl_mover.c

📁 网络数据管理协议的开发
💻 C
📖 第 1 页 / 共 2 页
字号:
intmoverStopCmd(void*			clientData,			 Tcl_Interp*	interp,			 int			argc,			 char*			argv[] __attribute__ ((unused))){	NdmpConnection			connection = (NdmpConnection)clientData;	ndmp_mover_stop_reply*	reply = 0;	int 					r;		if (argc != 1)	{		Tcl_SetResult(interp, "usage: mover_stop",					  TCL_STATIC);		return(TCL_ERROR);	}	r = ndmpSendRequest(connection, NDMP_MOVER_STOP, NDMP_NO_ERR,						0, (void*)&reply);	if (ndmpcCheckNdmpSend(interp, r,						   reply ? reply->error : 0))	{		ndmpFreeMessage(connection);		return(r < 0 ? TCL_ERROR : TCL_OK);	}	ndmpFreeMessage(connection);	return(TCL_OK);}/* * moverSetWindowCmd *   Sends an ndmp_mover_set_window_request to the NDMP server. *   usage: mover_set_window begin-byte end-byte * * Parameters: *   clientData (input) - connection handle. *   interp     (input) - Tcl interpreter. *   argc       (input) - argument count. *   argv       (input) - argument array. * * Returns: *   Tcl error code. */intmoverSetWindowCmd(void*			clientData,				  Tcl_Interp*	interp,				  int			argc,				  char*			argv[]){	NdmpConnection					connection = (NdmpConnection)clientData;	ndmp_mover_set_window_request	request;	ndmp_mover_set_window_reply*	reply = 0;	int 							r;		if (argc != 3)	{		Tcl_SetResult(interp, "usage: mover_set_window offset length",					  TCL_STATIC);		return(TCL_ERROR);	}	request.offset = longLongToQuad(strtoull(argv[1], 0, 0));	request.length = longLongToQuad(strtoull(argv[2], 0, 0));	r = ndmpSendRequest(connection, NDMP_MOVER_SET_WINDOW, NDMP_NO_ERR,						&request, (void*)&reply);	if (ndmpcCheckNdmpSend(interp, r,						   reply ? reply->error : 0))	{		ndmpFreeMessage(connection);		return(r < 0 ? TCL_ERROR : TCL_OK);	}	ndmpFreeMessage(connection);	return(TCL_OK);}/* * moverReadCmd *   Sends a ndmp_mover_read request to the NDMP server. *   usage: mover_read offset length * * Parameters: *   clientData (input) - connection handle. *   interp     (input) - Tcl interpreter. *   argc       (input) - argument count. *   argv       (input) - argument array. * * Returns: *   Tcl error code. */intmoverReadCmd(void*			clientData,			 Tcl_Interp*	interp,			 int			argc,			 char*			argv[]){	NdmpConnection			connection = (NdmpConnection)clientData;	ndmp_mover_read_request	request;	ndmp_mover_read_reply*	reply = 0;	int 					r;		if (argc != 3)	{		Tcl_SetResult(interp, "usage: mover_read offset length",					  TCL_STATIC);		return(TCL_ERROR);	}	request.offset = longLongToQuad(strtoull(argv[1], 0, 0));	request.length = longLongToQuad(strtoull(argv[2], 0, 0));	r = ndmpSendRequest(connection, NDMP_MOVER_READ, NDMP_NO_ERR,						&request, (void*)&reply);	if (ndmpcCheckNdmpSend(interp, r,						   reply ? reply->error : 0))	{		ndmpFreeMessage(connection);		return(r < 0 ? TCL_ERROR : TCL_OK);	}	ndmpFreeMessage(connection);	return(TCL_OK);}/* * moverCloseCmd *   Sends an ndmp_mover_close_request to the NDMP server. *   usage: mover_close  * * Parameters: *   clientData (input) - connection handle. *   interp     (input) - Tcl interpreter. *   argc       (input) - argument count. *   argv       (input) - argument array. * * Returns: *   Tcl error code. */intmoverCloseCmd(void*			clientData,			  Tcl_Interp*	interp,			  int			argc,			  char*			argv[] __attribute__ ((unused))){	NdmpConnection			connection = (NdmpConnection)clientData;	ndmp_mover_close_reply*	reply = 0;	int 					r;		if (argc != 1)	{		Tcl_SetResult(interp, "usage: mover_close",					  TCL_STATIC);		return(TCL_ERROR);	}	r = ndmpSendRequest(connection, NDMP_MOVER_CLOSE, NDMP_NO_ERR,						0, (void*)&reply);	if (ndmpcCheckNdmpSend(interp, r,						   reply ? reply->error : 0))	{		ndmpFreeMessage(connection);		return(r < 0 ? TCL_ERROR : TCL_OK);	}	ndmpFreeMessage(connection);	return(TCL_OK);}/* * moverSetRecordSizeCmd *   Sends an ndmp_mover_set_record_size_request to the NDMP server. *   usage: mover_set_record_size size * * Parameters: *   clientData (input) - connection handle. *   interp     (input) - Tcl interpreter. *   argc       (input) - argument count. *   argv       (input) - argument array. * * Returns: *   Tcl error code. */intmoverSetRecordSizeCmd(void*			clientData,					  Tcl_Interp*	interp,					  int			argc,					  char*			argv[]){	NdmpConnection						connection = (NdmpConnection)clientData;	ndmp_mover_set_record_size_request	request;	ndmp_mover_set_record_size_reply*	reply = 0;	int 								r;		if (argc != 2)	{		Tcl_SetResult(interp, "usage: mover_set_record_size size",					  TCL_STATIC);		return(TCL_ERROR);	}	request.len    = strtoul(argv[1], 0, 0);	r = ndmpSendRequest(connection, NDMP_MOVER_SET_RECORD_SIZE, NDMP_NO_ERR,						&request, (void*)&reply);	if (ndmpcCheckNdmpSend(interp, r,						   reply ? reply->error : 0))	{		ndmpFreeMessage(connection);		return(r < 0 ? TCL_ERROR : TCL_OK);	}	ndmpFreeMessage(connection);	return(TCL_OK);}/* * moverConnectCmd *   Sends an ndmp_mover_connect_request to the NDMP server. *   usage: mover_connect read|write local|tcp|fc|ipc * * Parameters: *   clientData (input) - connection handle. *   interp     (input) - Tcl interpreter. *   argc       (input) - argument count. *   argv       (input) - argument array. * * Returns: *   Tcl error code. */intmoverConnectCmd(void*		clientData,				Tcl_Interp*	interp,				int			argc,				char*		argv[]){	NdmpConnection				connection = (NdmpConnection)clientData;	ndmp_mover_connect_request	request;	ndmp_mover_connect_reply*	reply = 0;	int 						r;		if (argc < 3)	{		Tcl_SetResult(interp,					  "usage: mover_connect read|write local|tcp|fc|ipc ?address?",					  TCL_STATIC);		return(TCL_ERROR);	}	if (strcmp(argv[1], "read") == 0)	{		request.mode = NDMP_MOVER_MODE_READ;	}	else if (strcmp(argv[1], "write") == 0)	{		request.mode = NDMP_MOVER_MODE_WRITE;	}	else	{		Tcl_SetResult(interp,					  "usage: mover_connect read|write local|tcp|fc|ipc ?address?",					  TCL_STATIC);		return(TCL_ERROR);	}		if (strcmp(argv[2], "local") == 0)	{		request.addr.addr_type = NDMP_ADDR_LOCAL;	}	else if (strcmp(argv[2], "tcp") == 0)	{		if (argc != 5)		{			Tcl_SetResult(interp, "usage: mover_connect read|write tcp ip_addr port",						  TCL_STATIC);			return(TCL_ERROR);		}				request.addr.addr_type = NDMP_ADDR_TCP;		request.addr.ndmp_addr_u.tcp_addr.ip_addr = strtoul(argv[3], 0, 0);		request.addr.ndmp_addr_u.tcp_addr.port = strtoul(argv[4], 0, 0);	}	else if (strcmp(argv[2], "fc") == 0)	{		if (argc != 4)		{			Tcl_SetResult(interp,						  "usage: mover_connect read|write fc loop_id",						  TCL_STATIC);			return(TCL_ERROR);		}				request.addr.addr_type = NDMP_ADDR_FC;		request.addr.ndmp_addr_u.fc_addr.loop_id = strtoul(argv[3], 0, 0);	}	else if (strcmp(argv[2], "ipc") == 0)	{		if (argc != 3)		{			Tcl_SetResult(interp,						  "usage: mover_connect read|write ipc address",						  TCL_STATIC);			return(TCL_ERROR);		}				request.addr.addr_type = NDMP_ADDR_IPC;		request.addr.ndmp_addr_u.ipc_addr.comm_data.comm_data_len = strlen(argv[2]);		request.addr.ndmp_addr_u.ipc_addr.comm_data.comm_data_val = argv[3];	}	else	{		Tcl_SetResult(interp,					  "usage: mover_connect read|write local|tcp|fc|ipc ?address?",					  TCL_STATIC);		return(TCL_ERROR);	}		r = ndmpSendRequest(connection, NDMP_MOVER_CONNECT, NDMP_NO_ERR,						&request, (void*)&reply);	if (ndmpcCheckNdmpSend(interp, r,						   reply ? reply->error : 0))	{		ndmpFreeMessage(connection);		return(r < 0 ? TCL_ERROR : TCL_OK);	}	ndmpFreeMessage(connection);	return(TCL_OK);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -