struct lsblob_action_data lbad = {
.flags = *(uint32_t *)query->data,
.pb = {
struct lsblob_action_data lbad = {
.flags = *(uint32_t *)query->data,
.pb = {
- .max_size = SHMMAX,
- .private_data = &fd,
- .max_size_handler = pass_buffer_as_shm
+ .max_size = shm_get_shmmax(),
+ .private_data = &(struct afs_max_size_handler_data) {
+ .fd = fd,
+ .band = SBD_OUTPUT
+ },
+ .max_size_handler = afs_max_size_handler,
ret = for_each_matching_row(&pmd);
if (ret < 0)
para_printf(&lbad.pb, "%s\n", para_strerror(-ret));
ret = for_each_matching_row(&pmd);
if (ret < 0)
para_printf(&lbad.pb, "%s\n", para_strerror(-ret));
- pass_buffer_as_shm(lbad.pb.buf, lbad.pb.offset, &fd);
+ pass_buffer_as_shm(fd, SBD_OUTPUT, lbad.pb.buf, lbad.pb.offset);
- return send_option_arg_callback_request(&options, argc - i,
- argv + i, f, rc4_send_result, rc4c);
+ return send_option_arg_callback_request(&options, cc->argc - i,
+ cc->argv + i, f, afs_cb_result_handler, cc);
}
static int cat_blob(struct osl_table *table, struct osl_row *row,
__a_unused const char *name, void *data)
{
}
static int cat_blob(struct osl_table *table, struct osl_row *row,
__a_unused const char *name, void *data)
{
struct osl_object obj;
ret = osl(osl_open_disk_object(table, row, BLOBCOL_DEF, &obj));
if (ret < 0)
struct osl_object obj;
ret = osl(osl_open_disk_object(table, row, BLOBCOL_DEF, &obj));
if (ret < 0)
- return ret;
- if (obj.size)
- ret = pass_buffer_as_shm(obj.data, obj.size, data);
+ return (ret == osl(-E_OSL_EMPTY))? 0 : ret;
+ assert(obj.size > 0);
+ ret = pass_buffer_as_shm(fd, SBD_OUTPUT, obj.data, obj.size);
+ if (pmd.num_matches == 0) {
+ char err_msg[] = "no matches\n";
+ pass_buffer_as_shm(fd, SBD_OUTPUT, err_msg, sizeof(err_msg));
+ }
-static int com_catblob(callback_function *f, struct rc4_context *rc4c, int argc,
- char * const * const argv)
+static int com_catblob(callback_function *f, struct command_context *cc)
- return send_standard_callback_request(argc - 1, argv + 1, f,
- rc4_send_result, rc4c);
+ return send_standard_callback_request(cc->argc - 1, cc->argv + 1, f,
+ afs_cb_result_handler, cc);
para_printf(&rmbd->pb, "%s: %s\n", name, para_strerror(-ret));
return ret;
}
para_printf(&rmbd->pb, "%s: %s\n", name, para_strerror(-ret));
return ret;
}
- .max_size = SHMMAX,
- .private_data = &fd,
- .max_size_handler = pass_buffer_as_shm
+ .max_size = shm_get_shmmax(),
+ .private_data = &(struct afs_max_size_handler_data) {
+ .fd = fd,
+ .band = SBD_OUTPUT
+ },
+ .max_size_handler = afs_max_size_handler,
afs_event(BLOB_RENAME, NULL, table);
}
out:
if (ret2 >= 0 && rmbd.pb.offset)
afs_event(BLOB_RENAME, NULL, table);
}
out:
if (ret2 >= 0 && rmbd.pb.offset)
- pass_buffer_as_shm(rmbd.pb.buf, rmbd.pb.offset, &fd);
+ pass_buffer_as_shm(fd, SBD_OUTPUT, rmbd.pb.buf, rmbd.pb.offset);
-static int com_rmblob(callback_function *f, struct rc4_context *rc4c, int argc,
- char * const * const argv)
+static int com_rmblob(callback_function *f, struct command_context *cc)
- return send_option_arg_callback_request(NULL, argc - 1, argv + 1, f,
- rc4_send_result, rc4c);
+ return send_option_arg_callback_request(NULL, cc->argc - 1, cc->argv + 1, f,
+ afs_cb_result_handler, cc);
* write input from fd to dynamically allocated buffer,
* but maximal max_size byte.
*/
* write input from fd to dynamically allocated buffer,
* but maximal max_size byte.
*/
{
const size_t chunk_size = 1024;
size_t size = 2048, received = 0;
{
const size_t chunk_size = 1024;
size_t size = 2048, received = 0;
* \param arg_obj Pointer to the arguments to \a f.
* \param f The callback function.
* \param max_len Don't read more than that many bytes from stdin.
* \param arg_obj Pointer to the arguments to \a f.
* \param f The callback function.
* \param max_len Don't read more than that many bytes from stdin.
* This function is used by commands that wish to let para_server store
* arbitrary data specified by the user (for instance the add_blob family of
* commands). First, at most \a max_len bytes are read and decrypted from the
* This function is used by commands that wish to let para_server store
* arbitrary data specified by the user (for instance the add_blob family of
* commands). First, at most \a max_len bytes are read and decrypted from the
* given by \a arg_obj, and the combined buffer is made available to the afs
* process via the callback method. See \ref send_callback_request for details.
*
* \return Negative on errors, the return value of the underlying call to
* send_callback_request() otherwise.
*/
* given by \a arg_obj, and the combined buffer is made available to the afs
* process via the callback method. See \ref send_callback_request for details.
*
* \return Negative on errors, the return value of the underlying call to
* send_callback_request() otherwise.
*/
callback_function *f, unsigned max_len,
callback_result_handler *result_handler,
void *private_result_data)
callback_function *f, unsigned max_len,
callback_result_handler *result_handler,
void *private_result_data)
- ret = rc4_send_buffer(rc4c, AWAITING_DATA_MSG);
+ if (cc->use_sideband)
+ ret = send_sb(&cc->scc, NULL, 0, SBD_AWAITING_DATA, false);
+ else
+ ret = sc_send_buffer(&cc->scc, AWAITING_DATA_MSG);
-static int com_addblob(callback_function *f, struct rc4_context *rc4c, int argc,
- char * const * const argv)
+static int com_addblob(callback_function *f, struct command_context *cc)
- arg_obj.size = strlen(argv[1]) + 1;
- arg_obj.data = (char *)argv[1];
- return stdin_command(rc4c, &arg_obj, f, 10 * 1024 * 1024, NULL, NULL);
+ arg_obj.size = strlen(cc->argv[1]) + 1;
+ arg_obj.data = (char *)cc->argv[1];
+ return stdin_command(cc, &arg_obj, f, 10 * 1024 * 1024, NULL, NULL);
-static int com_mvblob(callback_function *f, __a_unused struct rc4_context *rc4c,
- int argc, char * const * const argv)
+static int com_mvblob(callback_function *f, struct command_context *cc)
- return send_option_arg_callback_request(NULL, argc - 1, argv + 1, f,
- NULL, NULL);
+ return send_option_arg_callback_request(NULL, cc->argc - 1,
+ cc->argv + 1, f, NULL, NULL);
{ \
osl_close_table(table_name ## _table, OSL_MARK_CLEAN); \
table_name ## _table = NULL; \
{ \
osl_close_table(table_name ## _table, OSL_MARK_CLEAN); \
table_name ## _table = NULL; \
{ \
return blob_open(&table_name ## _table, \
&table_name ## _table_desc, dir); \
{ \
return blob_open(&table_name ## _table, \
&table_name ## _table_desc, dir); \
DEFINE_GET_DEF_BY_NAME(table_name, cmd_prefix); \
DEFINE_GET_NAME_AND_DEF_BY_ROW(table_name, cmd_prefix); \
DEFINE_GET_DEF_BY_NAME(table_name, cmd_prefix); \
DEFINE_GET_NAME_AND_DEF_BY_ROW(table_name, cmd_prefix); \
DEFINE_BLOB_FUNCTIONS(lyrics, lyr);
DEFINE_BLOB_FUNCTIONS(images, img);
DEFINE_BLOB_FUNCTIONS(moods, mood);
DEFINE_BLOB_FUNCTIONS(playlists, pl);
DEFINE_BLOB_FUNCTIONS(lyrics, lyr);
DEFINE_BLOB_FUNCTIONS(images, img);
DEFINE_BLOB_FUNCTIONS(moods, mood);
DEFINE_BLOB_FUNCTIONS(playlists, pl);