BurstFS_Server/burstfs_cmd_handler.c
int pack_ack_msg(char *ptr_cmd, int cmd, int rc, void *val, \
		int val_len) {
	int ret_sz = 0;

	memcpy(ptr_cmd, &cmd, sizeof(int));
	ret_sz += sizeof(int);
	memcpy(ptr_cmd + sizeof(int), &rc, sizeof(int));
	ret_sz += sizeof(int);

	if (val != NULL) {
		memcpy(ptr_cmd + 2 * sizeof(int), val, val_len);
		ret_sz += val_len;
	}
	return ret_sz;
}
/**
* pack the message to be returned to the client.
* format: command type, error code, payload
* @param ptr_cmd: command buffer
* @param rc: error code
* @param val: payload
* @return success/error code
*/
pack the message to be returned to the client.
format: command type, error code, payload
pack the message to be returned to the client . format : command type error code payload
int pack_ack_msg(char *ptr_cmd, int cmd, int rc, void *val, \
		int val_len) {
	int ret_sz = 0;
	memcpy(ptr_cmd, &cmd, sizeof(int));
	ret_sz += sizeof(int);
	memcpy(ptr_cmd + sizeof(int), &rc, sizeof(int));
	ret_sz += sizeof(int);
	if (val != NULL) {
		memcpy(ptr_cmd + 2 * sizeof(int), val, val_len);
		ret_sz += val_len;
	}
	return ret_sz;
}
int pack_ack_msg ( char * ptr_cmd , int cmd , int rc , void * val , int val_len ) { int ret_sz = 0 ; memcpy ( ptr_cmd , & cmd , sizeof ( int ) ) ; ret_sz += sizeof ( int ) ; memcpy ( ptr_cmd + sizeof ( int ) , & rc , sizeof ( int ) ) ; ret_sz += sizeof ( int ) ; if ( val != NULL ) { memcpy ( ptr_cmd + 2 * sizeof ( int ) , val , val_len ) ; ret_sz += val_len ; } return ret_sz ; }
pack the message to be returned to the client.
pack the message to be returned to the client .