Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F148662199
D19243.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D19243.diff
View Options
Index: stand/common/devopen.c
===================================================================
--- stand/common/devopen.c
+++ stand/common/devopen.c
@@ -29,8 +29,10 @@
#include <stand.h>
#include <string.h>
+#include <stdbool.h>
#include "bootstrap.h"
+#include "disk.h"
#ifdef LOADER_GELI_SUPPORT
#include "geliboot.h"
@@ -41,6 +43,7 @@
{
struct devdesc *dev;
int result;
+ bool is_open = false;
result = archsw.arch_getdev((void **)&dev, fname, file);
if (result)
@@ -49,11 +52,37 @@
/* point to device-specific data so that device open can use it */
f->f_dev = dev->d_dev;
f->f_devdata = dev;
- result = dev->d_dev->dv_open(f, dev);
- if (result != 0) {
- f->f_devdata = NULL;
- free(dev);
- return (result);
+
+ /*
+ * Traditinally the open of FREEBSD MBR slice means that we will
+ * open the first BSD slice, if that does fail, only then we will
+ * open the MBR slice.
+ * To provide backwards compatibility, we need to check if there is
+ * slice specified in device name, and if so, we will add partition
+ * name 'a' and will try to open this updated name first.
+ */
+ if (dev->d_dev->dv_type == DEVT_DISK) {
+ struct disk_devdesc *tdev;
+
+ tdev = (struct disk_devdesc *)dev;
+ if (tdev->d_partition == -1) {
+ tdev->d_partition = 0;
+ result = dev->d_dev->dv_open(f, dev);
+ if (result != 0) {
+ tdev->d_partition = -1;
+ } else {
+ is_open = true;
+ }
+ }
+ }
+
+ if (is_open == false) {
+ result = dev->d_dev->dv_open(f, dev);
+ if (result != 0) {
+ f->f_devdata = NULL;
+ free(dev);
+ return (result);
+ }
}
#ifdef LOADER_GELI_SUPPORT
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Mar 20, 11:22 AM (10 h, 38 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
30014868
Default Alt Text
D19243.diff (1 KB)
Attached To
Mode
D19243: loader: devopen() should probe partition 'a' from freebsd slice first
Attached
Detach File
Event Timeline
Log In to Comment