[geom_redboot] Extend geom_redboot to handle non-zero fis offset.
Submitted by: Mori Hiroki <yamori813@yahoo.co.jp> Differential Revision: https://reviews.freebsd.org/D7237
This commit is contained in:
parent
edf24a9e69
commit
3a420a3cf8
@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include <sys/bio.h>
|
#include <sys/bio.h>
|
||||||
#include <sys/lock.h>
|
#include <sys/lock.h>
|
||||||
#include <sys/mutex.h>
|
#include <sys/mutex.h>
|
||||||
|
#include <sys/bus.h>
|
||||||
|
|
||||||
#include <sys/sbuf.h>
|
#include <sys/sbuf.h>
|
||||||
#include <geom/geom.h>
|
#include <geom/geom.h>
|
||||||
@ -246,6 +247,16 @@ g_redboot_taste(struct g_class *mp, struct g_provider *pp, int insist)
|
|||||||
u_int blksize; /* NB: flash block size stored as stripesize */
|
u_int blksize; /* NB: flash block size stored as stripesize */
|
||||||
u_char *buf;
|
u_char *buf;
|
||||||
off_t offset;
|
off_t offset;
|
||||||
|
const char *value;
|
||||||
|
char *op;
|
||||||
|
|
||||||
|
offset = 0;
|
||||||
|
if (resource_string_value("redboot", 0, "fisoffset", &value) == 0) {
|
||||||
|
offset = strtouq(value, &op, 0);
|
||||||
|
if (*op != '\0') {
|
||||||
|
offset = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
g_trace(G_T_TOPOLOGY, "redboot_taste(%s,%s)", mp->name, pp->name);
|
g_trace(G_T_TOPOLOGY, "redboot_taste(%s,%s)", mp->name, pp->name);
|
||||||
g_topology_assert();
|
g_topology_assert();
|
||||||
@ -278,7 +289,8 @@ g_redboot_taste(struct g_class *mp, struct g_provider *pp, int insist)
|
|||||||
return (NULL);
|
return (NULL);
|
||||||
g_topology_unlock();
|
g_topology_unlock();
|
||||||
head = NULL;
|
head = NULL;
|
||||||
offset = cp->provider->mediasize - blksize;
|
if(offset == 0)
|
||||||
|
offset = cp->provider->mediasize - blksize;
|
||||||
again:
|
again:
|
||||||
buf = g_read_data(cp, offset, blksize, NULL);
|
buf = g_read_data(cp, offset, blksize, NULL);
|
||||||
if (buf != NULL)
|
if (buf != NULL)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user