mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
Port latest grub zfs boot code to pygrub
Signed-off-by: Mark Johnson <mark.r.johnson@oracle.com> Add -Werror to CFLAGS and fix numerous warnings/errors. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
This commit is contained in:
1 parent
d68069e6cb
commit
f426678bf2
28 files changed
+1005
-476
No files matched your search
@@ -1,6 +1,7 @@
|
||||
include $(XEN_ROOT)/tools/Rules.mk
|
||||
|
||||
CFLAGS += -I$(XEN_ROOT)/tools/libfsimage/common/ -Werror
|
||||
CFLAGS += -Wno-unknown-pragmas -I$(XEN_ROOT)/tools/libfsimage/common/
|
||||
CFLAGS += -Werror -D_GNU_SOURCE
|
||||
LDFLAGS += -L../common/
|
||||
|
||||
PIC_OBJS := $(patsubst %.c,%.opic,$(LIB_SRCS-y))
|
||||
|
||||
@@ -78,6 +78,7 @@ unsigned long fsig_log2(unsigned long);
|
||||
#define ERR_DEV_VALUES 1
|
||||
#define ERR_WONT_FIT 1
|
||||
#define ERR_READ 1
|
||||
#define ERR_NEWER_VERSION 1
|
||||
|
||||
fsi_plugin_ops_t *fsig_init(fsi_plugin_t *, fsig_plugin_ops_t *);
|
||||
|
||||
|
||||
@@ -24,7 +24,8 @@
|
||||
|
||||
XEN_ROOT = ../../..
|
||||
|
||||
LIB_SRCS-y = fsys_zfs.c zfs_lzjb.c zfs_sha256.c zfs_fletcher.c
|
||||
CFLAGS += -DFSYS_ZFS -DFSIMAGE -I$(XEN_ROOT)/tools/libfsimage/zfs
|
||||
LIB_SRCS-y = zfs_lzjb.c zfs_sha256.c zfs_fletcher.c fsi_zfs.c fsys_zfs.c
|
||||
|
||||
FS = zfs
|
||||
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/*
|
||||
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
#ifndef _FILESYS_H
|
||||
#define _FILESYS_H
|
||||
|
||||
#ifdef FSYS_ZFS
|
||||
|
||||
/* THIS FILE IS INTENTIONALLY BLANK */
|
||||
|
||||
#endif /* FSI_ZFS */
|
||||
|
||||
#endif /* !_FILESYS_H */
|
||||
|
||||
@@ -0,0 +1,158 @@
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/*
|
||||
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#ifdef FSYS_ZFS
|
||||
|
||||
#include <fsimage_grub.h>
|
||||
#include <fsimage_priv.h>
|
||||
#include <stdio.h>
|
||||
#include <inttypes.h>
|
||||
#include "mb_info.h"
|
||||
|
||||
|
||||
#undef filemax
|
||||
#undef filepos
|
||||
#undef errnum
|
||||
|
||||
|
||||
#define MAXNAMELEN 256
|
||||
#define MAXPATHLEN 1024
|
||||
|
||||
/**** START FROM disk_io.c ****/
|
||||
char current_rootpool[MAXNAMELEN];
|
||||
char current_bootfs[MAXNAMELEN];
|
||||
uint64_t current_bootfs_obj;
|
||||
char current_bootpath[MAXPATHLEN];
|
||||
char current_devid[MAXPATHLEN];
|
||||
int is_zfs_mount;
|
||||
unsigned long best_drive;
|
||||
unsigned long best_part;
|
||||
int find_best_root;
|
||||
unsigned long part_length;
|
||||
/**** END FROM disk_io.c ****/
|
||||
|
||||
uint64_t filemax;
|
||||
uint64_t filepos;
|
||||
|
||||
struct multiboot_info mbi;
|
||||
fsi_file_t *zfs_ffi;
|
||||
int errnum;
|
||||
char *bootstring = NULL;
|
||||
|
||||
extern int zfs_mount(void);
|
||||
extern int zfs_open(char *filename);
|
||||
extern int zfs_read(char *buf, int len);
|
||||
|
||||
#define ZFS_SCRATCH_SIZE 0x400000
|
||||
#define FSI_MOS_SHIFT 10
|
||||
#define FSI_MOS_MASK ((1 << FSI_MOS_SHIFT) - 1)
|
||||
unsigned char fsi_mos_buf[ZFS_SCRATCH_SIZE + FSI_MOS_MASK + 1];
|
||||
|
||||
#define FSI_MOS_ALIGN(addr) (((uintptr_t)addr + FSI_MOS_MASK) & \
|
||||
~FSI_MOS_MASK)
|
||||
#define FSI_MOS(buf) ((FSI_MOS_ALIGN(buf) + \
|
||||
ZFS_SCRATCH_SIZE - 0x100000) >> FSI_MOS_SHIFT)
|
||||
|
||||
static int
|
||||
fsi_zfs_mount(fsi_file_t *ffi, const char *options)
|
||||
{
|
||||
zfs_ffi = ffi;
|
||||
mbi.mem_upper = FSI_MOS(fsi_mos_buf);
|
||||
|
||||
/* If an boot filesystem is passed in, set it to current_bootfs */
|
||||
if (options != NULL) {
|
||||
if (strlen(options) < MAXNAMELEN) {
|
||||
strcpy(current_bootfs, options);
|
||||
}
|
||||
}
|
||||
|
||||
return (zfs_mount());
|
||||
}
|
||||
|
||||
static int
|
||||
fsi_zfs_open(fsi_file_t *ffi, char *filename)
|
||||
{
|
||||
char *fsi_bootstring;
|
||||
uint64_t *fmax;
|
||||
uint64_t *fpos;
|
||||
int rc;
|
||||
|
||||
zfs_ffi = ffi;
|
||||
fmax = fsig_filemax(ffi);
|
||||
fpos = fsig_filepos(ffi);
|
||||
|
||||
rc = zfs_open(filename);
|
||||
if (rc != 1) {
|
||||
return (rc);
|
||||
}
|
||||
|
||||
*fmax = filemax;
|
||||
*fpos = filepos;
|
||||
|
||||
if (bootstring == NULL) {
|
||||
rc = asprintf(&bootstring,
|
||||
"zfs-bootfs=%s/%"PRIu64",bootpath='%s'",
|
||||
current_rootpool, current_bootfs_obj,
|
||||
current_bootpath);
|
||||
if (rc == -1) {
|
||||
return (rc);
|
||||
}
|
||||
fsi_bootstring = fsi_bootstring_alloc(ffi->ff_fsi,
|
||||
strlen(bootstring) + 1);
|
||||
strcpy(fsi_bootstring, bootstring);
|
||||
}
|
||||
|
||||
return (rc);
|
||||
}
|
||||
|
||||
static int
|
||||
fsi_zfs_read(fsi_file_t *ffi, char *buf, int len)
|
||||
{
|
||||
uint64_t *fpos;
|
||||
int rc;
|
||||
|
||||
zfs_ffi = ffi;
|
||||
fpos = fsig_filepos(ffi);
|
||||
filepos = *fpos;
|
||||
rc = zfs_read(buf, len);
|
||||
*fpos = filepos;
|
||||
|
||||
return (rc);
|
||||
}
|
||||
|
||||
|
||||
fsi_plugin_ops_t *
|
||||
fsi_init_plugin(int version, fsi_plugin_t *fp, const char **name)
|
||||
{
|
||||
static fsig_plugin_ops_t ops = {
|
||||
FSIMAGE_PLUGIN_VERSION,
|
||||
.fpo_mount = fsi_zfs_mount,
|
||||
.fpo_dir = fsi_zfs_open,
|
||||
.fpo_read = fsi_zfs_read,
|
||||
};
|
||||
|
||||
*name = "zfs";
|
||||
return (fsig_init(fp, &ops));
|
||||
}
|
||||
|
||||
#endif /* FSYS_ZFS */
|
||||
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/*
|
||||
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
#ifndef _FSI_ZFS_H
|
||||
#define _FSI_ZFS_H
|
||||
|
||||
#ifdef FSYS_ZFS
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <fsimage_grub.h>
|
||||
|
||||
|
||||
/*** START FROM shared.h ****/
|
||||
#include "mb_info.h"
|
||||
|
||||
/* Boot signature related defines for the findroot command */
|
||||
#define BOOTSIGN_DIR "/boot/grub/bootsign"
|
||||
#define BOOTSIGN_BACKUP "/etc/bootsign"
|
||||
|
||||
/* Maybe redirect memory requests through grub_scratch_mem. */
|
||||
#define RAW_ADDR(x) (x)
|
||||
#define RAW_SEG(x) (x)
|
||||
|
||||
/* ZFS will use the top 4 Meg of physical memory (below 4Gig) for sratch */
|
||||
#define ZFS_SCRATCH_SIZE 0x400000
|
||||
|
||||
#define MAXPATHLEN 1024
|
||||
#define MAXNAMELEN 256
|
||||
#define MIN(x, y) ((x) < (y) ? (x) : (y))
|
||||
|
||||
#define MAXUINT 0xFFFFFFFF
|
||||
|
||||
#undef NULL
|
||||
#define NULL ((void *) 0)
|
||||
|
||||
#define grub_printf printf
|
||||
#define grub_strcmp strcmp
|
||||
#define grub_strncmp strncmp
|
||||
#define grub_strstr strstr
|
||||
#define grub_strlen strlen
|
||||
#define grub_memmove memmove
|
||||
|
||||
extern char current_bootpath[MAXPATHLEN];
|
||||
extern char current_rootpool[MAXNAMELEN];
|
||||
extern char current_bootfs[MAXNAMELEN];
|
||||
extern uint64_t current_bootfs_obj;
|
||||
extern char current_devid[MAXPATHLEN];
|
||||
extern int is_zfs_mount;
|
||||
extern unsigned long best_drive;
|
||||
extern unsigned long best_part;
|
||||
extern int find_best_root;
|
||||
|
||||
extern unsigned long part_length;
|
||||
|
||||
#undef filemax
|
||||
#undef filepos
|
||||
extern uint64_t filemax;
|
||||
extern uint64_t filepos;
|
||||
|
||||
extern struct multiboot_info mbi;
|
||||
|
||||
/*** END FROM shared.h ***/
|
||||
|
||||
#ifdef __linux__
|
||||
typedef unsigned char uchar_t;
|
||||
#endif
|
||||
|
||||
typedef struct fsi_file *fsi_file_handle_t;
|
||||
extern fsi_file_handle_t zfs_ffi;
|
||||
extern int fsig_devread(fsi_file_handle_t, unsigned int, unsigned int,
|
||||
unsigned int, char *);
|
||||
|
||||
#undef devread
|
||||
#define devread(a, b, c, d) fsig_devread(zfs_ffi, a, b, c, d)
|
||||
|
||||
#undef errnum
|
||||
extern int errnum;
|
||||
|
||||
#endif /* FSI_ZFS */
|
||||
|
||||
#endif /* !_FSI_ZFS_H */
|
||||
|
||||
+432
-340
File diff suppressed because it is too large.
Load diff
@@ -17,64 +17,56 @@
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/*
|
||||
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
|
||||
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
#ifndef _FSYS_ZFS_H
|
||||
#define _FSYS_ZFS_H
|
||||
|
||||
#include <fsimage_grub.h>
|
||||
#include <fsimage_priv.h>
|
||||
#ifdef FSYS_ZFS
|
||||
|
||||
#include "zfs-include/zfs.h"
|
||||
#include "zfs-include/dmu.h"
|
||||
#include "zfs-include/spa.h"
|
||||
#include "zfs-include/zio.h"
|
||||
#include "zfs-include/zio_checksum.h"
|
||||
#include "zfs-include/vdev_impl.h"
|
||||
#include "zfs-include/zap_impl.h"
|
||||
#include "zfs-include/zap_leaf.h"
|
||||
#include "zfs-include/uberblock_impl.h"
|
||||
#include "zfs-include/dnode.h"
|
||||
#include "zfs-include/dsl_dir.h"
|
||||
#include "zfs-include/zfs_acl.h"
|
||||
#include "zfs-include/zfs_znode.h"
|
||||
#include "zfs-include/dsl_dataset.h"
|
||||
#include "zfs-include/zil.h"
|
||||
#include "zfs-include/dmu_objset.h"
|
||||
#ifndef FSIMAGE
|
||||
typedef unsigned long long uint64_t;
|
||||
typedef unsigned int uint32_t;
|
||||
typedef unsigned short uint16_t;
|
||||
typedef unsigned char uint8_t;
|
||||
typedef unsigned char uchar_t;
|
||||
|
||||
#if defined(_LP64) || defined(_I32LPx)
|
||||
typedef unsigned long size_t;
|
||||
#else
|
||||
typedef unsigned int size_t;
|
||||
#endif
|
||||
#else
|
||||
#include "fsi_zfs.h"
|
||||
#endif /* !FSIMAGE */
|
||||
|
||||
#include <zfs-include/zfs.h>
|
||||
#include <zfs-include/dmu.h>
|
||||
#include <zfs-include/spa.h>
|
||||
#include <zfs-include/zio.h>
|
||||
#include <zfs-include/zio_checksum.h>
|
||||
#include <zfs-include/vdev_impl.h>
|
||||
#include <zfs-include/zap_impl.h>
|
||||
#include <zfs-include/zap_leaf.h>
|
||||
#include <zfs-include/uberblock_impl.h>
|
||||
#include <zfs-include/dnode.h>
|
||||
#include <zfs-include/dsl_dir.h>
|
||||
#include <zfs-include/zfs_acl.h>
|
||||
#include <zfs-include/zfs_znode.h>
|
||||
#include <zfs-include/dsl_dataset.h>
|
||||
#include <zfs-include/zil.h>
|
||||
#include <zfs-include/dmu_objset.h>
|
||||
#include <zfs-include/sa_impl.h>
|
||||
|
||||
/*
|
||||
* Global Memory addresses to store MOS and DNODE data
|
||||
*/
|
||||
#define MOS ((dnode_phys_t *)(((zfs_bootarea_t *) \
|
||||
(ffi->ff_fsi->f_data))->zfs_data))
|
||||
#define MOS ((dnode_phys_t *)\
|
||||
(RAW_ADDR((mbi.mem_upper << 10) + 0x100000) - ZFS_SCRATCH_SIZE))
|
||||
#define DNODE (MOS+1) /* move sizeof(dnode_phys_t) bytes */
|
||||
#define ZFS_SCRATCH ((char *)(DNODE+1))
|
||||
|
||||
#define MAXNAMELEN 256
|
||||
|
||||
typedef struct zfs_bootarea {
|
||||
char zfs_current_bootpath[MAXNAMELEN];
|
||||
char zfs_current_rootpool[MAXNAMELEN];
|
||||
char zfs_current_bootfs[MAXNAMELEN];
|
||||
uint64_t zfs_current_bootfs_obj;
|
||||
int zfs_open;
|
||||
|
||||
/* cache for a file block of the currently zfs_open()-ed file */
|
||||
void *zfs_file_buf;
|
||||
uint64_t zfs_file_start;
|
||||
uint64_t zfs_file_end;
|
||||
|
||||
/* cache for a dnode block */
|
||||
dnode_phys_t *zfs_dnode_buf;
|
||||
dnode_phys_t *zfs_dnode_mdn;
|
||||
uint64_t zfs_dnode_start;
|
||||
uint64_t zfs_dnode_end;
|
||||
|
||||
char *zfs_stackbase;
|
||||
char zfs_data[0x400000];
|
||||
} zfs_bootarea_t;
|
||||
|
||||
/*
|
||||
* Verify dnode type.
|
||||
* Can only be used in functions returning non-0 for failure.
|
||||
@@ -108,9 +100,8 @@ typedef struct zfs_bootarea {
|
||||
* can support large sector disks.
|
||||
*/
|
||||
#define UBERBLOCK_SIZE (1ULL << UBERBLOCK_SHIFT)
|
||||
#undef offsetof
|
||||
#define offsetof(t, m) (size_t)(&(((t *)0)->m))
|
||||
#define VDEV_UBERBLOCK_SHIFT UBERBLOCK_SHIFT
|
||||
#include <stddef.h>
|
||||
#define VDEV_UBERBLOCK_OFFSET(n) \
|
||||
offsetof(vdev_label_t, vl_uberblock[(n) << VDEV_UBERBLOCK_SHIFT])
|
||||
|
||||
@@ -120,8 +111,8 @@ typedef struct uberblock uberblock_t;
|
||||
typedef struct uberblock_phys {
|
||||
uberblock_t ubp_uberblock;
|
||||
char ubp_pad[UBERBLOCK_SIZE - sizeof (uberblock_t) -
|
||||
sizeof (zio_block_tail_t)];
|
||||
zio_block_tail_t ubp_zbt;
|
||||
sizeof (zio_eck_t)];
|
||||
zio_eck_t ubp_zec;
|
||||
} uberblock_phys_t;
|
||||
|
||||
/*
|
||||
@@ -131,6 +122,15 @@ typedef struct uberblock_phys {
|
||||
#define DVA_OFFSET_TO_PHYS_SECTOR(offset) \
|
||||
((offset + VDEV_LABEL_START_SIZE) >> SPA_MINBLOCKSHIFT)
|
||||
|
||||
/*
|
||||
* return x rounded down to an align boundary
|
||||
* eg, P2ALIGN(1200, 1024) == 1024 (1*align)
|
||||
* eg, P2ALIGN(1024, 1024) == 1024 (1*align)
|
||||
* eg, P2ALIGN(0x1234, 0x100) == 0x1200 (0x12*align)
|
||||
* eg, P2ALIGN(0x5600, 0x100) == 0x5600 (0x56*align)
|
||||
*/
|
||||
#define P2ALIGN(x, align) ((x) & -(align))
|
||||
|
||||
/*
|
||||
* For nvlist manipulation. (from nvpair.h)
|
||||
*/
|
||||
@@ -200,4 +200,6 @@ extern void fletcher_4_byteswap(const void *, uint64_t, zio_cksum_t *);
|
||||
extern void zio_checksum_SHA256(const void *, uint64_t, zio_cksum_t *);
|
||||
extern int lzjb_decompress(void *, void *, size_t, size_t);
|
||||
|
||||
#endif /* FSYS_ZFS */
|
||||
|
||||
#endif /* !_FSYS_ZFS_H */
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/*
|
||||
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
#ifndef _SHARED_H
|
||||
#define _SHARED_H
|
||||
|
||||
#ifdef FSYS_ZFS
|
||||
|
||||
/* THIS FILE IS INTENTIONALLY BLANK */
|
||||
|
||||
#endif /* FSI_ZFS */
|
||||
|
||||
#endif /* !_SHARED_H */
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/*
|
||||
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
|
||||
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
@@ -56,7 +56,7 @@ typedef enum dmu_object_type {
|
||||
DMU_OT_DSL_DATASET, /* UINT64 */
|
||||
/* zpl: */
|
||||
DMU_OT_ZNODE, /* ZNODE */
|
||||
DMU_OT_ACL, /* ACL */
|
||||
DMU_OT_OLDACL, /* OLD ACL */
|
||||
DMU_OT_PLAIN_FILE_CONTENTS, /* UINT8 */
|
||||
DMU_OT_DIRECTORY_CONTENTS, /* ZAP */
|
||||
DMU_OT_MASTER_NODE, /* ZAP */
|
||||
@@ -73,7 +73,22 @@ typedef enum dmu_object_type {
|
||||
DMU_OT_SPA_HISTORY, /* UINT8 */
|
||||
DMU_OT_SPA_HISTORY_OFFSETS, /* spa_his_phys_t */
|
||||
DMU_OT_POOL_PROPS, /* ZAP */
|
||||
|
||||
DMU_OT_DSL_PERMS, /* ZAP */
|
||||
DMU_OT_ACL, /* ACL */
|
||||
DMU_OT_SYSACL, /* SYSACL */
|
||||
DMU_OT_FUID, /* FUID table (Packed NVLIST UINT8) */
|
||||
DMU_OT_FUID_SIZE, /* FUID table size UINT64 */
|
||||
DMU_OT_NEXT_CLONES, /* ZAP */
|
||||
DMU_OT_SCRUB_QUEUE, /* ZAP */
|
||||
DMU_OT_USERGROUP_USED, /* ZAP */
|
||||
DMU_OT_USERGROUP_QUOTA, /* ZAP */
|
||||
DMU_OT_USERREFS, /* ZAP */
|
||||
DMU_OT_DDT_ZAP, /* ZAP */
|
||||
DMU_OT_DDT_STATS, /* ZAP */
|
||||
DMU_OT_SA, /* System attr */
|
||||
DMU_OT_SA_MASTER_NODE, /* ZAP */
|
||||
DMU_OT_SA_ATTR_REGISTRATION, /* ZAP */
|
||||
DMU_OT_SA_ATTR_LAYOUTS, /* ZAP */
|
||||
DMU_OT_NUMTYPES
|
||||
} dmu_object_type_t;
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/*
|
||||
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
|
||||
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
@@ -47,6 +47,8 @@
|
||||
#define DNODES_PER_BLOCK (1ULL << DNODES_PER_BLOCK_SHIFT)
|
||||
#define DNODES_PER_LEVEL_SHIFT (DN_MAX_INDBLKSHIFT - SPA_BLKPTRSHIFT)
|
||||
|
||||
#define DNODE_FLAG_SPILL_BLKPTR (1<<2)
|
||||
|
||||
#define DN_BONUS(dnp) ((void*)((dnp)->dn_bonus + \
|
||||
(((dnp)->dn_nblkptr - 1) * sizeof (blkptr_t))))
|
||||
|
||||
@@ -70,7 +72,8 @@ typedef struct dnode_phys {
|
||||
uint64_t dn_pad3[4];
|
||||
|
||||
blkptr_t dn_blkptr[1];
|
||||
uint8_t dn_bonus[DN_MAX_BONUSLEN];
|
||||
uint8_t dn_bonus[DN_MAX_BONUSLEN - sizeof (blkptr_t)];
|
||||
blkptr_t dn_spill;
|
||||
} dnode_phys_t;
|
||||
|
||||
#endif /* _SYS_DNODE_H */
|
||||
@@ -24,6 +24,8 @@
|
||||
#ifndef _SYS_DSL_DATASET_H
|
||||
#define _SYS_DSL_DATASET_H
|
||||
|
||||
#pragma ident "%Z%%M% %I% %E% SMI"
|
||||
|
||||
typedef struct dsl_dataset_phys {
|
||||
uint64_t ds_dir_obj;
|
||||
uint64_t ds_prev_snap_obj;
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
#ifndef _SYS_DSL_DIR_H
|
||||
#define _SYS_DSL_DIR_H
|
||||
|
||||
#pragma ident "%Z%%M% %I% %E% SMI"
|
||||
|
||||
typedef struct dsl_dir_phys {
|
||||
uint64_t dd_creation_time; /* not actually used */
|
||||
uint64_t dd_head_dataset_obj;
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/*
|
||||
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
#ifndef _SYS_SA_IMPL_H
|
||||
#define _SYS_SA_IMPL_H
|
||||
|
||||
typedef struct sa_hdr_phys {
|
||||
uint32_t sa_magic;
|
||||
uint16_t sa_layout_info;
|
||||
uint16_t sa_lengths[1];
|
||||
} sa_hdr_phys_t;
|
||||
|
||||
#define SA_HDR_SIZE(hdr) BF32_GET_SB(hdr->sa_layout_info, 10, 16, 3, 0)
|
||||
#define SA_SIZE_OFFSET 0x8
|
||||
|
||||
#endif /* _SYS_SA_IMPL_H */
|
||||
@@ -17,7 +17,7 @@
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/*
|
||||
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
|
||||
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
@@ -62,6 +62,11 @@
|
||||
|
||||
#define SPA_BLOCKSIZES (SPA_MAXBLOCKSHIFT - SPA_MINBLOCKSHIFT + 1)
|
||||
|
||||
/*
|
||||
* Size of block to hold the configuration data (a packed nvlist)
|
||||
*/
|
||||
#define SPA_CONFIG_BLOCKSIZE (1 << 14)
|
||||
|
||||
/*
|
||||
* The DVA size encodings for LSIZE and PSIZE support blocks up to 32MB.
|
||||
* The ASIZE encoding should be at least 64 times larger (6 more bits)
|
||||
@@ -106,15 +111,15 @@ typedef struct zio_cksum {
|
||||
* +-------+-------+-------+-------+-------+-------+-------+-------+
|
||||
* 5 |G| offset3 |
|
||||
* +-------+-------+-------+-------+-------+-------+-------+-------+
|
||||
* 6 |E| lvl | type | cksum | comp | PSIZE | LSIZE |
|
||||
* 6 |BDX|lvl| type | cksum | comp | PSIZE | LSIZE |
|
||||
* +-------+-------+-------+-------+-------+-------+-------+-------+
|
||||
* 7 | padding |
|
||||
* +-------+-------+-------+-------+-------+-------+-------+-------+
|
||||
* 8 | padding |
|
||||
* +-------+-------+-------+-------+-------+-------+-------+-------+
|
||||
* 9 | padding |
|
||||
* 9 | physical birth txg |
|
||||
* +-------+-------+-------+-------+-------+-------+-------+-------+
|
||||
* a | birth txg |
|
||||
* a | logical birth txg |
|
||||
* +-------+-------+-------+-------+-------+-------+-------+-------+
|
||||
* b | fill count |
|
||||
* +-------+-------+-------+-------+-------+-------+-------+-------+
|
||||
@@ -138,25 +143,29 @@ typedef struct zio_cksum {
|
||||
* cksum checksum function
|
||||
* comp compression function
|
||||
* G gang block indicator
|
||||
* E endianness
|
||||
* type DMU object type
|
||||
* B byteorder (endianness)
|
||||
* D dedup
|
||||
* X unused
|
||||
* lvl level of indirection
|
||||
* birth txg transaction group in which the block was born
|
||||
* type DMU object type
|
||||
* phys birth txg of block allocation; zero if same as logical birth txg
|
||||
* log. birth transaction group in which the block was logically born
|
||||
* fill count number of non-zero blocks under this bp
|
||||
* checksum[4] 256-bit checksum of the data this bp describes
|
||||
*/
|
||||
typedef struct blkptr {
|
||||
dva_t blk_dva[3]; /* 128-bit Data Virtual Address */
|
||||
uint64_t blk_prop; /* size, compression, type, etc */
|
||||
uint64_t blk_pad[3]; /* Extra space for the future */
|
||||
uint64_t blk_birth; /* transaction group at birth */
|
||||
uint64_t blk_fill; /* fill count */
|
||||
zio_cksum_t blk_cksum; /* 256-bit checksum */
|
||||
} blkptr_t;
|
||||
|
||||
#define SPA_BLKPTRSHIFT 7 /* blkptr_t is 128 bytes */
|
||||
#define SPA_DVAS_PER_BP 3 /* Number of DVAs in a bp */
|
||||
|
||||
typedef struct blkptr {
|
||||
dva_t blk_dva[SPA_DVAS_PER_BP]; /* Data Virtual Addresses */
|
||||
uint64_t blk_prop; /* size, compression, type, etc */
|
||||
uint64_t blk_pad[2]; /* Extra space for the future */
|
||||
uint64_t blk_phys_birth; /* txg when block was allocated */
|
||||
uint64_t blk_birth; /* transaction group at birth */
|
||||
uint64_t blk_fill; /* fill count */
|
||||
zio_cksum_t blk_cksum; /* 256-bit checksum */
|
||||
} blkptr_t;
|
||||
|
||||
/*
|
||||
* Macros to get and set fields in a bp or DVA.
|
||||
*/
|
||||
@@ -180,8 +189,7 @@ typedef struct blkptr {
|
||||
#define DVA_SET_GANG(dva, x) BF64_SET((dva)->dva_word[1], 63, 1, x)
|
||||
|
||||
#define BP_GET_LSIZE(bp) \
|
||||
(BP_IS_HOLE(bp) ? 0 : \
|
||||
BF64_GET_SB((bp)->blk_prop, 0, 16, SPA_MINBLOCKSHIFT, 1))
|
||||
BF64_GET_SB((bp)->blk_prop, 0, 16, SPA_MINBLOCKSHIFT, 1)
|
||||
#define BP_SET_LSIZE(bp, x) \
|
||||
BF64_SET_SB((bp)->blk_prop, 0, 16, SPA_MINBLOCKSHIFT, 1, x)
|
||||
|
||||
@@ -190,20 +198,35 @@ typedef struct blkptr {
|
||||
#define BP_SET_PSIZE(bp, x) \
|
||||
BF64_SET_SB((bp)->blk_prop, 16, 16, SPA_MINBLOCKSHIFT, 1, x)
|
||||
|
||||
#define BP_GET_COMPRESS(bp) BF64_GET((bp)->blk_prop, 32, 8)
|
||||
#define BP_SET_COMPRESS(bp, x) BF64_SET((bp)->blk_prop, 32, 8, x)
|
||||
#define BP_GET_COMPRESS(bp) BF64_GET((bp)->blk_prop, 32, 8)
|
||||
#define BP_SET_COMPRESS(bp, x) BF64_SET((bp)->blk_prop, 32, 8, x)
|
||||
|
||||
#define BP_GET_CHECKSUM(bp) BF64_GET((bp)->blk_prop, 40, 8)
|
||||
#define BP_SET_CHECKSUM(bp, x) BF64_SET((bp)->blk_prop, 40, 8, x)
|
||||
#define BP_GET_CHECKSUM(bp) BF64_GET((bp)->blk_prop, 40, 8)
|
||||
#define BP_SET_CHECKSUM(bp, x) BF64_SET((bp)->blk_prop, 40, 8, x)
|
||||
|
||||
#define BP_GET_TYPE(bp) BF64_GET((bp)->blk_prop, 48, 8)
|
||||
#define BP_SET_TYPE(bp, x) BF64_SET((bp)->blk_prop, 48, 8, x)
|
||||
#define BP_GET_TYPE(bp) BF64_GET((bp)->blk_prop, 48, 8)
|
||||
#define BP_SET_TYPE(bp, x) BF64_SET((bp)->blk_prop, 48, 8, x)
|
||||
|
||||
#define BP_GET_LEVEL(bp) BF64_GET((bp)->blk_prop, 56, 5)
|
||||
#define BP_SET_LEVEL(bp, x) BF64_SET((bp)->blk_prop, 56, 5, x)
|
||||
#define BP_GET_LEVEL(bp) BF64_GET((bp)->blk_prop, 56, 5)
|
||||
#define BP_SET_LEVEL(bp, x) BF64_SET((bp)->blk_prop, 56, 5, x)
|
||||
|
||||
#define BP_GET_BYTEORDER(bp) (0 - BF64_GET((bp)->blk_prop, 63, 1))
|
||||
#define BP_SET_BYTEORDER(bp, x) BF64_SET((bp)->blk_prop, 63, 1, x)
|
||||
#define BP_GET_PROP_BIT_61(bp) BF64_GET((bp)->blk_prop, 61, 1)
|
||||
#define BP_SET_PROP_BIT_61(bp, x) BF64_SET((bp)->blk_prop, 61, 1, x)
|
||||
|
||||
#define BP_GET_DEDUP(bp) BF64_GET((bp)->blk_prop, 62, 1)
|
||||
#define BP_SET_DEDUP(bp, x) BF64_SET((bp)->blk_prop, 62, 1, x)
|
||||
|
||||
#define BP_GET_BYTEORDER(bp) (0 - BF64_GET((bp)->blk_prop, 63, 1))
|
||||
#define BP_SET_BYTEORDER(bp, x) BF64_SET((bp)->blk_prop, 63, 1, x)
|
||||
|
||||
#define BP_PHYSICAL_BIRTH(bp) \
|
||||
((bp)->blk_phys_birth ? (bp)->blk_phys_birth : (bp)->blk_birth)
|
||||
|
||||
#define BP_SET_BIRTH(bp, logical, physical) \
|
||||
{ \
|
||||
(bp)->blk_birth = (logical); \
|
||||
(bp)->blk_phys_birth = ((logical) == (physical) ? 0 : (physical)); \
|
||||
}
|
||||
|
||||
#define BP_GET_ASIZE(bp) \
|
||||
(DVA_GET_ASIZE(&(bp)->blk_dva[0]) + DVA_GET_ASIZE(&(bp)->blk_dva[1]) + \
|
||||
@@ -227,13 +250,18 @@ typedef struct blkptr {
|
||||
((dva1)->dva_word[1] == (dva2)->dva_word[1] && \
|
||||
(dva1)->dva_word[0] == (dva2)->dva_word[0])
|
||||
|
||||
#define BP_EQUAL(bp1, bp2) \
|
||||
(BP_PHYSICAL_BIRTH(bp1) == BP_PHYSICAL_BIRTH(bp2) && \
|
||||
DVA_EQUAL(&(bp1)->blk_dva[0], &(bp2)->blk_dva[0]) && \
|
||||
DVA_EQUAL(&(bp1)->blk_dva[1], &(bp2)->blk_dva[1]) && \
|
||||
DVA_EQUAL(&(bp1)->blk_dva[2], &(bp2)->blk_dva[2]))
|
||||
|
||||
#define ZIO_CHECKSUM_EQUAL(zc1, zc2) \
|
||||
(0 == (((zc1).zc_word[0] - (zc2).zc_word[0]) | \
|
||||
((zc1).zc_word[1] - (zc2).zc_word[1]) | \
|
||||
((zc1).zc_word[2] - (zc2).zc_word[2]) | \
|
||||
((zc1).zc_word[3] - (zc2).zc_word[3])))
|
||||
|
||||
|
||||
#define DVA_IS_VALID(dva) (DVA_GET_ASIZE(dva) != 0)
|
||||
|
||||
#define ZIO_SET_CHECKSUM(zcp, w0, w1, w2, w3) \
|
||||
@@ -247,7 +275,10 @@ typedef struct blkptr {
|
||||
#define BP_IDENTITY(bp) (&(bp)->blk_dva[0])
|
||||
#define BP_IS_GANG(bp) DVA_GET_GANG(BP_IDENTITY(bp))
|
||||
#define BP_IS_HOLE(bp) ((bp)->blk_birth == 0)
|
||||
#define BP_IS_OLDER(bp, txg) (!BP_IS_HOLE(bp) && (bp)->blk_birth < (txg))
|
||||
|
||||
/* BP_IS_RAIDZ(bp) assumes no block compression */
|
||||
#define BP_IS_RAIDZ(bp) (DVA_GET_ASIZE(&(bp)->blk_dva[0]) > \
|
||||
BP_GET_PSIZE(bp))
|
||||
|
||||
#define BP_ZERO(bp) \
|
||||
{ \
|
||||
@@ -260,7 +291,7 @@ typedef struct blkptr {
|
||||
(bp)->blk_prop = 0; \
|
||||
(bp)->blk_pad[0] = 0; \
|
||||
(bp)->blk_pad[1] = 0; \
|
||||
(bp)->blk_pad[2] = 0; \
|
||||
(bp)->blk_phys_birth = 0; \
|
||||
(bp)->blk_birth = 0; \
|
||||
(bp)->blk_fill = 0; \
|
||||
ZIO_SET_CHECKSUM(&(bp)->blk_cksum, 0, 0, 0, 0); \
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
#ifndef _SYS_UBERBLOCK_IMPL_H
|
||||
#define _SYS_UBERBLOCK_IMPL_H
|
||||
|
||||
#pragma ident "%Z%%M% %I% %E% SMI"
|
||||
|
||||
/*
|
||||
* The uberblock version is incremented whenever an incompatible on-disk
|
||||
* format change is made to the SPA, DMU, or ZAP.
|
||||
|
||||
@@ -17,38 +17,27 @@
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/*
|
||||
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
|
||||
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_VDEV_IMPL_H
|
||||
#define _SYS_VDEV_IMPL_H
|
||||
|
||||
#define VDEV_SKIP_SIZE (8 << 10)
|
||||
#define VDEV_BOOT_HEADER_SIZE (8 << 10)
|
||||
#define VDEV_PAD_SIZE (8 << 10)
|
||||
/* 2 padding areas (vl_pad1 and vl_pad2) to skip */
|
||||
#define VDEV_SKIP_SIZE VDEV_PAD_SIZE * 2
|
||||
#define VDEV_PHYS_SIZE (112 << 10)
|
||||
#define VDEV_UBERBLOCK_RING (128 << 10)
|
||||
|
||||
/* ZFS boot block */
|
||||
#define VDEV_BOOT_MAGIC 0x2f5b007b10cULL
|
||||
#define VDEV_BOOT_VERSION 1 /* version number */
|
||||
|
||||
typedef struct vdev_boot_header {
|
||||
uint64_t vb_magic; /* VDEV_BOOT_MAGIC */
|
||||
uint64_t vb_version; /* VDEV_BOOT_VERSION */
|
||||
uint64_t vb_offset; /* start offset (bytes) */
|
||||
uint64_t vb_size; /* size (bytes) */
|
||||
char vb_pad[VDEV_BOOT_HEADER_SIZE - 4 * sizeof (uint64_t)];
|
||||
} vdev_boot_header_t;
|
||||
|
||||
typedef struct vdev_phys {
|
||||
char vp_nvlist[VDEV_PHYS_SIZE - sizeof (zio_block_tail_t)];
|
||||
zio_block_tail_t vp_zbt;
|
||||
char vp_nvlist[VDEV_PHYS_SIZE - sizeof (zio_eck_t)];
|
||||
zio_eck_t vp_zbt;
|
||||
} vdev_phys_t;
|
||||
|
||||
typedef struct vdev_label {
|
||||
char vl_pad[VDEV_SKIP_SIZE]; /* 8K */
|
||||
vdev_boot_header_t vl_boot_header; /* 8K */
|
||||
char vl_pad1[VDEV_PAD_SIZE]; /* 8K */
|
||||
char vl_pad2[VDEV_PAD_SIZE]; /* 8K */
|
||||
vdev_phys_t vl_vdev_phys; /* 112K */
|
||||
char vl_uberblock[VDEV_UBERBLOCK_RING]; /* 128K */
|
||||
} vdev_label_t; /* 256K total */
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/*
|
||||
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
|
||||
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
|
||||
#define ZAP_MAGIC 0x2F52AB2ABULL
|
||||
|
||||
#define ZAP_HASHBITS 28
|
||||
#define MZAP_ENT_LEN 64
|
||||
#define MZAP_NAME_LEN (MZAP_ENT_LEN - 8 - 4 - 2)
|
||||
#define MZAP_MAX_BLKSHIFT SPA_MAXBLOCKSHIFT
|
||||
@@ -99,6 +98,8 @@ typedef struct zap_phys {
|
||||
uint64_t zap_num_leafs; /* number of leafs */
|
||||
uint64_t zap_num_entries; /* number of entries */
|
||||
uint64_t zap_salt; /* salt to stir into hash function */
|
||||
uint64_t zap_normflags; /* flags for u8_textprep_str() */
|
||||
uint64_t zap_flags; /* zap_flag_t */
|
||||
/*
|
||||
* This structure is followed by padding, and then the embedded
|
||||
* pointer table. The embedded pointer table takes up second
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
#ifndef _SYS_ZAP_LEAF_H
|
||||
#define _SYS_ZAP_LEAF_H
|
||||
|
||||
#pragma ident "%Z%%M% %I% %E% SMI"
|
||||
|
||||
#define ZAP_LEAF_MAGIC 0x2AB1EAF
|
||||
|
||||
/* chunk size = 24 bytes */
|
||||
|
||||
@@ -17,18 +17,17 @@
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/*
|
||||
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_FS_ZFS_H
|
||||
#define _SYS_FS_ZFS_H
|
||||
|
||||
|
||||
/*
|
||||
* On-disk version number.
|
||||
*/
|
||||
#define SPA_VERSION 16ULL
|
||||
#define SPA_VERSION 24ULL
|
||||
|
||||
/*
|
||||
* The following are configuration names used in the nvlist describing a pool's
|
||||
@@ -62,6 +61,12 @@
|
||||
#define ZPOOL_CONFIG_NPARITY "nparity"
|
||||
#define ZPOOL_CONFIG_PHYS_PATH "phys_path"
|
||||
#define ZPOOL_CONFIG_L2CACHE "l2cache"
|
||||
#define ZPOOL_CONFIG_HOLE_ARRAY "hole_array"
|
||||
#define ZPOOL_CONFIG_VDEV_CHILDREN "vdev_children"
|
||||
#define ZPOOL_CONFIG_IS_HOLE "is_hole"
|
||||
#define ZPOOL_CONFIG_DDT_HISTOGRAM "ddt_histogram"
|
||||
#define ZPOOL_CONFIG_DDT_OBJ_STATS "ddt_object_stats"
|
||||
#define ZPOOL_CONFIG_DDT_STATS "ddt_stats"
|
||||
/*
|
||||
* The persistent vdev state is stored as separate values rather than a single
|
||||
* 'vdev_state' entry. This is because a device can be in multiple states, such
|
||||
@@ -79,6 +84,7 @@
|
||||
#define VDEV_TYPE_DISK "disk"
|
||||
#define VDEV_TYPE_FILE "file"
|
||||
#define VDEV_TYPE_MISSING "missing"
|
||||
#define VDEV_TYPE_HOLE "hole"
|
||||
#define VDEV_TYPE_SPARE "spare"
|
||||
#define VDEV_TYPE_L2CACHE "l2cache"
|
||||
|
||||
|
||||
@@ -24,6 +24,13 @@
|
||||
#ifndef _SYS_FS_ZFS_ACL_H
|
||||
#define _SYS_FS_ZFS_ACL_H
|
||||
|
||||
#pragma ident "%Z%%M% %I% %E% SMI"
|
||||
|
||||
#ifndef _UID_T
|
||||
#define _UID_T
|
||||
typedef unsigned int uid_t; /* UID type */
|
||||
#endif /* _UID_T */
|
||||
|
||||
typedef struct zfs_oldace {
|
||||
uint32_t z_fuid; /* "who" */
|
||||
uint32_t z_access_mask; /* access mask */
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/*
|
||||
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
@@ -27,8 +27,9 @@
|
||||
#define MASTER_NODE_OBJ 1
|
||||
#define ZFS_ROOT_OBJ "ROOT"
|
||||
#define ZPL_VERSION_STR "VERSION"
|
||||
#define ZFS_SA_ATTRS "SA_ATTRS"
|
||||
|
||||
#define ZPL_VERSION 4ULL
|
||||
#define ZPL_VERSION 5ULL
|
||||
|
||||
#define ZFS_DIRENT_OBJ(de) BF64_GET(de, 0, 48)
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/*
|
||||
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
|
||||
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
@@ -45,7 +45,13 @@ typedef struct zil_header {
|
||||
uint64_t zh_replay_seq; /* highest replayed sequence number */
|
||||
blkptr_t zh_log; /* log chain */
|
||||
uint64_t zh_claim_seq; /* highest claimed sequence number */
|
||||
uint64_t zh_pad[5];
|
||||
uint64_t zh_flags; /* header flags */
|
||||
uint64_t zh_pad[4];
|
||||
} zil_header_t;
|
||||
|
||||
/*
|
||||
* zh_flags bit settings
|
||||
*/
|
||||
#define ZIL_REPLAY_NEEDED 0x1 /* replay needed - internal only */
|
||||
|
||||
#endif /* _SYS_ZIL_H */
|
||||
@@ -17,19 +17,19 @@
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/*
|
||||
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
|
||||
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#ifndef _ZIO_H
|
||||
#define _ZIO_H
|
||||
|
||||
#define ZBT_MAGIC 0x210da7ab10c7a11ULL /* zio data bloc tail */
|
||||
#define ZEC_MAGIC 0x210da7ab10c7a11ULL /* zio data bloc tail */
|
||||
|
||||
typedef struct zio_block_tail {
|
||||
uint64_t zbt_magic; /* for validation, endianness */
|
||||
zio_cksum_t zbt_cksum; /* 256-bit checksum */
|
||||
} zio_block_tail_t;
|
||||
typedef struct zio_eck {
|
||||
uint64_t zec_magic; /* for validation, endianness */
|
||||
zio_cksum_t zec_cksum; /* 256-bit checksum */
|
||||
} zio_eck_t;
|
||||
|
||||
/*
|
||||
* Gang block headers are self-checksumming and contain an array
|
||||
@@ -37,9 +37,9 @@ typedef struct zio_block_tail {
|
||||
*/
|
||||
#define SPA_GANGBLOCKSIZE SPA_MINBLOCKSIZE
|
||||
#define SPA_GBH_NBLKPTRS ((SPA_GANGBLOCKSIZE - \
|
||||
sizeof (zio_block_tail_t)) / sizeof (blkptr_t))
|
||||
sizeof (zio_eck_t)) / sizeof (blkptr_t))
|
||||
#define SPA_GBH_FILLER ((SPA_GANGBLOCKSIZE - \
|
||||
sizeof (zio_block_tail_t) - \
|
||||
sizeof (zio_eck_t) - \
|
||||
(SPA_GBH_NBLKPTRS * sizeof (blkptr_t))) /\
|
||||
sizeof (uint64_t))
|
||||
|
||||
@@ -50,7 +50,7 @@ typedef struct zio_block_tail {
|
||||
typedef struct zio_gbh {
|
||||
blkptr_t zg_blkptr[SPA_GBH_NBLKPTRS];
|
||||
uint64_t zg_filler[SPA_GBH_FILLER];
|
||||
zio_block_tail_t zg_tail;
|
||||
zio_eck_t zg_tail;
|
||||
} zio_gbh_phys_t;
|
||||
|
||||
enum zio_checksum {
|
||||
@@ -63,12 +63,10 @@ enum zio_checksum {
|
||||
ZIO_CHECKSUM_FLETCHER_2,
|
||||
ZIO_CHECKSUM_FLETCHER_4,
|
||||
ZIO_CHECKSUM_SHA256,
|
||||
ZIO_CHECKSUM_ZILOG2,
|
||||
ZIO_CHECKSUM_FUNCTIONS
|
||||
};
|
||||
|
||||
#define ZIO_CHECKSUM_ON_VALUE ZIO_CHECKSUM_FLETCHER_2
|
||||
#define ZIO_CHECKSUM_DEFAULT ZIO_CHECKSUM_ON
|
||||
|
||||
enum zio_compress {
|
||||
ZIO_COMPRESS_INHERIT = 0,
|
||||
ZIO_COMPRESS_ON,
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/*
|
||||
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
|
||||
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
@@ -35,7 +35,7 @@ typedef void zio_checksum_t(const void *data, uint64_t size, zio_cksum_t *zcp);
|
||||
typedef struct zio_checksum_info {
|
||||
zio_checksum_t *ci_func[2]; /* checksum function for each byteorder */
|
||||
int ci_correctable; /* number of correctable bits */
|
||||
int ci_zbt; /* uses zio block tail? */
|
||||
int ci_eck; /* uses zio embedded checksum? */
|
||||
char *ci_name; /* descriptive name */
|
||||
} zio_checksum_info_t;
|
||||
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#pragma ident "%Z%%M% %I% %E% SMI"
|
||||
|
||||
#include "fsys_zfs.h"
|
||||
|
||||
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#pragma ident "%Z%%M% %I% %E% SMI"
|
||||
|
||||
#include "fsys_zfs.h"
|
||||
|
||||
#define MATCH_BITS 6
|
||||
@@ -32,11 +34,10 @@
|
||||
int
|
||||
lzjb_decompress(void *s_start, void *d_start, size_t s_len, size_t d_len)
|
||||
{
|
||||
unsigned char *src = s_start;
|
||||
unsigned char *dst = d_start;
|
||||
unsigned char *d_end = (unsigned char *)d_start + d_len;
|
||||
unsigned char *cpy;
|
||||
unsigned char copymap = '\0';
|
||||
uchar_t *src = s_start;
|
||||
uchar_t *dst = d_start;
|
||||
uchar_t *d_end = (uchar_t *)d_start + d_len;
|
||||
uchar_t *cpy, copymap = '\0';
|
||||
int copymask = 1 << (NBBY - 1);
|
||||
|
||||
while (dst < d_end) {
|
||||
@@ -44,11 +45,11 @@ lzjb_decompress(void *s_start, void *d_start, size_t s_len, size_t d_len)
|
||||
copymask = 1;
|
||||
copymap = *src++;
|
||||
}
|
||||
if (copymap & (unsigned char)copymask) {
|
||||
if (copymap & copymask) {
|
||||
int mlen = (src[0] >> (NBBY - MATCH_BITS)) + MATCH_MIN;
|
||||
int offset = ((src[0] << NBBY) | src[1]) & OFFSET_MASK;
|
||||
src += 2;
|
||||
if ((cpy = dst - offset) < (unsigned char *)d_start)
|
||||
if ((cpy = dst - offset) < (uchar_t *)d_start)
|
||||
return (-1);
|
||||
while (--mlen >= 0 && dst < d_end)
|
||||
*dst++ = *cpy++;
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#pragma ident "%Z%%M% %I% %E% SMI"
|
||||
|
||||
#include "fsys_zfs.h"
|
||||
|
||||
/*
|
||||
|
||||