gpart_ops.c (0b7472b3d8d2f1e90fade5236b44fd98d8e396c2) gpart_ops.c (2117cdd4b4ebda7db0270c56f5a3cbdd37ec8cfc)
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3 *
4 * Copyright (c) 2011 Nathan Whitehorn
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 1193 unchanged lines hidden (view full) ---

1202 firstfree += bytes / sector;
1203 size -= (bytes + stripe)/sector;
1204 if (stripe > 0 && (firstfree*sector % stripe) != 0)
1205 firstfree += (stripe - ((firstfree*sector) %
1206 stripe)) / sector;
1207 }
1208 }
1209
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3 *
4 * Copyright (c) 2011 Nathan Whitehorn
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 1193 unchanged lines hidden (view full) ---

1202 firstfree += bytes / sector;
1203 size -= (bytes + stripe)/sector;
1204 if (stripe > 0 && (firstfree*sector % stripe) != 0)
1205 firstfree += (stripe - ((firstfree*sector) %
1206 stripe)) / sector;
1207 }
1208 }
1209
1210 output[0] = '\0';
1211
1210 r = gctl_get_handle();
1211 gctl_ro_param(r, "class", -1, "PART");
1212 gctl_ro_param(r, "arg0", -1, geom->lg_name);
1213 gctl_ro_param(r, "flags", -1, GPART_FLAGS);
1214 gctl_ro_param(r, "verb", -1, "add");
1212 r = gctl_get_handle();
1213 gctl_ro_param(r, "class", -1, "PART");
1214 gctl_ro_param(r, "arg0", -1, geom->lg_name);
1215 gctl_ro_param(r, "flags", -1, GPART_FLAGS);
1216 gctl_ro_param(r, "verb", -1, "add");
1215
1216 gctl_ro_param(r, "type", -1, items[0].text);
1217 snprintf(sizestr, sizeof(sizestr), "%jd", size);
1218 gctl_ro_param(r, "size", -1, sizestr);
1219 snprintf(startstr, sizeof(startstr), "%jd", firstfree);
1220 gctl_ro_param(r, "start", -1, startstr);
1221 if (items[3].text[0] != '\0')
1222 gctl_ro_param(r, "label", -1, items[3].text);
1217 gctl_ro_param(r, "type", -1, items[0].text);
1218 snprintf(sizestr, sizeof(sizestr), "%jd", size);
1219 gctl_ro_param(r, "size", -1, sizestr);
1220 snprintf(startstr, sizeof(startstr), "%jd", firstfree);
1221 gctl_ro_param(r, "start", -1, startstr);
1222 if (items[3].text[0] != '\0')
1223 gctl_ro_param(r, "label", -1, items[3].text);
1223 gctl_rw_param(r, "output", sizeof(output), output);
1224 gctl_add_param(r, "output", sizeof(output), output,
1225 GCTL_PARAM_WR | GCTL_PARAM_ASCII);
1224 errstr = gctl_issue(r);
1225 if (errstr != NULL && errstr[0] != '\0') {
1226 gpart_show_error("Error", NULL, errstr);
1227 gctl_free(r);
1228 goto addpartform;
1229 }
1230 newpartname = strtok(output, " ");
1231 gctl_free(r);

--- 229 unchanged lines hidden ---
1226 errstr = gctl_issue(r);
1227 if (errstr != NULL && errstr[0] != '\0') {
1228 gpart_show_error("Error", NULL, errstr);
1229 gctl_free(r);
1230 goto addpartform;
1231 }
1232 newpartname = strtok(output, " ");
1233 gctl_free(r);

--- 229 unchanged lines hidden ---