83d290c56f
When U-Boot started using SPDX tags we were among the early adopters and there weren't a lot of other examples to borrow from. So we picked the area of the file that usually had a full license text and replaced it with an appropriate SPDX-License-Identifier: entry. Since then, the Linux Kernel has adopted SPDX tags and they place it as the very first line in a file (except where shebangs are used, then it's second line) and with slightly different comment styles than us. In part due to community overlap, in part due to better tag visibility and in part for other minor reasons, switch over to that style. This commit changes all instances where we have a single declared license in the tag as both the before and after are identical in tag contents. There's also a few places where I found we did not have a tag and have introduced one. Signed-off-by: Tom Rini <trini@konsulko.com>
69 lines
2.2 KiB
C
69 lines
2.2 KiB
C
/* SPDX-License-Identifier: GPL-2.0+ */
|
|
/*
|
|
* GRUB -- GRand Unified Bootloader
|
|
* Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc.
|
|
*/
|
|
/*
|
|
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
|
|
* Use is subject to license terms.
|
|
*/
|
|
|
|
#ifndef _SYS_DNODE_H
|
|
#define _SYS_DNODE_H
|
|
|
|
#include <zfs/spa.h>
|
|
|
|
/*
|
|
* Fixed constants.
|
|
*/
|
|
#define DNODE_SHIFT 9 /* 512 bytes */
|
|
#define DN_MIN_INDBLKSHIFT 10 /* 1k */
|
|
#define DN_MAX_INDBLKSHIFT 14 /* 16k */
|
|
#define DNODE_BLOCK_SHIFT 14 /* 16k */
|
|
#define DNODE_CORE_SIZE 64 /* 64 bytes for dnode sans blkptrs */
|
|
#define DN_MAX_OBJECT_SHIFT 48 /* 256 trillion (zfs_fid_t limit) */
|
|
#define DN_MAX_OFFSET_SHIFT 64 /* 2^64 bytes in a dnode */
|
|
|
|
/*
|
|
* Derived constants.
|
|
*/
|
|
#define DNODE_SIZE (1 << DNODE_SHIFT)
|
|
#define DN_MAX_NBLKPTR ((DNODE_SIZE - DNODE_CORE_SIZE) >> SPA_BLKPTRSHIFT)
|
|
#define DN_MAX_BONUSLEN (DNODE_SIZE - DNODE_CORE_SIZE - (1 << SPA_BLKPTRSHIFT))
|
|
#define DN_MAX_OBJECT (1ULL << DN_MAX_OBJECT_SHIFT)
|
|
|
|
#define DNODES_PER_BLOCK_SHIFT (DNODE_BLOCK_SHIFT - DNODE_SHIFT)
|
|
#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))))
|
|
|
|
typedef struct dnode_phys {
|
|
uint8_t dn_type; /* dmu_object_type_t */
|
|
uint8_t dn_indblkshift; /* ln2(indirect block size) */
|
|
uint8_t dn_nlevels; /* 1=dn_blkptr->data blocks */
|
|
uint8_t dn_nblkptr; /* length of dn_blkptr */
|
|
uint8_t dn_bonustype; /* type of data in bonus buffer */
|
|
uint8_t dn_checksum; /* ZIO_CHECKSUM type */
|
|
uint8_t dn_compress; /* ZIO_COMPRESS type */
|
|
uint8_t dn_flags; /* DNODE_FLAG_* */
|
|
uint16_t dn_datablkszsec; /* data block size in 512b sectors */
|
|
uint16_t dn_bonuslen; /* length of dn_bonus */
|
|
uint8_t dn_pad2[4];
|
|
|
|
/* accounting is protected by dn_dirty_mtx */
|
|
uint64_t dn_maxblkid; /* largest allocated block ID */
|
|
uint64_t dn_used; /* bytes (or sectors) of disk space */
|
|
|
|
uint64_t dn_pad3[4];
|
|
|
|
blkptr_t dn_blkptr[1];
|
|
uint8_t dn_bonus[DN_MAX_BONUSLEN - sizeof(blkptr_t)];
|
|
blkptr_t dn_spill;
|
|
} dnode_phys_t;
|
|
|
|
#endif /* _SYS_DNODE_H */
|