Commit 63525f01 authored by Mike Hibler's avatar Mike Hibler

Make Linux client do FFS disklabel relocations.

The only reason it didn't before was because we didn't have a "portable"
version of disklabel.h.  We have had that for quite some time now...
parent 277f4a62
/* /*
* EMULAB-COPYRIGHT * EMULAB-COPYRIGHT
* Copyright (c) 2000-2009 University of Utah and the Flux Group. * Copyright (c) 2000-2010 University of Utah and the Flux Group.
* All rights reserved. * All rights reserved.
*/ */
...@@ -19,9 +19,6 @@ ...@@ -19,9 +19,6 @@
#include <zlib.h> #include <zlib.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/time.h> #include <sys/time.h>
#ifndef linux
#include <sys/disklabel.h>
#endif
#include "imagehdr.h" #include "imagehdr.h"
#include "queue.h" #include "queue.h"
#ifndef NOTHREADS #ifndef NOTHREADS
...@@ -1632,12 +1629,12 @@ fixmbr(int slice, int dtype) ...@@ -1632,12 +1629,12 @@ fixmbr(int slice, int dtype)
static struct blockreloc *reloctable; static struct blockreloc *reloctable;
static int numrelocs; static int numrelocs;
#ifndef linux
static void reloc_bsdlabel(struct disklabel *label, int reloctype);
#endif
static void reloc_lilo(void *addr, int reloctype, uint32_t size); static void reloc_lilo(void *addr, int reloctype, uint32_t size);
static void reloc_lilocksum(void *addr, uint32_t off, uint32_t size); static void reloc_lilocksum(void *addr, uint32_t off, uint32_t size);
#include "ffs/disklabel.h" /* XXX doesn't belong here */
static void reloc_bsdlabel(struct disklabel *label, int reloctype);
static void static void
getrelocinfo(const blockhdr_t *hdr) getrelocinfo(const blockhdr_t *hdr)
{ {
...@@ -1701,14 +1698,12 @@ applyrelocs(off_t offset, size_t size, void *buf) ...@@ -1701,14 +1698,12 @@ applyrelocs(off_t offset, size_t size, void *buf)
switch (reloc->type) { switch (reloc->type) {
case RELOC_NONE: case RELOC_NONE:
break; break;
#ifndef linux
case RELOC_FBSDDISKLABEL: case RELOC_FBSDDISKLABEL:
case RELOC_OBSDDISKLABEL: case RELOC_OBSDDISKLABEL:
assert(reloc->size >= sizeof(struct disklabel)); assert(reloc->size >= sizeof(struct disklabel));
reloc_bsdlabel((struct disklabel *)((char *)buf+coff), reloc_bsdlabel((struct disklabel *)((char *)buf+coff),
reloc->type); reloc->type);
break; break;
#endif
case RELOC_LILOSADDR: case RELOC_LILOSADDR:
case RELOC_LILOMAPSECT: case RELOC_LILOMAPSECT:
reloc_lilo((char *)buf+coff, reloc->type, reloc_lilo((char *)buf+coff, reloc->type,
...@@ -1734,7 +1729,6 @@ applyrelocs(off_t offset, size_t size, void *buf) ...@@ -1734,7 +1729,6 @@ applyrelocs(off_t offset, size_t size, void *buf)
return nsize; return nsize;
} }
#ifndef linux
static void static void
reloc_bsdlabel(struct disklabel *label, int reloctype) reloc_bsdlabel(struct disklabel *label, int reloctype)
{ {
...@@ -1803,7 +1797,6 @@ reloc_bsdlabel(struct disklabel *label, int reloctype) ...@@ -1803,7 +1797,6 @@ reloc_bsdlabel(struct disklabel *label, int reloctype)
label->d_checksum = 0; label->d_checksum = 0;
label->d_checksum = dkcksum(label); label->d_checksum = dkcksum(label);
} }
#endif
#include "extfs/lilo.h" #include "extfs/lilo.h"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment