+
+static int com_mvatt_callback(const struct osl_object *query,
+ struct osl_object *result)
+{
+ char *old = query->data;
+ size_t size = strlen(old) + 1;
+ char *new = old + size;
+ struct osl_object obj = {.data = old, .size = size};
+ struct osl_row *row;
+ struct para_buffer pb = {.size = 0};
+ int ret;
+
+ ret = osl_get_row(attribute_table, ATTCOL_NAME, &obj, &row);
+ if (ret < 0)
+ goto out;
+ obj.data = new;
+ obj.size = strlen(new) + 1;
+ ret = osl_update_object(attribute_table, row, ATTCOL_NAME, &obj);
+out:
+ if (ret < 0)
+ para_printf(&pb, "%s\n", PARA_STRERROR(-ret));
+ else
+ afs_event(ATTRIBUTE_RENAME, &pb, NULL);
+ if (!pb.buf)
+ return 0;
+ result->data = pb.buf;
+ result->size = pb.size;
+ return 1;
+}
+
+int com_mvatt(int fd, int argc, char * const * const argv)
+{
+ struct osl_object result;
+ int ret;
+
+ if (argc != 3)
+ return -E_ATTR_SYNTAX;
+ ret = send_standard_callback_request(argc - 1, argv + 1, com_mvatt_callback,
+ &result);
+ if (!ret)
+ return 1;
+ if (ret < 0)
+ return ret;
+ if (!result.data || !result.size)
+ return 1;
+ ret = send_va_buffer(fd, "%s", (char *) result.data);
+ free(result.data);
+ return ret;
+}
+
+/** Data passed to the action handler of com_rmatt(). */