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

Commit 7c27d16e authored by Jeremy Compostella's avatar Jeremy Compostella Committed by Amit Pundir
Browse files

ANDROID: dm: android-verity: use name_to_dev_t



This patch makes android_verity_ctr() parse its block device string
parameter with name_to_dev_t().  It allows the use of less hardware
related block device reference like PARTUUID for instance.

Change-Id: Idb84453e70cc11abd5ef3a0adfbb16f8b5feaf07
Signed-off-by: default avatarJeremy Compostella <jeremy.compostella@intel.com>
parent 47c3ee97
Loading
Loading
Loading
Loading
+6 −9
Original line number Diff line number Diff line
@@ -613,8 +613,7 @@ static int android_verity_ctr(struct dm_target *ti, unsigned argc, char **argv)
	/* One for specifying number of opt args and one for mode */
	sector_t data_sectors;
	u32 data_block_size;
	unsigned int major, minor,
	no_of_args = VERITY_TABLE_ARGS + 2 + VERITY_TABLE_OPT_FEC_ARGS;
	unsigned int no_of_args = VERITY_TABLE_ARGS + 2 + VERITY_TABLE_OPT_FEC_ARGS;
	struct fec_header uninitialized_var(fec);
	struct fec_ecc_metadata uninitialized_var(ecc);
	char buf[FEC_ARG_LENGTH], *buf_ptr;
@@ -630,13 +629,11 @@ static int android_verity_ctr(struct dm_target *ti, unsigned argc, char **argv)
	key_id = argv[0];
	strreplace(argv[0], '#', ' ');

	if (sscanf(argv[1], "%u:%u%c", &major, &minor, &dummy) == 2) {
		dev = MKDEV(major, minor);
		if (MAJOR(dev) != major || MINOR(dev) != minor) {
			DMERR("Incorrect bdev major minor number");
	dev = name_to_dev_t(argv[1]);
	if (!dev) {
		DMERR("no dev found for %s", argv[1]);
		handle_error();
			return -EOVERFLOW;
		}
		return -EINVAL;
	}

	DMINFO("key:%s dev:%s", argv[0], argv[1]);