X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=blob.c;h=bdff90613817a56d14c6b9622ae5e068a496efcf;hp=37f5404890d94b89589be8121a1c04af50c89061;hb=4d9d588c5df359c3c5f279fbfd4ea51d3a2afc87;hpb=03849db5d67e1702b1311429966fedd2545512d7 diff --git a/blob.c b/blob.c index 37f54048..bdff9061 100644 --- a/blob.c +++ b/blob.c @@ -482,35 +482,51 @@ static int com_addblob(callback_function *f, struct command_context *cc) return stdin_command(cc, &arg_obj, f, afs_cb_result_handler, cc); } -/* FIXME: Print output to client, not to log file */ -static void com_mvblob_callback(struct osl_table *table, __a_unused int fd, +static void com_mvblob_callback(struct osl_table *table, int fd, const struct osl_object *query) { char *src = (char *) query->data; struct osl_object obj = {.data = src, .size = strlen(src) + 1}; char *dest = src + obj.size; struct osl_row *row; + struct para_buffer pb = { + .max_size = shm_get_shmmax(), + .private_data = &fd, + .max_size_handler = afs_max_size_handler + }; int ret = osl(osl_get_row(table, BLOBCOL_NAME, &obj, &row)); - if (ret < 0) + if (ret < 0) { + para_printf(&pb, "could not locate %s: %s\n", src, + para_strerror(-ret)); goto out; + } obj.data = dest; obj.size = strlen(dest) + 1; ret = osl(osl_update_object(table, row, BLOBCOL_NAME, &obj)); - if (ret < 0) + if (ret < 0) { + para_printf(&pb, "failed to update object %s: %s\n", dest, + para_strerror(-ret)); goto out; + } afs_event(BLOB_RENAME, NULL, table); out: - if (ret < 0) - PARA_NOTICE_LOG("%s\n", para_strerror(-ret)); + if (pb.offset) + pass_buffer_as_shm(fd, SBD_OUTPUT, pb.buf, pb.offset); + free(pb.buf); } static int com_mvblob(callback_function *f, struct command_context *cc) { + int ret; + if (cc->argc != 3) return -E_MOOD_SYNTAX; - return send_option_arg_callback_request(NULL, cc->argc - 1, - cc->argv + 1, f, NULL, NULL); + ret = send_option_arg_callback_request(NULL, cc->argc - 1, + cc->argv + 1, f, afs_cb_result_handler, cc); + if (ret < 0) + send_strerror(cc, -ret); + return ret; } #define DEFINE_BLOB_COMMAND(cmd_name, table_name, cmd_prefix) \