]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
Merge branch 't/mvblob_improvement'
authorAndre Noll <maan@tuebingen.mpg.de>
Sun, 14 Sep 2014 17:01:47 +0000 (19:01 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Sun, 14 Sep 2014 17:02:35 +0000 (19:02 +0200)
Cooking for two months.

* t/mvblob_improvement:
  mvblob: Improve error diagnostics.

1  2 
NEWS
blob.c

diff --combined NEWS
index 7c54b5cc7875b9da8ff6c10d5a419a47e9d373e2,f6fca5662938ecdaaac58b21056760f25712e7d3..f7158c455fc90723d11ad6902b4e2042d6b93955
--- 1/NEWS
--- 2/NEWS
+++ b/NEWS
@@@ -1,24 -1,11 +1,25 @@@
  NEWS
  ====
  
 --------------------------------------------------
 -0.5.3 (to be released) "symbolic synchronization"
 --------------------------------------------------
 +-----------------------------------------------
 +0.5.4 (to be announced) "exponential alignment"
 +-----------------------------------------------
  
 +      * Minor cleanups to daemon.c.
 +      * New URLs for home page and git services.
++      * Improved error diagnostics for the mvblob commands.
 +
 +Download: ./releases/paraslash-git.tar.bz2
 +
 +---------------------------------------------
 +0.5.3 (2014-08-01) "symbolic synchronization"
 +---------------------------------------------
 +
 +Not many new features, but lots of fixes and usability improvements.
 +
 +      - para_gui has been converted to use the paraslash scheduler.
        - Various alsa-related fixes, mostly for the raspberry pi.
 +      - Many scheduler improvements and cleanups.
        - The test suite has been extended to include sanity checks
          for the generated man pages.
        - ao_writer fixes. This writer was in a quite bad shape. Many
@@@ -28,9 -15,6 +29,9 @@@
        - The cpsi command now prints a meaningful error message if
          none of the given patterns matched any audio file.
  
 +Downloads: ./releases/paraslash-0.5.3.tar.bz2 (tarball),
 +./releases/paraslash-0.5.3.tar.bz2.asc (signature)
 +
  ----------------------------------------
  0.5.2 (2014-04-11) "orthogonal interior"
  ----------------------------------------
diff --combined blob.c
index 37f5404890d94b89589be8121a1c04af50c89061,9973de9544486e4df2f1d9d0a381db9978c4dc6d..bdff90613817a56d14c6b9622ae5e068a496efcf
--- 1/blob.c
--- 2/blob.c
+++ b/blob.c
@@@ -1,5 -1,5 +1,5 @@@
  /*
 - * Copyright (C) 2007-2014 Andre Noll <maan@systemlinux.org>
 + * Copyright (C) 2007-2014 Andre Noll <maan@tuebingen.mpg.de>
   *
   * Licensed under the GPL v2. For licencing details see COPYING.
   */
@@@ -482,35 -482,51 +482,51 @@@ static int com_addblob(callback_functio
        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) \