Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1eb5fa84 authored by Mike Snitzer's avatar Mike Snitzer
Browse files

dm: allow targets to return output from messages they are sent



Could be useful for a target to return stats or other information.
If a target does DMEMIT() anything to @result from its .message method
then it must return 1 to the caller.

Signed-off-By: default avatarMike Snitzer <snitzer@redhat.com>
parent da5dadb4
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -3387,7 +3387,8 @@ static int process_invalidate_cblocks_message(struct cache *cache, unsigned coun
 *
 * The key migration_threshold is supported by the cache target core.
 */
static int cache_message(struct dm_target *ti, unsigned argc, char **argv)
static int cache_message(struct dm_target *ti, unsigned argc, char **argv,
			 char *result, unsigned maxlen)
{
	struct cache *cache = ti->private;

+2 −1
Original line number Diff line number Diff line
@@ -2942,7 +2942,8 @@ static void crypt_resume(struct dm_target *ti)
 *	key set <key>
 *	key wipe
 */
static int crypt_message(struct dm_target *ti, unsigned argc, char **argv)
static int crypt_message(struct dm_target *ti, unsigned argc, char **argv,
			 char *result, unsigned maxlen)
{
	struct crypt_config *cc = ti->private;
	int key_size, ret = -EINVAL;
+2 −1
Original line number Diff line number Diff line
@@ -1635,7 +1635,8 @@ static void era_status(struct dm_target *ti, status_type_t type,
	DMEMIT("Error");
}

static int era_message(struct dm_target *ti, unsigned argc, char **argv)
static int era_message(struct dm_target *ti, unsigned argc, char **argv,
		       char *result, unsigned maxlen)
{
	struct era *era = ti->private;

+1 −1
Original line number Diff line number Diff line
@@ -1595,7 +1595,7 @@ static int target_message(struct file *filp, struct dm_ioctl *param, size_t para
		DMWARN("Target message sector outside device.");
		r = -EINVAL;
	} else if (ti->type->message)
		r = ti->type->message(ti, argc, argv);
		r = ti->type->message(ti, argc, argv, result, maxlen);
	else {
		DMWARN("Target type does not support messages");
		r = -EINVAL;
+2 −1
Original line number Diff line number Diff line
@@ -887,7 +887,8 @@ static int log_writes_iterate_devices(struct dm_target *ti,
 * Messages supported:
 *   mark <mark data> - specify the marked data.
 */
static int log_writes_message(struct dm_target *ti, unsigned argc, char **argv)
static int log_writes_message(struct dm_target *ti, unsigned argc, char **argv,
			      char *result, unsigned maxlen)
{
	int r = -EINVAL;
	struct log_writes_c *lc = ti->private;
Loading