2010-09-24 19:49:12 +00:00
|
|
|
/*-
|
|
|
|
* Copyright (c) 2010 Pawel Jakub Dawidek <pjd@FreeBSD.org>
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*
|
|
|
|
* $FreeBSD$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _DRV_H_
|
|
|
|
#define _DRV_H_
|
|
|
|
|
|
|
|
struct dsk {
|
|
|
|
unsigned int drive;
|
|
|
|
unsigned int type;
|
|
|
|
unsigned int unit;
|
|
|
|
unsigned int slice;
|
|
|
|
int part;
|
|
|
|
daddr_t start;
|
loader: zfs reader should check all labels
The current zfs reader is only checking first label from each device, however,
we do have 4 labels on device and we should check all 4 to be protected
against disk failures and incomplete label updates.
The difficulty is about the fact that 2 label copies are in front of the
pool data, and 2 are at the end, which means, we have to know the size of
the pool data area.
Since we have now the mechanism from common/disk.c to use the partition
information, it does help us in this task; however, there are still some
corner cases.
Namely, if the pool is created without partition, directly on the disk,
and firmware will give us the wrong size for the disk, we only can check
the first two label copies.
Reviewed by: allanjude
Differential Revision: https://reviews.freebsd.org/D10203
2017-04-06 18:17:29 +00:00
|
|
|
uint64_t size;
|
2010-09-24 19:49:12 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
int drvread(struct dsk *dskp, void *buf, daddr_t lba, unsigned nblk);
|
2016-10-29 14:09:32 +00:00
|
|
|
#if defined(GPT) || defined(ZFS)
|
2010-09-24 19:49:12 +00:00
|
|
|
int drvwrite(struct dsk *dskp, void *buf, daddr_t lba, unsigned nblk);
|
2016-10-29 14:09:32 +00:00
|
|
|
#endif /* GPT || ZFS */
|
2016-03-16 23:12:19 +00:00
|
|
|
uint64_t drvsize(struct dsk *dskp);
|
2010-09-24 19:49:12 +00:00
|
|
|
|
|
|
|
#endif /* !_DRV_H_ */
|