BONESLIB:=-lglite_lb_server_bones
GSOAPLIB:=-L${stagedir}/lib -lglite_security_gsoap_plugin_${dotless_soap_ver}_${nothrflavour}
TRIOLIB:=-lglite_jp_trio
-LIBTARLIB:=-L${libtar_prefix}/lib -llibtar
+LIBTARLIB:=-L${libtar_prefix}/lib -ltar
ifneq (${mysql_prefix},/usr)
ifeq ($(shell test -f ${mysql_prefix}/lib/libmysqlclient.a -o -f ${mysql_prefix}/lib/libmysqlclient.so && echo ok),ok)
#
glite-jp-sandbox.la: sandbox_plugin.lo
- ${SOLINK} -o $@ sandbox_plugin.lo ${LIBLIBTAR}
+ ${SOLINK} -o $@ sandbox_plugin.lo ${LIBTARLIB}
glite-jp-tags.la: tags_plugin.lo
${SOLINK} -o $@ tags_plugin.lo
char **file_names;
} sb_handle;
-
+// Global data needed for read/write wrappers
+static struct {
+ void *bhandle;
+ glite_jp_context_t ctx;
+ off_t offset;
+} global_data;
+
//static int sandbox_append(void *,void *,int,...);
static int sandbox_open(void *,void *,const char *uri,void **);
return 0;
}
-static ssize_t my_read(int fd, void *buf, size_t count) {
- // XXX: wrapper around glite_jppsbe_pread
+// wrapper around glite_jppsbe_pread
+static ssize_t my_read(int fd, void *buf, size_t count)
+{
+ size_t r;
+
+
+ if (glite_jppsbe_pread(global_data.ctx,global_data.bhandle,buf,count,global_data.offset,&r)) {
+ errno = global_data.ctx->error->code;
+ return -1;
+ }
+
+ global_data.offset += r;
+
+ return r;
}
int init(glite_jp_context_t ctx, glite_jpps_fplug_data_t *data)
{
data->fpctx = ctx;
+ global_data.ctx = ctx;
data->uris = calloc(2,sizeof *data->uris);
data->uris[0] = strdup(GLITE_JP_FILETYPE_ISB);
printf("sandbox_open() called\n");
h->bhandle = bhandle;
+ global_data.bhandle = bhandle;
+ global_data.offset = 0;
h->tt = malloc(sizeof(*h->tt));
h->tt->openfunc = my_open;