Skip to contentSkip to conversation

block: sed-opal: split generation of bytestring header and content

PATCH Scott Bauer 1 participant 1 message Jan 19, 2019 Block layer

lore
Share & tools
lore
#0 lore raw

Review

Quoted 4 lines · David Kozub
(quoted diff) +1 -2
-
-	memcpy(&cmd->cmd[cmd->pos], bytestring, len);
+	start = &cmd->cmd[cmd->pos];
 	cmd->pos += len;

This is somewhat pendatic, but it helps me review patches if we keep things together. Since we're no longer doing the memcpy in this function, can we please move the cmd->pos += len to the location where we actually do the memcpy.

I'm willing to be told to get over it if other reviewers don't like that approach, but if no one cares please move it.

Review

Quoted 12 lines
(quoted diff) +11 -0
+	return start;
+}
 
+static void add_token_bytestring(int *err, struct opal_dev *cmd,
+				 const u8 *bytestring, size_t len)
+{
+	u8 *start;
+
+	start = add_bytestring_header(err, cmd, len);
+	if (!start)
+		return;
+	memcpy(start, bytestring, len);

Do the above here instead.

Quoted 3 lines

2.20.1