xref: /freebsd/contrib/libdiff/test/expect117.diff (revision a0ca4af9455b844c5e094fc1b09b1390ffa979fc)
1--- test117.left-P.txt
2+++ test117.right-P.txt
3@@ -65,6 +65,8 @@
4 		    struct sr_crypto_kdfinfo *, struct sr_crypto_kdfinfo *);
5 int		sr_crypto_create(struct sr_discipline *,
6 		    struct bioc_createraid *, int, int64_t);
7+int		sr_crypto_init(struct sr_discipline *,
8+		    struct bioc_createraid *);
9 int		sr_crypto_assemble(struct sr_discipline *,
10 		    struct bioc_createraid *, int, void *);
11 int		sr_crypto_alloc_resources(struct sr_discipline *);
12@@ -117,18 +119,34 @@
13 sr_crypto_create(struct sr_discipline *sd, struct bioc_createraid *bc,
14     int no_chunk, int64_t coerced_size)
15 {
16-	struct sr_meta_opt_item	*omi;
17-	int			rv = EINVAL;
18+	int rv = EINVAL;
19
20 	if (no_chunk != 1) {
21 		sr_error(sd->sd_sc, "%s requires exactly one chunk",
22 		    sd->sd_name);
23-		goto done;
24+		return (rv);
25 	}
26
27-	if (coerced_size > SR_CRYPTO_MAXSIZE) {
28+	sd->sd_meta->ssdi.ssd_size = coerced_size;
29+
30+	rv = sr_crypto_init(sd, bc);
31+	if (rv)
32+		return (rv);
33+
34+	sd->sd_max_ccb_per_wu = no_chunk;
35+	return (0);
36+}
37+
38+int
39+sr_crypto_init(struct sr_discipline *sd, struct bioc_createraid *bc)
40+{
41+	struct sr_meta_opt_item	*omi;
42+	int			rv = EINVAL;
43+
44+	if (sd->sd_meta->ssdi.ssd_size > SR_CRYPTO_MAXSIZE) {
45 		sr_error(sd->sd_sc, "%s exceeds maximum size (%lli > %llu)",
46-		    sd->sd_name, coerced_size, SR_CRYPTO_MAXSIZE);
47+		    sd->sd_name, sd->sd_meta->ssdi.ssd_size,
48+		    SR_CRYPTO_MAXSIZE);
49 		goto done;
50 	}
51
52@@ -170,12 +188,8 @@
53 	if (!(bc->bc_flags & BIOC_SCNOAUTOASSEMBLE) && bc->bc_key_disk == NODEV)
54 		goto done;
55
56-	sd->sd_meta->ssdi.ssd_size = coerced_size;
57-
58 	sr_crypto_create_keys(sd);
59
60-	sd->sd_max_ccb_per_wu = no_chunk;
61-
62 	rv = 0;
63 done:
64 	return (rv);
65