Skip to content

Commit

Permalink
Make NDMP ImageStream buffer dynamically allocated size.
Browse files Browse the repository at this point in the history
Instead of hardcoding the Image Stream buffer to 100 K size it to the
actual recordsize in use by the NDMP Job. This way we don't have to
check if the recordsize specified is outside the allowable size.
  • Loading branch information
Marco van Wieringen committed Feb 17, 2015
1 parent 39dd352 commit 71b89e4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
9 changes: 9 additions & 0 deletions src/ndmp/ndma_image_stream.c
Expand Up @@ -93,6 +93,13 @@ ndmis_initialize (struct ndm_session *sess)
NDMOS_MACRO_ZEROFILL (sess->plumb.image_stream);
NDMOS_MACRO_ZEROFILL (&sess->plumb.image_stream->chan);

sess->plumb.image_stream->buf = NDMOS_API_MALLOC (sess->control_acb->job.record_size);
if (!sess->plumb.image_stream->buf) {
NDMOS_API_FREE (sess->plumb.image_stream);
return -1;
}
NDMOS_MACRO_ZEROFILL (sess->plumb.image_stream->buf);

ndmis_reinit_remote (sess);

sess->plumb.image_stream->data_ep.name = "DATA";
Expand Down Expand Up @@ -123,11 +130,13 @@ ndmis_destroy (struct ndm_session *sess)
return 0;
}

NDMOS_API_FREE (sess->plumb.image_stream->buf);
NDMOS_API_FREE (sess->plumb.image_stream);
sess->plumb.image_stream = NULL;

return 0;
}

/* Belay -- Cancel partially issued activation/start */
int
ndmis_belay (struct ndm_session *sess)
Expand Down
6 changes: 1 addition & 5 deletions src/ndmp/ndmagents.h
Expand Up @@ -932,10 +932,6 @@ extern int ndmra_destroy (struct ndm_session *sess);
****************************************************************
*/

#ifndef NDM_N_IMAGE_STREAM_BUF
#define NDM_N_IMAGE_STREAM_BUF (100*1024)
#endif

enum ndmis_connect_status {
NDMIS_CONN_IDLE = 0,
NDMIS_CONN_LISTEN,
Expand Down Expand Up @@ -975,7 +971,7 @@ struct ndm_image_stream {
/* transfer stuff */
int transfer_mode;
struct ndmchan chan;
char buf[NDM_N_IMAGE_STREAM_BUF];
char * buf;
};

extern int ndmis_initialize (struct ndm_session *sess);
Expand Down

0 comments on commit 71b89e4

Please sign in to comment.