Skip to content

Commit

Permalink
Make NDMP code compile on FreeBSD.
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco van Wieringen committed Feb 17, 2015
1 parent c20af5f commit 2d76895
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 7 deletions.
2 changes: 2 additions & 0 deletions src/ndmp/ndma_robot.c
Expand Up @@ -81,9 +81,11 @@ ndmra_destroy (struct ndm_session *sess)
return 0;
}

#ifdef NDMOS_OPTION_ROBOT_SIMULATOR
if (sess->robot_acb->sim_dir) {
NDMOS_API_FREE (sess->robot_acb->sim_dir);
}
#endif

NDMOS_API_FREE (sess->robot_acb);
sess->robot_acb = NULL;
Expand Down
2 changes: 2 additions & 0 deletions src/ndmp/ndma_tape.c
Expand Up @@ -96,9 +96,11 @@ ndmta_destroy (struct ndm_session *sess)
NDMOS_API_FREE (sess->tape_acb->tape_buffer);
}

#ifdef NDMOS_OPTION_TAPE_SIMULATOR
if (sess->tape_acb->drive_name) {
NDMOS_API_FREE (sess->tape_acb->drive_name);
}
#endif

NDMOS_API_FREE (sess->tape_acb);
sess->tape_acb = NULL;
Expand Down
1 change: 1 addition & 0 deletions src/ndmp/ndmos.h
Expand Up @@ -495,6 +495,7 @@ extern char *ndml_strend(char *s); /* ndml_util.c */
#endif /* NDMOS_OPTION_TAPE_SIMULATOR */

#ifdef NDMOS_OPTION_ROBOT_SIMULATOR
#undef NDMOS_MACRO_ROBOT_AGENT_ADDITIONS
#define NDMOS_MACRO_ROBOT_AGENT_ADDITIONS \
char * sim_dir;
#endif /* NDMOS_OPTION_ROBOT_SIMULATOR */
Expand Down
4 changes: 3 additions & 1 deletion src/ndmp/ndmos_common.c
Expand Up @@ -280,7 +280,9 @@ ndmos_tape_initialize (struct ndm_session *sess)
void
ndmos_tape_sync_state (struct ndm_session *sess)
{
the_tape_state.error = NDMP9_DEV_NOT_OPEN_ERR;
struct ndm_tape_agent * ta = sess->tape_acb;

ta->tape_state.error = NDMP9_DEV_NOT_OPEN_ERR;
}

ndmp9_error
Expand Down
10 changes: 5 additions & 5 deletions src/ndmp/ndmos_freebsd.c
Expand Up @@ -65,7 +65,7 @@
#define NDMOS_COMMON_MD5
#define NDMOS_COMMON_NONBLOCKING_IO_SUPPORT
#define NDMOS_COMMON_TAPE_INTERFACE /* uses tape simulator */
#undef NDMOS_COMMON_SCSI_INTERFACE /* stub-out */
#define NDMOS_COMMON_SCSI_INTERFACE /* use scsi simulator */
#define NDMOS_COMMON_DISPATCH_REQUEST /* no-op */


Expand Down Expand Up @@ -216,7 +216,7 @@ ndmos_scsi_execute_cdb (struct ndm_session *sess,
}

data_len = request->datain_len;
data_in_ptr = malloc (data_len);
data_in_ptr = (u_int8_t *)malloc (data_len);

if (!data_in_ptr) {
reply->error = NDMP9_NO_MEM_ERR;
Expand All @@ -228,7 +228,7 @@ ndmos_scsi_execute_cdb (struct ndm_session *sess,

case NDMP9_SCSI_DATA_DIR_OUT:
data_len = request->dataout.dataout_len;
data_ptr = request->dataout.dataout_val;
data_ptr = (u_int8_t *)request->dataout.dataout_val;
flags = CAM_DIR_OUT;
break;

Expand Down Expand Up @@ -272,7 +272,7 @@ ndmos_scsi_execute_cdb (struct ndm_session *sess,
int n_sense;

n_sense = ccb->csio.sense_len - ccb->csio.sense_resid;
reply->ext_sense.ext_sense_val = malloc (n_sense);
reply->ext_sense.ext_sense_val = (char *)malloc (n_sense);
if (reply->ext_sense.ext_sense_val) {
bcopy (&ccb->csio.sense_data,
reply->ext_sense.ext_sense_val,
Expand All @@ -298,7 +298,7 @@ ndmos_scsi_execute_cdb (struct ndm_session *sess,
break;

case NDMP9_SCSI_DATA_DIR_IN:
reply->datain.datain_val = data_in_ptr;
reply->datain.datain_val = (char *)data_in_ptr;
reply->datain.datain_len = data_len;
break;

Expand Down
2 changes: 1 addition & 1 deletion src/ndmp/ndmos_freebsd.h
Expand Up @@ -66,6 +66,7 @@
#include <sys/fcntl.h>
#include <signal.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <rpc/rpc.h>
#include <assert.h>
#include <errno.h>
Expand Down Expand Up @@ -101,5 +102,4 @@
#define NDMOS_MACRO_ROBOT_AGENT_ADDITIONS \
struct cam_device * camdev;


#endif /* NDMOS_ID == NDMOS_ID_FREEBSD */

0 comments on commit 2d76895

Please sign in to comment.