main.c (add8154e451f441778fb9c2fb7d10d281dea9611) main.c (17276525fa1a28028f7ca423f365d5081cbe9a97)
1/*-
2 * Copyright (c) 2000 Benno Rice <benno@jeamland.net>
3 * Copyright (c) 2000 Stephane Potvin <sepotvin@videotron.ca>
4 * Copyright (c) 2007-2008 Semihalf, Rafal Jaworowski <raj@semihalf.com>
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

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

201 *
202 * For valid type names, see the device_types array, above.
203 *
204 * Slice numbers are 1-based. 0 is a wildcard.
205 */
206static void
207get_load_device(int *type, int *unit, int *slice, int *partition)
208{
1/*-
2 * Copyright (c) 2000 Benno Rice <benno@jeamland.net>
3 * Copyright (c) 2000 Stephane Potvin <sepotvin@videotron.ca>
4 * Copyright (c) 2007-2008 Semihalf, Rafal Jaworowski <raj@semihalf.com>
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

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

201 *
202 * For valid type names, see the device_types array, above.
203 *
204 * Slice numbers are 1-based. 0 is a wildcard.
205 */
206static void
207get_load_device(int *type, int *unit, int *slice, int *partition)
208{
209 struct disk_devdesc dev;
209 struct disk_devdesc *dev;
210 char *devstr;
211 const char *p;
212 char *endp;
213
214 *type = DEV_TYP_NONE;
215 *unit = -1;
216 *slice = D_SLICEWILD;
217 *partition = D_PARTWILD;

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

232 * standard loader(8) format (e.g., disk0s2a or mmc1p12), so try to
233 * parse the remainder of the string as such, and if it works, return
234 * those results. Otherwise we'll fall through to the code that parses
235 * the legacy format.
236 */
237 if (*type & DEV_TYP_STOR) {
238 size_t len = strlen(p);
239 if (strcspn(p, " .") == len && strcspn(p, ":") >= len - 1 &&
210 char *devstr;
211 const char *p;
212 char *endp;
213
214 *type = DEV_TYP_NONE;
215 *unit = -1;
216 *slice = D_SLICEWILD;
217 *partition = D_PARTWILD;

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

232 * standard loader(8) format (e.g., disk0s2a or mmc1p12), so try to
233 * parse the remainder of the string as such, and if it works, return
234 * those results. Otherwise we'll fall through to the code that parses
235 * the legacy format.
236 */
237 if (*type & DEV_TYP_STOR) {
238 size_t len = strlen(p);
239 if (strcspn(p, " .") == len && strcspn(p, ":") >= len - 1 &&
240 disk_parsedev(&dev, p, NULL) == 0) {
241 *unit = dev.dd.d_unit;
242 *slice = dev.d_slice;
243 *partition = dev.d_partition;
240 disk_parsedev((struct devdesc **)&dev, p, NULL) == 0) {
241 *unit = dev->dd.d_unit;
242 *slice = dev->d_slice;
243 *partition = dev->d_partition;
244 free(dev);
244 return;
245 }
246 }
247
248 /* Ignore optional spaces after the device name. */
249 while (*p == ' ')
250 p++;
251

--- 475 unchanged lines hidden ---
245 return;
246 }
247 }
248
249 /* Ignore optional spaces after the device name. */
250 while (*p == ' ')
251 p++;
252

--- 475 unchanged lines hidden ---