Module Name: src Committed By: chs Date: Thu Jun 8 22:24:59 UTC 2017
Modified Files: src/sys/sys: disk.h Log Message: do not expose kernel-internal structure definitions to userland. needed for ZFS. To generate a diff of this commit: cvs rdiff -u -r1.70 -r1.71 src/sys/sys/disk.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/sys/disk.h diff -u src/sys/sys/disk.h:1.70 src/sys/sys/disk.h:1.71 --- src/sys/sys/disk.h:1.70 Sun Mar 5 23:07:12 2017 +++ src/sys/sys/disk.h Thu Jun 8 22:24:59 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: disk.h,v 1.70 2017/03/05 23:07:12 mlelstv Exp $ */ +/* $NetBSD: disk.h,v 1.71 2017/06/08 22:24:59 chs Exp $ */ /*- * Copyright (c) 1996, 1997, 2004 The NetBSD Foundation, Inc. @@ -79,23 +79,9 @@ * Disk device structures. */ -#ifdef _KERNEL -#include <sys/device.h> -#endif #include <sys/dkio.h> #include <sys/time.h> #include <sys/queue.h> -#include <sys/mutex.h> -#include <sys/iostat.h> - -#include <prop/proplib.h> - -struct buf; -struct disk; -struct disklabel; -struct cpu_disklabel; -struct lwp; -struct vnode; /* * Disk information dictionary. @@ -188,31 +174,6 @@ struct dkwedge_list { u_int dkwl_ncopied; /* number actually copied */ }; -#ifdef _KERNEL -/* - * dkwedge_discovery_method: - * - * Structure used to describe partition map parsing schemes - * used for wedge autodiscovery. - */ -struct dkwedge_discovery_method { - /* link in wedge driver's list */ - LIST_ENTRY(dkwedge_discovery_method) ddm_list; - const char *ddm_name; /* name of this method */ - int ddm_priority; /* search priority */ - int (*ddm_discover)(struct disk *, struct vnode *); -}; - -#define DKWEDGE_DISCOVERY_METHOD_DECL(name, prio, discover) \ -static struct dkwedge_discovery_method name ## _ddm = { \ - { NULL, NULL }, \ - #name, \ - prio, \ - discover \ -}; \ -__link_set_add_data(dkwedge_methods, name ## _ddm) -#endif /* _KERNEL */ - /* Some common partition types */ #define DKW_PTYPE_UNKNOWN "" #define DKW_PTYPE_UNUSED "unused" @@ -311,6 +272,68 @@ struct disk_geom { }; /* + * Bad sector lists per fixed disk + */ +struct disk_badsectors { + SLIST_ENTRY(disk_badsectors) dbs_next; + daddr_t dbs_min; /* min. sector number */ + daddr_t dbs_max; /* max. sector number */ + struct timeval dbs_failedat; /* first failure at */ +}; + +struct disk_badsecinfo { + uint32_t dbsi_bufsize; /* size of region pointed to */ + uint32_t dbsi_skip; /* how many to skip past */ + uint32_t dbsi_copied; /* how many got copied back */ + uint32_t dbsi_left; /* remaining to copy */ + void * dbsi_buffer; /* region to copy disk_badsectors to */ +}; + +#define DK_STRATEGYNAMELEN 32 +struct disk_strategy { + char dks_name[DK_STRATEGYNAMELEN]; /* name of strategy */ + char *dks_param; /* notyet; should be NULL */ + size_t dks_paramlen; /* notyet; should be 0 */ +}; + +#ifdef _KERNEL +#include <sys/device.h> +#include <sys/mutex.h> +#include <sys/iostat.h> + +#include <prop/proplib.h> + +struct buf; +struct disk; +struct disklabel; +struct cpu_disklabel; +struct lwp; +struct vnode; + +/* + * dkwedge_discovery_method: + * + * Structure used to describe partition map parsing schemes + * used for wedge autodiscovery. + */ +struct dkwedge_discovery_method { + /* link in wedge driver's list */ + LIST_ENTRY(dkwedge_discovery_method) ddm_list; + const char *ddm_name; /* name of this method */ + int ddm_priority; /* search priority */ + int (*ddm_discover)(struct disk *, struct vnode *); +}; + +#define DKWEDGE_DISCOVERY_METHOD_DECL(name, prio, discover) \ +static struct dkwedge_discovery_method name ## _ddm = { \ + { NULL, NULL }, \ + #name, \ + prio, \ + discover \ +}; \ +__link_set_add_data(dkwedge_methods, name ## _ddm) + +/* * Disk partition dictionary. * * A partition is represented as a dictionary containing generic partition @@ -470,7 +493,6 @@ struct disk { struct cpu_disklabel *dk_cpulabel; }; -#ifdef _KERNEL struct dkdriver { void (*d_strategy)(struct buf *); void (*d_minphys)(struct buf *); @@ -484,7 +506,6 @@ struct dkdriver { int (*d_firstopen)(device_t, dev_t, int, int); void (*d_label)(device_t, struct disklabel *lp); }; -#endif /* states */ #define DK_CLOSED 0 /* drive is closed */ @@ -494,37 +515,11 @@ struct dkdriver { #define DK_OPEN 4 /* label read, drive open */ #define DK_OPENRAW 5 /* open without label */ -/* - * Bad sector lists per fixed disk - */ -struct disk_badsectors { - SLIST_ENTRY(disk_badsectors) dbs_next; - daddr_t dbs_min; /* min. sector number */ - daddr_t dbs_max; /* max. sector number */ - struct timeval dbs_failedat; /* first failure at */ -}; - -struct disk_badsecinfo { - uint32_t dbsi_bufsize; /* size of region pointed to */ - uint32_t dbsi_skip; /* how many to skip past */ - uint32_t dbsi_copied; /* how many got copied back */ - uint32_t dbsi_left; /* remaining to copy */ - void * dbsi_buffer; /* region to copy disk_badsectors to */ -}; - -#define DK_STRATEGYNAMELEN 32 -struct disk_strategy { - char dks_name[DK_STRATEGYNAMELEN]; /* name of strategy */ - char *dks_param; /* notyet; should be NULL */ - size_t dks_paramlen; /* notyet; should be 0 */ -}; - #define DK_BSIZE2BLKSHIFT(b) ((ffs((b) / DEV_BSIZE)) - 1) #define DK_BSIZE2BYTESHIFT(b) (ffs((b)) - 1) #define DK_DEV_BSIZE_OK(b) \ ((b) >= DEV_BSIZE && ((b) & ((b) - 1)) == 0 && (b) <= MAXPHYS) -#ifdef _KERNEL extern int disk_count; /* number of disks in global disklist */ struct proc; @@ -555,6 +550,6 @@ const char *dkwedge_get_parent_name(dev_ void dkwedge_print_wnames(void); device_t dkwedge_find_partition(device_t, daddr_t, uint64_t); -#endif +#endif /* _KERNEL */ #endif /* _SYS_DISK_H_ */