From owner-svn-src-user@FreeBSD.ORG Tue Nov 15 23:32:31 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4325B106567D; Tue, 15 Nov 2011 23:32:31 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2FB458FC08; Tue, 15 Nov 2011 23:32:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pAFNWVl6021527; Tue, 15 Nov 2011 23:32:31 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pAFNWUhZ021504; Tue, 15 Nov 2011 23:32:30 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201111152332.pAFNWUhZ021504@svn.freebsd.org> From: Attilio Rao Date: Tue, 15 Nov 2011 23:32:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227542 - in user/attilio/vmcontention: cddl/contrib/opensolaris/cmd/zpool contrib/top etc etc/periodic/daily include lib/libc/gen lib/msun/src release rescue/rescue sbin/geom/class/mul... X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Nov 2011 23:32:31 -0000 Author: attilio Date: Tue Nov 15 23:32:30 2011 New Revision: 227542 URL: http://svn.freebsd.org/changeset/base/227542 Log: MFC Added: user/attilio/vmcontention/sys/boot/fdt/dts/p1020rdb.dts - copied unchanged from r227541, head/sys/boot/fdt/dts/p1020rdb.dts user/attilio/vmcontention/sys/boot/fdt/dts/p3041ds.dts - copied unchanged from r227541, head/sys/boot/fdt/dts/p3041ds.dts user/attilio/vmcontention/tools/build/atomic.c - copied unchanged from r227541, head/tools/build/atomic.c user/attilio/vmcontention/tools/regression/lib/libc/gen/test-arc4random.c - copied unchanged from r227541, head/tools/regression/lib/libc/gen/test-arc4random.c Modified: user/attilio/vmcontention/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c user/attilio/vmcontention/etc/periodic/daily/310.accounting user/attilio/vmcontention/etc/rc.resume user/attilio/vmcontention/include/ctype.h user/attilio/vmcontention/include/stdio.h user/attilio/vmcontention/include/wchar.h user/attilio/vmcontention/include/wctype.h user/attilio/vmcontention/lib/libc/gen/arc4random.c user/attilio/vmcontention/lib/msun/src/math.h user/attilio/vmcontention/release/generate-release.sh user/attilio/vmcontention/rescue/rescue/Makefile user/attilio/vmcontention/sbin/geom/class/multipath/geom_multipath.c user/attilio/vmcontention/sbin/gvinum/gvinum.c user/attilio/vmcontention/sbin/ifconfig/ifconfig.8 user/attilio/vmcontention/sbin/ipfw/main.c user/attilio/vmcontention/sbin/md5/md5.1 user/attilio/vmcontention/sbin/md5/md5.c user/attilio/vmcontention/sbin/mount_nfs/mount_nfs.8 user/attilio/vmcontention/sbin/mount_nfs/mount_nfs.c user/attilio/vmcontention/share/man/man4/ip.4 user/attilio/vmcontention/share/man/man4/mvs.4 user/attilio/vmcontention/share/man/man4/tcp.4 user/attilio/vmcontention/share/man/man4/ti.4 user/attilio/vmcontention/share/man/man7/release.7 user/attilio/vmcontention/share/man/man9/Makefile user/attilio/vmcontention/share/man/man9/kobj.9 user/attilio/vmcontention/share/misc/committers-ports.dot user/attilio/vmcontention/sys/amd64/include/_stdint.h user/attilio/vmcontention/sys/cam/scsi/scsi_ch.h user/attilio/vmcontention/sys/cam/scsi/scsi_ses.c user/attilio/vmcontention/sys/compat/freebsd32/freebsd32_misc.c user/attilio/vmcontention/sys/dev/bktr/bktr_reg.h user/attilio/vmcontention/sys/dev/ofw/openfirm.c user/attilio/vmcontention/sys/dev/puc/pucdata.c user/attilio/vmcontention/sys/dev/sio/sio_pci.c user/attilio/vmcontention/sys/dev/ti/if_ti.c user/attilio/vmcontention/sys/dev/ti/if_tireg.h user/attilio/vmcontention/sys/dev/usb/controller/xhci.c user/attilio/vmcontention/sys/fs/devfs/devfs_rule.c user/attilio/vmcontention/sys/fs/nfsclient/nfs_clvfsops.c user/attilio/vmcontention/sys/fs/nfsclient/nfs_clvnops.c user/attilio/vmcontention/sys/fs/pseudofs/pseudofs_vnops.c user/attilio/vmcontention/sys/geom/geom_dev.c user/attilio/vmcontention/sys/kern/kern_descrip.c user/attilio/vmcontention/sys/kern/subr_kobj.c user/attilio/vmcontention/sys/kern/subr_uio.c user/attilio/vmcontention/sys/kern/sys_generic.c user/attilio/vmcontention/sys/kern/uipc_socket.c user/attilio/vmcontention/sys/kern/vfs_syscalls.c user/attilio/vmcontention/sys/net/if_spppfr.c user/attilio/vmcontention/sys/netinet/sctp_pcb.c user/attilio/vmcontention/sys/netinet/sctp_structs.h user/attilio/vmcontention/sys/netinet6/in6_mcast.c user/attilio/vmcontention/sys/nfsclient/nfs_vfsops.c user/attilio/vmcontention/sys/powerpc/powerpc/platform.c user/attilio/vmcontention/sys/powerpc/powerpc/pmap_dispatch.c user/attilio/vmcontention/sys/sparc64/include/pcpu.h user/attilio/vmcontention/sys/sys/cdefs.h user/attilio/vmcontention/sys/sys/kobj.h user/attilio/vmcontention/sys/sys/syscallsubr.h user/attilio/vmcontention/sys/sys/uio.h user/attilio/vmcontention/sys/vm/device_pager.c user/attilio/vmcontention/sys/vm/vm_object.h user/attilio/vmcontention/sys/vm/vm_pager.c user/attilio/vmcontention/sys/vm/vm_pager.h user/attilio/vmcontention/tools/build/Makefile user/attilio/vmcontention/tools/regression/lib/libc/gen/Makefile user/attilio/vmcontention/usr.sbin/mtree/mtree.5 user/attilio/vmcontention/usr.sbin/pc-sysinstall/backend-query/sys-mem.sh user/attilio/vmcontention/usr.sbin/pmccontrol/pmccontrol.c user/attilio/vmcontention/usr.sbin/pmcstat/pmcpl_calltree.c user/attilio/vmcontention/usr.sbin/pmcstat/pmcpl_gprof.c user/attilio/vmcontention/usr.sbin/pmcstat/pmcstat.c user/attilio/vmcontention/usr.sbin/pmcstat/pmcstat_log.c user/attilio/vmcontention/usr.sbin/portsnap/portsnap/portsnap.sh Directory Properties: user/attilio/vmcontention/ (props changed) user/attilio/vmcontention/cddl/contrib/opensolaris/ (props changed) user/attilio/vmcontention/contrib/bind9/ (props changed) user/attilio/vmcontention/contrib/binutils/ (props changed) user/attilio/vmcontention/contrib/bzip2/ (props changed) user/attilio/vmcontention/contrib/com_err/ (props changed) user/attilio/vmcontention/contrib/compiler-rt/ (props changed) user/attilio/vmcontention/contrib/dialog/ (props changed) user/attilio/vmcontention/contrib/ee/ (props changed) user/attilio/vmcontention/contrib/expat/ (props changed) user/attilio/vmcontention/contrib/file/ (props changed) user/attilio/vmcontention/contrib/gcc/ (props changed) user/attilio/vmcontention/contrib/gdb/ (props changed) user/attilio/vmcontention/contrib/gdtoa/ (props changed) user/attilio/vmcontention/contrib/gnu-sort/ (props changed) user/attilio/vmcontention/contrib/groff/ (props changed) user/attilio/vmcontention/contrib/less/ (props changed) user/attilio/vmcontention/contrib/libpcap/ (props changed) user/attilio/vmcontention/contrib/libstdc++/ (props changed) user/attilio/vmcontention/contrib/llvm/ (props changed) user/attilio/vmcontention/contrib/llvm/tools/clang/ (props changed) user/attilio/vmcontention/contrib/ncurses/ (props changed) user/attilio/vmcontention/contrib/netcat/ (props changed) user/attilio/vmcontention/contrib/ntp/ (props changed) user/attilio/vmcontention/contrib/one-true-awk/ (props changed) user/attilio/vmcontention/contrib/openbsm/ (props changed) user/attilio/vmcontention/contrib/openpam/ (props changed) user/attilio/vmcontention/contrib/openresolv/ (props changed) user/attilio/vmcontention/contrib/pf/ (props changed) user/attilio/vmcontention/contrib/sendmail/ (props changed) user/attilio/vmcontention/contrib/tcpdump/ (props changed) user/attilio/vmcontention/contrib/tcsh/ (props changed) user/attilio/vmcontention/contrib/tnftp/ (props changed) user/attilio/vmcontention/contrib/top/ (props changed) user/attilio/vmcontention/contrib/top/install-sh (props changed) user/attilio/vmcontention/contrib/tzcode/stdtime/ (props changed) user/attilio/vmcontention/contrib/tzcode/zic/ (props changed) user/attilio/vmcontention/contrib/tzdata/ (props changed) user/attilio/vmcontention/contrib/wpa/ (props changed) user/attilio/vmcontention/contrib/xz/ (props changed) user/attilio/vmcontention/crypto/heimdal/ (props changed) user/attilio/vmcontention/crypto/openssh/ (props changed) user/attilio/vmcontention/crypto/openssl/ (props changed) user/attilio/vmcontention/gnu/lib/ (props changed) user/attilio/vmcontention/gnu/usr.bin/binutils/ (props changed) user/attilio/vmcontention/gnu/usr.bin/cc/cc_tools/ (props changed) user/attilio/vmcontention/gnu/usr.bin/gdb/ (props changed) user/attilio/vmcontention/lib/libc/ (props changed) user/attilio/vmcontention/lib/libc/stdtime/ (props changed) user/attilio/vmcontention/lib/libutil/ (props changed) user/attilio/vmcontention/lib/libz/ (props changed) user/attilio/vmcontention/sbin/ (props changed) user/attilio/vmcontention/sbin/ipfw/ (props changed) user/attilio/vmcontention/share/mk/bsd.arch.inc.mk (props changed) user/attilio/vmcontention/share/zoneinfo/ (props changed) user/attilio/vmcontention/sys/ (props changed) user/attilio/vmcontention/sys/amd64/include/xen/ (props changed) user/attilio/vmcontention/sys/boot/ (props changed) user/attilio/vmcontention/sys/boot/i386/efi/ (props changed) user/attilio/vmcontention/sys/boot/ia64/efi/ (props changed) user/attilio/vmcontention/sys/boot/ia64/ski/ (props changed) user/attilio/vmcontention/sys/boot/powerpc/boot1.chrp/ (props changed) user/attilio/vmcontention/sys/boot/powerpc/ofw/ (props changed) user/attilio/vmcontention/sys/cddl/contrib/opensolaris/ (props changed) user/attilio/vmcontention/sys/conf/ (props changed) user/attilio/vmcontention/sys/contrib/dev/acpica/ (props changed) user/attilio/vmcontention/sys/contrib/octeon-sdk/ (props changed) user/attilio/vmcontention/sys/contrib/pf/ (props changed) user/attilio/vmcontention/sys/contrib/x86emu/ (props changed) user/attilio/vmcontention/usr.bin/calendar/ (props changed) user/attilio/vmcontention/usr.bin/csup/ (props changed) user/attilio/vmcontention/usr.bin/procstat/ (props changed) user/attilio/vmcontention/usr.sbin/ndiscvt/ (props changed) user/attilio/vmcontention/usr.sbin/rtadvctl/ (props changed) user/attilio/vmcontention/usr.sbin/rtadvd/ (props changed) user/attilio/vmcontention/usr.sbin/rtsold/ (props changed) user/attilio/vmcontention/usr.sbin/zic/ (props changed) Modified: user/attilio/vmcontention/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c ============================================================================== --- user/attilio/vmcontention/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Tue Nov 15 20:48:57 2011 (r227541) +++ user/attilio/vmcontention/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Tue Nov 15 23:32:30 2011 (r227542) @@ -21,6 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright 2011 Nexenta Systems, Inc. All rights reserved. */ #include @@ -2206,10 +2207,15 @@ print_vdev_stats(zpool_handle_t *zhp, co return; for (c = 0; c < children; c++) { - uint64_t ishole = B_FALSE; + uint64_t ishole = B_FALSE, islog = B_FALSE; - if (nvlist_lookup_uint64(newchild[c], - ZPOOL_CONFIG_IS_HOLE, &ishole) == 0 && ishole) + (void) nvlist_lookup_uint64(newchild[c], ZPOOL_CONFIG_IS_HOLE, + &ishole); + + (void) nvlist_lookup_uint64(newchild[c], ZPOOL_CONFIG_IS_LOG, + &islog); + + if (ishole || islog) continue; vname = zpool_vdev_name(g_zfs, zhp, newchild[c], B_FALSE); @@ -2219,6 +2225,31 @@ print_vdev_stats(zpool_handle_t *zhp, co } /* + * Log device section + */ + + if (num_logs(newnv) > 0) { + (void) printf("%-*s - - - - - " + "-\n", cb->cb_namewidth, "logs"); + + for (c = 0; c < children; c++) { + uint64_t islog = B_FALSE; + (void) nvlist_lookup_uint64(newchild[c], + ZPOOL_CONFIG_IS_LOG, &islog); + + if (islog) { + vname = zpool_vdev_name(g_zfs, zhp, newchild[c], + B_FALSE); + print_vdev_stats(zhp, vname, oldnv ? + oldchild[c] : NULL, newchild[c], + cb, depth + 2); + free(vname); + } + } + + } + + /* * Include level 2 ARC devices in iostat output */ if (nvlist_lookup_nvlist_array(newnv, ZPOOL_CONFIG_L2CACHE, @@ -3565,10 +3596,16 @@ print_dedup_stats(nvlist_t *config) * table continue processing the stats. */ if (nvlist_lookup_uint64_array(config, ZPOOL_CONFIG_DDT_OBJ_STATS, - (uint64_t **)&ddo, &c) != 0 || ddo->ddo_count == 0) + (uint64_t **)&ddo, &c) != 0) return; (void) printf("\n"); + (void) printf(gettext(" dedup: ")); + if (ddo->ddo_count == 0) { + (void) printf(gettext("no DDT entries\n")); + return; + } + (void) printf("DDT entries %llu, size %llu on disk, %llu in core\n", (u_longlong_t)ddo->ddo_count, (u_longlong_t)ddo->ddo_dspace, Modified: user/attilio/vmcontention/etc/periodic/daily/310.accounting ============================================================================== --- user/attilio/vmcontention/etc/periodic/daily/310.accounting Tue Nov 15 20:48:57 2011 (r227541) +++ user/attilio/vmcontention/etc/periodic/daily/310.accounting Tue Nov 15 23:32:30 2011 (r227542) @@ -30,8 +30,13 @@ case "$daily_accounting_enable" in cd /var/account rc=0 - n=$daily_accounting_save - rm -f acct.$n.gz acct.$n || rc=3 + n=$(( $daily_accounting_save - 1 )) + for f in acct.*; do + case "$f" in acct.\*) continue ;; esac # No files match + m=${f%.gz} ; m=${m#acct.} + [ $m -ge $n ] && { rm $f || rc=3; } + done + m=$n n=$(($n - 1)) while [ $n -ge 0 ] @@ -44,13 +49,14 @@ case "$daily_accounting_enable" in /etc/rc.d/accounting rotate_log || rc=3 + rm -f acct.merge && cp acct.0 acct.merge || rc=3 + sa -s $daily_accounting_flags /var/account/acct.merge || rc=3 + rm acct.merge + case "$daily_accounting_compress" in [Yy][Ee][Ss]) - gzip --keep -f acct.0 || rc=3;; + gzip -f acct.0 || rc=3;; esac - - sa -s $daily_accounting_flags /var/account/acct.0 && - unlink acct.0 || rc=3 fi;; *) rc=0;; Modified: user/attilio/vmcontention/etc/rc.resume ============================================================================== --- user/attilio/vmcontention/etc/rc.resume Tue Nov 15 20:48:57 2011 (r227541) +++ user/attilio/vmcontention/etc/rc.resume Tue Nov 15 23:32:30 2011 (r227542) @@ -49,6 +49,10 @@ if [ -r /var/run/rc.suspend.tch ]; then /bin/rm -f /var/run/rc.suspend.tch fi +if [ -r /var/run/moused.pid ]; then + kill -HUP `head -1 /var/run/moused.pid` +fi + # Turns on a power supply of a card in the slot inactivated. # See also contrib/pccardq.c (only for PAO users). # pccardq | awk -F '~' '$5 == "inactive" \ Modified: user/attilio/vmcontention/include/ctype.h ============================================================================== --- user/attilio/vmcontention/include/ctype.h Tue Nov 15 20:48:57 2011 (r227541) +++ user/attilio/vmcontention/include/ctype.h Tue Nov 15 23:32:30 2011 (r227542) @@ -80,6 +80,7 @@ int isspecial(int); #endif __END_DECLS +#ifndef __cplusplus #define isalnum(c) __sbistype((c), _CTYPE_A|_CTYPE_D) #define isalpha(c) __sbistype((c), _CTYPE_A) #define iscntrl(c) __sbistype((c), _CTYPE_C) @@ -93,6 +94,7 @@ __END_DECLS #define isxdigit(c) __isctype((c), _CTYPE_X) /* ANSI -- locale independent */ #define tolower(c) __sbtolower(c) #define toupper(c) __sbtoupper(c) +#endif /* !__cplusplus */ #if __XSI_VISIBLE /* @@ -112,7 +114,7 @@ __END_DECLS #define toascii(c) ((c) & 0x7F) #endif -#if __ISO_C_VISIBLE >= 1999 +#if __ISO_C_VISIBLE >= 1999 && !defined(__cplusplus) #define isblank(c) __sbistype((c), _CTYPE_B) #endif Modified: user/attilio/vmcontention/include/stdio.h ============================================================================== --- user/attilio/vmcontention/include/stdio.h Tue Nov 15 20:48:57 2011 (r227541) +++ user/attilio/vmcontention/include/stdio.h Tue Nov 15 23:32:30 2011 (r227542) @@ -107,7 +107,7 @@ struct __sbuf { * inline functions. To preserve ABI compat, these members must not * be disturbed. These members are marked below with (*). */ -typedef struct __sFILE { +struct __sFILE { unsigned char *_p; /* (*) current position in (some) buffer */ int _r; /* (*) read space left for getc() */ int _w; /* (*) write space left for putc() */ @@ -144,8 +144,11 @@ typedef struct __sFILE { int _fl_count; /* recursive lock count */ int _orientation; /* orientation for fwide() */ __mbstate_t _mbstate; /* multibyte conversion state */ -} FILE; - +}; +#ifndef _STDFILE_DECLARED +#define _STDFILE_DECLARED +typedef struct __sFILE FILE; +#endif #ifndef _STDSTREAM_DECLARED __BEGIN_DECLS extern FILE *__stdinp; @@ -467,6 +470,7 @@ static __inline int __sputc(int _c, FILE __swbuf((int)(c), p) : \ (*(p)->_p = (c), (int)*(p)->_p++)) #endif +#ifndef __cplusplus #define __sfeof(p) (((p)->_flags & __SEOF) != 0) #define __sferror(p) (((p)->_flags & __SERR) != 0) @@ -506,6 +510,7 @@ extern int __isthreaded; #define getchar_unlocked() getc_unlocked(stdin) #define putchar_unlocked(x) putc_unlocked(x, stdout) #endif +#endif /* __cplusplus */ __END_DECLS #endif /* !_STDIO_H_ */ Modified: user/attilio/vmcontention/include/wchar.h ============================================================================== --- user/attilio/vmcontention/include/wchar.h Tue Nov 15 20:48:57 2011 (r227541) +++ user/attilio/vmcontention/include/wchar.h Tue Nov 15 23:32:30 2011 (r227542) @@ -97,20 +97,23 @@ typedef __wint_t wint_t; #define WEOF ((wint_t)-1) #endif -struct __sFILE; +#ifndef _STDFILE_DECLARED +#define _STDFILE_DECLARED +typedef struct __sFILE FILE; +#endif struct tm; __BEGIN_DECLS wint_t btowc(int); -wint_t fgetwc(struct __sFILE *); +wint_t fgetwc(FILE *); wchar_t * - fgetws(wchar_t * __restrict, int, struct __sFILE * __restrict); -wint_t fputwc(wchar_t, struct __sFILE *); -int fputws(const wchar_t * __restrict, struct __sFILE * __restrict); -int fwide(struct __sFILE *, int); -int fwprintf(struct __sFILE * __restrict, const wchar_t * __restrict, ...); -int fwscanf(struct __sFILE * __restrict, const wchar_t * __restrict, ...); -wint_t getwc(struct __sFILE *); + fgetws(wchar_t * __restrict, int, FILE * __restrict); +wint_t fputwc(wchar_t, FILE *); +int fputws(const wchar_t * __restrict, FILE * __restrict); +int fwide(FILE *, int); +int fwprintf(FILE * __restrict, const wchar_t * __restrict, ...); +int fwscanf(FILE * __restrict, const wchar_t * __restrict, ...); +wint_t getwc(FILE *); wint_t getwchar(void); size_t mbrlen(const char * __restrict, size_t, mbstate_t * __restrict); size_t mbrtowc(wchar_t * __restrict, const char * __restrict, size_t, @@ -118,13 +121,13 @@ size_t mbrtowc(wchar_t * __restrict, con int mbsinit(const mbstate_t *); size_t mbsrtowcs(wchar_t * __restrict, const char ** __restrict, size_t, mbstate_t * __restrict); -wint_t putwc(wchar_t, struct __sFILE *); +wint_t putwc(wchar_t, FILE *); wint_t putwchar(wchar_t); int swprintf(wchar_t * __restrict, size_t n, const wchar_t * __restrict, ...); int swscanf(const wchar_t * __restrict, const wchar_t * __restrict, ...); -wint_t ungetwc(wint_t, struct __sFILE *); -int vfwprintf(struct __sFILE * __restrict, const wchar_t * __restrict, +wint_t ungetwc(wint_t, FILE *); +int vfwprintf(FILE * __restrict, const wchar_t * __restrict, __va_list); int vswprintf(wchar_t * __restrict, size_t n, const wchar_t * __restrict, __va_list); @@ -167,9 +170,9 @@ int wprintf(const wchar_t * __restrict, int wscanf(const wchar_t * __restrict, ...); #ifndef _STDSTREAM_DECLARED -extern struct __sFILE *__stdinp; -extern struct __sFILE *__stdoutp; -extern struct __sFILE *__stderrp; +extern FILE *__stdinp; +extern FILE *__stdoutp; +extern FILE *__stderrp; #define _STDSTREAM_DECLARED #endif @@ -179,7 +182,7 @@ extern struct __sFILE *__stderrp; #define putwchar(wc) fputwc(wc, __stdoutp) #if __ISO_C_VISIBLE >= 1999 -int vfwscanf(struct __sFILE * __restrict, const wchar_t * __restrict, +int vfwscanf(FILE * __restrict, const wchar_t * __restrict, __va_list); int vswscanf(const wchar_t * __restrict, const wchar_t * __restrict, __va_list); @@ -217,7 +220,7 @@ size_t wcsnrtombs(char * __restrict, con #endif #if __BSD_VISIBLE -wchar_t *fgetwln(struct __sFILE * __restrict, size_t * __restrict); +wchar_t *fgetwln(FILE * __restrict, size_t * __restrict); size_t wcslcat(wchar_t *, const wchar_t *, size_t); size_t wcslcpy(wchar_t *, const wchar_t *, size_t); #endif Modified: user/attilio/vmcontention/include/wctype.h ============================================================================== --- user/attilio/vmcontention/include/wctype.h Tue Nov 15 20:48:57 2011 (r227541) +++ user/attilio/vmcontention/include/wctype.h Tue Nov 15 23:32:30 2011 (r227542) @@ -89,6 +89,7 @@ wint_t nextwctype(wint_t, wctype_t); #endif __END_DECLS +#ifndef __cplusplus #define iswalnum(wc) __istype((wc), _CTYPE_A|_CTYPE_D) #define iswalpha(wc) __istype((wc), _CTYPE_A) #define iswblank(wc) __istype((wc), _CTYPE_B) @@ -113,6 +114,7 @@ __END_DECLS #define iswphonogram(wc) __istype((wc), _CTYPE_Q) #define iswrune(wc) __istype((wc), 0xFFFFFF00L) #define iswspecial(wc) __istype((wc), _CTYPE_T) -#endif +#endif /* __BSD_VISIBLE */ +#endif /* __cplusplus */ #endif /* _WCTYPE_H_ */ Modified: user/attilio/vmcontention/lib/libc/gen/arc4random.c ============================================================================== --- user/attilio/vmcontention/lib/libc/gen/arc4random.c Tue Nov 15 20:48:57 2011 (r227541) +++ user/attilio/vmcontention/lib/libc/gen/arc4random.c Tue Nov 15 23:32:30 2011 (r227542) @@ -1,3 +1,5 @@ +/* $OpenBSD: arc4random.c,v 1.22 2010/12/22 08:23:42 otto Exp $ */ + /* * Copyright (c) 1996, David Mazieres * Copyright (c) 2008, Damien Miller @@ -24,11 +26,6 @@ * which is a trade secret). The same algorithm is used as a stream * cipher called "arcfour" in Tatu Ylonen's ssh package. * - * Here the stream cipher has been modified always to include the time - * when initializing the state. That makes it impossible to - * regenerate the same random sequence twice, so this can't be used - * for encryption, but will generate good random numbers. - * * RC4 is a registered trademark of RSA Laboratories. */ @@ -36,16 +33,24 @@ __FBSDID("$FreeBSD$"); #include "namespace.h" -#include -#include -#include #include +#include +#include #include +#include +#include +#include #include #include "libc_private.h" #include "un-namespace.h" +#ifdef __GNUC__ +#define inline __inline +#else /* !__GNUC__ */ +#define inline +#endif /* !__GNUC__ */ + struct arc4_stream { u_int8_t i; u_int8_t j; @@ -55,22 +60,22 @@ struct arc4_stream { static pthread_mutex_t arc4random_mtx = PTHREAD_MUTEX_INITIALIZER; #define RANDOMDEV "/dev/random" -#define KEYSIZE 128 -#define THREAD_LOCK() \ +#define KEYSIZE 128 +#define _ARC4_LOCK() \ do { \ if (__isthreaded) \ _pthread_mutex_lock(&arc4random_mtx); \ } while (0) -#define THREAD_UNLOCK() \ +#define _ARC4_UNLOCK() \ do { \ if (__isthreaded) \ _pthread_mutex_unlock(&arc4random_mtx); \ } while (0) -static struct arc4_stream rs; static int rs_initialized; -static int rs_stired; +static struct arc4_stream rs; +static pid_t arc4_stir_pid; static int arc4_count; static inline u_int8_t arc4_getbyte(void); @@ -107,20 +112,24 @@ arc4_addrandom(u_char *dat, int datlen) static void arc4_stir(void) { - int done, fd, n; + int done, fd, i; struct { struct timeval tv; - pid_t pid; - u_int8_t rnd[KEYSIZE]; + pid_t pid; + u_char rnd[KEYSIZE]; } rdat; + if (!rs_initialized) { + arc4_init(); + rs_initialized = 1; + } fd = _open(RANDOMDEV, O_RDONLY, 0); done = 0; if (fd >= 0) { if (_read(fd, &rdat, KEYSIZE) == KEYSIZE) done = 1; (void)_close(fd); - } + } if (!done) { (void)gettimeofday(&rdat.tv, NULL); rdat.pid = getpid(); @@ -130,17 +139,26 @@ arc4_stir(void) arc4_addrandom((u_char *)&rdat, KEYSIZE); /* - * Throw away the first N bytes of output, as suggested in the - * paper "Weaknesses in the Key Scheduling Algorithm of RC4" - * by Fluher, Mantin, and Shamir. N=1024 is based on - * suggestions in the paper "(Not So) Random Shuffles of RC4" - * by Ilya Mironov. + * Discard early keystream, as per recommendations in: + * "(Not So) Random Shuffles of RC4" by Ilya Mironov. */ - for (n = 0; n < 1024; n++) - (void) arc4_getbyte(); + for (i = 0; i < 1024; i++) + (void)arc4_getbyte(); arc4_count = 1600000; } +static void +arc4_stir_if_needed(void) +{ + pid_t pid = getpid(); + + if (arc4_count <= 0 || !rs_initialized || arc4_stir_pid != pid) + { + arc4_stir_pid = pid; + arc4_stir(); + } +} + static inline u_int8_t arc4_getbyte(void) { @@ -152,7 +170,6 @@ arc4_getbyte(void) sj = rs.s[rs.j]; rs.s[rs.i] = sj; rs.s[rs.j] = si; - return (rs.s[(si + sj) & 0xff]); } @@ -160,81 +177,55 @@ static inline u_int32_t arc4_getword(void) { u_int32_t val; - val = arc4_getbyte() << 24; val |= arc4_getbyte() << 16; val |= arc4_getbyte() << 8; val |= arc4_getbyte(); - - return (val); -} - -static void -arc4_check_init(void) -{ - if (!rs_initialized) { - arc4_init(); - rs_initialized = 1; - } -} - -static inline void -arc4_check_stir(void) -{ - if (!rs_stired || arc4_count <= 0) { - arc4_stir(); - rs_stired = 1; - } + return val; } void arc4random_stir(void) { - THREAD_LOCK(); - arc4_check_init(); + _ARC4_LOCK(); arc4_stir(); - rs_stired = 1; - THREAD_UNLOCK(); + _ARC4_UNLOCK(); } void arc4random_addrandom(u_char *dat, int datlen) { - THREAD_LOCK(); - arc4_check_init(); - arc4_check_stir(); + _ARC4_LOCK(); + if (!rs_initialized) + arc4_stir(); arc4_addrandom(dat, datlen); - THREAD_UNLOCK(); + _ARC4_UNLOCK(); } u_int32_t arc4random(void) { - u_int32_t rnd; - - THREAD_LOCK(); - arc4_check_init(); - arc4_check_stir(); - rnd = arc4_getword(); + u_int32_t val; + _ARC4_LOCK(); arc4_count -= 4; - THREAD_UNLOCK(); - - return (rnd); + arc4_stir_if_needed(); + val = arc4_getword(); + _ARC4_UNLOCK(); + return val; } void arc4random_buf(void *_buf, size_t n) { u_char *buf = (u_char *)_buf; - - THREAD_LOCK(); - arc4_check_init(); + _ARC4_LOCK(); + arc4_stir_if_needed(); while (n--) { - arc4_check_stir(); + if (--arc4_count <= 0) + arc4_stir(); buf[n] = arc4_getbyte(); - arc4_count--; } - THREAD_UNLOCK(); + _ARC4_UNLOCK(); } /* @@ -253,7 +244,7 @@ arc4random_uniform(u_int32_t upper_bound u_int32_t r, min; if (upper_bound < 2) - return (0); + return 0; #if (ULONG_MAX > 0xffffffffUL) min = 0x100000000UL % upper_bound; @@ -279,7 +270,7 @@ arc4random_uniform(u_int32_t upper_bound break; } - return (r % upper_bound); + return r % upper_bound; } #if 0 Modified: user/attilio/vmcontention/lib/msun/src/math.h ============================================================================== --- user/attilio/vmcontention/lib/msun/src/math.h Tue Nov 15 20:48:57 2011 (r227541) +++ user/attilio/vmcontention/lib/msun/src/math.h Tue Nov 15 23:32:30 2011 (r227542) @@ -395,32 +395,32 @@ float significandf(float); * long double versions of ISO/POSIX math functions */ #if __ISO_C_VISIBLE >= 1999 -#if 0 +#if _DECLARE_C99_LDBL_MATH long double acoshl(long double); #endif long double acosl(long double); -#if 0 +#if _DECLARE_C99_LDBL_MATH long double asinhl(long double); #endif long double asinl(long double); long double atan2l(long double, long double); -#if 0 +#if _DECLARE_C99_LDBL_MATH long double atanhl(long double); #endif long double atanl(long double); long double cbrtl(long double); long double ceill(long double); long double copysignl(long double, long double) __pure2; -#if 0 +#if _DECLARE_C99_LDBL_MATH long double coshl(long double); #endif long double cosl(long double); -#if 0 +#if _DECLARE_C99_LDBL_MATH long double erfcl(long double); long double erfl(long double); #endif long double exp2l(long double); -#if 0 +#if _DECLARE_C99_LDBL_MATH long double expl(long double); long double expm1l(long double); #endif @@ -435,18 +435,18 @@ long double frexpl(long double value, in long double hypotl(long double, long double); int ilogbl(long double) __pure2; long double ldexpl(long double, int); -#if 0 +#if _DECLARE_C99_LDBL_MATH long double lgammal(long double); #endif long long llrintl(long double); long long llroundl(long double); -#if 0 +#if _DECLARE_C99_LDBL_MATH long double log10l(long double); long double log1pl(long double); long double log2l(long double); #endif long double logbl(long double); -#if 0 +#if _DECLARE_C99_LDBL_MATH long double logl(long double); #endif long lrintl(long double); @@ -458,7 +458,7 @@ long double nextafterl(long double, long double nexttoward(double, long double); float nexttowardf(float, long double); long double nexttowardl(long double, long double); -#if 0 +#if _DECLARE_C99_LDBL_MATH long double powl(long double, long double); #endif long double remainderl(long double, long double); @@ -467,16 +467,16 @@ long double rintl(long double); long double roundl(long double); long double scalblnl(long double, long); long double scalbnl(long double, int); -#if 0 +#if _DECLARE_C99_LDBL_MATH long double sinhl(long double); #endif long double sinl(long double); long double sqrtl(long double); -#if 0 +#if _DECLARE_C99_LDBL_MATH long double tanhl(long double); #endif long double tanl(long double); -#if 0 +#if _DECLARE_C99_LDBL_MATH long double tgammal(long double); #endif long double truncl(long double); Modified: user/attilio/vmcontention/release/generate-release.sh ============================================================================== --- user/attilio/vmcontention/release/generate-release.sh Tue Nov 15 20:48:57 2011 (r227541) +++ user/attilio/vmcontention/release/generate-release.sh Tue Nov 15 23:32:30 2011 (r227542) @@ -14,6 +14,7 @@ # SVNROOT: SVN URL to FreeBSD source repository (by default, # svn://svn.freebsd.org/base) # MAKE_FLAGS: optional flags to pass to make (e.g. -j) +# RELSTRING: optional base name for media images (e.g. FreeBSD-9.0-RC2-amd64) # # Note: Since this requires a chroot, release cross-builds will not work! # @@ -65,3 +66,12 @@ chroot $2 make -C /usr/src $MAKE_FLAGS b chroot $2 make -C /usr/src/release release chroot $2 make -C /usr/src/release install DESTDIR=/R +: ${RELSTRING=`chroot $2 uname -s`-`chroot $2 uname -r`-`chroot $2 uname -p`} + +cd $2/R +for i in release.iso bootonly.iso memstick; do + mv $i $RELSTRING-$i +done +sha256 $RELSTRING-* > CHECKSUM.SHA256 +md5 $RELSTRING-* > CHECKSUM.MD5 + Modified: user/attilio/vmcontention/rescue/rescue/Makefile ============================================================================== --- user/attilio/vmcontention/rescue/rescue/Makefile Tue Nov 15 20:48:57 2011 (r227541) +++ user/attilio/vmcontention/rescue/rescue/Makefile Tue Nov 15 23:32:30 2011 (r227542) @@ -181,7 +181,7 @@ CRUNCH_BUILDOPTS_dhclient= -DRELEASE_CRU # CRUNCH_SRCDIRS+= usr.bin -CRUNCH_PROGS_usr.bin= head mt sed tail tee +CRUNCH_PROGS_usr.bin= head mt nc sed tail tee CRUNCH_PROGS_usr.bin+= gzip CRUNCH_ALIAS_gzip= gunzip gzcat zcat Modified: user/attilio/vmcontention/sbin/geom/class/multipath/geom_multipath.c ============================================================================== --- user/attilio/vmcontention/sbin/geom/class/multipath/geom_multipath.c Tue Nov 15 20:48:57 2011 (r227541) +++ user/attilio/vmcontention/sbin/geom/class/multipath/geom_multipath.c Tue Nov 15 23:32:30 2011 (r227542) @@ -133,7 +133,8 @@ mp_label(struct gctl_req *req) uint8_t *sector, *rsector; char *ptr; uuid_t uuid; - uint32_t secsize = 0, ssize, status; + ssize_t secsize = 0, ssize; + uint32_t status; const char *name, *name2, *mpname; int error, i, nargs, fd; @@ -161,8 +162,8 @@ mp_label(struct gctl_req *req) disksize = msize; } else { if (secsize != ssize) { - gctl_error(req, "%s sector size %u different.", - name, ssize); + gctl_error(req, "%s sector size %ju different.", + name, (intmax_t)ssize); return; } if (disksize != msize) { @@ -240,7 +241,7 @@ mp_label(struct gctl_req *req) continue; } if (pread(fd, rsector, secsize, disksize - secsize) != - secsize) { + (ssize_t)secsize) { fprintf(stderr, "Unable to read metadata from %s: %s.\n", name2, strerror(errno)); g_close(fd); Modified: user/attilio/vmcontention/sbin/gvinum/gvinum.c ============================================================================== --- user/attilio/vmcontention/sbin/gvinum/gvinum.c Tue Nov 15 20:48:57 2011 (r227541) +++ user/attilio/vmcontention/sbin/gvinum/gvinum.c Tue Nov 15 23:32:30 2011 (r227542) @@ -557,7 +557,7 @@ find_pattern(char *line, char *pattern) return (NULL); } -/* Find a free name for an object given a a prefix. */ +/* Find a free name for an object given a prefix. */ char * find_name(const char *prefix, int type, int namelen) { Modified: user/attilio/vmcontention/sbin/ifconfig/ifconfig.8 ============================================================================== --- user/attilio/vmcontention/sbin/ifconfig/ifconfig.8 Tue Nov 15 20:48:57 2011 (r227541) +++ user/attilio/vmcontention/sbin/ifconfig/ifconfig.8 Tue Nov 15 23:32:30 2011 (r227542) @@ -28,7 +28,7 @@ .\" From: @(#)ifconfig.8 8.3 (Berkeley) 1/5/94 .\" $FreeBSD$ .\" -.Dd September 13, 2011 +.Dd November 12, 2011 .Dt IFCONFIG 8 .Os .Sh NAME @@ -1088,6 +1088,38 @@ The specifies the number of beacon intervals between DTIM and must be in the range 1 to 15. By default DTIM is 1 (i.e., DTIM occurs at each beacon). +.It Cm quiet +Enable the use of quiet IE. Hostap will use this to silent other +stations to reduce interference for radar detection when +operating on 5Ghz frequency and doth support is enabled. +Use +.Fl quiet +to disable this functionality. +.It Cm quiet_period Ar period +Set the QUIET +.Ar period +to the number of beacon intervals between the start of regularly +scheduled quiet intervals defined by Quiet element. +.It Cm quiet_count Ar count +Set the QUIET +.Ar count +to the number of TBTTs until the beacon interval during which the +next quiet interval shall start. A value of 1 indicates the quiet +interval will start during the beacon interval starting at the next +TBTT. A value 0 is reserved. +.It Cm quiet_offset Ar offset +Set the QUIET +.Ar offset +to the offset of the start of the quiet interval from the TBTT +specified by the Quiet count, expressed in TUs. +The value of the +.Ar offset +shall be less than one beacon interval. +.It Cm quiet_duration Ar dur +Set the QUIET +.Ar dur +to the duration of the Quiet interval, expressed in TUs. +The value should be less than beacon interval. .It Cm dturbo Enable the use of Atheros Dynamic Turbo mode when communicating with another Dynamic Turbo-capable station. Modified: user/attilio/vmcontention/sbin/ipfw/main.c ============================================================================== --- user/attilio/vmcontention/sbin/ipfw/main.c Tue Nov 15 20:48:57 2011 (r227541) +++ user/attilio/vmcontention/sbin/ipfw/main.c Tue Nov 15 23:32:30 2011 (r227542) @@ -87,7 +87,7 @@ help(void) * which includes the program name and a NULL entry at the end. * If we are called with a single string, we split it on whitespace. * Also, arguments with a trailing ',' are joined to the next one. - * The pointers (av[]) and data are in a a single chunk of memory. + * The pointers (av[]) and data are in a single chunk of memory. * av[0] points to the original program name, all other entries * point into the allocated chunk. */ Modified: user/attilio/vmcontention/sbin/md5/md5.1 ============================================================================== --- user/attilio/vmcontention/sbin/md5/md5.1 Tue Nov 15 20:48:57 2011 (r227541) +++ user/attilio/vmcontention/sbin/md5/md5.1 Tue Nov 15 23:32:30 2011 (r227542) @@ -8,18 +8,22 @@ .Sh SYNOPSIS .Nm md5 .Op Fl pqrtx +.Op Fl c Ar string .Op Fl s Ar string .Op Ar .Nm sha1 .Op Fl pqrtx +.Op Fl c Ar string .Op Fl s Ar string .Op Ar .Nm sha256 .Op Fl pqrtx +.Op Fl c Ar string .Op Fl s Ar string .Op Ar .Nm rmd160 .Op Fl pqrtx +.Op Fl c Ar string .Op Fl s Ar string .Op Ar .Sh DESCRIPTION @@ -73,6 +77,9 @@ precede any files named on the command l The hexadecimal checksum of each file listed on the command line is printed after the options are processed. .Bl -tag -width indent +.It Fl c Ar string +Compare files to this md5 string. +(Note that this option is not yet useful if multiple files are specified.) .It Fl s Ar string Print a checksum of the given .Ar string . @@ -101,7 +108,8 @@ The and .Nm rmd160 utilities exit 0 on success, -and 1 if at least one of the input files could not be read. +1 if at least one of the input files could not be read, +and 2 if at least one file does not have the same hash as the -c option. .Sh SEE ALSO .Xr cksum 1 , .Xr md5 3 , Modified: user/attilio/vmcontention/sbin/md5/md5.c ============================================================================== --- user/attilio/vmcontention/sbin/md5/md5.c Tue Nov 15 20:48:57 2011 (r227541) +++ user/attilio/vmcontention/sbin/md5/md5.c Tue Nov 15 23:32:30 2011 (r227542) @@ -44,6 +44,8 @@ __FBSDID("$FreeBSD$"); int qflag; int rflag; int sflag; +unsigned char* checkAgainst; +int checksFailed; typedef void (DIGEST_Init)(void *); typedef void (DIGEST_Update)(void *, const unsigned char *, size_t); @@ -138,8 +140,13 @@ main(int argc, char *argv[]) digest = 0; failed = 0; - while ((ch = getopt(argc, argv, "pqrs:tx")) != -1) + checkAgainst = NULL; + checksFailed = 0; + while ((ch = getopt(argc, argv, "c:pqrs:tx")) != -1) switch (ch) { + case 'c': + checkAgainst = optarg; + break; case 'p': MDFilter(&Algorithm[digest], 1); break; @@ -173,12 +180,19 @@ main(int argc, char *argv[]) failed++; } else { if (qflag) - printf("%s\n", p); + printf("%s", p); else if (rflag) - printf("%s %s\n", p, *argv); + printf("%s %s", p, *argv); else - printf("%s (%s) = %s\n", + printf("%s (%s) = %s", Algorithm[digest].name, *argv, p); + if (checkAgainst && strcmp(checkAgainst,p)) + { + checksFailed++; + if (!qflag) + printf(" [ Failed ]"); + } + printf("\n"); } } while (*++argv); } else if (!sflag && (optind == 1 || qflag || rflag)) @@ -186,6 +200,8 @@ main(int argc, char *argv[]) if (failed != 0) return (1); + if (checksFailed != 0) + return (2); return (0); } @@ -198,12 +214,20 @@ MDString(Algorithm_t *alg, const char *s size_t len = strlen(string); char buf[HEX_DIGEST_LENGTH]; + alg->Data(string,len,buf); if (qflag) - printf("%s\n", alg->Data(string, len, buf)); + printf("%s", buf); else if (rflag) - printf("%s \"%s\"\n", alg->Data(string, len, buf), string); + printf("%s \"%s\"", buf, string); else - printf("%s (\"%s\") = %s\n", alg->name, string, alg->Data(string, len, buf)); + printf("%s (\"%s\") = %s", alg->name, string, buf); + if (checkAgainst && strcmp(buf,checkAgainst)) + { + checksFailed++; + if (!qflag) + printf(" [ failed ]"); + } + printf("\n"); } /* * Measures the time to digest TEST_BLOCK_COUNT TEST_BLOCK_LEN-byte blocks. Modified: user/attilio/vmcontention/sbin/mount_nfs/mount_nfs.8 ============================================================================== --- user/attilio/vmcontention/sbin/mount_nfs/mount_nfs.8 Tue Nov 15 20:48:57 2011 (r227541) +++ user/attilio/vmcontention/sbin/mount_nfs/mount_nfs.8 Tue Nov 15 23:32:30 2011 (r227542) @@ -318,6 +318,10 @@ tune the timeout interval.) .It Cm udp Use UDP transport. +.It Cm wcommitsize Ns = Ns Aq Ar value +Set the maximum pending write commit size to the specified value. +This determines the maximum amount of pending write data that the NFS +client is willing to cache for each file. .It Cm wsize Ns = Ns Aq Ar value Set the write data size to the specified value. Ditto the comments w.r.t.\& the Modified: user/attilio/vmcontention/sbin/mount_nfs/mount_nfs.c ============================================================================== --- user/attilio/vmcontention/sbin/mount_nfs/mount_nfs.c Tue Nov 15 20:48:57 2011 (r227541) +++ user/attilio/vmcontention/sbin/mount_nfs/mount_nfs.c Tue Nov 15 23:32:30 2011 (r227542) @@ -612,6 +612,13 @@ fallback_mount(struct iovec *iov, int io } args.flags |= NFSMNT_ACDIRMAX; } + if (findopt(iov, iovlen, "wcommitsize", &opt, NULL) == 0) { + ret = sscanf(opt, "%d", &args.wcommitsize); + if (ret != 1 || args.wcommitsize < 0) { + errx(1, "illegal wcommitsize: %s", opt); + } + args.flags |= NFSMNT_WCOMMITSIZE; + } if (findopt(iov, iovlen, "deadthresh", &opt, NULL) == 0) { ret = sscanf(opt, "%d", &args.deadthresh); if (ret != 1 || args.deadthresh <= 0) { Modified: user/attilio/vmcontention/share/man/man4/ip.4 ============================================================================== --- user/attilio/vmcontention/share/man/man4/ip.4 Tue Nov 15 20:48:57 2011 (r227541) +++ user/attilio/vmcontention/share/man/man4/ip.4 Tue Nov 15 23:32:30 2011 (r227542) @@ -32,7 +32,7 @@ .\" @(#)ip.4 8.2 (Berkeley) 11/30/93 .\" $FreeBSD$ .\" -.Dd June 1, 2009 +.Dd November 14, 2011 .Dt IP 4 .Os .Sh NAME @@ -847,3 +847,10 @@ The .Vt ip_mreqn structure appeared in .Tn Linux 2.4 . +.Sh BUGS +Before +.Fx 10.0 +packets received on raw IP sockets had the +.Va ip_hl +subtracted from the +.Va ip_len field. Modified: user/attilio/vmcontention/share/man/man4/mvs.4 ============================================================================== --- user/attilio/vmcontention/share/man/man4/mvs.4 Tue Nov 15 20:48:57 2011 (r227541) +++ user/attilio/vmcontention/share/man/man4/mvs.4 Tue Nov 15 23:32:30 2011 (r227542) @@ -120,9 +120,8 @@ The .Nm driver supports the following controllers: .Pp -.Bl -tag -compact -.It Gen-I (SATA 1.5Gbps): -.Bl -bullet -compact +Gen-I (SATA 1.5Gbps): +.Bl -bullet -compact -offset "xxxxxx" .It 88SX5040 .It @@ -132,8 +131,9 @@ driver supports the following controller .It 88SX5081 .El -.It Gen-II (SATA 3Gbps, NCQ, PMP): -.Bl -bullet -compact +.Pp +Gen-II (SATA 3Gbps, NCQ, PMP): +.Bl -bullet -compact -offset "xxxxxx" .It 88SX6040 .It @@ -143,8 +143,9 @@ driver supports the following controller .It *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Tue Nov 15 23:37:16 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1E722106566B; Tue, 15 Nov 2011 23:37:16 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0EFE98FC14; Tue, 15 Nov 2011 23:37:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pAFNbFgh021746; Tue, 15 Nov 2011 23:37:15 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pAFNbF0L021744; Tue, 15 Nov 2011 23:37:15 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201111152337.pAFNbF0L021744@svn.freebsd.org> From: Attilio Rao Date: Tue, 15 Nov 2011 23:37:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227544 - user/attilio/vmcontention/sys/vm X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Nov 2011 23:37:16 -0000 Author: attilio Date: Tue Nov 15 23:37:15 2011 New Revision: 227544 URL: http://svn.freebsd.org/changeset/base/227544 Log: Fix compilation for userland: - Use CTASSERT() only in the kernel. - the root pointer is required by struct vm_object which is accessible (maybe incorrectly?) by userland. Modified: user/attilio/vmcontention/sys/vm/vm_radix.h Modified: user/attilio/vmcontention/sys/vm/vm_radix.h ============================================================================== --- user/attilio/vmcontention/sys/vm/vm_radix.h Tue Nov 15 23:35:43 2011 (r227543) +++ user/attilio/vmcontention/sys/vm/vm_radix.h Tue Nov 15 23:37:15 2011 (r227544) @@ -44,20 +44,11 @@ #define VM_RADIX_HEIGHT 0xf /* Bits of height in root */ #define VM_RADIX_STACK 8 /* Nodes to store on stack. */ -CTASSERT(VM_RADIX_HEIGHT >= VM_RADIX_LIMIT); - /* Calculates maximum value for a tree of height h. */ #define VM_RADIX_MAX(h) \ ((h) == VM_RADIX_LIMIT ? ((vm_pindex_t)-1) : \ (((vm_pindex_t)1 << ((h) * VM_RADIX_WIDTH)) - 1)) -#ifdef _KERNEL - -struct vm_radix_node { - void *rn_child[VM_RADIX_COUNT]; /* child nodes. */ - uint16_t rn_count; /* Valid children. */ -}; - /* * Radix tree root. The height and pointer are set together to permit * coherent lookups while the root is modified. @@ -66,6 +57,14 @@ struct vm_radix { uintptr_t rt_root; /* root + height */ }; +#ifdef _KERNEL +CTASSERT(VM_RADIX_HEIGHT >= VM_RADIX_LIMIT); + +struct vm_radix_node { + void *rn_child[VM_RADIX_COUNT]; /* child nodes. */ + uint16_t rn_count; /* Valid children. */ +}; + void vm_radix_init(void); /* From owner-svn-src-user@FreeBSD.ORG Thu Nov 17 17:16:43 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C69C110657B0; Thu, 17 Nov 2011 17:16:43 +0000 (UTC) (envelope-from mjacob@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9DB5A8FC19; Thu, 17 Nov 2011 17:16:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pAHHGhVh019917; Thu, 17 Nov 2011 17:16:43 GMT (envelope-from mjacob@svn.freebsd.org) Received: (from mjacob@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pAHHGhMG019916; Thu, 17 Nov 2011 17:16:43 GMT (envelope-from mjacob@svn.freebsd.org) Message-Id: <201111171716.pAHHGhMG019916@svn.freebsd.org> From: Matt Jacob Date: Thu, 17 Nov 2011 17:16:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227632 - user/mjacob X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Nov 2011 17:16:43 -0000 Author: mjacob Date: Thu Nov 17 17:16:43 2011 New Revision: 227632 URL: http://svn.freebsd.org/changeset/base/227632 Log: Make a playpen area for potential FreeBSD work. I had been using a perforce client, but it gets so hopelessly skewed from head that it gets unbuildable. Added: user/mjacob/ - copied from r227631, head/sys/ Directory Properties: user/mjacob/sys/ (props changed) From owner-svn-src-user@FreeBSD.ORG Thu Nov 17 18:08:56 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D5B0A106566C; Thu, 17 Nov 2011 18:08:56 +0000 (UTC) (envelope-from mjacob@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C405F8FC17; Thu, 17 Nov 2011 18:08:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pAHI8uUJ022235; Thu, 17 Nov 2011 18:08:56 GMT (envelope-from mjacob@svn.freebsd.org) Received: (from mjacob@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pAHI8uWT022230; Thu, 17 Nov 2011 18:08:56 GMT (envelope-from mjacob@svn.freebsd.org) Message-Id: <201111171808.pAHI8uWT022230@svn.freebsd.org> From: Matt Jacob Date: Thu, 17 Nov 2011 18:08:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227634 - in user/mjacob/sys: conf dev/mpt2sas dev/mpt2sas/mpilib X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Nov 2011 18:08:56 -0000 Author: mjacob Date: Thu Nov 17 18:08:56 2011 New Revision: 227634 URL: http://svn.freebsd.org/changeset/base/227634 Log: Import changes from my perforce client into a users svn project. Mostly an alternate mpt2 driver at this point. Added: user/mjacob/sys/dev/mpt2sas/ user/mjacob/sys/dev/mpt2sas/mpilib/ user/mjacob/sys/dev/mpt2sas/mpilib/mpi2.h user/mjacob/sys/dev/mpt2sas/mpilib/mpi2_cnfg.h user/mjacob/sys/dev/mpt2sas/mpilib/mpi2_hbd.h user/mjacob/sys/dev/mpt2sas/mpilib/mpi2_init.h user/mjacob/sys/dev/mpt2sas/mpilib/mpi2_ioc.h user/mjacob/sys/dev/mpt2sas/mpilib/mpi2_ra.h user/mjacob/sys/dev/mpt2sas/mpilib/mpi2_raid.h user/mjacob/sys/dev/mpt2sas/mpilib/mpi2_sas.h user/mjacob/sys/dev/mpt2sas/mpilib/mpi2_targ.h user/mjacob/sys/dev/mpt2sas/mpilib/mpi2_tool.h user/mjacob/sys/dev/mpt2sas/mpilib/mpi2_type.h user/mjacob/sys/dev/mpt2sas/mpt2_ioctl.c user/mjacob/sys/dev/mpt2sas/mpt2_ioctl.h user/mjacob/sys/dev/mpt2sas/mpt2cam.c user/mjacob/sys/dev/mpt2sas/mpt2cam.h user/mjacob/sys/dev/mpt2sas/mpt2pci.c user/mjacob/sys/dev/mpt2sas/mpt2reg.h user/mjacob/sys/dev/mpt2sas/mpt2sas.c user/mjacob/sys/dev/mpt2sas/mpt2sas.h Modified: user/mjacob/sys/conf/files user/mjacob/sys/conf/systags.sh Modified: user/mjacob/sys/conf/files ============================================================================== --- user/mjacob/sys/conf/files Thu Nov 17 17:57:35 2011 (r227633) +++ user/mjacob/sys/conf/files Thu Nov 17 18:08:56 2011 (r227634) @@ -1468,6 +1468,9 @@ dev/mpt/mpt_pci.c optional mpt pci dev/mpt/mpt_raid.c optional mpt dev/mpt/mpt_user.c optional mpt dev/msk/if_msk.c optional msk +dev/mpt2sas/mpt2sas.c optional mpt2sas +dev/mpt2sas/mpt2cam.c optional mpt2sas +dev/mpt2sas/mpt2pci.c optional mpt2sas pci dev/mvs/mvs.c optional mvs dev/mvs/mvs_if.m optional mvs dev/mvs/mvs_pci.c optional mvs pci Modified: user/mjacob/sys/conf/systags.sh ============================================================================== --- user/mjacob/sys/conf/systags.sh Thu Nov 17 17:57:35 2011 (r227633) +++ user/mjacob/sys/conf/systags.sh Thu Nov 17 18:08:56 2011 (r227634) @@ -57,10 +57,13 @@ sed -e "s, machine/, ../../include/,g" \ print i > "tags.hfiles"; }' -ctags -t -d -w `cat tags.cfiles tags.hfiles tags.sfiles` -egrep "^ENTRY\(.*\)|^ALTENTRY\(.*\)" `cat tags.sfiles` | \ +if [ `which -s exctags` -eq 0 ]; then + exctags `cat tags.cfiles tags.hfiles tags.sfiles` +else + ctags -t -d -w `cat tags.cfiles tags.hfiles tags.sfiles` + egrep "^ENTRY\(.*\)|^ALTENTRY\(.*\)" `cat tags.sfiles` | \ sed "s;\([^:]*\):\([^(]*\)(\([^, )]*\)\(.*\);\3 \1 /^\2(\3\4$/;" >> tags - +fi mv tags tags.tmp sort -u tags.tmp > tags rm tags.tmp tags.cfiles tags.sfiles tags.hfiles Added: user/mjacob/sys/dev/mpt2sas/mpilib/mpi2.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/mjacob/sys/dev/mpt2sas/mpilib/mpi2.h Thu Nov 17 18:08:56 2011 (r227634) @@ -0,0 +1,1133 @@ +/* + * Copyright (c) 2000-2010 LSI Corporation. + * + * + * Name: mpi2.h + * Title: MPI Message independent structures and definitions + * including System Interface Register Set and + * scatter/gather formats. + * Creation Date: June 21, 2006 + * + * mpi2.h Version: 02.00.18 + * + * Version History + * --------------- + * + * Date Version Description + * -------- -------- ------------------------------------------------------ + * 04-30-07 02.00.00 Corresponds to Fusion-MPT MPI Specification Rev A. + * 06-04-07 02.00.01 Bumped MPI2_HEADER_VERSION_UNIT. + * 06-26-07 02.00.02 Bumped MPI2_HEADER_VERSION_UNIT. + * 08-31-07 02.00.03 Bumped MPI2_HEADER_VERSION_UNIT. + * Moved ReplyPostHostIndex register to offset 0x6C of the + * MPI2_SYSTEM_INTERFACE_REGS and modified the define for + * MPI2_REPLY_POST_HOST_INDEX_OFFSET. + * Added union of request descriptors. + * Added union of reply descriptors. + * 10-31-07 02.00.04 Bumped MPI2_HEADER_VERSION_UNIT. + * Added define for MPI2_VERSION_02_00. + * Fixed the size of the FunctionDependent5 field in the + * MPI2_DEFAULT_REPLY structure. + * 12-18-07 02.00.05 Bumped MPI2_HEADER_VERSION_UNIT. + * Removed the MPI-defined Fault Codes and extended the + * product specific codes up to 0xEFFF. + * Added a sixth key value for the WriteSequence register + * and changed the flush value to 0x0. + * Added message function codes for Diagnostic Buffer Post + * and Diagnsotic Release. + * New IOCStatus define: MPI2_IOCSTATUS_DIAGNOSTIC_RELEASED + * Moved MPI2_VERSION_UNION from mpi2_ioc.h. + * 02-29-08 02.00.06 Bumped MPI2_HEADER_VERSION_UNIT. + * 03-03-08 02.00.07 Bumped MPI2_HEADER_VERSION_UNIT. + * 05-21-08 02.00.08 Bumped MPI2_HEADER_VERSION_UNIT. + * Added #defines for marking a reply descriptor as unused. + * 06-27-08 02.00.09 Bumped MPI2_HEADER_VERSION_UNIT. + * 10-02-08 02.00.10 Bumped MPI2_HEADER_VERSION_UNIT. + * Moved LUN field defines from mpi2_init.h. + * 01-19-09 02.00.11 Bumped MPI2_HEADER_VERSION_UNIT. + * 05-06-09 02.00.12 Bumped MPI2_HEADER_VERSION_UNIT. + * In all request and reply descriptors, replaced VF_ID + * field with MSIxIndex field. + * Removed DevHandle field from + * MPI2_SCSI_IO_SUCCESS_REPLY_DESCRIPTOR and made those + * bytes reserved. + * Added RAID Accelerator functionality. + * 07-30-09 02.00.13 Bumped MPI2_HEADER_VERSION_UNIT. + * 10-28-09 02.00.14 Bumped MPI2_HEADER_VERSION_UNIT. + * Added MSI-x index mask and shift for Reply Post Host + * Index register. + * Added function code for Host Based Discovery Action. + * 02-10-10 02.00.15 Bumped MPI2_HEADER_VERSION_UNIT. + * Added define for MPI2_FUNCTION_PWR_MGMT_CONTROL. + * Added defines for product-specific range of message + * function codes, 0xF0 to 0xFF. + * 05-12-10 02.00.16 Bumped MPI2_HEADER_VERSION_UNIT. + * Added alternative defines for the SGE Direction bit. + * 08-11-10 02.00.17 Bumped MPI2_HEADER_VERSION_UNIT. + * 11-10-10 02.00.18 Bumped MPI2_HEADER_VERSION_UNIT. + * Added MPI2_IEEE_SGE_FLAGS_SYSTEMPLBCPI_ADDR define. + * -------------------------------------------------------------------------- + */ + +#ifndef MPI2_H +#define MPI2_H + + +/***************************************************************************** +* +* MPI Version Definitions +* +*****************************************************************************/ + +#define MPI2_VERSION_MAJOR (0x02) +#define MPI2_VERSION_MINOR (0x00) +#define MPI2_VERSION_MAJOR_MASK (0xFF00) +#define MPI2_VERSION_MAJOR_SHIFT (8) +#define MPI2_VERSION_MINOR_MASK (0x00FF) +#define MPI2_VERSION_MINOR_SHIFT (0) +#define MPI2_VERSION ((MPI2_VERSION_MAJOR << MPI2_VERSION_MAJOR_SHIFT) | \ + MPI2_VERSION_MINOR) + +#define MPI2_VERSION_02_00 (0x0200) + +/* versioning for this MPI header set */ +#define MPI2_HEADER_VERSION_UNIT (0x12) +#define MPI2_HEADER_VERSION_DEV (0x00) +#define MPI2_HEADER_VERSION_UNIT_MASK (0xFF00) +#define MPI2_HEADER_VERSION_UNIT_SHIFT (8) +#define MPI2_HEADER_VERSION_DEV_MASK (0x00FF) +#define MPI2_HEADER_VERSION_DEV_SHIFT (0) +#define MPI2_HEADER_VERSION ((MPI2_HEADER_VERSION_UNIT << 8) | MPI2_HEADER_VERSION_DEV) + + +/***************************************************************************** +* +* IOC State Definitions +* +*****************************************************************************/ + +#define MPI2_IOC_STATE_RESET (0x00000000) +#define MPI2_IOC_STATE_READY (0x10000000) +#define MPI2_IOC_STATE_OPERATIONAL (0x20000000) +#define MPI2_IOC_STATE_FAULT (0x40000000) + +#define MPI2_IOC_STATE_MASK (0xF0000000) +#define MPI2_IOC_STATE_SHIFT (28) + +/* Fault state range for prodcut specific codes */ +#define MPI2_FAULT_PRODUCT_SPECIFIC_MIN (0x0000) +#define MPI2_FAULT_PRODUCT_SPECIFIC_MAX (0xEFFF) + + +/***************************************************************************** +* +* System Interface Register Definitions +* +*****************************************************************************/ + +typedef volatile struct _MPI2_SYSTEM_INTERFACE_REGS +{ + U32 Doorbell; /* 0x00 */ + U32 WriteSequence; /* 0x04 */ + U32 HostDiagnostic; /* 0x08 */ + U32 Reserved1; /* 0x0C */ + U32 DiagRWData; /* 0x10 */ + U32 DiagRWAddressLow; /* 0x14 */ + U32 DiagRWAddressHigh; /* 0x18 */ + U32 Reserved2[5]; /* 0x1C */ + U32 HostInterruptStatus; /* 0x30 */ + U32 HostInterruptMask; /* 0x34 */ + U32 DCRData; /* 0x38 */ + U32 DCRAddress; /* 0x3C */ + U32 Reserved3[2]; /* 0x40 */ + U32 ReplyFreeHostIndex; /* 0x48 */ + U32 Reserved4[8]; /* 0x4C */ + U32 ReplyPostHostIndex; /* 0x6C */ + U32 Reserved5; /* 0x70 */ + U32 HCBSize; /* 0x74 */ + U32 HCBAddressLow; /* 0x78 */ + U32 HCBAddressHigh; /* 0x7C */ + U32 Reserved6[16]; /* 0x80 */ + U32 RequestDescriptorPostLow; /* 0xC0 */ + U32 RequestDescriptorPostHigh; /* 0xC4 */ + U32 Reserved7[14]; /* 0xC8 */ +} MPI2_SYSTEM_INTERFACE_REGS, MPI2_POINTER PTR_MPI2_SYSTEM_INTERFACE_REGS, + Mpi2SystemInterfaceRegs_t, MPI2_POINTER pMpi2SystemInterfaceRegs_t; + +/* + * Defines for working with the Doorbell register. + */ +#define MPI2_DOORBELL_OFFSET (0x00000000) + +/* IOC --> System values */ +#define MPI2_DOORBELL_USED (0x08000000) +#define MPI2_DOORBELL_WHO_INIT_MASK (0x07000000) +#define MPI2_DOORBELL_WHO_INIT_SHIFT (24) +#define MPI2_DOORBELL_FAULT_CODE_MASK (0x0000FFFF) +#define MPI2_DOORBELL_DATA_MASK (0x0000FFFF) + +/* System --> IOC values */ +#define MPI2_DOORBELL_FUNCTION_MASK (0xFF000000) +#define MPI2_DOORBELL_FUNCTION_SHIFT (24) +#define MPI2_DOORBELL_ADD_DWORDS_MASK (0x00FF0000) +#define MPI2_DOORBELL_ADD_DWORDS_SHIFT (16) + + +/* + * Defines for the WriteSequence register + */ +#define MPI2_WRITE_SEQUENCE_OFFSET (0x00000004) +#define MPI2_WRSEQ_KEY_VALUE_MASK (0x0000000F) +#define MPI2_WRSEQ_FLUSH_KEY_VALUE (0x0) +#define MPI2_WRSEQ_1ST_KEY_VALUE (0xF) +#define MPI2_WRSEQ_2ND_KEY_VALUE (0x4) +#define MPI2_WRSEQ_3RD_KEY_VALUE (0xB) +#define MPI2_WRSEQ_4TH_KEY_VALUE (0x2) +#define MPI2_WRSEQ_5TH_KEY_VALUE (0x7) +#define MPI2_WRSEQ_6TH_KEY_VALUE (0xD) + +/* + * Defines for the HostDiagnostic register + */ +#define MPI2_HOST_DIAGNOSTIC_OFFSET (0x00000008) + +#define MPI2_DIAG_BOOT_DEVICE_SELECT_MASK (0x00001800) +#define MPI2_DIAG_BOOT_DEVICE_SELECT_DEFAULT (0x00000000) +#define MPI2_DIAG_BOOT_DEVICE_SELECT_HCDW (0x00000800) + +#define MPI2_DIAG_CLEAR_FLASH_BAD_SIG (0x00000400) +#define MPI2_DIAG_FORCE_HCB_ON_RESET (0x00000200) +#define MPI2_DIAG_HCB_MODE (0x00000100) +#define MPI2_DIAG_DIAG_WRITE_ENABLE (0x00000080) +#define MPI2_DIAG_FLASH_BAD_SIG (0x00000040) +#define MPI2_DIAG_RESET_HISTORY (0x00000020) +#define MPI2_DIAG_DIAG_RW_ENABLE (0x00000010) +#define MPI2_DIAG_RESET_ADAPTER (0x00000004) +#define MPI2_DIAG_HOLD_IOC_RESET (0x00000002) + +/* + * Offsets for DiagRWData and address + */ +#define MPI2_DIAG_RW_DATA_OFFSET (0x00000010) +#define MPI2_DIAG_RW_ADDRESS_LOW_OFFSET (0x00000014) +#define MPI2_DIAG_RW_ADDRESS_HIGH_OFFSET (0x00000018) + +/* + * Defines for the HostInterruptStatus register + */ +#define MPI2_HOST_INTERRUPT_STATUS_OFFSET (0x00000030) +#define MPI2_HIS_SYS2IOC_DB_STATUS (0x80000000) +#define MPI2_HIS_IOP_DOORBELL_STATUS MPI2_HIS_SYS2IOC_DB_STATUS +#define MPI2_HIS_RESET_IRQ_STATUS (0x40000000) +#define MPI2_HIS_REPLY_DESCRIPTOR_INTERRUPT (0x00000008) +#define MPI2_HIS_IOC2SYS_DB_STATUS (0x00000001) +#define MPI2_HIS_DOORBELL_INTERRUPT MPI2_HIS_IOC2SYS_DB_STATUS + +/* + * Defines for the HostInterruptMask register + */ +#define MPI2_HOST_INTERRUPT_MASK_OFFSET (0x00000034) +#define MPI2_HIM_RESET_IRQ_MASK (0x40000000) +#define MPI2_HIM_REPLY_INT_MASK (0x00000008) +#define MPI2_HIM_RIM MPI2_HIM_REPLY_INT_MASK +#define MPI2_HIM_IOC2SYS_DB_MASK (0x00000001) +#define MPI2_HIM_DIM MPI2_HIM_IOC2SYS_DB_MASK + +/* + * Offsets for DCRData and address + */ +#define MPI2_DCR_DATA_OFFSET (0x00000038) +#define MPI2_DCR_ADDRESS_OFFSET (0x0000003C) + +/* + * Offset for the Reply Free Queue + */ +#define MPI2_REPLY_FREE_HOST_INDEX_OFFSET (0x00000048) + +/* + * Defines for the Reply Descriptor Post Queue + */ +#define MPI2_REPLY_POST_HOST_INDEX_OFFSET (0x0000006C) +#define MPI2_REPLY_POST_HOST_INDEX_MASK (0x00FFFFFF) +#define MPI2_RPHI_MSIX_INDEX_MASK (0xFF000000) +#define MPI2_RPHI_MSIX_INDEX_SHIFT (24) + +/* + * Defines for the HCBSize and address + */ +#define MPI2_HCB_SIZE_OFFSET (0x00000074) +#define MPI2_HCB_SIZE_SIZE_MASK (0xFFFFF000) +#define MPI2_HCB_SIZE_HCB_ENABLE (0x00000001) + +#define MPI2_HCB_ADDRESS_LOW_OFFSET (0x00000078) +#define MPI2_HCB_ADDRESS_HIGH_OFFSET (0x0000007C) + +/* + * Offsets for the Request Queue + */ +#define MPI2_REQUEST_DESCRIPTOR_POST_LOW_OFFSET (0x000000C0) +#define MPI2_REQUEST_DESCRIPTOR_POST_HIGH_OFFSET (0x000000C4) + + +/***************************************************************************** +* +* Message Descriptors +* +*****************************************************************************/ + +/* Request Descriptors */ + +/* Default Request Descriptor */ +typedef struct _MPI2_DEFAULT_REQUEST_DESCRIPTOR +{ + U8 RequestFlags; /* 0x00 */ + U8 MSIxIndex; /* 0x01 */ + U16 SMID; /* 0x02 */ + U16 LMID; /* 0x04 */ + U16 DescriptorTypeDependent; /* 0x06 */ +} MPI2_DEFAULT_REQUEST_DESCRIPTOR, + MPI2_POINTER PTR_MPI2_DEFAULT_REQUEST_DESCRIPTOR, + Mpi2DefaultRequestDescriptor_t, MPI2_POINTER pMpi2DefaultRequestDescriptor_t; + +/* defines for the RequestFlags field */ +#define MPI2_REQ_DESCRIPT_FLAGS_TYPE_MASK (0x0E) +#define MPI2_REQ_DESCRIPT_FLAGS_SCSI_IO (0x00) +#define MPI2_REQ_DESCRIPT_FLAGS_SCSI_TARGET (0x02) +#define MPI2_REQ_DESCRIPT_FLAGS_HIGH_PRIORITY (0x06) +#define MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE (0x08) +#define MPI2_REQ_DESCRIPT_FLAGS_RAID_ACCELERATOR (0x0A) + +#define MPI2_REQ_DESCRIPT_FLAGS_IOC_FIFO_MARKER (0x01) + + +/* High Priority Request Descriptor */ +typedef struct _MPI2_HIGH_PRIORITY_REQUEST_DESCRIPTOR +{ + U8 RequestFlags; /* 0x00 */ + U8 MSIxIndex; /* 0x01 */ + U16 SMID; /* 0x02 */ + U16 LMID; /* 0x04 */ + U16 Reserved1; /* 0x06 */ +} MPI2_HIGH_PRIORITY_REQUEST_DESCRIPTOR, + MPI2_POINTER PTR_MPI2_HIGH_PRIORITY_REQUEST_DESCRIPTOR, + Mpi2HighPriorityRequestDescriptor_t, + MPI2_POINTER pMpi2HighPriorityRequestDescriptor_t; + + +/* SCSI IO Request Descriptor */ +typedef struct _MPI2_SCSI_IO_REQUEST_DESCRIPTOR +{ + U8 RequestFlags; /* 0x00 */ + U8 MSIxIndex; /* 0x01 */ + U16 SMID; /* 0x02 */ + U16 LMID; /* 0x04 */ + U16 DevHandle; /* 0x06 */ +} MPI2_SCSI_IO_REQUEST_DESCRIPTOR, + MPI2_POINTER PTR_MPI2_SCSI_IO_REQUEST_DESCRIPTOR, + Mpi2SCSIIORequestDescriptor_t, MPI2_POINTER pMpi2SCSIIORequestDescriptor_t; + + +/* SCSI Target Request Descriptor */ +typedef struct _MPI2_SCSI_TARGET_REQUEST_DESCRIPTOR +{ + U8 RequestFlags; /* 0x00 */ + U8 MSIxIndex; /* 0x01 */ + U16 SMID; /* 0x02 */ + U16 LMID; /* 0x04 */ + U16 IoIndex; /* 0x06 */ +} MPI2_SCSI_TARGET_REQUEST_DESCRIPTOR, + MPI2_POINTER PTR_MPI2_SCSI_TARGET_REQUEST_DESCRIPTOR, + Mpi2SCSITargetRequestDescriptor_t, + MPI2_POINTER pMpi2SCSITargetRequestDescriptor_t; + + +/* RAID Accelerator Request Descriptor */ +typedef struct _MPI2_RAID_ACCEL_REQUEST_DESCRIPTOR +{ + U8 RequestFlags; /* 0x00 */ + U8 MSIxIndex; /* 0x01 */ + U16 SMID; /* 0x02 */ + U16 LMID; /* 0x04 */ + U16 Reserved; /* 0x06 */ +} MPI2_RAID_ACCEL_REQUEST_DESCRIPTOR, + MPI2_POINTER PTR_MPI2_RAID_ACCEL_REQUEST_DESCRIPTOR, + Mpi2RAIDAcceleratorRequestDescriptor_t, + MPI2_POINTER pMpi2RAIDAcceleratorRequestDescriptor_t; + + +/* union of Request Descriptors */ +typedef union _MPI2_REQUEST_DESCRIPTOR_UNION +{ + MPI2_DEFAULT_REQUEST_DESCRIPTOR Default; + MPI2_HIGH_PRIORITY_REQUEST_DESCRIPTOR HighPriority; + MPI2_SCSI_IO_REQUEST_DESCRIPTOR SCSIIO; + MPI2_SCSI_TARGET_REQUEST_DESCRIPTOR SCSITarget; + MPI2_RAID_ACCEL_REQUEST_DESCRIPTOR RAIDAccelerator; + U64 Words; +} MPI2_REQUEST_DESCRIPTOR_UNION, MPI2_POINTER PTR_MPI2_REQUEST_DESCRIPTOR_UNION, + Mpi2RequestDescriptorUnion_t, MPI2_POINTER pMpi2RequestDescriptorUnion_t; + + +/* Reply Descriptors */ + +/* Default Reply Descriptor */ +typedef struct _MPI2_DEFAULT_REPLY_DESCRIPTOR +{ + U8 ReplyFlags; /* 0x00 */ + U8 MSIxIndex; /* 0x01 */ + U16 DescriptorTypeDependent1; /* 0x02 */ + U32 DescriptorTypeDependent2; /* 0x04 */ +} MPI2_DEFAULT_REPLY_DESCRIPTOR, MPI2_POINTER PTR_MPI2_DEFAULT_REPLY_DESCRIPTOR, + Mpi2DefaultReplyDescriptor_t, MPI2_POINTER pMpi2DefaultReplyDescriptor_t; + +/* defines for the ReplyFlags field */ +#define MPI2_RPY_DESCRIPT_FLAGS_TYPE_MASK (0x0F) +#define MPI2_RPY_DESCRIPT_FLAGS_SCSI_IO_SUCCESS (0x00) +#define MPI2_RPY_DESCRIPT_FLAGS_ADDRESS_REPLY (0x01) +#define MPI2_RPY_DESCRIPT_FLAGS_TARGETASSIST_SUCCESS (0x02) +#define MPI2_RPY_DESCRIPT_FLAGS_TARGET_COMMAND_BUFFER (0x03) +#define MPI2_RPY_DESCRIPT_FLAGS_RAID_ACCELERATOR_SUCCESS (0x05) +#define MPI2_RPY_DESCRIPT_FLAGS_UNUSED (0x0F) + +/* values for marking a reply descriptor as unused */ +#define MPI2_RPY_DESCRIPT_UNUSED_WORD0_MARK (0xFFFFFFFF) +#define MPI2_RPY_DESCRIPT_UNUSED_WORD1_MARK (0xFFFFFFFF) + +/* Address Reply Descriptor */ +typedef struct _MPI2_ADDRESS_REPLY_DESCRIPTOR +{ + U8 ReplyFlags; /* 0x00 */ + U8 MSIxIndex; /* 0x01 */ + U16 SMID; /* 0x02 */ + U32 ReplyFrameAddress; /* 0x04 */ +} MPI2_ADDRESS_REPLY_DESCRIPTOR, MPI2_POINTER PTR_MPI2_ADDRESS_REPLY_DESCRIPTOR, + Mpi2AddressReplyDescriptor_t, MPI2_POINTER pMpi2AddressReplyDescriptor_t; + +#define MPI2_ADDRESS_REPLY_SMID_INVALID (0x00) + + +/* SCSI IO Success Reply Descriptor */ +typedef struct _MPI2_SCSI_IO_SUCCESS_REPLY_DESCRIPTOR +{ + U8 ReplyFlags; /* 0x00 */ + U8 MSIxIndex; /* 0x01 */ + U16 SMID; /* 0x02 */ + U16 TaskTag; /* 0x04 */ + U16 Reserved1; /* 0x06 */ +} MPI2_SCSI_IO_SUCCESS_REPLY_DESCRIPTOR, + MPI2_POINTER PTR_MPI2_SCSI_IO_SUCCESS_REPLY_DESCRIPTOR, + Mpi2SCSIIOSuccessReplyDescriptor_t, + MPI2_POINTER pMpi2SCSIIOSuccessReplyDescriptor_t; + + +/* TargetAssist Success Reply Descriptor */ +typedef struct _MPI2_TARGETASSIST_SUCCESS_REPLY_DESCRIPTOR +{ + U8 ReplyFlags; /* 0x00 */ + U8 MSIxIndex; /* 0x01 */ + U16 SMID; /* 0x02 */ + U8 SequenceNumber; /* 0x04 */ + U8 Reserved1; /* 0x05 */ + U16 IoIndex; /* 0x06 */ +} MPI2_TARGETASSIST_SUCCESS_REPLY_DESCRIPTOR, + MPI2_POINTER PTR_MPI2_TARGETASSIST_SUCCESS_REPLY_DESCRIPTOR, + Mpi2TargetAssistSuccessReplyDescriptor_t, + MPI2_POINTER pMpi2TargetAssistSuccessReplyDescriptor_t; + + +/* Target Command Buffer Reply Descriptor */ +typedef struct _MPI2_TARGET_COMMAND_BUFFER_REPLY_DESCRIPTOR +{ + U8 ReplyFlags; /* 0x00 */ + U8 MSIxIndex; /* 0x01 */ + U8 VP_ID; /* 0x02 */ + U8 Flags; /* 0x03 */ + U16 InitiatorDevHandle; /* 0x04 */ + U16 IoIndex; /* 0x06 */ +} MPI2_TARGET_COMMAND_BUFFER_REPLY_DESCRIPTOR, + MPI2_POINTER PTR_MPI2_TARGET_COMMAND_BUFFER_REPLY_DESCRIPTOR, + Mpi2TargetCommandBufferReplyDescriptor_t, + MPI2_POINTER pMpi2TargetCommandBufferReplyDescriptor_t; + +/* defines for Flags field */ +#define MPI2_RPY_DESCRIPT_TCB_FLAGS_PHYNUM_MASK (0x3F) + + +/* RAID Accelerator Success Reply Descriptor */ +typedef struct _MPI2_RAID_ACCELERATOR_SUCCESS_REPLY_DESCRIPTOR +{ + U8 ReplyFlags; /* 0x00 */ + U8 MSIxIndex; /* 0x01 */ + U16 SMID; /* 0x02 */ + U32 Reserved; /* 0x04 */ +} MPI2_RAID_ACCELERATOR_SUCCESS_REPLY_DESCRIPTOR, + MPI2_POINTER PTR_MPI2_RAID_ACCELERATOR_SUCCESS_REPLY_DESCRIPTOR, + Mpi2RAIDAcceleratorSuccessReplyDescriptor_t, + MPI2_POINTER pMpi2RAIDAcceleratorSuccessReplyDescriptor_t; + + +/* union of Reply Descriptors */ +typedef union _MPI2_REPLY_DESCRIPTORS_UNION +{ + MPI2_DEFAULT_REPLY_DESCRIPTOR Default; + MPI2_ADDRESS_REPLY_DESCRIPTOR AddressReply; + MPI2_SCSI_IO_SUCCESS_REPLY_DESCRIPTOR SCSIIOSuccess; + MPI2_TARGETASSIST_SUCCESS_REPLY_DESCRIPTOR TargetAssistSuccess; + MPI2_TARGET_COMMAND_BUFFER_REPLY_DESCRIPTOR TargetCommandBuffer; + MPI2_RAID_ACCELERATOR_SUCCESS_REPLY_DESCRIPTOR RAIDAcceleratorSuccess; + U64 Words; +} MPI2_REPLY_DESCRIPTORS_UNION, MPI2_POINTER PTR_MPI2_REPLY_DESCRIPTORS_UNION, + Mpi2ReplyDescriptorsUnion_t, MPI2_POINTER pMpi2ReplyDescriptorsUnion_t; + + + +/***************************************************************************** +* +* Message Functions +* +*****************************************************************************/ + +#define MPI2_FUNCTION_SCSI_IO_REQUEST (0x00) /* SCSI IO */ +#define MPI2_FUNCTION_SCSI_TASK_MGMT (0x01) /* SCSI Task Management */ +#define MPI2_FUNCTION_IOC_INIT (0x02) /* IOC Init */ +#define MPI2_FUNCTION_IOC_FACTS (0x03) /* IOC Facts */ +#define MPI2_FUNCTION_CONFIG (0x04) /* Configuration */ +#define MPI2_FUNCTION_PORT_FACTS (0x05) /* Port Facts */ +#define MPI2_FUNCTION_PORT_ENABLE (0x06) /* Port Enable */ +#define MPI2_FUNCTION_EVENT_NOTIFICATION (0x07) /* Event Notification */ +#define MPI2_FUNCTION_EVENT_ACK (0x08) /* Event Acknowledge */ +#define MPI2_FUNCTION_FW_DOWNLOAD (0x09) /* FW Download */ +#define MPI2_FUNCTION_TARGET_ASSIST (0x0B) /* Target Assist */ +#define MPI2_FUNCTION_TARGET_STATUS_SEND (0x0C) /* Target Status Send */ +#define MPI2_FUNCTION_TARGET_MODE_ABORT (0x0D) /* Target Mode Abort */ +#define MPI2_FUNCTION_FW_UPLOAD (0x12) /* FW Upload */ +#define MPI2_FUNCTION_RAID_ACTION (0x15) /* RAID Action */ +#define MPI2_FUNCTION_RAID_SCSI_IO_PASSTHROUGH (0x16) /* SCSI IO RAID Passthrough */ +#define MPI2_FUNCTION_TOOLBOX (0x17) /* Toolbox */ +#define MPI2_FUNCTION_SCSI_ENCLOSURE_PROCESSOR (0x18) /* SCSI Enclosure Processor */ +#define MPI2_FUNCTION_SMP_PASSTHROUGH (0x1A) /* SMP Passthrough */ +#define MPI2_FUNCTION_SAS_IO_UNIT_CONTROL (0x1B) /* SAS IO Unit Control */ +#define MPI2_FUNCTION_SATA_PASSTHROUGH (0x1C) /* SATA Passthrough */ +#define MPI2_FUNCTION_DIAG_BUFFER_POST (0x1D) /* Diagnostic Buffer Post */ +#define MPI2_FUNCTION_DIAG_RELEASE (0x1E) /* Diagnostic Release */ +#define MPI2_FUNCTION_TARGET_CMD_BUF_BASE_POST (0x24) /* Target Command Buffer Post Base */ +#define MPI2_FUNCTION_TARGET_CMD_BUF_LIST_POST (0x25) /* Target Command Buffer Post List */ +#define MPI2_FUNCTION_RAID_ACCELERATOR (0x2C) /* RAID Accelerator */ +#define MPI2_FUNCTION_HOST_BASED_DISCOVERY_ACTION (0x2F) /* Host Based Discovery Action */ +#define MPI2_FUNCTION_PWR_MGMT_CONTROL (0x30) /* Power Management Control */ +#define MPI2_FUNCTION_MIN_PRODUCT_SPECIFIC (0xF0) /* beginning of product-specific range */ +#define MPI2_FUNCTION_MAX_PRODUCT_SPECIFIC (0xFF) /* end of product-specific range */ + + + +/* Doorbell functions */ +#define MPI2_FUNCTION_IOC_MESSAGE_UNIT_RESET (0x40) +#define MPI2_FUNCTION_HANDSHAKE (0x42) + + +/***************************************************************************** +* +* IOC Status Values +* +*****************************************************************************/ + +/* mask for IOCStatus status value */ +#define MPI2_IOCSTATUS_MASK (0x7FFF) + +/**************************************************************************** +* Common IOCStatus values for all replies +****************************************************************************/ + +#define MPI2_IOCSTATUS_SUCCESS (0x0000) +#define MPI2_IOCSTATUS_INVALID_FUNCTION (0x0001) +#define MPI2_IOCSTATUS_BUSY (0x0002) +#define MPI2_IOCSTATUS_INVALID_SGL (0x0003) +#define MPI2_IOCSTATUS_INTERNAL_ERROR (0x0004) +#define MPI2_IOCSTATUS_INVALID_VPID (0x0005) +#define MPI2_IOCSTATUS_INSUFFICIENT_RESOURCES (0x0006) +#define MPI2_IOCSTATUS_INVALID_FIELD (0x0007) +#define MPI2_IOCSTATUS_INVALID_STATE (0x0008) +#define MPI2_IOCSTATUS_OP_STATE_NOT_SUPPORTED (0x0009) + +/**************************************************************************** +* Config IOCStatus values +****************************************************************************/ + +#define MPI2_IOCSTATUS_CONFIG_INVALID_ACTION (0x0020) +#define MPI2_IOCSTATUS_CONFIG_INVALID_TYPE (0x0021) +#define MPI2_IOCSTATUS_CONFIG_INVALID_PAGE (0x0022) +#define MPI2_IOCSTATUS_CONFIG_INVALID_DATA (0x0023) +#define MPI2_IOCSTATUS_CONFIG_NO_DEFAULTS (0x0024) +#define MPI2_IOCSTATUS_CONFIG_CANT_COMMIT (0x0025) + +/**************************************************************************** +* SCSI IO Reply +****************************************************************************/ + +#define MPI2_IOCSTATUS_SCSI_RECOVERED_ERROR (0x0040) +#define MPI2_IOCSTATUS_SCSI_INVALID_DEVHANDLE (0x0042) +#define MPI2_IOCSTATUS_SCSI_DEVICE_NOT_THERE (0x0043) +#define MPI2_IOCSTATUS_SCSI_DATA_OVERRUN (0x0044) +#define MPI2_IOCSTATUS_SCSI_DATA_UNDERRUN (0x0045) +#define MPI2_IOCSTATUS_SCSI_IO_DATA_ERROR (0x0046) +#define MPI2_IOCSTATUS_SCSI_PROTOCOL_ERROR (0x0047) +#define MPI2_IOCSTATUS_SCSI_TASK_TERMINATED (0x0048) +#define MPI2_IOCSTATUS_SCSI_RESIDUAL_MISMATCH (0x0049) +#define MPI2_IOCSTATUS_SCSI_TASK_MGMT_FAILED (0x004A) +#define MPI2_IOCSTATUS_SCSI_IOC_TERMINATED (0x004B) +#define MPI2_IOCSTATUS_SCSI_EXT_TERMINATED (0x004C) + +/**************************************************************************** +* For use by SCSI Initiator and SCSI Target end-to-end data protection +****************************************************************************/ + +#define MPI2_IOCSTATUS_EEDP_GUARD_ERROR (0x004D) +#define MPI2_IOCSTATUS_EEDP_REF_TAG_ERROR (0x004E) +#define MPI2_IOCSTATUS_EEDP_APP_TAG_ERROR (0x004F) + +/**************************************************************************** +* SCSI Target values +****************************************************************************/ + +#define MPI2_IOCSTATUS_TARGET_INVALID_IO_INDEX (0x0062) +#define MPI2_IOCSTATUS_TARGET_ABORTED (0x0063) +#define MPI2_IOCSTATUS_TARGET_NO_CONN_RETRYABLE (0x0064) +#define MPI2_IOCSTATUS_TARGET_NO_CONNECTION (0x0065) +#define MPI2_IOCSTATUS_TARGET_XFER_COUNT_MISMATCH (0x006A) +#define MPI2_IOCSTATUS_TARGET_DATA_OFFSET_ERROR (0x006D) +#define MPI2_IOCSTATUS_TARGET_TOO_MUCH_WRITE_DATA (0x006E) +#define MPI2_IOCSTATUS_TARGET_IU_TOO_SHORT (0x006F) +#define MPI2_IOCSTATUS_TARGET_ACK_NAK_TIMEOUT (0x0070) +#define MPI2_IOCSTATUS_TARGET_NAK_RECEIVED (0x0071) + +/**************************************************************************** +* Serial Attached SCSI values +****************************************************************************/ + +#define MPI2_IOCSTATUS_SAS_SMP_REQUEST_FAILED (0x0090) +#define MPI2_IOCSTATUS_SAS_SMP_DATA_OVERRUN (0x0091) + +/**************************************************************************** +* Diagnostic Buffer Post / Diagnostic Release values +****************************************************************************/ + +#define MPI2_IOCSTATUS_DIAGNOSTIC_RELEASED (0x00A0) + +/**************************************************************************** +* RAID Accelerator values +****************************************************************************/ + +#define MPI2_IOCSTATUS_RAID_ACCEL_ERROR (0x00B0) + +/**************************************************************************** +* IOCStatus flag to indicate that log info is available +****************************************************************************/ + +#define MPI2_IOCSTATUS_FLAG_LOG_INFO_AVAILABLE (0x8000) + +/**************************************************************************** +* IOCLogInfo Types +****************************************************************************/ + +#define MPI2_IOCLOGINFO_TYPE_MASK (0xF0000000) +#define MPI2_IOCLOGINFO_TYPE_SHIFT (28) +#define MPI2_IOCLOGINFO_TYPE_NONE (0x0) +#define MPI2_IOCLOGINFO_TYPE_SCSI (0x1) +#define MPI2_IOCLOGINFO_TYPE_FC (0x2) +#define MPI2_IOCLOGINFO_TYPE_SAS (0x3) +#define MPI2_IOCLOGINFO_TYPE_ISCSI (0x4) +#define MPI2_IOCLOGINFO_LOG_DATA_MASK (0x0FFFFFFF) + + +/***************************************************************************** +* +* Standard Message Structures +* +*****************************************************************************/ + +/**************************************************************************** +* Request Message Header for all request messages +****************************************************************************/ + +typedef struct _MPI2_REQUEST_HEADER +{ + U16 FunctionDependent1; /* 0x00 */ + U8 ChainOffset; /* 0x02 */ + U8 Function; /* 0x03 */ + U16 FunctionDependent2; /* 0x04 */ + U8 FunctionDependent3; /* 0x06 */ + U8 MsgFlags; /* 0x07 */ + U8 VP_ID; /* 0x08 */ + U8 VF_ID; /* 0x09 */ + U16 Reserved1; /* 0x0A */ +} MPI2_REQUEST_HEADER, MPI2_POINTER PTR_MPI2_REQUEST_HEADER, + MPI2RequestHeader_t, MPI2_POINTER pMPI2RequestHeader_t; + + +/**************************************************************************** +* Default Reply +****************************************************************************/ + +typedef struct _MPI2_DEFAULT_REPLY +{ + U16 FunctionDependent1; /* 0x00 */ + U8 MsgLength; /* 0x02 */ + U8 Function; /* 0x03 */ + U16 FunctionDependent2; /* 0x04 */ + U8 FunctionDependent3; /* 0x06 */ + U8 MsgFlags; /* 0x07 */ + U8 VP_ID; /* 0x08 */ + U8 VF_ID; /* 0x09 */ + U16 Reserved1; /* 0x0A */ + U16 FunctionDependent5; /* 0x0C */ + U16 IOCStatus; /* 0x0E */ + U32 IOCLogInfo; /* 0x10 */ +} MPI2_DEFAULT_REPLY, MPI2_POINTER PTR_MPI2_DEFAULT_REPLY, + MPI2DefaultReply_t, MPI2_POINTER pMPI2DefaultReply_t; + + +/* common version structure/union used in messages and configuration pages */ + +typedef struct _MPI2_VERSION_STRUCT +{ + U8 Dev; /* 0x00 */ + U8 Unit; /* 0x01 */ + U8 Minor; /* 0x02 */ + U8 Major; /* 0x03 */ +} MPI2_VERSION_STRUCT; + +typedef union _MPI2_VERSION_UNION +{ + MPI2_VERSION_STRUCT Struct; + U32 Word; +} MPI2_VERSION_UNION; + + +/* LUN field defines, common to many structures */ +#define MPI2_LUN_FIRST_LEVEL_ADDRESSING (0x0000FFFF) +#define MPI2_LUN_SECOND_LEVEL_ADDRESSING (0xFFFF0000) +#define MPI2_LUN_THIRD_LEVEL_ADDRESSING (0x0000FFFF) +#define MPI2_LUN_FOURTH_LEVEL_ADDRESSING (0xFFFF0000) +#define MPI2_LUN_LEVEL_1_WORD (0xFF00) +#define MPI2_LUN_LEVEL_1_DWORD (0x0000FF00) + + +/***************************************************************************** +* +* Fusion-MPT MPI Scatter Gather Elements +* +*****************************************************************************/ + +/**************************************************************************** +* MPI Simple Element structures +****************************************************************************/ + +typedef struct _MPI2_SGE_SIMPLE32 +{ + U32 FlagsLength; + U32 Address; +} MPI2_SGE_SIMPLE32, MPI2_POINTER PTR_MPI2_SGE_SIMPLE32, + Mpi2SGESimple32_t, MPI2_POINTER pMpi2SGESimple32_t; + +typedef struct _MPI2_SGE_SIMPLE64 +{ + U32 FlagsLength; + U64 Address; +} MPI2_SGE_SIMPLE64, MPI2_POINTER PTR_MPI2_SGE_SIMPLE64, + Mpi2SGESimple64_t, MPI2_POINTER pMpi2SGESimple64_t; + +typedef struct _MPI2_SGE_SIMPLE_UNION +{ + U32 FlagsLength; + union + { + U32 Address32; + U64 Address64; + } u; +} MPI2_SGE_SIMPLE_UNION, MPI2_POINTER PTR_MPI2_SGE_SIMPLE_UNION, + Mpi2SGESimpleUnion_t, MPI2_POINTER pMpi2SGESimpleUnion_t; + + +/**************************************************************************** +* MPI Chain Element structures +****************************************************************************/ + +typedef struct _MPI2_SGE_CHAIN32 +{ + U16 Length; + U8 NextChainOffset; + U8 Flags; + U32 Address; +} MPI2_SGE_CHAIN32, MPI2_POINTER PTR_MPI2_SGE_CHAIN32, + Mpi2SGEChain32_t, MPI2_POINTER pMpi2SGEChain32_t; + +typedef struct _MPI2_SGE_CHAIN64 +{ + U16 Length; + U8 NextChainOffset; + U8 Flags; + U64 Address; +} MPI2_SGE_CHAIN64, MPI2_POINTER PTR_MPI2_SGE_CHAIN64, + Mpi2SGEChain64_t, MPI2_POINTER pMpi2SGEChain64_t; + +typedef struct _MPI2_SGE_CHAIN_UNION +{ + U16 Length; + U8 NextChainOffset; + U8 Flags; + union + { + U32 Address32; + U64 Address64; + } u; +} MPI2_SGE_CHAIN_UNION, MPI2_POINTER PTR_MPI2_SGE_CHAIN_UNION, + Mpi2SGEChainUnion_t, MPI2_POINTER pMpi2SGEChainUnion_t; + + +/**************************************************************************** +* MPI Transaction Context Element structures +****************************************************************************/ + +typedef struct _MPI2_SGE_TRANSACTION32 +{ + U8 Reserved; + U8 ContextSize; + U8 DetailsLength; + U8 Flags; + U32 TransactionContext[1]; + U32 TransactionDetails[1]; +} MPI2_SGE_TRANSACTION32, MPI2_POINTER PTR_MPI2_SGE_TRANSACTION32, + Mpi2SGETransaction32_t, MPI2_POINTER pMpi2SGETransaction32_t; + +typedef struct _MPI2_SGE_TRANSACTION64 +{ + U8 Reserved; + U8 ContextSize; + U8 DetailsLength; + U8 Flags; + U32 TransactionContext[2]; + U32 TransactionDetails[1]; +} MPI2_SGE_TRANSACTION64, MPI2_POINTER PTR_MPI2_SGE_TRANSACTION64, + Mpi2SGETransaction64_t, MPI2_POINTER pMpi2SGETransaction64_t; + +typedef struct _MPI2_SGE_TRANSACTION96 +{ + U8 Reserved; + U8 ContextSize; + U8 DetailsLength; + U8 Flags; + U32 TransactionContext[3]; + U32 TransactionDetails[1]; +} MPI2_SGE_TRANSACTION96, MPI2_POINTER PTR_MPI2_SGE_TRANSACTION96, + Mpi2SGETransaction96_t, MPI2_POINTER pMpi2SGETransaction96_t; + +typedef struct _MPI2_SGE_TRANSACTION128 +{ + U8 Reserved; + U8 ContextSize; + U8 DetailsLength; + U8 Flags; + U32 TransactionContext[4]; + U32 TransactionDetails[1]; +} MPI2_SGE_TRANSACTION128, MPI2_POINTER PTR_MPI2_SGE_TRANSACTION128, + Mpi2SGETransaction_t128, MPI2_POINTER pMpi2SGETransaction_t128; + +typedef struct _MPI2_SGE_TRANSACTION_UNION +{ + U8 Reserved; + U8 ContextSize; + U8 DetailsLength; + U8 Flags; + union + { + U32 TransactionContext32[1]; + U32 TransactionContext64[2]; + U32 TransactionContext96[3]; + U32 TransactionContext128[4]; + } u; + U32 TransactionDetails[1]; +} MPI2_SGE_TRANSACTION_UNION, MPI2_POINTER PTR_MPI2_SGE_TRANSACTION_UNION, + Mpi2SGETransactionUnion_t, MPI2_POINTER pMpi2SGETransactionUnion_t; + + +/**************************************************************************** +* MPI SGE union for IO SGL's +****************************************************************************/ + +typedef struct _MPI2_MPI_SGE_IO_UNION +{ + union + { + MPI2_SGE_SIMPLE_UNION Simple; + MPI2_SGE_CHAIN_UNION Chain; + } u; +} MPI2_MPI_SGE_IO_UNION, MPI2_POINTER PTR_MPI2_MPI_SGE_IO_UNION, + Mpi2MpiSGEIOUnion_t, MPI2_POINTER pMpi2MpiSGEIOUnion_t; + + +/**************************************************************************** +* MPI SGE union for SGL's with Simple and Transaction elements +****************************************************************************/ + +typedef struct _MPI2_SGE_TRANS_SIMPLE_UNION +{ + union + { + MPI2_SGE_SIMPLE_UNION Simple; + MPI2_SGE_TRANSACTION_UNION Transaction; + } u; +} MPI2_SGE_TRANS_SIMPLE_UNION, MPI2_POINTER PTR_MPI2_SGE_TRANS_SIMPLE_UNION, + Mpi2SGETransSimpleUnion_t, MPI2_POINTER pMpi2SGETransSimpleUnion_t; + + +/**************************************************************************** +* All MPI SGE types union +****************************************************************************/ + +typedef struct _MPI2_MPI_SGE_UNION +{ + union + { + MPI2_SGE_SIMPLE_UNION Simple; + MPI2_SGE_CHAIN_UNION Chain; + MPI2_SGE_TRANSACTION_UNION Transaction; + } u; +} MPI2_MPI_SGE_UNION, MPI2_POINTER PTR_MPI2_MPI_SGE_UNION, + Mpi2MpiSgeUnion_t, MPI2_POINTER pMpi2MpiSgeUnion_t; + + +/**************************************************************************** +* MPI SGE field definition and masks +****************************************************************************/ + +/* Flags field bit definitions */ + +#define MPI2_SGE_FLAGS_LAST_ELEMENT (0x80) +#define MPI2_SGE_FLAGS_END_OF_BUFFER (0x40) +#define MPI2_SGE_FLAGS_ELEMENT_TYPE_MASK (0x30) +#define MPI2_SGE_FLAGS_LOCAL_ADDRESS (0x08) +#define MPI2_SGE_FLAGS_DIRECTION (0x04) +#define MPI2_SGE_FLAGS_ADDRESS_SIZE (0x02) +#define MPI2_SGE_FLAGS_END_OF_LIST (0x01) + +#define MPI2_SGE_FLAGS_SHIFT (24) + +#define MPI2_SGE_LENGTH_MASK (0x00FFFFFF) +#define MPI2_SGE_CHAIN_LENGTH_MASK (0x0000FFFF) + +/* Element Type */ + +#define MPI2_SGE_FLAGS_TRANSACTION_ELEMENT (0x00) +#define MPI2_SGE_FLAGS_SIMPLE_ELEMENT (0x10) +#define MPI2_SGE_FLAGS_CHAIN_ELEMENT (0x30) +#define MPI2_SGE_FLAGS_ELEMENT_MASK (0x30) + +/* Address location */ + +#define MPI2_SGE_FLAGS_SYSTEM_ADDRESS (0x00) + +/* Direction */ + +#define MPI2_SGE_FLAGS_IOC_TO_HOST (0x00) +#define MPI2_SGE_FLAGS_HOST_TO_IOC (0x04) + +#define MPI2_SGE_FLAGS_DEST (MPI2_SGE_FLAGS_IOC_TO_HOST) +#define MPI2_SGE_FLAGS_SOURCE (MPI2_SGE_FLAGS_HOST_TO_IOC) + +/* Address Size */ + +#define MPI2_SGE_FLAGS_32_BIT_ADDRESSING (0x00) +#define MPI2_SGE_FLAGS_64_BIT_ADDRESSING (0x02) + +/* Context Size */ + +#define MPI2_SGE_FLAGS_32_BIT_CONTEXT (0x00) +#define MPI2_SGE_FLAGS_64_BIT_CONTEXT (0x02) +#define MPI2_SGE_FLAGS_96_BIT_CONTEXT (0x04) +#define MPI2_SGE_FLAGS_128_BIT_CONTEXT (0x06) + +#define MPI2_SGE_CHAIN_OFFSET_MASK (0x00FF0000) +#define MPI2_SGE_CHAIN_OFFSET_SHIFT (16) + +/**************************************************************************** +* MPI SGE operation Macros +****************************************************************************/ + +/* SIMPLE FlagsLength manipulations... */ +#define MPI2_SGE_SET_FLAGS(f) ((U32)(f) << MPI2_SGE_FLAGS_SHIFT) +#define MPI2_SGE_GET_FLAGS(f) (((f) & ~MPI2_SGE_LENGTH_MASK) >> MPI2_SGE_FLAGS_SHIFT) +#define MPI2_SGE_LENGTH(f) ((f) & MPI2_SGE_LENGTH_MASK) +#define MPI2_SGE_CHAIN_LENGTH(f) ((f) & MPI2_SGE_CHAIN_LENGTH_MASK) + +#define MPI2_SGE_SET_FLAGS_LENGTH(f,l) (MPI2_SGE_SET_FLAGS(f) | MPI2_SGE_LENGTH(l)) + +#define MPI2_pSGE_GET_FLAGS(psg) MPI2_SGE_GET_FLAGS((psg)->FlagsLength) +#define MPI2_pSGE_GET_LENGTH(psg) MPI2_SGE_LENGTH((psg)->FlagsLength) +#define MPI2_pSGE_SET_FLAGS_LENGTH(psg,f,l) (psg)->FlagsLength = MPI2_SGE_SET_FLAGS_LENGTH(f,l) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Fri Nov 18 01:00:26 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E0EDA106566B; Fri, 18 Nov 2011 01:00:26 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B82368FC08; Fri, 18 Nov 2011 01:00:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pAI10QEd040163; Fri, 18 Nov 2011 01:00:26 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pAI10QeP040162; Fri, 18 Nov 2011 01:00:26 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201111180100.pAI10QeP040162@svn.freebsd.org> From: Sean Bruno Date: Fri, 18 Nov 2011 01:00:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227643 - user/sbruno X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Nov 2011 01:00:27 -0000 Author: sbruno Date: Fri Nov 18 01:00:26 2011 New Revision: 227643 URL: http://svn.freebsd.org/changeset/base/227643 Log: add a proj dir for myself Added: user/sbruno/ From owner-svn-src-user@FreeBSD.ORG Fri Nov 18 01:04:25 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D121E106564A; Fri, 18 Nov 2011 01:04:25 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C01D28FC14; Fri, 18 Nov 2011 01:04:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pAI14PrO040376; Fri, 18 Nov 2011 01:04:25 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pAI14P9H040373; Fri, 18 Nov 2011 01:04:25 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201111180104.pAI14P9H040373@svn.freebsd.org> From: Sean Bruno Date: Fri, 18 Nov 2011 01:04:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227644 - user/sbruno/mfid X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Nov 2011 01:04:25 -0000 Author: sbruno Date: Fri Nov 18 01:04:25 2011 New Revision: 227644 URL: http://svn.freebsd.org/changeset/base/227644 Log: Add the Yahoo! mfi(4) monitoring utility for review. Compiles against amd64 freebsd-current at this time. Installs a /usr/sbin/mfid and can be started/stopped via the included rc script. Obtained from: Yahoo! Inc. and jhb@ in a former life Added: user/sbruno/mfid/ user/sbruno/mfid/Makefile user/sbruno/mfid/mfid.c user/sbruno/mfid/mfid.rc (contents, props changed) Added: user/sbruno/mfid/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/sbruno/mfid/Makefile Fri Nov 18 01:04:25 2011 (r227644) @@ -0,0 +1,9 @@ +PROG= mfid +BINDIR= /usr/sbin + +CFLAGS+= -g -Wall -Wunused + +NOMAN= +NO_MAN= + +.include Added: user/sbruno/mfid/mfid.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/sbruno/mfid/mfid.c Fri Nov 18 01:04:25 2011 (r227644) @@ -0,0 +1,1011 @@ +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#define MAX_UNIT 16 + +#define VOLUME_DEGRADED(state) \ + ((state) == MFI_LD_STATE_PARTIALLY_DEGRADED || \ + (state) == MFI_LD_STATE_DEGRADED) + +static char hostname[MAXHOSTNAMELEN]; +static char *mailto = "root@localhost"; +static int notifyminutes = 720; /* send mail every 12 hours by default */ +static int dostdout; + +/* Maximum target_id and device_id of volumes and drives, respectively. */ +#define MFI_MAX_LD_ID 256 +#define MFI_MAX_PD_ID 65536 + +struct mfi_physical_drive { + uint32_t generation; + uint16_t device_id; + enum mfi_pd_state state; + uint16_t encl_device_id; + uint8_t encl_index; + uint8_t slot_number; + uint8_t missing; +}; + +struct mfi_logical_drive { + enum mfi_ld_state state; + enum mfi_ld_state prev_state; + int sentcnt; + uint32_t generation; + uint8_t target_id; + int missing_drives; +}; + +struct mfi_controller { + int fd; + int unit; + uint32_t generation; + uint32_t config_size; + int config_valid; + int missing_drives; + int bad_drives; + int prev_bad_drives; + int sentcnt; + struct mfi_config_data *config; + struct mfi_logical_drive *ldrives[MFI_MAX_LD_ID]; + struct mfi_physical_drive *pdrives[MFI_MAX_PD_ID]; +}; + +static struct mfi_array *mfi_find_array(struct mfi_controller *c, + uint16_t array_ref); + +static struct mfi_controller controllers[MAX_UNIT]; +static int ncontrollers; + +static int +mfi_query_disk(struct mfi_controller *c, uint8_t target_id, + struct mfi_query_disk *info) +{ + + info->array_id = target_id; + if (ioctl(c->fd, MFIIO_QUERY_DISK, info) < 0) + return (-1); + if (!info->present) { + errno = ENXIO; + return (-1); + } + return (0); +} + +static const char * +mfi_volume_name(struct mfi_controller *c, uint8_t target_id) +{ + static struct mfi_query_disk info; + static char buf[4]; + + if (mfi_query_disk(c, target_id, &info) < 0) { + snprintf(buf, sizeof(buf), "%d", target_id); + return (buf); + } + return (info.devname); +} + +static int +mfi_dcmd_command(struct mfi_controller *c, uint32_t opcode, void *buf, + size_t bufsize, uint8_t *mbox, size_t mboxlen, uint8_t *statusp) +{ + struct mfi_ioc_passthru ioc; + struct mfi_dcmd_frame *dcmd; + int r; + + if ((mbox != NULL && (mboxlen == 0 || mboxlen > MFI_MBOX_SIZE)) || + (mbox == NULL && mboxlen != 0)) { + errno = EINVAL; + return (-1); + } + + bzero(&ioc, sizeof(ioc)); + dcmd = &ioc.ioc_frame; + if (mbox) + bcopy(mbox, dcmd->mbox, mboxlen); + dcmd->header.cmd = MFI_CMD_DCMD; + dcmd->header.timeout = 0; + dcmd->header.flags = 0; + dcmd->header.data_len = bufsize; + dcmd->opcode = opcode; + + ioc.buf = buf; + ioc.buf_size = bufsize; + r = ioctl(c->fd, MFIIO_PASSTHRU, &ioc); + if (r < 0) + return (r); + + if (statusp != NULL) + *statusp = dcmd->header.cmd_status; + else if (dcmd->header.cmd_status != MFI_STAT_OK) { + warnx("mfi%d: command %x returned error status %x", c->unit, + opcode, dcmd->header.cmd_status); + errno = EIO; + return (-1); + } + return (0); +} + +static void +mbox_store_device_id(uint8_t *mbox, uint16_t device_id) +{ + + mbox[0] = device_id & 0xff; + mbox[1] = device_id >> 8; +} + +static int +mfi_pd_get_list(struct mfi_controller *c, struct mfi_pd_list **listp, + uint8_t *statusp) +{ + struct mfi_pd_list *list; + uint32_t list_size; + + /* + * Keep fetching the list in a loop until we have a large enough + * buffer to hold the entire list. + */ + list = NULL; + list_size = 1024; +fetch: + list = reallocf(list, list_size); + if (list == NULL) + return (-1); + if (mfi_dcmd_command(c, MFI_DCMD_PD_GET_LIST, list, list_size, NULL, 0, + statusp) < 0) { + free(list); + return (-1); + } + + if (list->size > list_size) { + list_size = list->size; + goto fetch; + } + + *listp = list; + return (0); +} + +static int +mfi_pd_get_info(struct mfi_controller *c, uint16_t device_id, + struct mfi_pd_info *info, uint8_t *statusp) +{ + uint8_t mbox[2]; + + mbox_store_device_id(&mbox[0], device_id); + return (mfi_dcmd_command(c, MFI_DCMD_PD_GET_INFO, info, + sizeof(struct mfi_pd_info), mbox, 2, statusp)); +} + +int +mfi_drive_location(char *p, struct mfi_physical_drive *pd) +{ + + if (pd->encl_device_id == 0xffff) + return (sprintf(p, "slot %d", pd->slot_number)); + else if (pd->encl_device_id == pd->device_id) + return (sprintf(p, "enclosure %d", pd->encl_index)); + else + return (sprintf(p, "enclosure %d, slot %d", pd->encl_index, + pd->slot_number)); +} + +static void +mfi_scan_volume(struct mfi_controller *c, struct mfi_ld_config *ldc) +{ + struct mfi_logical_drive *ld; + struct mfi_array *ar; + uint8_t state; + int i, span; + + state = ldc->params.state; + + /* See if we have seen this drive before. */ + ld = c->ldrives[ldc->properties.ld.v.target_id]; + if (ld == NULL) { + ld = calloc(1, sizeof(struct mfi_logical_drive)); + ld->target_id = ldc->properties.ld.v.target_id; + c->ldrives[ld->target_id] = ld; + + ld->prev_state = state; + } else + ld->prev_state = ld->state; + + /* Update generation count and other state. */ + ld->generation = c->generation; + ld->state = state; + + /* + * Scan all the arrays this volume spans to see if this volume + * is missing any drives. + */ + ld->missing_drives = 0; + for (span = 0; span < ldc->params.span_depth; span++) { + ar = mfi_find_array(c, ldc->span[span].array_ref); + + /* Walk the array to find the backing drives. */ + for (i = 0; i < ar->num_drives; i++) + /* Missing drive. */ + if (ar->pd[i].ref.v.device_id == 0xffff) + ld->missing_drives++; + } +} + +static void +mfi_scan_volumes(struct mfi_controller *c) +{ + struct mfi_logical_drive *ld; + char *p; + int i; + + /* Find the first config. */ + p = (char *)c->config->array + + c->config->array_count * c->config->array_size; + + /* Scan all the volumes. */ + for (i = 0; i < c->config->log_drv_count; i++) { + mfi_scan_volume(c, (struct mfi_ld_config *)p); + p += c->config->log_drv_size; + } + + /* Throw away all the volumes that disappeared. */ + for (i = 0; i < MFI_MAX_LD_ID; i++) { + ld = c->ldrives[i]; + if (ld == NULL) + continue; + if (ld->generation != c->generation) { + c->ldrives[i] = NULL; + free(ld); + } + } +} + +static void +mfi_scan_drive(struct mfi_controller *c, uint16_t device_id, uint16_t state) +{ + struct mfi_physical_drive *pd; + struct mfi_pd_info info; + + /* See if we have seen this drive before. */ + pd = c->pdrives[device_id]; + if (pd == NULL) { + pd = calloc(1, sizeof(struct mfi_physical_drive)); + pd->device_id = device_id; + c->pdrives[device_id] = pd; + + if (mfi_pd_get_info(c, device_id, &info, NULL) < 0) + warn("mfi%d: Failed to get info for drive %u", c->unit, + device_id); + else { + pd->encl_device_id = info.encl_device_id; + pd->encl_index = info.encl_index; + pd->slot_number = info.slot_number; + } + } + + /* Update generation count and other state. */ + pd->generation = c->generation; + pd->state = state; + pd->missing = 0; +} + +static void +mfi_scan_drives(struct mfi_controller *c) +{ + struct mfi_physical_drive *pd; + struct mfi_pd_list *list; + struct mfi_pd_info info; + struct mfi_array *ar; + char *p; + int i, j, count; + + /* Find the first array. */ + p = (char *)c->config->array; + + /* Scan all the arrays. */ + c->missing_drives = 0; + for (i = 0; i < c->config->array_count; i++) { + ar = (struct mfi_array *)p; + + /* Scan each drive in the array. */ + for (j = 0; j < ar->num_drives; j++) { + /* Missing drive. */ + if (ar->pd[j].ref.v.device_id == 0xffff) { + c->missing_drives++; + continue; + } + mfi_scan_drive(c, ar->pd[j].ref.v.device_id, + ar->pd[j].fw_state); + } + p += c->config->array_size; + } + + /* Scan all of the physical drives to find bad drives. */ + c->prev_bad_drives = c->bad_drives; + c->bad_drives = 0; + if (mfi_pd_get_list(c, &list, NULL) < 0) + warn("mfi%d: Failed to get physical drive list", c->unit); + else { + for (i = 0; i < list->count; i++) { + if (list->addr[i].scsi_dev_type != 0) + continue; + + /* Skip drives we've already scanned above. */ + pd = c->pdrives[list->addr[i].device_id]; + if (pd != NULL && pd->generation == c->generation) + continue; + + if (mfi_pd_get_info(c, list->addr[i].device_id, &info, + NULL) < 0) { + warn("mfi%d: Failed to get info for drive %u", + c->unit, list->addr[i].device_id); + continue; + } + if (info.fw_state == MFI_PD_STATE_UNCONFIGURED_BAD) { + mfi_scan_drive(c, list->addr[i].device_id, + info.fw_state); + c->bad_drives++; + } + } + free(list); + } + + /* + * If we have any missing drives, check to see if all of the drives + * that disappeared are missing drives. + */ + if (c->missing_drives) { + count = 0; + for (i = 0; i < MFI_MAX_PD_ID; i++) { + pd = c->pdrives[i]; + if (pd == NULL) + continue; + if (pd->generation != c->generation) + count++; + } + + if (count <= c->missing_drives) { + /* + * Ok, it looks like all of the drives that + * disappeared are known to be missing. + */ + for (i = 0; i < MFI_MAX_PD_ID; i++) { + pd = c->pdrives[i]; + if (pd == NULL) + continue; + if (pd->generation != c->generation) { + pd->missing = 1; + pd->generation = c->generation; + } + } + } + } + + /* Throw away all the drives that disappeared. */ + for (i = 0; i < MFI_MAX_PD_ID; i++) { + pd = c->pdrives[i]; + if (pd == NULL) + continue; + if (pd->generation != c->generation) { + c->pdrives[i] = NULL; + free(pd); + } + } +} + +static void +mfi_scan_controller(struct mfi_controller *c) +{ + uint8_t status; + int count; + + c->config_valid = 0; + + /* Start off with just the header. */ + if (c->config == NULL) { + c->config_size = sizeof(struct mfi_config_data); + c->config = malloc(sizeof(struct mfi_config_data)); + }; + +fetch: + /* Try to fetch the RAID configuration for this controller. */ + for (count = 0; count < 5; count++) { + if (mfi_dcmd_command(c, MFI_DCMD_CFG_READ, c->config, + c->config_size, NULL, 0, &status) < 0) { + warn("mfi%d: Failed to get config", c->unit); + return; + } + if (status != MFI_STAT_MEMORY_NOT_AVAILABLE) + break; + sleep(5); + } + if (status != MFI_STAT_OK) { + warnx("mfi%d: Failed to get config with error status %x", + c->unit, status); + return; + } + + /* Is the size too small? */ + if (c->config_size < c->config->size) { + c->config_size = c->config->size; + c->config = realloc(c->config, c->config_size); + if (c->config == NULL) { + warn("mfi%d: Failed to grow config object", c->unit); + return; + } + goto fetch; + } + + /* + * Ok, now we have a config. The config contains 3 arrays for us to + * process. The first array contains MFI_ARRAY objects which define + * RAID arrays of physical drives. The second array contains + * MFI_LD_CONFIG objects which define logical drives, or volumes, + * that are created by taking spans from backing MFI_ARRAYs. Finally, + * the third array consists of MFI_SPARE objects describing spare + * disks. We ignore the spares. We care about the states of the + * volumes (degraded or not) and the state of the drives backing each + * of the volumes. The MFI_LD_CONFIG objects already contain the + * state of each volume, but we need to query each of the physical + * drives to determine their state. + */ + + /* Bump the overall generation count. */ + c->generation++; + c->config_valid = 1; + + mfi_scan_volumes(c); + mfi_scan_drives(c); +} + +static void +mfi_scan_all(void) +{ + int i; + + for (i = 0; i < ncontrollers; i++) + mfi_scan_controller(&controllers[i]); +} + +static int +mfi_open(void) +{ + char path[MAXPATHLEN]; + int fd, unit; + + ncontrollers = 0; + for (unit = 0; unit < MAX_UNIT; unit++) { + snprintf(path, sizeof(path), "/dev/mfi%d", unit); + fd = open(path, O_RDWR); + if (fd < 0) + continue; + controllers[ncontrollers].fd = fd; + controllers[ncontrollers].unit = unit; + ncontrollers++; + } + if (ncontrollers == 0) + return (ncontrollers); + + mfi_scan_all(); + + return (ncontrollers); +} + +static FILE * +mailer_open(void) +{ + FILE *fp; + + if (dostdout) + fp = stdout; + else + fp = popen("/usr/sbin/sendmail -t", "w"); + fprintf(fp, "To: %s\n", mailto); + return fp; +} + +static void +mailer_close(FILE *fp) +{ + + if (dostdout == 0) + pclose(fp); + else + fflush(fp); +} + +static void +mailer_write(FILE *fp, const char *fmt, ...) +{ + va_list ap; + char *mfmt, *pfmt = NULL; + + pfmt = mfmt = strdup(fmt); + + va_start (ap, fmt); + vfprintf (fp, fmt, ap); + va_end (ap); + + /* XXX: Hack for Subject: */ + if (strncmp(fmt, "Subject: ", 9) == 0) { + char *p; + pfmt += strlen("Subject: "); + if ((p = strchr(pfmt, '\n')) != NULL) + *p = '\0'; + } + + if (dostdout == 0) { + va_start (ap, fmt); + vsyslog(LOG_CRIT, pfmt, ap); + va_end (ap); + } + + if (mfmt) + free(mfmt); +} + +static struct mfi_ld_config * +mfi_find_ld_config(struct mfi_controller *c, uint8_t target_id) +{ + struct mfi_ld_config *ld; + char *p; + int i; + + p = (char *)&c->config[1] + + c->config->array_count * c->config->array_size; + for (i = 0; i < c->config->log_drv_count; i++) { + ld = (struct mfi_ld_config *)p; + if (ld->properties.ld.v.target_id == target_id) + return (ld); + p += c->config->log_drv_size; + } + return (NULL); +} + +static struct mfi_array * +mfi_find_array(struct mfi_controller *c, uint16_t array_ref) +{ + struct mfi_array *ar; + char *p; + int i; + + p = (char *)&c->config[1]; + for (i = 0; i < c->config->array_count; i++) { + ar = (struct mfi_array *)p; + if (ar->array_ref == array_ref) + return (ar); + p += c->config->array_size; + } + return (NULL); +} + +static int +mfi_in_state(uint16_t state, struct mfi_controller *c, + struct mfi_logical_drive *ld) +{ + struct mfi_physical_drive *pd; + struct mfi_ld_config *ldc; + struct mfi_array *ar; + int i, instate, span; + + instate = 0; + + /* Find the config for this volume. */ + ldc = mfi_find_ld_config(c, ld->target_id); + + /* Walk each span for this volume. */ + for (span = 0; span < ldc->params.span_depth; span++) { + ar = mfi_find_array(c, ldc->span[span].array_ref); + + /* Walk the array to find the backing drives. */ + for (i = 0; i < ar->num_drives; i++) { + pd = c->pdrives[ar->pd[i].ref.v.device_id]; + if (pd == NULL) + continue; + if (pd->state == state) { + instate++; + } + } + } + return (instate); +} + +char * +mfi_show_state(uint16_t state, struct mfi_controller *c, + struct mfi_logical_drive *ld) +{ + struct mfi_physical_drive *pd; + struct mfi_ld_config *ldc; + struct mfi_array *ar; + int i, comma = 0, instate, span; + char *str, *p; + + instate = mfi_in_state(state, c, ld); + if (instate == 0) + return (NULL); + + str = calloc(instate * 64, sizeof(char)); + if (str == NULL) + return (NULL); + + p = str; + *p++ = '('; + + /* Find the config for this volume. */ + ldc = mfi_find_ld_config(c, ld->target_id); + + /* Walk each span for this volume. */ + for (span = 0; span < ldc->params.span_depth; span++) { + ar = mfi_find_array(c, ldc->span[span].array_ref); + + /* Walk the array to find the backing drives. */ + for (i = 0; i < ar->num_drives; i++) { + pd = c->pdrives[ar->pd[i].ref.v.device_id]; + if (pd == NULL) + continue; + if (pd->state == state) { + if (comma++) + *p++ = ','; + p += sprintf(p, "drive %u in ", pd->device_id); + p += mfi_drive_location(p, pd); + } + } + } + if ((p - str) == 1) { + int n = sprintf(p, "none"); + p += n; + } + *p = ')'; + + return (str); +} + +char * +mfi_show_missing(struct mfi_controller *c, struct mfi_logical_drive *ld) +{ + struct mfi_physical_drive *pd; + char *str, *p; + int i, comma = 0, instate; + + if (c->missing_drives == 0 || ld->missing_drives == 0) + return (NULL); + + instate = 0; + for (i = 0; i < MFI_MAX_PD_ID; i++) { + pd = c->pdrives[i]; + if (pd == NULL) + continue; + if (pd->missing) + instate++; + } + if (instate == 0) + return (NULL); + + str = calloc(instate * 64, sizeof(char)); + if (str == NULL) + return (NULL); + + p = str; + *p++ = '('; + for (i = 0; i < MFI_MAX_PD_ID; i++) { + pd = c->pdrives[i]; + if (pd == NULL) + continue; + if (pd->missing) { + if (comma++) + *p++ = ','; + p += sprintf(p, "drive %u in ", pd->device_id); + p += mfi_drive_location(p, pd); + } + } + if ((p - str) == 1) { + int n = sprintf(p, "none"); + p += n; + } + *p = ')'; + + return (str); +} + +char * +mfi_show_bad(struct mfi_controller *c) +{ + struct mfi_physical_drive *pd; + char *str, *p; + int i, comma = 0, instate; + + if (c->bad_drives == 0) + return (NULL); + + instate = 0; + for (i = 0; i < MFI_MAX_PD_ID; i++) { + pd = c->pdrives[i]; + if (pd == NULL) + continue; + if (pd->state == MFI_PD_STATE_UNCONFIGURED_BAD) + instate++; + } + if (instate == 0) + return (NULL); + + str = calloc(instate * 64, sizeof(char)); + if (str == NULL) + return (NULL); + + p = str; + *p++ = '('; + for (i = 0; i < MFI_MAX_PD_ID; i++) { + pd = c->pdrives[i]; + if (pd == NULL) + continue; + if (pd->state == MFI_PD_STATE_UNCONFIGURED_BAD) { + if (comma++) + *p++ = ','; + p += sprintf(p, "drive %u in ", pd->device_id); + p += mfi_drive_location(p, pd); + } + } + if ((p - str) == 1) { + int n = sprintf(p, "none"); + p += n; + } + *p = ')'; + + return (str); +} + +static void +mfi_notify_failure(struct mfi_controller *c, struct mfi_logical_drive *ld) +{ + FILE *fp; + int *sentcnt; + char *bad, *failed, *missing, *rebuild; + + sentcnt = &ld->sentcnt; + if (ld->state == ld->prev_state && + c->bad_drives == c->prev_bad_drives && + ((*sentcnt)++ % notifyminutes) != 0) + return; + *sentcnt = 1; + c->sentcnt = 1; + + bad = mfi_show_bad(c); + rebuild = mfi_show_state(MFI_PD_STATE_REBUILD, c, ld); + failed = mfi_show_state(MFI_PD_STATE_FAILED, c, ld); + missing = mfi_show_missing(c, ld); + + fp = mailer_open(); + mailer_write(fp, "Subject: [MFI ALERT] controller %d vol %s on %s\n\n", + c->unit, mfi_volume_name(c, ld->target_id), hostname); + if (!VOLUME_DEGRADED(ld->state)) { + mailer_write(fp, + "%s: controller %d volume %s is rebuilt and no longer has errors\n", + hostname, c->unit, mfi_volume_name(c, ld->target_id)); + } else { + if (rebuild) + mailer_write(fp, + "%s: recovering to %s on controller %d volume %s\n", + hostname, rebuild, c->unit, + mfi_volume_name(c, ld->target_id)); + if (failed) + mailer_write(fp, + "%s: disk(s) on controller %d volume %s needs to be replaced: %s\n", + hostname, c->unit, + mfi_volume_name(c, ld->target_id), failed); + if (missing) + mailer_write(fp, + "%s: disk(s) on controller %d volume %s are missing: %s\n", + hostname, c->unit, + mfi_volume_name(c, ld->target_id), missing); + else if (ld->missing_drives) + mailer_write(fp, + "%s: %d disk(s) on controller %d volume %s are missing\n", + hostname, ld->missing_drives, c->unit, + mfi_volume_name(c, ld->target_id)); + } + if (bad) + mailer_write(fp, "%s: disk(s) on controller %d are bad: %s\n", + hostname, c->unit, bad); + else if (c->bad_drives) + mailer_write(fp, "%s: %d disk(s) on controller %d are bad\n", + hostname, c->bad_drives, c->unit); + else if (c->prev_bad_drives) + mailer_write(fp, + "%s: controller %d no longer has any bad disks\n", + hostname, c->unit); + + if (bad) + free(bad); + if (failed) + free(failed); + if (rebuild) + free(rebuild); + if (missing) + free(missing); + + mailer_close(fp); +} + +static void +mfi_notify_bad(struct mfi_controller *c) +{ + FILE *fp; + int *sentcnt; + char *bad; + + sentcnt = &c->sentcnt; + if (c->bad_drives == c->prev_bad_drives && + ((*sentcnt)++ % notifyminutes) != 0) + return; + *sentcnt = 1; + + bad = mfi_show_bad(c); + + fp = mailer_open(); + mailer_write(fp, "Subject: [MFI ALERT] controller %d on %s\n\n", + c->unit, hostname); + if (bad) + mailer_write(fp, "%s: disk(s) on controller %d are bad: %s\n", + hostname, c->unit, bad); + else if (c->bad_drives) + mailer_write(fp, "%s: %d disk(s) on controller %d are bad\n", + hostname, c->bad_drives, c->unit); + else + mailer_write(fp, + "%s: controller %d no longer has any bad disks\n", + hostname, c->unit); + + if (bad) + free(bad); + + mailer_close(fp); +} + +static void +mfi_check_volumes(void) +{ + struct mfi_logical_drive *ld; + struct mfi_controller *c; + int i, j, notified; + + for (i = 0; i < ncontrollers; i++) { + c = &controllers[i]; + if (!c->config_valid) + continue; + notified = 0; + for (j = 0; j < MFI_MAX_LD_ID; j++) { + ld = c->ldrives[j]; + if (ld == NULL) + continue; + + if (VOLUME_DEGRADED(ld->state) || + VOLUME_DEGRADED(ld->prev_state)) { + mfi_notify_failure(c, ld); + notified = 1; + } + } + if (!notified && + (c->bad_drives != 0 || c->prev_bad_drives != 0)) + mfi_notify_bad(c); + } +} + +static void +mfi_stop_patrol(void) +{ + struct mfi_controller *c; + struct mfi_pr_status status; + int i; + + for (i = 0; i < ncontrollers; i++) { + c = &controllers[i]; + if (c->config_valid == 0) + continue; + if (mfi_dcmd_command(c, MFI_DCMD_PR_GET_STATUS, &status, + sizeof(status), NULL, 0, NULL) < 0) + continue; + if (status.state == MFI_PR_STATE_STOPPED) + continue; + if (mfi_dcmd_command(c, MFI_DCMD_PR_STOP, NULL, 0, + NULL, 0, NULL) < 0) + warn("Failed to stop patrol reads"); + } +} + +static void +mfi_disable_patrol(void) +{ + struct mfi_controller *c; + struct mfi_pr_properties prop; + int i; + + for (i = 0; i < ncontrollers; i++) { + c = &controllers[i]; + if (c->config_valid == 0) + continue; + if (mfi_dcmd_command(c, MFI_DCMD_PR_GET_PROPERTIES, &prop, + sizeof(prop), NULL, 0, NULL) < 0) + continue; + if (prop.op_mode == MFI_PR_OPMODE_DISABLED) + continue; + prop.op_mode = MFI_PR_OPMODE_DISABLED; + if (mfi_dcmd_command(c, MFI_DCMD_PR_SET_PROPERTIES, &prop, + sizeof(prop), NULL, 0, NULL) < 0) + warn("Failed to disable patrol reads"); + } +} + +static void +usage(void) +{ + fprintf(stderr, "usage: mfid [-ds] [-t minutes] [mailto]\n"); + exit(1); +} + +int +main(int ac, char *av[]) +{ + int ch, daemonize = 1; + + while ((ch = getopt(ac, av, "dst:")) != -1) { + switch (ch) { + case 'd': + daemonize = 0; + break; + + case 't': + notifyminutes = atoi(optarg); + break; + + case 's': + dostdout = 1; + break; + case '?': + usage(); + } + } + + av += optind; + ac -= optind; + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Fri Nov 18 01:07:09 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 20EAE1065672; Fri, 18 Nov 2011 01:07:09 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 119348FC17; Fri, 18 Nov 2011 01:07:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pAI178Ds040523; Fri, 18 Nov 2011 01:07:08 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pAI178qP040521; Fri, 18 Nov 2011 01:07:08 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201111180107.pAI178qP040521@svn.freebsd.org> From: Sean Bruno Date: Fri, 18 Nov 2011 01:07:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227645 - user/sbruno/mfid X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Nov 2011 01:07:09 -0000 Author: sbruno Date: Fri Nov 18 01:07:08 2011 New Revision: 227645 URL: http://svn.freebsd.org/changeset/base/227645 Log: etc/bin --> usr/sbin Obtained from: Yahoo! Inc Modified: user/sbruno/mfid/mfid.rc Modified: user/sbruno/mfid/mfid.rc ============================================================================== --- user/sbruno/mfid/mfid.rc Fri Nov 18 01:04:25 2011 (r227644) +++ user/sbruno/mfid/mfid.rc Fri Nov 18 01:07:08 2011 (r227645) @@ -13,9 +13,9 @@ stop_cmd="mfid_stop" mfid_start() { - if [ -x "/etc/bin/mfid" -a -e "/dev/mfi0" ]; then + if [ -x "/usr/sbin/mfid" -a -e "/dev/mfi0" ]; then echo "Starting mfid." - /etc/bin/mfid ${raid_alert_mailto} + /usr/sbin/mfid ${raid_alert_mailto} fi } From owner-svn-src-user@FreeBSD.ORG Fri Nov 18 01:30:54 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D10CB1065676; Fri, 18 Nov 2011 01:30:54 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B62338FC0C; Fri, 18 Nov 2011 01:30:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pAI1Us9e041582; Fri, 18 Nov 2011 01:30:54 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pAI1UscZ041579; Fri, 18 Nov 2011 01:30:54 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201111180130.pAI1UscZ041579@svn.freebsd.org> From: Sean Bruno Date: Fri, 18 Nov 2011 01:30:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227647 - user/sbruno/mfid X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Nov 2011 01:30:54 -0000 Author: sbruno Date: Fri Nov 18 01:30:54 2011 New Revision: 227647 URL: http://svn.freebsd.org/changeset/base/227647 Log: Add 3 clause license, just to be clear. Obtained from: Yahoo Inc. Noted by: delphij@ Modified: user/sbruno/mfid/mfid.c user/sbruno/mfid/mfid.rc Modified: user/sbruno/mfid/mfid.c ============================================================================== --- user/sbruno/mfid/mfid.c Fri Nov 18 01:28:52 2011 (r227646) +++ user/sbruno/mfid/mfid.c Fri Nov 18 01:30:54 2011 (r227647) @@ -1,3 +1,32 @@ +/*- + * Copyright (c) 2011 Yahoo! Inc. + * + * 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. + * 3. Neither the name of Yahoo! Inc. nor the name of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written consent. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. + */ + #include #include #include Modified: user/sbruno/mfid/mfid.rc ============================================================================== --- user/sbruno/mfid/mfid.rc Fri Nov 18 01:28:52 2011 (r227646) +++ user/sbruno/mfid/mfid.rc Fri Nov 18 01:30:54 2011 (r227647) @@ -1,3 +1,32 @@ +/*- + * Copyright (c) 2011 Yahoo! Inc. + * + * 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. + * 3. Neither the name of Yahoo! Inc. nor the name of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written consent. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. + */ + #!/bin/sh # PROVIDE: mfid From owner-svn-src-user@FreeBSD.ORG Fri Nov 18 09:54:15 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 440BA106566C; Fri, 18 Nov 2011 09:54:15 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2FDD78FC13; Fri, 18 Nov 2011 09:54:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pAI9sFJ5064871; Fri, 18 Nov 2011 09:54:15 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pAI9sFhn064868; Fri, 18 Nov 2011 09:54:15 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201111180954.pAI9sFhn064868@svn.freebsd.org> From: Attilio Rao Date: Fri, 18 Nov 2011 09:54:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227659 - in user/attilio/vmcontention: cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/cmd/zpool cddl/sbin/zfs cddl/sbin/zpool contrib/bind9 contrib/bind9/bin/named contrib/b... X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Nov 2011 09:54:15 -0000 Author: attilio Date: Fri Nov 18 09:54:14 2011 New Revision: 227659 URL: http://svn.freebsd.org/changeset/base/227659 Log: MFC Added: user/attilio/vmcontention/share/man/man4/netmap.4 - copied unchanged from r227658, head/share/man/man4/netmap.4 user/attilio/vmcontention/share/man/man4/sfxge.4 - copied unchanged from r227658, head/share/man/man4/sfxge.4 user/attilio/vmcontention/share/man/man4/virtio.4 - copied unchanged from r227658, head/share/man/man4/virtio.4 user/attilio/vmcontention/share/man/man4/virtio_balloon.4 - copied unchanged from r227658, head/share/man/man4/virtio_balloon.4 user/attilio/vmcontention/share/man/man4/virtio_blk.4 - copied unchanged from r227658, head/share/man/man4/virtio_blk.4 user/attilio/vmcontention/share/man/man4/vtnet.4 - copied unchanged from r227658, head/share/man/man4/vtnet.4 user/attilio/vmcontention/sys/boot/fdt/dts/p2020ds.dts - copied unchanged from r227658, head/sys/boot/fdt/dts/p2020ds.dts user/attilio/vmcontention/sys/dev/netmap/ - copied from r227658, head/sys/dev/netmap/ user/attilio/vmcontention/sys/dev/sfxge/ - copied from r227658, head/sys/dev/sfxge/ user/attilio/vmcontention/sys/dev/virtio/ - copied from r227658, head/sys/dev/virtio/ user/attilio/vmcontention/sys/libkern/iconv_ucs.c - copied unchanged from r227658, head/sys/libkern/iconv_ucs.c user/attilio/vmcontention/sys/modules/sfxge/ - copied from r227658, head/sys/modules/sfxge/ user/attilio/vmcontention/sys/modules/virtio/ - copied from r227658, head/sys/modules/virtio/ user/attilio/vmcontention/sys/net/netmap.h - copied unchanged from r227658, head/sys/net/netmap.h user/attilio/vmcontention/sys/net/netmap_user.h - copied unchanged from r227658, head/sys/net/netmap_user.h user/attilio/vmcontention/tools/tools/netmap/ - copied from r227658, head/tools/tools/netmap/ Deleted: user/attilio/vmcontention/tools/build/atomic.c Modified: user/attilio/vmcontention/cddl/contrib/opensolaris/cmd/zfs/zfs.8 user/attilio/vmcontention/cddl/contrib/opensolaris/cmd/zpool/zpool.8 user/attilio/vmcontention/cddl/sbin/zfs/Makefile user/attilio/vmcontention/cddl/sbin/zpool/Makefile user/attilio/vmcontention/contrib/bind9/CHANGES user/attilio/vmcontention/contrib/bind9/bin/named/query.c user/attilio/vmcontention/contrib/bind9/lib/dns/rbtdb.c user/attilio/vmcontention/contrib/bind9/version user/attilio/vmcontention/contrib/gcc/config/rs6000/freebsd.h user/attilio/vmcontention/lib/clang/include/llvm/Config/config.h user/attilio/vmcontention/lib/clang/include/llvm/Config/llvm-config.h user/attilio/vmcontention/lib/libc/sys/stat.2 user/attilio/vmcontention/lib/libkiconv/xlat16_iconv.c user/attilio/vmcontention/lib/libthr/thread/thr_umtx.c user/attilio/vmcontention/share/man/man4/Makefile user/attilio/vmcontention/share/man/man9/lock.9 user/attilio/vmcontention/share/man/man9/mutex.9 user/attilio/vmcontention/share/man/man9/rmlock.9 user/attilio/vmcontention/share/man/man9/rwlock.9 user/attilio/vmcontention/share/man/man9/stack.9 user/attilio/vmcontention/share/man/man9/sx.9 user/attilio/vmcontention/sys/boot/ia64/common/exec.c user/attilio/vmcontention/sys/cam/cam_sim.h user/attilio/vmcontention/sys/cam/cam_xpt.c user/attilio/vmcontention/sys/conf/files user/attilio/vmcontention/sys/dev/acpica/acpi_thermal.c user/attilio/vmcontention/sys/dev/ahci/ahci.c user/attilio/vmcontention/sys/dev/ath/if_ath.c user/attilio/vmcontention/sys/dev/ath/if_ath_tx.c user/attilio/vmcontention/sys/dev/ath/if_athvar.h user/attilio/vmcontention/sys/dev/isp/isp.c user/attilio/vmcontention/sys/dev/isp/isp_pci.c user/attilio/vmcontention/sys/dev/mfi/mfi.c user/attilio/vmcontention/sys/dev/mfi/mfi_cam.c user/attilio/vmcontention/sys/dev/mfi/mfi_debug.c user/attilio/vmcontention/sys/dev/mfi/mfi_disk.c user/attilio/vmcontention/sys/dev/mfi/mfi_pci.c user/attilio/vmcontention/sys/dev/mfi/mfivar.h user/attilio/vmcontention/sys/dev/msk/if_msk.c user/attilio/vmcontention/sys/dev/msk/if_mskreg.h user/attilio/vmcontention/sys/dev/qlxgb/qla_def.h user/attilio/vmcontention/sys/dev/re/if_re.c user/attilio/vmcontention/sys/dev/usb/controller/xhci.c user/attilio/vmcontention/sys/dev/usb/quirk/usb_quirk.c user/attilio/vmcontention/sys/dev/usb/usbdevs user/attilio/vmcontention/sys/fs/msdosfs/msdosfs_conv.c user/attilio/vmcontention/sys/fs/nfsclient/nfs_clvnops.c user/attilio/vmcontention/sys/fs/pseudofs/pseudofs_vnops.c user/attilio/vmcontention/sys/fs/smbfs/smbfs_smb.c user/attilio/vmcontention/sys/fs/smbfs/smbfs_subr.c user/attilio/vmcontention/sys/kern/kern_lock.c user/attilio/vmcontention/sys/kern/kern_mutex.c user/attilio/vmcontention/sys/kern/kern_rmlock.c user/attilio/vmcontention/sys/kern/kern_rwlock.c user/attilio/vmcontention/sys/kern/kern_sx.c user/attilio/vmcontention/sys/kern/kern_thread.c user/attilio/vmcontention/sys/kern/subr_mchain.c user/attilio/vmcontention/sys/kern/subr_stack.c user/attilio/vmcontention/sys/kern/subr_witness.c user/attilio/vmcontention/sys/libkern/iconv.c user/attilio/vmcontention/sys/mips/include/asm.h user/attilio/vmcontention/sys/mips/include/cpufunc.h user/attilio/vmcontention/sys/mips/include/cpuregs.h user/attilio/vmcontention/sys/mips/mips/pmap.c user/attilio/vmcontention/sys/modules/Makefile user/attilio/vmcontention/sys/modules/libiconv/Makefile user/attilio/vmcontention/sys/modules/libmchain/Makefile user/attilio/vmcontention/sys/netinet/sctp_pcb.c user/attilio/vmcontention/sys/netsmb/smb_conn.c user/attilio/vmcontention/sys/netsmb/smb_conn.h user/attilio/vmcontention/sys/netsmb/smb_smb.c user/attilio/vmcontention/sys/netsmb/smb_subr.c user/attilio/vmcontention/sys/pci/if_rlreg.h user/attilio/vmcontention/sys/powerpc/aim/machdep.c user/attilio/vmcontention/sys/powerpc/aim/mmu_oea.c user/attilio/vmcontention/sys/powerpc/aim/mp_cpudep.c user/attilio/vmcontention/sys/powerpc/aim/slb.c user/attilio/vmcontention/sys/powerpc/include/pcpu.h user/attilio/vmcontention/sys/sparc64/sbus/lsi64854.c user/attilio/vmcontention/sys/sys/iconv.h user/attilio/vmcontention/sys/sys/lock.h user/attilio/vmcontention/sys/sys/lockmgr.h user/attilio/vmcontention/sys/sys/mchain.h user/attilio/vmcontention/sys/sys/mutex.h user/attilio/vmcontention/sys/sys/param.h user/attilio/vmcontention/sys/sys/proc.h user/attilio/vmcontention/sys/sys/rmlock.h user/attilio/vmcontention/sys/sys/rwlock.h user/attilio/vmcontention/sys/sys/stack.h user/attilio/vmcontention/sys/sys/sx.h user/attilio/vmcontention/sys/vm/vm_contig.c user/attilio/vmcontention/sys/vm/vm_page.c user/attilio/vmcontention/sys/vm/vm_page.h user/attilio/vmcontention/sys/vm/vm_phys.c user/attilio/vmcontention/sys/vm/vm_phys.h user/attilio/vmcontention/tools/build/Makefile user/attilio/vmcontention/tools/tools/README user/attilio/vmcontention/usr.bin/comm/comm.1 Directory Properties: user/attilio/vmcontention/ (props changed) user/attilio/vmcontention/cddl/contrib/opensolaris/ (props changed) user/attilio/vmcontention/contrib/bind9/ (props changed) user/attilio/vmcontention/contrib/binutils/ (props changed) user/attilio/vmcontention/contrib/bzip2/ (props changed) user/attilio/vmcontention/contrib/com_err/ (props changed) user/attilio/vmcontention/contrib/compiler-rt/ (props changed) user/attilio/vmcontention/contrib/dialog/ (props changed) user/attilio/vmcontention/contrib/ee/ (props changed) user/attilio/vmcontention/contrib/expat/ (props changed) user/attilio/vmcontention/contrib/file/ (props changed) user/attilio/vmcontention/contrib/gcc/ (props changed) user/attilio/vmcontention/contrib/gdb/ (props changed) user/attilio/vmcontention/contrib/gdtoa/ (props changed) user/attilio/vmcontention/contrib/gnu-sort/ (props changed) user/attilio/vmcontention/contrib/groff/ (props changed) user/attilio/vmcontention/contrib/less/ (props changed) user/attilio/vmcontention/contrib/libpcap/ (props changed) user/attilio/vmcontention/contrib/libstdc++/ (props changed) user/attilio/vmcontention/contrib/llvm/ (props changed) user/attilio/vmcontention/contrib/llvm/tools/clang/ (props changed) user/attilio/vmcontention/contrib/ncurses/ (props changed) user/attilio/vmcontention/contrib/netcat/ (props changed) user/attilio/vmcontention/contrib/ntp/ (props changed) user/attilio/vmcontention/contrib/one-true-awk/ (props changed) user/attilio/vmcontention/contrib/openbsm/ (props changed) user/attilio/vmcontention/contrib/openpam/ (props changed) user/attilio/vmcontention/contrib/openresolv/ (props changed) user/attilio/vmcontention/contrib/pf/ (props changed) user/attilio/vmcontention/contrib/sendmail/ (props changed) user/attilio/vmcontention/contrib/tcpdump/ (props changed) user/attilio/vmcontention/contrib/tcsh/ (props changed) user/attilio/vmcontention/contrib/tnftp/ (props changed) user/attilio/vmcontention/contrib/top/ (props changed) user/attilio/vmcontention/contrib/top/install-sh (props changed) user/attilio/vmcontention/contrib/tzcode/stdtime/ (props changed) user/attilio/vmcontention/contrib/tzcode/zic/ (props changed) user/attilio/vmcontention/contrib/tzdata/ (props changed) user/attilio/vmcontention/contrib/wpa/ (props changed) user/attilio/vmcontention/contrib/xz/ (props changed) user/attilio/vmcontention/crypto/heimdal/ (props changed) user/attilio/vmcontention/crypto/openssh/ (props changed) user/attilio/vmcontention/crypto/openssl/ (props changed) user/attilio/vmcontention/gnu/lib/ (props changed) user/attilio/vmcontention/gnu/usr.bin/binutils/ (props changed) user/attilio/vmcontention/gnu/usr.bin/cc/cc_tools/ (props changed) user/attilio/vmcontention/gnu/usr.bin/gdb/ (props changed) user/attilio/vmcontention/lib/libc/ (props changed) user/attilio/vmcontention/lib/libc/stdtime/ (props changed) user/attilio/vmcontention/lib/libutil/ (props changed) user/attilio/vmcontention/lib/libz/ (props changed) user/attilio/vmcontention/sbin/ (props changed) user/attilio/vmcontention/sbin/ipfw/ (props changed) user/attilio/vmcontention/share/mk/bsd.arch.inc.mk (props changed) user/attilio/vmcontention/share/zoneinfo/ (props changed) user/attilio/vmcontention/sys/ (props changed) user/attilio/vmcontention/sys/amd64/include/xen/ (props changed) user/attilio/vmcontention/sys/boot/ (props changed) user/attilio/vmcontention/sys/boot/i386/efi/ (props changed) user/attilio/vmcontention/sys/boot/ia64/efi/ (props changed) user/attilio/vmcontention/sys/boot/ia64/ski/ (props changed) user/attilio/vmcontention/sys/boot/powerpc/boot1.chrp/ (props changed) user/attilio/vmcontention/sys/boot/powerpc/ofw/ (props changed) user/attilio/vmcontention/sys/cddl/contrib/opensolaris/ (props changed) user/attilio/vmcontention/sys/conf/ (props changed) user/attilio/vmcontention/sys/contrib/dev/acpica/ (props changed) user/attilio/vmcontention/sys/contrib/octeon-sdk/ (props changed) user/attilio/vmcontention/sys/contrib/pf/ (props changed) user/attilio/vmcontention/sys/contrib/x86emu/ (props changed) user/attilio/vmcontention/usr.bin/calendar/ (props changed) user/attilio/vmcontention/usr.bin/csup/ (props changed) user/attilio/vmcontention/usr.bin/procstat/ (props changed) user/attilio/vmcontention/usr.sbin/ndiscvt/ (props changed) user/attilio/vmcontention/usr.sbin/rtadvctl/ (props changed) user/attilio/vmcontention/usr.sbin/rtadvd/ (props changed) user/attilio/vmcontention/usr.sbin/rtsold/ (props changed) user/attilio/vmcontention/usr.sbin/zic/ (props changed) Modified: user/attilio/vmcontention/cddl/contrib/opensolaris/cmd/zfs/zfs.8 ============================================================================== --- user/attilio/vmcontention/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Fri Nov 18 09:30:24 2011 (r227658) +++ user/attilio/vmcontention/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Fri Nov 18 09:54:14 2011 (r227659) @@ -8,7 +8,9 @@ .\" the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] .\" Copyright 2011 Nexenta Systems, Inc. All rights reserved. .\" Copyright 2011 by Delphix. All rights reserved. -.TH zfs 1M "24 Sep 2009" "SunOS 5.11" "System Administration Commands" +.\" Portions Copyright 2011 Pawel Jakub Dawidek +.\" Portions Copyright 2011 Martin Matuska +.TH ZFS 8 "September 24, 2009" FreeBSD .SH NAME zfs \- configures ZFS file systems .SH SYNOPSIS @@ -39,7 +41,7 @@ zfs \- configures ZFS file systems .LP .nf -\fBzfs\fR \fBsnapshot\fR [\fB-r\fR] [\fB-o\fR \fIproperty\fR=\fIvalue\fR]... +\fBzfs\fR \fBsnapshot\fR [\fB-r\fR] [\fB-o\fR \fIproperty\fR=\fIvalue\fR]... \fIfilesystem@snapname\fR|\fIvolume@snapname\fR .fi @@ -60,7 +62,7 @@ zfs \- configures ZFS file systems .LP .nf -\fBzfs\fR \fBrename\fR \fIfilesystem\fR|\fIvolume\fR|\fIsnapshot\fR +\fBzfs\fR \fBrename\fR \fIfilesystem\fR|\fIvolume\fR|\fIsnapshot\fR \fIfilesystem\fR|\fIvolume\fR|\fIsnapshot\fR .fi @@ -125,7 +127,7 @@ zfs \- configures ZFS file systems .LP .nf -\fBzfs\fR \fBmount\fR +\fBzfs\fR \fBmount\fR .fi .LP @@ -170,7 +172,7 @@ zfs \- configures ZFS file systems .LP .nf -\fBzfs\fR \fBallow\fR [\fB-ldug\fR] "\fIeveryone\fR"|\fIuser\fR|\fIgroup\fR[,...] \fIperm\fR|\fI@setname\fR[,...] +\fBzfs\fR \fBallow\fR [\fB-ldug\fR] "\fIeveryone\fR"|\fIuser\fR|\fIgroup\fR[,...] \fIperm\fR|\fI@setname\fR[,...] \fIfilesystem\fR|\fIvolume\fR .fi @@ -191,7 +193,7 @@ zfs \- configures ZFS file systems .LP .nf -\fBzfs\fR \fBunallow\fR [\fB-rldug\fR] "\fIeveryone\fR"|\fIuser\fR|\fIgroup\fR[,...] [\fIperm\fR|@\fIsetname\fR[,... ]] +\fBzfs\fR \fBunallow\fR [\fB-rldug\fR] "\fIeveryone\fR"|\fIuser\fR|\fIgroup\fR[,...] [\fIperm\fR|@\fIsetname\fR[,... ]] \fIfilesystem\fR|\fIvolume\fR .fi @@ -225,17 +227,22 @@ zfs \- configures ZFS file systems \fBzfs\fR \fBrelease\fR [\fB-r\fR] \fItag\fR \fIsnapshot\fR... .fi -\fBzfs\fR \fBjail\fR \fBjailid\fR \fB\fIfilesystem\fR\fR +.LP +.nf +\fBzfs\fR \fBjail\fR \fIjailid\fR \fIfilesystem\fR .fi + .LP .nf -\fBzfs\fR \fBunjail\fR \fBjailid\fR \fB\fIfilesystem\fR\fR +\fBzfs\fR \fBunjail\fR \fIjailid\fR \fIfilesystem\fR .fi .SH DESCRIPTION .sp .LP -The \fBzfs\fR command configures \fBZFS\fR datasets within a \fBZFS\fR storage pool, as described in \fBzpool\fR(1M). A dataset is identified by a unique path within the \fBZFS\fR namespace. For example: +The \fBzfs\fR command configures \fBZFS\fR datasets within a \fBZFS\fR storage +pool, as described in \fBzpool\fR(8). A dataset is identified by a unique path +within the \fBZFS\fR namespace. For example: .sp .in +2 .nf @@ -252,115 +259,164 @@ where the maximum length of a dataset na A dataset can be one of the following: .sp .ne 2 -.mk .na \fB\fIfile system\fR\fR .ad .sp .6 .RS 4n -A \fBZFS\fR dataset of type \fBfilesystem\fR can be mounted within the standard system namespace and behaves like other file systems. While \fBZFS\fR file systems are designed to be \fBPOSIX\fR compliant, known issues exist that prevent compliance in some cases. Applications that depend on standards conformance might fail due to nonstandard behavior when checking file system free space. +A \fBZFS\fR dataset of type \fBfilesystem\fR can be mounted within the standard +system namespace and behaves like other file systems. While \fBZFS\fR file +systems are designed to be \fBPOSIX\fR compliant, known issues exist that +prevent compliance in some cases. Applications that depend on standards +conformance might fail due to nonstandard behavior when checking file system +free space. .RE .sp .ne 2 -.mk .na \fB\fIvolume\fR\fR .ad .sp .6 .RS 4n -A logical volume exported as a raw or block device. This type of dataset should only be used under special circumstances. File systems are typically used in most environments. +A logical volume exported as a raw or block device. This type of dataset should +only be used under special circumstances. File systems are typically used in +most environments. .RE .sp .ne 2 -.mk .na \fB\fIsnapshot\fR\fR .ad .sp .6 .RS 4n -A read-only version of a file system or volume at a given point in time. It is specified as \fIfilesystem@name\fR or \fIvolume@name\fR. +A read-only version of a file system or volume at a given point in time. It is +specified as \fIfilesystem@name\fR or \fIvolume@name\fR. .RE .SS "ZFS File System Hierarchy" .sp .LP -A \fBZFS\fR storage pool is a logical collection of devices that provide space for datasets. A storage pool is also the root of the \fBZFS\fR file system hierarchy. +A \fBZFS\fR storage pool is a logical collection of devices that provide space +for datasets. A storage pool is also the root of the \fBZFS\fR file system +hierarchy. .sp .LP -The root of the pool can be accessed as a file system, such as mounting and unmounting, taking snapshots, and setting properties. The physical storage characteristics, however, are managed by the \fBzpool\fR(1M) command. +The root of the pool can be accessed as a file system, such as mounting and +unmounting, taking snapshots, and setting properties. The physical storage +characteristics, however, are managed by the \fBzpool\fR(8) command. .sp .LP -See \fBzpool\fR(1M) for more information on creating and administering pools. +See \fBzpool\fR(8) for more information on creating and administering pools. .SS "Snapshots" .sp .LP -A snapshot is a read-only copy of a file system or volume. Snapshots can be created extremely quickly, and initially consume no additional space within the pool. As data within the active dataset changes, the snapshot consumes more data than would otherwise be shared with the active dataset. +A snapshot is a read-only copy of a file system or volume. Snapshots can be +created extremely quickly, and initially consume no additional space within the +pool. As data within the active dataset changes, the snapshot consumes more +data than would otherwise be shared with the active dataset. .sp .LP -Snapshots can have arbitrary names. Snapshots of volumes can be cloned or rolled back, but cannot be accessed independently. +Snapshots can have arbitrary names. Snapshots of volumes can be cloned or +rolled back, but cannot be accessed independently. .sp .LP -File system snapshots can be accessed under the \fB\&.zfs/snapshot\fR directory in the root of the file system. Snapshots are automatically mounted on demand and may be unmounted at regular intervals. The visibility of the \fB\&.zfs\fR directory can be controlled by the \fBsnapdir\fR property. +File system snapshots can be accessed under the \fB\&.zfs/snapshot\fR directory +in the root of the file system. Snapshots are automatically mounted on demand +and may be unmounted at regular intervals. The visibility of the \fB\&.zfs\fR +directory can be controlled by the \fBsnapdir\fR property. .SS "Clones" .sp .LP -A clone is a writable volume or file system whose initial contents are the same as another dataset. As with snapshots, creating a clone is nearly instantaneous, and initially consumes no additional space. -.sp -.LP -Clones can only be created from a snapshot. When a snapshot is cloned, it creates an implicit dependency between the parent and child. Even though the clone is created somewhere else in the dataset hierarchy, the original snapshot cannot be destroyed as long as a clone exists. The \fBorigin\fR property exposes this dependency, and the \fBdestroy\fR command lists any such dependencies, if they exist. -.sp -.LP -The clone parent-child dependency relationship can be reversed by using the \fBpromote\fR subcommand. This causes the "origin" file system to become a clone of the specified file system, which makes it possible to destroy the file system that the clone was created from. +A clone is a writable volume or file system whose initial contents are the same +as another dataset. As with snapshots, creating a clone is nearly +instantaneous, and initially consumes no additional space. +.sp +.LP +Clones can only be created from a snapshot. When a snapshot is cloned, it +creates an implicit dependency between the parent and child. Even though the +clone is created somewhere else in the dataset hierarchy, the original snapshot +cannot be destroyed as long as a clone exists. The \fBorigin\fR property +exposes this dependency, and the \fBdestroy\fR command lists any such +dependencies, if they exist. +.sp +.LP +The clone parent-child dependency relationship can be reversed by using the +\fBpromote\fR subcommand. This causes the "origin" file system to become a +clone of the specified file system, which makes it possible to destroy the file +system that the clone was created from. .SS "Mount Points" .sp .LP -Creating a \fBZFS\fR file system is a simple operation, so the number of file systems per system is likely to be numerous. To cope with this, \fBZFS\fR automatically manages mounting and unmounting file systems without the need to edit the \fB/etc/vfstab\fR file. All automatically managed file systems are mounted by \fBZFS\fR at boot time. +Creating a \fBZFS\fR file system is a simple operation, so the number of file +systems per system is likely to be numerous. To cope with this, \fBZFS\fR +automatically manages mounting and unmounting file systems without the need to +edit the \fB/etc/fstab\fR file. All automatically managed file systems are +mounted by \fBZFS\fR at boot time. .sp .LP -By default, file systems are mounted under \fB/\fIpath\fR\fR, where \fIpath\fR is the name of the file system in the \fBZFS\fR namespace. Directories are created and destroyed as needed. +By default, file systems are mounted under \fB/\fIpath\fR\fR, where \fIpath\fR +is the name of the file system in the \fBZFS\fR namespace. Directories are +created and destroyed as needed. .sp .LP -A file system can also have a mount point set in the \fBmountpoint\fR property. This directory is created as needed, and \fBZFS\fR automatically mounts the file system when the \fBzfs mount -a\fR command is invoked (without editing \fB/etc/vfstab\fR). The \fBmountpoint\fR property can be inherited, so if \fBpool/home\fR has a mount point of \fB/export/stuff\fR, then \fBpool/home/user\fR automatically inherits a mount point of \fB/export/stuff/user\fR. +A file system can also have a mount point set in the \fBmountpoint\fR property. +This directory is created as needed, and \fBZFS\fR automatically mounts the +file system when the \fBzfs mount -a\fR command is invoked (without editing +\fB/etc/fstab\fR). The \fBmountpoint\fR property can be inherited, so if +\fBpool/home\fR has a mount point of \fB/export/stuff\fR, then +\fBpool/home/user\fR automatically inherits a mount point of +\fB/export/stuff/user\fR. .sp .LP -A file system \fBmountpoint\fR property of \fBnone\fR prevents the file system from being mounted. +A file system \fBmountpoint\fR property of \fBnone\fR prevents the file system +from being mounted. .sp .LP -If needed, \fBZFS\fR file systems can also be managed with traditional tools (\fBmount\fR, \fBumount\fR, \fB/etc/vfstab\fR). If a file system's mount point is set to \fBlegacy\fR, \fBZFS\fR makes no attempt to manage the file system, and the administrator is responsible for mounting and unmounting the file system. -.SS "Zones" +If needed, \fBZFS\fR file systems can also be managed with traditional tools +(\fBmount\fR, \fBumount\fR, \fB/etc/fstab\fR). If a file system's mount point +is set to \fBlegacy\fR, \fBZFS\fR makes no attempt to manage the file system, +and the administrator is responsible for mounting and unmounting the file +system. +.SS "Jails" .sp .LP -A \fBZFS\fR file system can be added to a non-global zone by using the \fBzonecfg\fR \fBadd fs\fR subcommand. A \fBZFS\fR file system that is added to a non-global zone must have its \fBmountpoint\fR property set to \fBlegacy\fR. +A \fBZFS\fR dataset can be attached to a jail by using the \fBzfs\fR +\fBjail\fR subcommand. You cannot attach a dataset to one jail and the +children of the same dataset to another jails. To allow managment of the +dataset from within a jail, the "\fBjailed\fR" property has to be set. +The \fBquota\fR property cannot be changed from within a jail. .sp .LP -The physical properties of an added file system are controlled by the global administrator. However, the zone administrator can create, modify, or destroy files within the added file system, depending on how the file system is mounted. +A \fBZFS\fR dataset can be detached from a jail using the \fBzfs\fR +\fBunjail\fR subcommand. .sp .LP -A dataset can also be delegated to a non-global zone by using the \fBzonecfg\fR \fBadd dataset\fR subcommand. You cannot delegate a dataset to one zone and the children of the same dataset to another zone. The zone administrator can change properties of the dataset or any of its children. However, the \fBquota\fR property is controlled by the global administrator. -.sp -.LP -A \fBZFS\fR volume can be added as a device to a non-global zone by using the \fBzonecfg\fR \fBadd device\fR subcommand. However, its physical properties can be modified only by the global administrator. -.sp -.LP -For more information about \fBzonecfg\fR syntax, see \fBzonecfg\fR(1M). -.sp -.LP -After a dataset is delegated to a non-global zone, the \fBzoned\fR property is automatically set. A zoned file system cannot be mounted in the global zone, since the zone administrator might have to set the mount point to an unacceptable value. -.sp -.LP -The global administrator can forcibly clear the \fBzoned\fR property, though this should be done with extreme care. The global administrator should verify that all the mount points are acceptable before clearing the property. +After a dataset is attached to a jail and the \fBjailed\fR property is set, +a jailed file system cannot be mounted outside the jail, since the jail +administrator might have set the mount point to an unacceptable value. .SS "Native Properties" .sp .LP -Properties are divided into two types, native properties and user-defined (or "user") properties. Native properties either export internal statistics or control \fBZFS\fR behavior. In addition, native properties are either editable or read-only. User properties have no effect on \fBZFS\fR behavior, but you can use them to annotate datasets in a way that is meaningful in your environment. For more information about user properties, see the "User Properties" section, below. -.sp -.LP -Every dataset has a set of properties that export statistics about the dataset as well as control various behaviors. Properties are inherited from the parent unless overridden by the child. Some properties apply only to certain types of datasets (file systems, volumes, or snapshots). -.sp -.LP -The values of numeric properties can be specified using human-readable suffixes (for example, \fBk\fR, \fBKB\fR, \fBM\fR, \fBGb\fR, and so forth, up to \fBZ\fR for zettabyte). The following are all valid (and equal) specifications: +Properties are divided into two types, native properties and user-defined (or +"user") properties. Native properties either export internal statistics or +control \fBZFS\fR behavior. In addition, native properties are either editable +or read-only. User properties have no effect on \fBZFS\fR behavior, but you can +use them to annotate datasets in a way that is meaningful in your environment. +For more information about user properties, see the "User Properties" section, +below. +.sp +.LP +Every dataset has a set of properties that export statistics about the dataset +as well as control various behaviors. Properties are inherited from the parent +unless overridden by the child. Some properties apply only to certain types of +datasets (file systems, volumes, or snapshots). +.sp +.LP +The values of numeric properties can be specified using human-readable suffixes +(for example, \fBk\fR, \fBKB\fR, \fBM\fR, \fBGb\fR, and so forth, up to \fBZ\fR +for zettabyte). The following are all valid (and equal) specifications: .sp .in +2 .nf @@ -371,37 +427,47 @@ The values of numeric properties can be .sp .LP -The values of non-numeric properties are case sensitive and must be lowercase, except for \fBmountpoint\fR, \fBsharenfs\fR, and \fBsharesmb\fR. +The values of non-numeric properties are case sensitive and must be lowercase, +except for \fBmountpoint\fR, \fBsharenfs\fR, and \fBsharesmb\fR. .sp .LP -The following native properties consist of read-only statistics about the dataset. These properties can be neither set, nor inherited. Native properties apply to all dataset types unless otherwise noted. +The following native properties consist of read-only statistics about the +dataset. These properties can be neither set, nor inherited. Native properties +apply to all dataset types unless otherwise noted. .sp .ne 2 -.mk .na \fB\fBavailable\fR\fR .ad .sp .6 .RS 4n -The amount of space available to the dataset and all its children, assuming that there is no other activity in the pool. Because space is shared within a pool, availability can be limited by any number of factors, including physical pool size, quotas, reservations, or other datasets within the pool. +The amount of space available to the dataset and all its children, assuming +that there is no other activity in the pool. Because space is shared within a +pool, availability can be limited by any number of factors, including physical +pool size, quotas, reservations, or other datasets within the pool. .sp -This property can also be referred to by its shortened column name, \fBavail\fR. +This property can also be referred to by its shortened column name, +\fBavail\fR. .RE .sp .ne 2 -.mk .na \fB\fBcompressratio\fR\fR .ad .sp .6 .RS 4n -For non-snapshots, the compression ratio achieved for the \fBused\fR space of this dataset, expressed as a multiplier. The \fBused\fR property includes descendant datasets, and, for clones, does not include the space shared with the origin snapshot. For snapshots, the \fBcompressratio\fR is the same as the \fBrefcompressratio\fR property. Compression can be turned on by running: \fBzfs set compression=on \fIdataset\fR\fR. The default value is \fBoff\fR. +For non-snapshots, the compression ratio achieved for the \fBused\fR +space of this dataset, expressed as a multiplier. The \fBused\fR +property includes descendant datasets, and, for clones, does not include +the space shared with the origin snapshot. For snapshots, the +\fBcompressratio\fR is the same as the \fBrefcompressratio\fR property. +Compression can be turned on by running: \fBzfs set compression=on +\fIdataset\fR\fR. The default value is \fBoff\fR. .RE .sp .ne 2 -.mk .na \fB\fBcreation\fR\fR .ad @@ -412,64 +478,69 @@ The time this dataset was created. .sp .ne 2 -.mk .na \fB\fBdefer_destroy\fR\fR .ad .sp .6 .RS 4n -This property is \fBon\fR if the snapshot has been marked for deferred destroy by using the \fBzfs destroy\fR \fB-d\fR command. Otherwise, the property is \fBoff\fR. +This property is \fBon\fR if the snapshot has been marked for deferred destroy +by using the \fBzfs destroy\fR \fB-d\fR command. Otherwise, the property is +\fBoff\fR. .RE .sp .ne 2 -.mk .na \fB\fBmounted\fR\fR .ad .sp .6 .RS 4n -For file systems, indicates whether the file system is currently mounted. This property can be either \fByes\fR or \fBno\fR. +For file systems, indicates whether the file system is currently mounted. This +property can be either \fByes\fR or \fBno\fR. .RE .sp .ne 2 -.mk .na \fB\fBorigin\fR\fR .ad .sp .6 .RS 4n -For cloned file systems or volumes, the snapshot from which the clone was created. The origin cannot be destroyed (even with the \fB-r\fR or \fB-f\fR options) so long as a clone exists. +For cloned file systems or volumes, the snapshot from which the clone was +created. The origin cannot be destroyed (even with the \fB-r\fR or \fB-f\fR +options) so long as a clone exists. .RE .sp .ne 2 -.mk .na \fB\fBreferenced\fR\fR .ad .sp .6 .RS 4n -The amount of data that is accessible by this dataset, which may or may not be shared with other datasets in the pool. When a snapshot or clone is created, it initially references the same amount of space as the file system or snapshot it was created from, since its contents are identical. +The amount of data that is accessible by this dataset, which may or may not be +shared with other datasets in the pool. When a snapshot or clone is created, it +initially references the same amount of space as the file system or snapshot it +was created from, since its contents are identical. .sp -This property can also be referred to by its shortened column name, \fBrefer\fR. +This property can also be referred to by its shortened column name, +\fBrefer\fR. .RE .sp .ne 2 -.mk .na \fB\fBrefcompressratio\fR\fR .ad .sp .6 .RS 4n -The compression ratio achieved for the \fBreferenced\fR space of this dataset, expressed as a multiplier. See also the \fBcompressratio\fR property. +The compression ratio achieved for the \fBreferenced\fR space of this +dataset, expressed as a multiplier. See also the \fBcompressratio\fR +property. .RE .sp .ne 2 -.mk .na \fB\fBtype\fR\fR .ad @@ -480,87 +551,113 @@ The type of dataset: \fBfilesystem\fR, \ .sp .ne 2 -.mk .na \fB\fBused\fR\fR .ad .sp .6 .RS 4n -The amount of space consumed by this dataset and all its descendents. This is the value that is checked against this dataset's quota and reservation. The space used does not include this dataset's reservation, but does take into account the reservations of any descendent datasets. The amount of space that a dataset consumes from its parent, as well as the amount of space that are freed if this dataset is recursively destroyed, is the greater of its space used and its reservation. -.sp -When snapshots (see the "Snapshots" section) are created, their space is initially shared between the snapshot and the file system, and possibly with previous snapshots. As the file system changes, space that was previously shared becomes unique to the snapshot, and counted in the snapshot's space used. Additionally, deleting snapshots can increase the amount of space unique to (and used by) other snapshots. -.sp -The amount of space used, available, or referenced does not take into account pending changes. Pending changes are generally accounted for within a few seconds. Committing a change to a disk using \fBfsync\fR(3c) or \fBO_SYNC\fR does not necessarily guarantee that the space usage information is updated immediately. +The amount of space consumed by this dataset and all its descendents. This is +the value that is checked against this dataset's quota and reservation. The +space used does not include this dataset's reservation, but does take into +account the reservations of any descendent datasets. The amount of space that a +dataset consumes from its parent, as well as the amount of space that are freed +if this dataset is recursively destroyed, is the greater of its space used and +its reservation. +.sp +When snapshots (see the "Snapshots" section) are created, their space is +initially shared between the snapshot and the file system, and possibly with +previous snapshots. As the file system changes, space that was previously +shared becomes unique to the snapshot, and counted in the snapshot's space +used. Additionally, deleting snapshots can increase the amount of space unique +to (and used by) other snapshots. +.sp +The amount of space used, available, or referenced does not take into account +pending changes. Pending changes are generally accounted for within a few +seconds. Committing a change to a disk using \fBfsync\fR(2) or \fBO_SYNC\fR +does not necessarily guarantee that the space usage information is updated +immediately. .RE .sp .ne 2 -.mk .na \fB\fBusedby*\fR\fR .ad .sp .6 .RS 4n -The \fBusedby*\fR properties decompose the \fBused\fR properties into the various reasons that space is used. Specifically, \fBused\fR = \fBusedbychildren\fR + \fBusedbydataset\fR + \fBusedbyrefreservation\fR +, \fBusedbysnapshots\fR. These properties are only available for datasets created on \fBzpool\fR "version 13" pools. +The \fBusedby*\fR properties decompose the \fBused\fR properties into the +various reasons that space is used. Specifically, \fBused\fR = +\fBusedbychildren\fR + \fBusedbydataset\fR + \fBusedbyrefreservation\fR +, +\fBusedbysnapshots\fR. These properties are only available for datasets created +on \fBzpool\fR "version 13" pools. .RE .sp .ne 2 -.mk .na \fB\fBusedbychildren\fR\fR .ad .sp .6 .RS 4n -The amount of space used by children of this dataset, which would be freed if all the dataset's children were destroyed. +The amount of space used by children of this dataset, which would be freed if +all the dataset's children were destroyed. .RE .sp .ne 2 -.mk .na \fB\fBusedbydataset\fR\fR .ad .sp .6 .RS 4n -The amount of space used by this dataset itself, which would be freed if the dataset were destroyed (after first removing any \fBrefreservation\fR and destroying any necessary snapshots or descendents). +The amount of space used by this dataset itself, which would be freed if the +dataset were destroyed (after first removing any \fBrefreservation\fR and +destroying any necessary snapshots or descendents). .RE .sp .ne 2 -.mk .na \fB\fBusedbyrefreservation\fR\fR .ad .sp .6 .RS 4n -The amount of space used by a \fBrefreservation\fR set on this dataset, which would be freed if the \fBrefreservation\fR was removed. +The amount of space used by a \fBrefreservation\fR set on this dataset, which +would be freed if the \fBrefreservation\fR was removed. .RE .sp .ne 2 -.mk .na \fB\fBusedbysnapshots\fR\fR .ad .sp .6 .RS 4n -The amount of space consumed by snapshots of this dataset. In particular, it is the amount of space that would be freed if all of this dataset's snapshots were destroyed. Note that this is not simply the sum of the snapshots' \fBused\fR properties because space can be shared by multiple snapshots. +The amount of space consumed by snapshots of this dataset. In particular, it is +the amount of space that would be freed if all of this dataset's snapshots were +destroyed. Note that this is not simply the sum of the snapshots' \fBused\fR +properties because space can be shared by multiple snapshots. .RE .sp .ne 2 -.mk .na \fB\fBuserused@\fR\fIuser\fR\fR .ad .sp .6 .RS 4n -The amount of space consumed by the specified user in this dataset. Space is charged to the owner of each file, as displayed by \fBls\fR \fB-l\fR. The amount of space charged is displayed by \fBdu\fR and \fBls\fR \fB-s\fR. See the \fBzfs userspace\fR subcommand for more information. -.sp -Unprivileged users can access only their own space usage. The root user, or a user who has been granted the \fBuserused\fR privilege with \fBzfs allow\fR, can access everyone's usage. -.sp -The \fBuserused@\fR... properties are not displayed by \fBzfs get all\fR. The user's name must be appended after the \fB@\fR symbol, using one of the following forms: +The amount of space consumed by the specified user in this dataset. Space is +charged to the owner of each file, as displayed by \fBls\fR \fB-l\fR. The +amount of space charged is displayed by \fBdu\fR and \fBls\fR \fB-s\fR. See the +\fBzfs userspace\fR subcommand for more information. +.sp +Unprivileged users can access only their own space usage. The root user, or a +user who has been granted the \fBuserused\fR privilege with \fBzfs allow\fR, +can access everyone's usage. +.sp +The \fBuserused@\fR... properties are not displayed by \fBzfs get all\fR. The +user's name must be appended after the \fB@\fR symbol, using one of the +following forms: .RS +4 .TP .ie t \(bu @@ -589,218 +686,310 @@ The \fBuserused@\fR... properties are no .sp .ne 2 -.mk .na \fB\fBuserrefs\fR\fR .ad .sp .6 .RS 4n -This property is set to the number of user holds on this snapshot. User holds are set by using the \fBzfs hold\fR command. +This property is set to the number of user holds on this snapshot. User holds +are set by using the \fBzfs hold\fR command. .RE .sp .ne 2 -.mk .na \fB\fBgroupused@\fR\fIgroup\fR\fR .ad .sp .6 .RS 4n -The amount of space consumed by the specified group in this dataset. Space is charged to the group of each file, as displayed by \fBls\fR \fB-l\fR. See the \fBuserused@\fR\fIuser\fR property for more information. -.sp -Unprivileged users can only access their own groups' space usage. The root user, or a user who has been granted the \fBgroupused\fR privilege with \fBzfs allow\fR, can access all groups' usage. +The amount of space consumed by the specified group in this dataset. Space is +charged to the group of each file, as displayed by \fBls\fR \fB-l\fR. See the +\fBuserused@\fR\fIuser\fR property for more information. +.sp +Unprivileged users can only access their own groups' space usage. The root +user, or a user who has been granted the \fBgroupused\fR privilege with \fBzfs +allow\fR, can access all groups' usage. .RE .sp .ne 2 -.mk .na \fB\fBvolblocksize\fR=\fIblocksize\fR\fR .ad .sp .6 .RS 4n -For volumes, specifies the block size of the volume. The \fBblocksize\fR cannot be changed once the volume has been written, so it should be set at volume creation time. The default \fBblocksize\fR for volumes is 8 Kbytes. Any power of 2 from 512 bytes to 128 Kbytes is valid. +For volumes, specifies the block size of the volume. The \fBblocksize\fR cannot +be changed once the volume has been written, so it should be set at volume +creation time. The default \fBblocksize\fR for volumes is 8 Kbytes. Any power +of 2 from 512 bytes to 128 Kbytes is valid. .sp -This property can also be referred to by its shortened column name, \fBvolblock\fR. +This property can also be referred to by its shortened column name, +\fBvolblock\fR. .RE .sp .LP -The following native properties can be used to change the behavior of a \fBZFS\fR dataset. +The following native properties can be used to change the behavior of a +\fBZFS\fR dataset. .sp .ne 2 -.mk .na -\fB\fBaclinherit\fR=\fBdiscard\fR | \fBnoallow\fR | \fBrestricted\fR | \fBpassthrough\fR | \fBpassthrough-x\fR\fR +\fB\fBaclinherit\fR=\fBdiscard\fR | \fBnoallow\fR | \fBrestricted\fR | +\fBpassthrough\fR | \fBpassthrough-x\fR\fR .ad .sp .6 .RS 4n -Controls how \fBACL\fR entries are inherited when files and directories are created. A file system with an \fBaclinherit\fR property of \fBdiscard\fR does not inherit any \fBACL\fR entries. A file system with an \fBaclinherit\fR property value of \fBnoallow\fR only inherits inheritable \fBACL\fR entries that specify "deny" permissions. The property value \fBrestricted\fR (the default) removes the \fBwrite_acl\fR and \fBwrite_owner\fR permissions when the \fBACL\fR entry is inherited. A file system with an \fBaclinherit\fR property value of \fBpassthrough\fR inherits all inheritable \fBACL\fR entries without any modifications made to the \fBACL\fR entries when they are inherited. A file system with an \fBaclinherit\fR property value of \fBpassthrough-x\fR has the same meaning as \fBpassthrough\fR, except that the \fBowner@\fR, \fBgroup@\fR, and \fBeveryone@\fR \fBACE\fRs inherit the execute permission only if the file creation mode also requests the execute bit. +Controls how \fBACL\fR entries are inherited when files and directories are +created. A file system with an \fBaclinherit\fR property of \fBdiscard\fR does +not inherit any \fBACL\fR entries. A file system with an \fBaclinherit\fR +property value of \fBnoallow\fR only inherits inheritable \fBACL\fR entries +that specify "deny" permissions. The property value \fBrestricted\fR (the +default) removes the \fBwrite_acl\fR and \fBwrite_owner\fR permissions when the +\fBACL\fR entry is inherited. A file system with an \fBaclinherit\fR property +value of \fBpassthrough\fR inherits all inheritable \fBACL\fR entries without +any modifications made to the \fBACL\fR entries when they are inherited. A file +system with an \fBaclinherit\fR property value of \fBpassthrough-x\fR has the +same meaning as \fBpassthrough\fR, except that the \fBowner@\fR, \fBgroup@\fR, +and \fBeveryone@\fR \fBACE\fRs inherit the execute permission only if the file +creation mode also requests the execute bit. .sp -When the property value is set to \fBpassthrough\fR, files are created with a mode determined by the inheritable \fBACE\fRs. If no inheritable \fBACE\fRs exist that affect the mode, then the mode is set in accordance to the requested mode from the application. +When the property value is set to \fBpassthrough\fR, files are created with a +mode determined by the inheritable \fBACE\fRs. If no inheritable \fBACE\fRs +exist that affect the mode, then the mode is set in accordance to the requested +mode from the application. .RE .sp .ne 2 -.mk .na \fB\fBaclmode\fR=\fBdiscard\fR | \fBgroupmask\fR | \fBpassthrough\fR\fR .ad .sp .6 .RS 4n -Controls how an \fBACL\fR is modified during \fBchmod\fR(2). A file system with an \fBaclmode\fR property of \fBdiscard\fR (the default) deletes all \fBACL\fR entries that do not represent the mode of the file. An \fBaclmode\fR property of \fBgroupmask\fR reduces permissions granted in all \fBALLOW\fR entries found in the \fBACL\fR such that they are no greater than the group permissions specified by \fBchmod\fR. A file system with an \fBaclmode\fR property of \fBpassthrough\fR indicates that no changes are made to the \fBACL\fR other than creating or updating the necessary \fBACL\fR entries to represent the new mode of the file or directory. +Controls how an \fBACL\fR is modified during \fBchmod\fR(2). A file system with +an \fBaclmode\fR property of \fBdiscard\fR (the default) deletes all \fBACL\fR +entries that do not represent the mode of the file. An \fBaclmode\fR property +of \fBgroupmask\fR reduces permissions granted in all \fBALLOW\fR entries found +in the \fBACL\fR such that they are no greater than the group permissions +specified by \fBchmod\fR. A file system with an \fBaclmode\fR property of +\fBpassthrough\fR indicates that no changes are made to the \fBACL\fR other +than creating or updating the necessary \fBACL\fR entries to +represent the new mode of the file or directory. .RE .sp .ne 2 -.mk .na \fB\fBatime\fR=\fBon\fR | \fBoff\fR\fR .ad .sp .6 .RS 4n -Controls whether the access time for files is updated when they are read. Turning this property off avoids producing write traffic when reading files and can result in significant performance gains, though it might confuse mailers and other similar utilities. The default value is \fBon\fR. +Controls whether the access time for files is updated when they are read. +Turning this property off avoids producing write traffic when reading files and +can result in significant performance gains, though it might confuse mailers +and other similar utilities. The default value is \fBon\fR. .RE .sp .ne 2 -.mk .na \fB\fBcanmount\fR=\fBon\fR | \fBoff\fR | \fBnoauto\fR\fR .ad .sp .6 .RS 4n -If this property is set to \fBoff\fR, the file system cannot be mounted, and is ignored by \fBzfs mount -a\fR. Setting this property to \fBoff\fR is similar to setting the \fBmountpoint\fR property to \fBnone\fR, except that the dataset still has a normal \fBmountpoint\fR property, which can be inherited. Setting this property to \fBoff\fR allows datasets to be used solely as a mechanism to inherit properties. One example of setting \fBcanmount=\fR\fBoff\fR is to have two datasets with the same \fBmountpoint\fR, so that the children of both datasets appear in the same directory, but might have different inherited characteristics. -.sp -When the \fBnoauto\fR option is set, a dataset can only be mounted and unmounted explicitly. The dataset is not mounted automatically when the dataset is created or imported, nor is it mounted by the \fBzfs mount -a\fR command or unmounted by the \fBzfs unmount -a\fR command. +If this property is set to \fBoff\fR, the file system cannot be mounted, and is +ignored by \fBzfs mount -a\fR. Setting this property to \fBoff\fR is similar to +setting the \fBmountpoint\fR property to \fBnone\fR, except that the dataset +still has a normal \fBmountpoint\fR property, which can be inherited. Setting +this property to \fBoff\fR allows datasets to be used solely as a mechanism to +inherit properties. One example of setting \fBcanmount=\fR\fBoff\fR is to have +two datasets with the same \fBmountpoint\fR, so that the children of both +datasets appear in the same directory, but might have different inherited +characteristics. +.sp +When the \fBnoauto\fR option is set, a dataset can only be mounted and +unmounted explicitly. The dataset is not mounted automatically when the dataset +is created or imported, nor is it mounted by the \fBzfs mount -a\fR command or +unmounted by the \fBzfs unmount -a\fR command. .sp This property is not inherited. .RE .sp .ne 2 -.mk .na -\fB\fBchecksum\fR=\fBon\fR | \fBoff\fR | \fBfletcher2,\fR| \fBfletcher4\fR | \fBsha256\fR\fR +\fB\fBchecksum\fR=\fBon\fR | \fBoff\fR | \fBfletcher2,\fR| \fBfletcher4\fR | +\fBsha256\fR\fR .ad .sp .6 .RS 4n -Controls the checksum used to verify data integrity. The default value is \fBon\fR, which automatically selects an appropriate algorithm (currently, \fBfletcher4\fR, but this may change in future releases). The value \fBoff\fR disables integrity checking on user data. Disabling checksums is \fBNOT\fR a recommended practice. +Controls the checksum used to verify data integrity. The default value is +\fBon\fR, which automatically selects an appropriate algorithm (currently, +\fBfletcher4\fR, but this may change in future releases). The value \fBoff\fR +disables integrity checking on user data. Disabling checksums is \fBNOT\fR a +recommended practice. .sp Changing this property affects only newly-written data. .RE .sp .ne 2 -.mk .na -\fB\fBcompression\fR=\fBon\fR | \fBoff\fR | \fBlzjb\fR | \fBgzip\fR | \fBgzip-\fR\fIN\fR\fR +\fB\fBcompression\fR=\fBon\fR | \fBoff\fR | \fBlzjb\fR | \fBgzip\fR | +\fBgzip-\fR\fIN\fR\fR .ad .sp .6 .RS 4n -Controls the compression algorithm used for this dataset. The \fBlzjb\fR compression algorithm is optimized for performance while providing decent data compression. Setting compression to \fBon\fR uses the \fBlzjb\fR compression algorithm. The \fBgzip\fR compression algorithm uses the same compression as the \fBgzip\fR(1) command. You can specify the \fBgzip\fR level by using the value \fBgzip-\fR\fIN\fR where \fIN\fR is an integer from 1 (fastest) to 9 (best compression ratio). Currently, \fBgzip\fR is equivalent to \fBgzip-6\fR (which is also the default for \fBgzip\fR(1)). +Controls the compression algorithm used for this dataset. The \fBlzjb\fR +compression algorithm is optimized for performance while providing decent data +compression. Setting compression to \fBon\fR uses the \fBlzjb\fR compression +algorithm. The \fBgzip\fR compression algorithm uses the same compression as +the \fBgzip\fR(1) command. You can specify the \fBgzip\fR level by using the +value \fBgzip-\fR\fIN\fR where \fIN\fR is an integer from 1 (fastest) to 9 +(best compression ratio). Currently, \fBgzip\fR is equivalent to \fBgzip-6\fR +(which is also the default for \fBgzip\fR(1)). .sp -This property can also be referred to by its shortened column name \fBcompress\fR. Changing this property affects only newly-written data. +This property can also be referred to by its shortened column name +\fBcompress\fR. Changing this property affects only newly-written data. .RE .sp .ne 2 -.mk .na \fB\fBcopies\fR=\fB1\fR | \fB2\fR | \fB3\fR\fR .ad .sp .6 .RS 4n -Controls the number of copies of data stored for this dataset. These copies are in addition to any redundancy provided by the pool, for example, mirroring or RAID-Z. The copies are stored on different disks, if possible. The space used by multiple copies is charged to the associated file and dataset, changing the \fBused\fR property and counting against quotas and reservations. -.sp -Changing this property only affects newly-written data. Therefore, set this property at file system creation time by using the \fB-o\fR \fBcopies=\fR\fIN\fR option. +Controls the number of copies of data stored for this dataset. These copies are +in addition to any redundancy provided by the pool, for example, mirroring or +RAID-Z. The copies are stored on different disks, if possible. The space used +by multiple copies is charged to the associated file and dataset, changing the +\fBused\fR property and counting against quotas and reservations. +.sp +Changing this property only affects newly-written data. Therefore, set this +property at file system creation time by using the \fB-o\fR +\fBcopies=\fR\fIN\fR option. .RE .sp .ne 2 -.mk .na \fB\fBdevices\fR=\fBon\fR | \fBoff\fR\fR .ad .sp .6 .RS 4n -Controls whether device nodes can be opened on this file system. The default value is \fBon\fR. +Controls whether device nodes can be opened on this file system. The default +value is \fBon\fR. .RE .sp .ne 2 -.mk .na \fB\fBexec\fR=\fBon\fR | \fBoff\fR\fR .ad .sp .6 .RS 4n -Controls whether processes can be executed from within this file system. The default value is \fBon\fR. +Controls whether processes can be executed from within this file system. The +default value is \fBon\fR. +.RE + +.sp +.ne 2 +.na +\fB\fBjailed\fR=\fBon\fR | \fBoff\fR\fR +.ad +.sp .6 +.RS 4n +Controls whether the dataset is managed from within a jail. See the "Jails" +section for more information. The default value is \fBoff\fR. .RE .sp .ne 2 -.mk .na \fB\fBmountpoint\fR=\fIpath\fR | \fBnone\fR | \fBlegacy\fR\fR .ad .sp .6 .RS 4n -Controls the mount point used for this file system. See the "Mount Points" section for more information on how this property is used. +Controls the mount point used for this file system. See the "Mount Points" +section for more information on how this property is used. .sp -When the \fBmountpoint\fR property is changed for a file system, the file system and any children that inherit the mount point are unmounted. If the new value is \fBlegacy\fR, then they remain unmounted. Otherwise, they are automatically remounted in the new location if the property was previously \fBlegacy\fR or \fBnone\fR, or if they were mounted before the property was changed. In addition, any shared file systems are unshared and shared in the new location. +When the \fBmountpoint\fR property is changed for a file system, the file +system and any children that inherit the mount point are unmounted. If the new +value is \fBlegacy\fR, then they remain unmounted. Otherwise, they are +automatically remounted in the new location if the property was previously +\fBlegacy\fR or \fBnone\fR, or if they were mounted before the property was +changed. In addition, any shared file systems are unshared and shared in the +new location. .RE .sp .ne 2 -.mk .na \fB\fBnbmand\fR=\fBon\fR | \fBoff\fR\fR .ad .sp .6 .RS 4n -Controls whether the file system should be mounted with \fBnbmand\fR (Non Blocking mandatory locks). This is used for \fBCIFS\fR clients. Changes to this property only take effect when the file system is umounted and remounted. See \fBmount\fR(1M) for more information on \fBnbmand\fR mounts. +Controls whether the file system should be mounted with \fBnbmand\fR (Non +Blocking mandatory locks). This is used for \fBCIFS\fR clients. Changes to this +property only take effect when the file system is umounted and remounted. See +\fBmount\fR(8) for more information on \fBnbmand\fR mounts. .RE .sp .ne 2 -.mk .na \fB\fBprimarycache\fR=\fBall\fR | \fBnone\fR | \fBmetadata\fR\fR .ad .sp .6 .RS 4n -Controls what is cached in the primary cache (ARC). If this property is set to \fBall\fR, then both user data and metadata is cached. If this property is set to \fBnone\fR, then neither user data nor metadata is cached. If this property is set to \fBmetadata\fR, then only metadata is cached. The default value is \fBall\fR. +Controls what is cached in the primary cache (ARC). If this property is set to +\fBall\fR, then both user data and metadata is cached. If this property is set +to \fBnone\fR, then neither user data nor metadata is cached. If this property +is set to \fBmetadata\fR, then only metadata is cached. The default value is +\fBall\fR. .RE .sp .ne 2 -.mk .na \fB\fBquota\fR=\fIsize\fR | \fBnone\fR\fR .ad .sp .6 .RS 4n -Limits the amount of space a dataset and its descendents can consume. This property enforces a hard limit on the amount of space used. This includes all space consumed by descendents, including file systems and snapshots. Setting a quota on a descendent of a dataset that already has a quota does not override the ancestor's quota, but rather imposes an additional limit. +Limits the amount of space a dataset and its descendents can consume. This +property enforces a hard limit on the amount of space used. This includes all +space consumed by descendents, including file systems and snapshots. Setting a +quota on a descendent of a dataset that already has a quota does not override +the ancestor's quota, but rather imposes an additional limit. .sp -Quotas cannot be set on volumes, as the \fBvolsize\fR property acts as an implicit quota. +Quotas cannot be set on volumes, as the \fBvolsize\fR property acts as an +implicit quota. .RE .sp .ne 2 -.mk .na \fB\fBuserquota@\fR\fIuser\fR=\fIsize\fR | \fBnone\fR\fR .ad .sp .6 .RS 4n -Limits the amount of space consumed by the specified user. User space consumption is identified by the \fBuserspace@\fR\fIuser\fR property. +Limits the amount of space consumed by the specified user. User space +consumption is identified by the \fBuserspace@\fR\fIuser\fR property. .sp -Enforcement of user quotas may be delayed by several seconds. This delay means that a user might exceed their quota before the system notices that they are over quota and begins to refuse additional writes with the \fBEDQUOT\fR error message . See the \fBzfs userspace\fR subcommand for more information. -.sp -Unprivileged users can only access their own groups' space usage. The root user, or a user who has been granted the \fBuserquota\fR privilege with \fBzfs allow\fR, can get and set everyone's quota. -.sp -This property is not available on volumes, on file systems before version 4, or on pools before version 15. The \fBuserquota@\fR... properties are not displayed by \fBzfs get all\fR. The user's name must be appended after the \fB@\fR symbol, using one of the following forms: +Enforcement of user quotas may be delayed by several seconds. This delay means +that a user might exceed their quota before the system notices that they are +over quota and begins to refuse additional writes with the \fBEDQUOT\fR error +message . See the \fBzfs userspace\fR subcommand for more information. +.sp +Unprivileged users can only access their own groups' space usage. The root +user, or a user who has been granted the \fBuserquota\fR privilege with \fBzfs +allow\fR, can get and set everyone's quota. +.sp +This property is not available on volumes, on file systems before version 4, or +on pools before version 15. The \fBuserquota@\fR... properties are not +displayed by \fBzfs get all\fR. The user's name must be appended after the +\fB@\fR symbol, using one of the following forms: .RS +4 .TP .ie t \(bu @@ -829,20 +1018,21 @@ This property is not available on volume .sp .ne 2 -.mk .na \fB\fBgroupquota@\fR\fIgroup\fR=\fIsize\fR | \fBnone\fR\fR .ad .sp .6 .RS 4n -Limits the amount of space consumed by the specified group. Group space consumption is identified by the \fBuserquota@\fR\fIuser\fR property. +Limits the amount of space consumed by the specified group. Group space +consumption is identified by the \fBuserquota@\fR\fIuser\fR property. .sp -Unprivileged users can access only their own groups' space usage. The root user, or a user who has been granted the \fBgroupquota\fR privilege with \fBzfs allow\fR, can get and set all groups' quotas. +Unprivileged users can access only their own groups' space usage. The root +user, or a user who has been granted the \fBgroupquota\fR privilege with \fBzfs +allow\fR, can get and set all groups' quotas. .RE .sp .ne 2 -.mk .na \fB\fBreadonly\fR=\fBon\fR | \fBoff\fR\fR .ad @@ -850,269 +1040,300 @@ Unprivileged users can access only their .RS 4n Controls whether this dataset can be modified. The default value is \fBoff\fR. .sp -This property can also be referred to by its shortened column name, \fBrdonly\fR. +This property can also be referred to by its shortened column name, +\fBrdonly\fR. .RE .sp .ne 2 -.mk .na \fB\fBrecordsize\fR=\fIsize\fR\fR .ad .sp .6 .RS 4n -Specifies a suggested block size for files in the file system. This property is designed solely for use with database workloads that access files in fixed-size records. \fBZFS\fR automatically tunes block sizes according to internal algorithms optimized for typical access patterns. +Specifies a suggested block size for files in the file system. This property is +designed solely for use with database workloads that access files in fixed-size +records. \fBZFS\fR automatically tunes block sizes according to internal +algorithms optimized for typical access patterns. +.sp +For databases that create very large files but access them in small random +chunks, these algorithms may be suboptimal. Specifying a \fBrecordsize\fR +greater than or equal to the record size of the database can result in +significant performance gains. Use of this property for general purpose file +systems is strongly discouraged, and may adversely affect performance. .sp -For databases that create very large files but access them in small random chunks, these algorithms may be suboptimal. Specifying a \fBrecordsize\fR greater than or equal to the record size of the database can result in significant performance gains. Use of this property for general purpose file systems is strongly discouraged, and may adversely affect performance. +The size specified must be a power of two greater than or equal to 512 and less +than or equal to 128 Kbytes. .sp -The size specified must be a power of two greater than or equal to 512 and less than or equal to 128 Kbytes. +Changing the file system's \fBrecordsize\fR affects only files created +afterward; existing files are unaffected. .sp -Changing the file system's \fBrecordsize\fR affects only files created afterward; existing files are unaffected. -.sp *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Fri Nov 18 13:14:44 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E37CD106564A; Fri, 18 Nov 2011 13:14:44 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id B44258FC08; Fri, 18 Nov 2011 13:14:44 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 37A4646B0A; Fri, 18 Nov 2011 08:14:44 -0500 (EST) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id D009B8A051; Fri, 18 Nov 2011 08:14:43 -0500 (EST) From: John Baldwin To: Sean Bruno Date: Fri, 18 Nov 2011 07:41:47 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p8; KDE/4.5.5; amd64; ; ) References: <201111180104.pAI14P9H040373@svn.freebsd.org> In-Reply-To: <201111180104.pAI14P9H040373@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201111180741.47408.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Fri, 18 Nov 2011 08:14:43 -0500 (EST) Cc: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: Re: svn commit: r227644 - user/sbruno/mfid X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Nov 2011 13:14:45 -0000 On Thursday, November 17, 2011 8:04:25 pm Sean Bruno wrote: > Author: sbruno > Date: Fri Nov 18 01:04:25 2011 > New Revision: 227644 > URL: http://svn.freebsd.org/changeset/base/227644 > > Log: > Add the Yahoo! mfi(4) monitoring utility for review. > > Compiles against amd64 freebsd-current at this time. > > Installs a /usr/sbin/mfid and can be started/stopped via the included > rc script. > > Obtained from: Yahoo! Inc. and jhb@ in a former life Woo, thanks! Two other daemons I worked on at Y! are in p4 at //depot/user/jhb/raid/... that are similar to this but for other controllers. mptd monitors mpt(4) volumes and ard monitors ata-raid volumes (ard also manages rebuilds for ata- raid volumes since those need extra hand-holding). -- John Baldwin From owner-svn-src-user@FreeBSD.ORG Fri Nov 18 17:35:05 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4C121106564A; Fri, 18 Nov 2011 17:35:05 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3B6DE8FC12; Fri, 18 Nov 2011 17:35:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pAIHZ50x088234; Fri, 18 Nov 2011 17:35:05 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pAIHZ5mK088231; Fri, 18 Nov 2011 17:35:05 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201111181735.pAIHZ5mK088231@svn.freebsd.org> From: Sean Bruno Date: Fri, 18 Nov 2011 17:35:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227667 - user/sbruno/mfid X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Nov 2011 17:35:05 -0000 Author: sbruno Date: Fri Nov 18 17:35:04 2011 New Revision: 227667 URL: http://svn.freebsd.org/changeset/base/227667 Log: Update to 2-clause BSD license for maximum compatibility Obtained from: Yahoo! Inc. Suggested by: peter@ Modified: user/sbruno/mfid/mfid.c user/sbruno/mfid/mfid.rc Modified: user/sbruno/mfid/mfid.c ============================================================================== --- user/sbruno/mfid/mfid.c Fri Nov 18 16:54:22 2011 (r227666) +++ user/sbruno/mfid/mfid.c Fri Nov 18 17:35:04 2011 (r227667) @@ -1,30 +1,28 @@ /*- * Copyright (c) 2011 Yahoo! Inc. + * 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. - * 3. Neither the name of Yahoo! Inc. nor the name of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written consent. * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 COPYRIGHT OWNER 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. + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR 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. + * */ #include Modified: user/sbruno/mfid/mfid.rc ============================================================================== --- user/sbruno/mfid/mfid.rc Fri Nov 18 16:54:22 2011 (r227666) +++ user/sbruno/mfid/mfid.rc Fri Nov 18 17:35:04 2011 (r227667) @@ -1,30 +1,28 @@ /*- * Copyright (c) 2011 Yahoo! Inc. + * 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. - * 3. Neither the name of Yahoo! Inc. nor the name of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written consent. * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 COPYRIGHT OWNER 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. + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR 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. + * */ #!/bin/sh From owner-svn-src-user@FreeBSD.ORG Fri Nov 18 17:37:05 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 226F71065678; Fri, 18 Nov 2011 17:37:05 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 116A18FC0C; Fri, 18 Nov 2011 17:37:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pAIHb53I088366; Fri, 18 Nov 2011 17:37:05 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pAIHb5xD088363; Fri, 18 Nov 2011 17:37:05 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201111181737.pAIHb5xD088363@svn.freebsd.org> From: Sean Bruno Date: Fri, 18 Nov 2011 17:37:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227668 - user/sbruno/ard X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Nov 2011 17:37:05 -0000 Author: sbruno Date: Fri Nov 18 17:37:04 2011 New Revision: 227668 URL: http://svn.freebsd.org/changeset/base/227668 Log: Add the Yahoo! ata-raid monitoring daemon for review. Compiles against amd64 freebsd-current at this time. Installs a /usr/sbin/ard and cam be started/stopped via the included rc script. Obtained from: Yahoo! Inc. and jhb@ in a former life Added: user/sbruno/ard/ user/sbruno/ard/Makefile user/sbruno/ard/ard.c user/sbruno/ard/ard.rc (contents, props changed) Added: user/sbruno/ard/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/sbruno/ard/Makefile Fri Nov 18 17:37:04 2011 (r227668) @@ -0,0 +1,9 @@ +PROG= ard +BINDIR= /usr/sbin + +CFLAGS+= -g -Wall -Wunused + +NOMAN= +NO_MAN= + +.include Added: user/sbruno/ard/ard.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/sbruno/ard/ard.c Fri Nov 18 17:37:04 2011 (r227668) @@ -0,0 +1,441 @@ +/*- + * Copyright (c) 2011 Yahoo! Inc. + * 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 AUTHOR 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 AUTHOR 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. + * + */ + +#include +#include +#include +#include +#include +#if __FreeBSD_version >= 600000 +#include +#endif +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#define MAX_UNIT 16 + +#define VOLUME_DEGRADED(status) ((status) != AR_READY) + +#if __FreeBSD_version < 600000 +#define ata_ioc_raid_status raid_status +#endif + +struct ata_volume { + struct ata_ioc_raid_status status; + int present; + int generation; + int prev_status; + int unit; + int sentcnt; + int missing_drives; + int disks[16]; +}; + +static struct ata_volume volumes[MAX_UNIT]; +static int fd, generation; + +static char hostname[MAXHOSTNAMELEN]; +static char *mailto = "root@localhost"; +static int notifyminutes = 720; /* send mail every 12 hours by default */ +static int dostdout; + +static int +ataraid_fetch_status(int unit, struct ata_ioc_raid_status *status) +{ +#if __FreeBSD_version < 600000 + struct ata_cmd cmd; + int retval; + + bzero(&cmd, sizeof(cmd)); + cmd.channel = unit; + cmd.cmd = ATARAIDSTATUS; + retval = ioctl(fd, IOCATA, &cmd); + if (retval >= 0) + *status = cmd.u.raid_status; + return (retval); +#else + status->lun = unit; + return (ioctl(fd, IOCATARAIDSTATUS, status)); +#endif +} + +static void +ataraid_scan_volume(int unit) +{ + struct ata_volume *vol; + int i, status; + + vol = &volumes[unit]; + status = vol->status.status; + if (ataraid_fetch_status(unit, &vol->status) < 0) { + vol->present = 0; + return; + } + vol->generation = generation; + vol->missing_drives = 0; + for (i = 0; i < vol->status.total_disks; i++) + if (vol->status.disks[i].lun < 0) + vol->missing_drives++; + + /* New volume arrived. */ + if (!vol->present) { + vol->present = 1; + vol->prev_status = AR_READY; + for (i = 0; i < 16; i++) + vol->disks[i] = vol->status.disks[i].lun; + return; + } + + /* See if any of the present disks differ. */ + for (i = 0; i < vol->status.total_disks; i++) { + if (vol->status.disks[i].lun < 0 || vol->disks[i] < 0) + continue; + if (vol->status.disks[i].lun != vol->disks[i]) { + /* Treat it as a new volume. */ + vol->prev_status = AR_READY; + for (i = 0; i < 16; i++) + vol->disks[i] = vol->status.disks[i].lun; + return; + } + } + + /* + * Copy over disks but don't replace a valid disk number with + * a missing disk so we remember what disk is missing. + */ + vol->prev_status = status; + for (i = 0; i < vol->status.total_disks; i++) { + if (vol->status.disks[i].lun < 0) + continue; + vol->disks[i] = vol->status.disks[i].lun; + } +} + +static void +ataraid_scan_all(void) +{ + int i; + + generation++; + for (i = 0; i < MAX_UNIT; i++) + ataraid_scan_volume(i); +} + +static void +ataraid_rebuild(struct ata_volume *vol) +{ +#if __FreeBSD_version < 600000 + struct ata_cmd cmd; +#else + char buf[32], title[32]; +#endif + int i, failed, spares; + + /* Make sure we have enough spares before trying a rebuild. */ + failed = 0; + spares = 0; + for (i = 0; i < vol->status.total_disks; i++) { + if (vol->status.disks[i].state & AR_DISK_ONLINE) + continue; + if (vol->status.disks[i].state & AR_DISK_SPARE) + spares++; + else + failed++; + } + if (dostdout) + printf("found %d failed drives and %d spares for ar%d\n", + failed, spares, vol->unit); + if (spares < failed) + return; + + switch (fork()) { + case 0: + /* Child process does the actual rebuild. */ + setproctitle("rebuilding ar%d", vol->unit); + if (dostdout) + printf("%d: initiating rebuild for ar%d\n", getpid(), + vol->unit); +#if __FreeBSD_version < 600000 + cmd.channel = vol->unit; + cmd.cmd = ATARAIDREBUILD; + ioctl(fd, IOCATA, &cmd); +#else + if (ioctl(fd, IOCATARAIDREBUILD, &vol->unit) >= 0) { + setpriority(PRIO_PROCESS, 0, 20); + snprintf(title, sizeof(title), "dd: rebuilding ar%d", + vol->unit); + snprintf(buf, sizeof(buf), "if=/dev/ar%d", vol->unit); + execl("/bin/dd", title, buf, "of=/dev/null", "bs=1m", + NULL); + } +#endif + exit(0); + default: + break; + } +} + +static int +ataraid_open(void) +{ + int i, nvolumes; + + fd = open("/dev/ata", O_RDWR); + if (fd < 0) + return (0); + generation++; + nvolumes = 0; + for (i = 0; i < MAX_UNIT; i++) { + volumes[i].unit = i; + if (ataraid_fetch_status(i, &volumes[i].status) < 0) + continue; + nvolumes++; + } + + return (nvolumes); +} + +static FILE * +mailer_open(void) +{ + FILE *fp; + + if (dostdout) + fp = stdout; + else + fp = popen("/usr/sbin/sendmail -t", "w"); + fprintf(fp, "To: %s\n", mailto); + return fp; +} + +static void +mailer_close(FILE *fp) +{ + + if (dostdout == 0) + pclose(fp); + else + fflush(fp); +} + +static void +mailer_write(FILE *fp, const char *fmt, ...) +{ + va_list ap; + char *mfmt, *pfmt = NULL; + + pfmt = mfmt = strdup(fmt); + + va_start (ap, fmt); + vfprintf (fp, fmt, ap); + va_end (ap); + + /* XXX: Hack for Subject: */ + if (strncmp(fmt, "Subject: ", 9) == 0) { + char *p; + pfmt += strlen("Subject: "); + if ((p = strchr(pfmt, '\n')) != NULL) + *p = '\0'; + } + + if (dostdout == 0) { + va_start (ap, fmt); + vsyslog(LOG_CRIT, pfmt, ap); + va_end (ap); + } + + if (mfmt) + free(mfmt); +} + +char * +ataraid_show_failed(struct ata_volume *vol) +{ + char *str, *p; + int i, comma = 0, failed; + + failed = 0; + for (i = 0; i < vol->status.total_disks; i++) + if ((vol->status.disks[i].state & (AR_DISK_ONLINE | + AR_DISK_SPARE)) == 0 && vol->disks[i] >= 0) + failed++; + if (failed == 0) + return (NULL); + + str = calloc(failed * 8, sizeof(char)); + if (str == NULL) + return (NULL); + + p = str; + *p++ = '('; + for (i = 0; i < vol->status.total_disks; i++) { + if ((vol->status.disks[i].state & (AR_DISK_ONLINE | + AR_DISK_SPARE)) != 0) + continue; + if (vol->disks[i] >= 0) { + if (comma++) + *p++ = ','; + p += sprintf(p, "ad%d", vol->disks[i]); + } + } + if ((p - str) == 1) { + p += sprintf(p, "none"); + } + *p = ')'; + + return (str); +} + +static void +ataraid_notify_failure(struct ata_volume *vol) +{ + FILE *fp; + int *sentcnt; + char *failed; + + sentcnt = &vol->sentcnt; + if (vol->status.status == vol->prev_status && + ((*sentcnt)++ % notifyminutes) != 0) + return; + *sentcnt = 1; + + failed = ataraid_show_failed(vol); + + fp = mailer_open(); + mailer_write(fp, "Subject: [ATA-RAID ALERT] vol ar%d on %s\n\n", + vol->unit, hostname); + if (!VOLUME_DEGRADED(vol->status.status)) { + mailer_write(fp, + "%s: volume ar%d is rebuilt and no longer has errors\n", + hostname, vol->unit); + } else { + if (vol->status.status == + (AR_READY | AR_DEGRADED | AR_REBUILDING)) + mailer_write(fp, + "%s: rebuilding volume ar%d: %d%% completed\n", + hostname, vol->unit, vol->status.progress); + else if (vol->status.status != (AR_READY | AR_DEGRADED)) + mailer_write(fp, "%s: volume ar%d is lost\n", hostname, + vol->unit); + if (failed) + mailer_write(fp, + "%s: disk(s) on volume ar%d need to be replaced: %s\n", + hostname, vol->unit, failed); + else if (vol->missing_drives) + mailer_write(fp, + "%s: %d disk(s) on volume ar%d need to be replaced\n", + hostname, vol->missing_drives, vol->unit); + else if (vol->status.status == (AR_READY | AR_DEGRADED)) + mailer_write(fp, "%s: volume ar%d is degraded\n", + hostname, vol->unit); + } + + if (failed) + free(failed); + + mailer_close(fp); +} + +static void +ataraid_check_volumes(void) +{ + int i; + + for (i = 0; i < MAX_UNIT; i++) { + if (!volumes[i].present) + continue; + if (volumes[i].status.status == (AR_READY | AR_DEGRADED)) + ataraid_rebuild(&volumes[i]); + if (VOLUME_DEGRADED(volumes[i].status.status) || + VOLUME_DEGRADED(volumes[i].prev_status)) + ataraid_notify_failure(&volumes[i]); + } +} + +static void +usage(void) +{ + fprintf(stderr, "usage: ard [-ds] [-t minutes] [mailto]\n"); + exit(1); +} + +int +main(int ac, char *av[]) +{ + int ch, daemonize = 1; + + while ((ch = getopt(ac, av, "dst:")) != -1) { + switch (ch) { + case 'd': + daemonize = 0; + break; + + case 't': + notifyminutes = atoi(optarg); + break; + + case 's': + dostdout = 1; + break; + case '?': + usage(); + } + } + + av += optind; + ac -= optind; + + if (ac > 1) + usage(); + if (ac == 1) + mailto = av[0]; + + gethostname(hostname, sizeof(hostname)); + + if (daemonize) { + if (daemon(0, 0) < 0) + err(1, "daemon"); + } + + if (ataraid_open() == 0) + return (0); + + for (;;) { + ataraid_scan_all(); + ataraid_check_volumes(); + sleep(60); + } +} Added: user/sbruno/ard/ard.rc ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/sbruno/ard/ard.rc Fri Nov 18 17:37:04 2011 (r227668) @@ -0,0 +1,54 @@ +#!/bin/sh +/*- + * Copyright (c) 2011 Yahoo! Inc. + * 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 AUTHOR 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 AUTHOR 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. + * + */ + +# PROVIDE: ard +# REQUIRE: dumpon root ldconfig devfs syslogd mail +# KEYWORD: nojail noyroot + +. /etc/rc.subr + +name=ard +raid_alert_mailto=${raid_alert_mailto:-"root@localhost"} +start_cmd="ard_start" +stop_cmd="ard_stop" + +ard_start() +{ + if [ -x "/usr/sbin/ard" -a -e "/dev/ata" ]; then + echo "Starting ard." + /usr/sbinard ${raid_alert_mailto} + fi +} + +ard_stop() +{ + killall -9 ard > /dev/null 2>&1 +} + +load_rc_config $name +run_rc_command "$1" From owner-svn-src-user@FreeBSD.ORG Fri Nov 18 17:39:20 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8C613106566B; Fri, 18 Nov 2011 17:39:20 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7B6678FC23; Fri, 18 Nov 2011 17:39:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pAIHdKNR088484; Fri, 18 Nov 2011 17:39:20 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pAIHdKjn088479; Fri, 18 Nov 2011 17:39:20 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201111181739.pAIHdKjn088479@svn.freebsd.org> From: Sean Bruno Date: Fri, 18 Nov 2011 17:39:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227669 - user/sbruno/mptd X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Nov 2011 17:39:20 -0000 Author: sbruno Date: Fri Nov 18 17:39:20 2011 New Revision: 227669 URL: http://svn.freebsd.org/changeset/base/227669 Log: Add the Yahoo! mpt(4) montioring utility for review. Compiles against amd64 freebsd-current at this time. Installs a /usr/sbin/mptd and can be started/stopped via the included rc script. Obtained from: Yahoo! Inc. and jhb@ in a former life Added: user/sbruno/mptd/ user/sbruno/mptd/Makefile user/sbruno/mptd/mpt_cam.c user/sbruno/mptd/mpt_cmd.c user/sbruno/mptd/mptd.c user/sbruno/mptd/mptd.h user/sbruno/mptd/mptd.rc (contents, props changed) Added: user/sbruno/mptd/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/sbruno/mptd/Makefile Fri Nov 18 17:39:20 2011 (r227669) @@ -0,0 +1,12 @@ +PROG= mptd +BINDIR= /usr/sbin + +SRCS= mptd.c mpt_cam.c mpt_cmd.c + +CFLAGS+= -g -Wall -Wunused + +MAN= + +LDADD+= -lcam + +.include Added: user/sbruno/mptd/mpt_cam.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/sbruno/mptd/mpt_cam.c Fri Nov 18 17:39:20 2011 (r227669) @@ -0,0 +1,139 @@ +/*- + * Copyright (c) 2011 Yahoo! Inc. + * 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 AUTHOR 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 AUTHOR 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. + * + */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "mptd.h" + +static int xptfd; + +static int +xpt_open(void) +{ + + if (xptfd == 0) + xptfd = open(XPT_DEVICE, O_RDWR); + return (xptfd); +} + +int +mpt_query_disk(int fd, int unit, U8 VolumeBus, U8 VolumeID, + struct mpt_query_disk *qd) +{ + struct bus_match_pattern *b; + struct periph_match_pattern *p; + struct periph_match_result *r; + union ccb ccb; + size_t bufsize; + int i; + + /* mpt(4) only handles devices on bus 0. */ + if (VolumeBus != 0) + return (ENXIO); + + if (xpt_open() < 0) + return (ENXIO); + + bzero(&ccb, sizeof(ccb)); + + ccb.ccb_h.func_code = XPT_DEV_MATCH; + + bufsize = sizeof(struct dev_match_result) * 5; + ccb.cdm.num_matches = 0; + ccb.cdm.match_buf_len = bufsize; + ccb.cdm.matches = calloc(1, bufsize); + + bufsize = sizeof(struct dev_match_pattern) * 2; + ccb.cdm.num_patterns = 2; + ccb.cdm.pattern_buf_len = bufsize; + ccb.cdm.patterns = calloc(1, bufsize); + + /* Match mptX bus. */ + ccb.cdm.patterns[0].type = DEV_MATCH_BUS; + b = &ccb.cdm.patterns[0].pattern.bus_pattern; + snprintf(b->dev_name, sizeof(b->dev_name), "mpt"); + b->unit_number = unit; + b->flags = BUS_MATCH_NAME | BUS_MATCH_UNIT; + + /* Look for a "da" device at the specified target and lun. */ + ccb.cdm.patterns[1].type = DEV_MATCH_PERIPH; + p = &ccb.cdm.patterns[1].pattern.periph_pattern; + snprintf(p->periph_name, sizeof(p->periph_name), "da"); + p->target_id = VolumeID; + p->flags = PERIPH_MATCH_NAME | PERIPH_MATCH_TARGET; + + if (ioctl(xptfd, CAMIOCOMMAND, &ccb) < 0) { + i = errno; + free(ccb.cdm.matches); + free(ccb.cdm.patterns); + return (i); + } + free(ccb.cdm.patterns); + + if (((ccb.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) || + (ccb.cdm.status != CAM_DEV_MATCH_LAST)) { + warnx("mpt_query_disk got CAM error %#x, CDM error %d\n", + ccb.ccb_h.status, ccb.cdm.status); + free(ccb.cdm.matches); + return (EIO); + } + + /* + * We should have exactly 2 matches, 1 for the bus and 1 for + * the peripheral. + */ + if (ccb.cdm.num_matches != 2) { + warnx("mpt_query_disk got %d matches, expected 2", + ccb.cdm.num_matches); + free(ccb.cdm.matches); + return (EIO); + } + if (ccb.cdm.matches[0].type != DEV_MATCH_BUS || + ccb.cdm.matches[1].type != DEV_MATCH_PERIPH) { + warnx("mpt_query_disk got wrong CAM matches"); + free(ccb.cdm.matches); + return (EIO); + } + + /* Copy out the data. */ + r = &ccb.cdm.matches[1].result.periph_result; + snprintf(qd->devname, sizeof(qd->devname), "%s%d", r->periph_name, + r->unit_number); + free(ccb.cdm.matches); + + return (0); +} Added: user/sbruno/mptd/mpt_cmd.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/sbruno/mptd/mpt_cmd.c Fri Nov 18 17:39:20 2011 (r227669) @@ -0,0 +1,409 @@ +/*- + * Copyright (c) 2011 Yahoo! Inc. + * 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 AUTHOR 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 AUTHOR 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. + * + */ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include "mptd.h" + +static const char *mpt_ioc_status_codes[] = { + "Success", /* 0x0000 */ + "Invalid function", + "Busy", + "Invalid scatter-gather list", + "Internal error", + "Reserved", + "Insufficient resources", + "Invalid field", + "Invalid state", /* 0x0008 */ + "Operation state not supported", + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, /* 0x0010 */ + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, /* 0x0018 */ + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + "Invalid configuration action", /* 0x0020 */ + "Invalid configuration type", + "Invalid configuration page", + "Invalid configuration data", + "No configuration defaults", + "Unable to commit configuration change", + NULL, + NULL, + NULL, /* 0x0028 */ + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, /* 0x0030 */ + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, /* 0x0038 */ + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + "Recovered SCSI error", /* 0x0040 */ + "Invalid SCSI bus", + "Invalid SCSI target ID", + "SCSI device not there", + "SCSI data overrun", + "SCSI data underrun", + "SCSI I/O error", + "SCSI protocol error", + "SCSI task terminated", /* 0x0048 */ + "SCSI residual mismatch", + "SCSI task management failed", + "SCSI I/O controller terminated", + "SCSI external controller terminated", + "EEDP guard error", + "EEDP reference tag error", + "EEDP application tag error", + NULL, /* 0x0050 */ + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, /* 0x0058 */ + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + "SCSI target priority I/O", /* 0x0060 */ + "Invalid SCSI target port", + "Invalid SCSI target I/O index", + "SCSI target aborted", + "No connection retryable", + "No connection", + "FC aborted", + "Invalid FC receive ID", + "FC did invalid", /* 0x0068 */ + "FC node logged out", + "Transfer count mismatch", + "STS data not set", + "FC exchange canceled", + "Data offset error", + "Too much write data", + "IU too short", + "ACK NAK timeout", /* 0x0070 */ + "NAK received", + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, /* 0x0078 */ + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + "LAN device not found", /* 0x0080 */ + "LAN device failure", + "LAN transmit error", + "LAN transmit aborted", + "LAN receive error", + "LAN receive aborted", + "LAN partial packet", + "LAN canceled", + NULL, /* 0x0088 */ + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + "SAS SMP request failed", /* 0x0090 */ + "SAS SMP data overrun", + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + "Inband aborted", /* 0x0098 */ + "No inband connection", + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + "Diagnostic released", /* 0x00A0 */ +}; + +#if 0 +static const char *mpt_raid_action_status_codes[] = { + "Success", + "Invalid action", + "Failure", + "Operation in progress", +}; +#endif + +const char * +mpt_ioc_status(U16 IOCStatus) +{ + static char buffer[16]; + + IOCStatus &= MPI_IOCSTATUS_MASK; + if (IOCStatus < sizeof(mpt_ioc_status_codes) / sizeof(char *) && + mpt_ioc_status_codes[IOCStatus] != NULL) + return (mpt_ioc_status_codes[IOCStatus]); + snprintf(buffer, sizeof(buffer), "Status: 0x%04x", IOCStatus); + return (buffer); +} + +#if 0 +const char * +mpt_raid_status(U16 ActionStatus) +{ + static char buffer[16]; + + if (ActionStatus < sizeof(mpt_raid_action_status_codes) / + sizeof(char *)) + return (mpt_raid_action_status_codes[ActionStatus]); + snprintf(buffer, sizeof(buffer), "Status: 0x%04x", ActionStatus); + return (buffer); +} + +const char * +mpt_raid_level(U8 VolumeType) +{ + static char buf[16]; + + switch (VolumeType) { + case MPI_RAID_VOL_TYPE_IS: + return ("RAID-0"); + case MPI_RAID_VOL_TYPE_IM: + return ("RAID-1"); + case MPI_RAID_VOL_TYPE_IME: + return ("RAID-1E"); + case MPI_RAID_VOL_TYPE_RAID_5: + return ("RAID-5"); + case MPI_RAID_VOL_TYPE_RAID_6: + return ("RAID-6"); + case MPI_RAID_VOL_TYPE_RAID_10: + return ("RAID-10"); + case MPI_RAID_VOL_TYPE_RAID_50: + return ("RAID-50"); + default: + sprintf(buf, "LVL 0x%02x", VolumeType); + return (buf); + } +} +#endif + +const char * +mpt_volume_name(int fd, int unit, U8 VolumeBus, U8 VolumeID) +{ + static struct mpt_query_disk info; + static char buf[16]; + + if (mpt_query_disk(fd, unit, VolumeBus, VolumeID, &info) != 0) { + /* + * We only print out the bus number if it is non-zero + * since mpt(4) only supports devices on bus zero + * anyway. + */ + if (VolumeBus == 0) + snprintf(buf, sizeof(buf), "%d", VolumeID); + else + snprintf(buf, sizeof(buf), "%d:%d", VolumeBus, + VolumeID); + return (buf); + } + return (info.devname); +} + +void * +mpt_read_config_page(int fd, U8 PageType, U8 PageNumber, U32 PageAddress) +{ + struct mpt_cfg_page_req req; + void *buf; + int save_errno; + + bzero(&req, sizeof(req)); + req.header.PageType = PageType; + req.header.PageNumber = PageNumber; + req.page_address = PageAddress; + if (ioctl(fd, MPTIO_READ_CFG_HEADER, &req) < 0) + return (NULL); + if (!IOC_STATUS_SUCCESS(req.ioc_status)) { + warnx("Reading config page header failed: %s", + mpt_ioc_status(req.ioc_status)); + errno = EIO; + return (NULL); + } + req.len = req.header.PageLength * 4; + buf = malloc(req.len); + req.buf = buf; + bcopy(&req.header, buf, sizeof(req.header)); + if (ioctl(fd, MPTIO_READ_CFG_PAGE, &req) < 0) { + save_errno = errno; + free(buf); + errno = save_errno; + return (NULL); + } + if (!IOC_STATUS_SUCCESS(req.ioc_status)) { + warnx("Reading config page failed: %s", + mpt_ioc_status(req.ioc_status)); + free(buf); + errno = EIO; + return (NULL); + } + return (buf); +} + +int +mpt_write_config_page(int fd, void *buf) +{ + CONFIG_PAGE_HEADER *hdr; + struct mpt_cfg_page_req req; + + bzero(&req, sizeof(req)); + req.buf = buf; + hdr = buf; + req.len = hdr->PageLength * 4; + if (ioctl(fd, MPTIO_WRITE_CFG_PAGE, &req) < 0) + return (-1); + if (!IOC_STATUS_SUCCESS(req.ioc_status)) { + warnx("Writing config page failed: %s", + mpt_ioc_status(req.ioc_status)); + errno = EIO; + return (-1); + } + return (0); +} + +#if 0 +int +mpt_raid_action(int fd, U8 Action, U8 VolumeBus, U8 VolumeID, U8 PhysDiskNum, + U32 ActionDataWord, void *buf, int len, RAID_VOL0_STATUS *VolumeStatus, + U32 *ActionData, int datalen, U16 *IOCStatus, U16 *ActionStatus, int write) +{ + struct mpt_raid_action raid_act; + + if (IOCStatus != NULL) + *IOCStatus = MPI_IOCSTATUS_SUCCESS; + if (datalen > sizeof(raid_act.action_data)) { + errno = EINVAL; + return (-1); + } + bzero(&raid_act, sizeof(raid_act)); + raid_act.action = Action; + raid_act.volume_bus = VolumeBus; + raid_act.volume_id = VolumeID; + raid_act.phys_disk_num = PhysDiskNum; + raid_act.action_data_word = ActionDataWord; + if (buf != NULL && len != 0) { + raid_act.buf = buf; + raid_act.len = len; + raid_act.write = write; + } + + if (ioctl(fd, MPTIO_RAID_ACTION, &raid_act) < 0) + return (-1); + + if (!IOC_STATUS_SUCCESS(raid_act.ioc_status)) { + if (IOCStatus != NULL) { + *IOCStatus = raid_act.ioc_status; + return (0); + } + warnx("RAID action failed: %s", + mpt_ioc_status(raid_act.ioc_status)); + errno = EIO; + return (-1); + } + + if (ActionStatus != NULL) + *ActionStatus = raid_act.action_status; + if (raid_act.action_status != MPI_RAID_ACTION_ASTATUS_SUCCESS) { + if (ActionStatus != NULL) + return (0); + warnx("RAID action failed: %s", + mpt_raid_status(raid_act.action_status)); + errno = EIO; + return (-1); + } + + if (VolumeStatus != NULL) + *((U32 *)VolumeStatus) = raid_act.volume_status; + if (ActionData != NULL) + bcopy(raid_act.action_data, ActionData, datalen); + return (0); +} +#endif Added: user/sbruno/mptd/mptd.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/sbruno/mptd/mptd.c Fri Nov 18 17:39:20 2011 (r227669) @@ -0,0 +1,871 @@ +/*- + * Copyright (c) 2011 Yahoo! Inc. + * 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 AUTHOR 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 AUTHOR 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. + * + */ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "mptd.h" + +#define MAX_UNIT 16 + +#define DRIVE_FAILED(Status) \ + ((Status).State != MPI_PHYSDISK0_STATUS_ONLINE && \ + (Status).State != MPI_PHYSDISK0_STATUS_MISSING && \ + (Status).State != MPI_PHYSDISK0_STATUS_NOT_COMPATIBLE && \ + (Status).State != MPI_PHYSDISK0_STATUS_INITIALIZING) + +#define DRIVE_MISSING(Status) \ + ((Status).State == MPI_PHYSDISK0_STATUS_MISSING) + +#define DRIVE_REBUILDING(Status) \ + ((Status).State == MPI_PHYSDISK0_STATUS_ONLINE && \ + ((Status).Flags & MPI_PHYSDISK0_STATUS_FLAG_OUT_OF_SYNC)) + +#define VOLUME_DEGRADED(Status) \ + ((Status.State) != MPI_RAIDVOL0_STATUS_STATE_OPTIMAL) + +static char hostname[MAXHOSTNAMELEN]; +static char *mailto = "root@localhost"; +static int notifyminutes = 720; /* send mail every 12 hours by default */ +static int dostdout; + +/* Maximum target_id and device_id of volumes and drives, respectively. */ +#define MPT_MAX_VOL_ID 65536 +#define MPT_MAX_PD_ID 256 + +struct mpt_physdisk { + uint32_t generation; + U8 PhysDiskBus; + U8 PhysDiskID; + U8 PhysDiskNum; + RAID_PHYS_DISK0_STATUS Status; + uint8_t spare; +}; + +struct mpt_volume { + CONFIG_PAGE_RAID_VOL_0 *config; + RAID_VOL0_STATUS prev_status; + int sentcnt; + uint32_t generation; + U8 VolumeBus; + U8 VolumeID; + int missing_drives; + int prev_missing_drives; +}; + +struct mpt_controller { + int fd; + int unit; + uint32_t generation; + int missing_drives; + int prev_missing_drives; + int bad_drives; + int prev_bad_drives; + int sentcnt; + struct mpt_volume *volumes[MPT_MAX_VOL_ID]; + struct mpt_physdisk *physdisks[MPT_MAX_PD_ID]; +}; + +static struct mpt_controller controllers[MAX_UNIT]; +static int ncontrollers; + +static int +mpt_drive_location(char *p, struct mpt_physdisk *pd) +{ + + return (sprintf(p, "bus %d id %d", pd->PhysDiskBus, pd->PhysDiskID)); +} + +static void +mpt_scan_drive(struct mpt_controller *c, U8 PhysDiskNum, struct mpt_volume *v) +{ + CONFIG_PAGE_RAID_PHYS_DISK_0 *info; + struct mpt_physdisk *pd; + + info = mpt_pd_info(c->fd, PhysDiskNum); + if (info == NULL) { + warn("mpt%d:disk%d: failed to fetch disk info", c->unit, + PhysDiskNum); + return; + } + + /* See if we have seen this drive before. */ + pd = c->physdisks[PhysDiskNum]; + if (pd == NULL) { + pd = calloc(1, sizeof(struct mpt_physdisk)); + pd->PhysDiskNum = PhysDiskNum; + c->physdisks[PhysDiskNum] = pd; + pd->PhysDiskBus = info->PhysDiskBus; + pd->PhysDiskID = info->PhysDiskID; + } + + /* Update generation count and other state. */ + pd->generation = c->generation; + pd->Status = info->PhysDiskStatus; + pd->spare = (info->PhysDiskSettings.HotSparePool != 0); + if (DRIVE_MISSING(info->PhysDiskStatus)) { + if (v != NULL) + v->missing_drives++; + else + c->missing_drives++; + } + free(info); +} + +static void +mpt_scan_volume(struct mpt_controller *c, CONFIG_PAGE_IOC_2_RAID_VOL *vol) +{ + CONFIG_PAGE_RAID_VOL_0 *info; + RAID_VOL0_PHYS_DISK *disk; + struct mpt_volume *v; + int i; + + info = mpt_vol_info(c->fd, vol->VolumeBus, vol->VolumeID); + if (info == NULL) { + warn("mpt%d:%d:%d: failed to fetch volume info", c->unit, + vol->VolumeBus, vol->VolumeID); + return; + } + + /* See if we have seen this drive before. */ + v = c->volumes[vol->VolumeBus * 256 + vol->VolumeID]; + if (v == NULL) { + v = calloc(1, sizeof(struct mpt_volume)); + v->VolumeBus = vol->VolumeBus; + v->VolumeID = vol->VolumeID; + c->volumes[v->VolumeBus * 256 + vol->VolumeID] = v; + + v->prev_status = info->VolumeStatus; + } else { + v->prev_status = v->config->VolumeStatus; + free(v->config); + } + + /* Update generation count and other state. */ + v->generation = c->generation; + v->config = info; + + /* Scan all the drives this volume spans. */ + v->prev_missing_drives = v->missing_drives; + v->missing_drives = 0; + disk = info->PhysDisk; + for (i = 0; i < info->NumPhysDisks; disk++, i++) + mpt_scan_drive(c, disk->PhysDiskNum, v); +} + +static void +mpt_scan_volumes(struct mpt_controller *c) +{ + CONFIG_PAGE_IOC_2 *ioc2; + CONFIG_PAGE_IOC_2_RAID_VOL *vol; + struct mpt_volume *mv; + int i; + + /* Get the volume list from the controller. */ + ioc2 = mpt_read_ioc_page(c->fd, 2); + if (ioc2 == NULL) { + warn("mpt%d: Failed to get volume list", c->unit); + return; + } + + /* Scan all the volumes. */ + vol = ioc2->RaidVolume; + for (i = 0; i < ioc2->NumActiveVolumes; vol++, i++) { + mpt_scan_volume(c, vol); + } + + /* Throw away all the volumes that disappeared. */ + for (i = 0; i < MPT_MAX_VOL_ID; i++) { + mv = c->volumes[i]; + if (mv == NULL) + continue; + if (mv->generation != c->generation) { + c->volumes[i] = NULL; + free(mv); + } + } + free(ioc2); +} + +static void +mpt_scan_drives(struct mpt_controller *c) +{ + CONFIG_PAGE_IOC_5 *ioc5; + IOC_5_HOT_SPARE *spare; + struct mpt_physdisk *pd; + int i; + + /* + * Drives from active volumes are scanned when the volumes are + * scanned. The only thing left for us to look at are the + * spare drives. + */ + ioc5 = mpt_read_ioc_page(c->fd, 5); + if (ioc5 == NULL) { + warn("mpt%d: Failed to get spare drive list", c->unit); + return; + } + + /* Scan all the spares. */ + c->prev_missing_drives = c->missing_drives; + c->missing_drives = 0; + spare = ioc5->HotSpare; + for (i = 0; i < ioc5->NumHotSpares; spare++, i++) + mpt_scan_drive(c, spare->PhysDiskNum, NULL); + free(ioc5); + + /* + * If a drive fails when there is a hot spare, the failing + * drive swaps places with the hot spare. In this case, the + * failed drive won't be associated with a volume, so we track + * them via a controller-wide bad drives count. + */ + c->prev_bad_drives = c->bad_drives; + c->bad_drives = 0; + for (i = 0; i < MPT_MAX_PD_ID; i++) { + if (c->physdisks[i] == NULL) + continue; + if (!DRIVE_FAILED(c->physdisks[i]->Status)) + continue; + if (!c->physdisks[i]->spare) + continue; + c->bad_drives++; + } + + /* Throw away all the drives that disappeared. */ + for (i = 0; i < MPT_MAX_PD_ID; i++) { + pd = c->physdisks[i]; + if (pd == NULL) + continue; + if (pd->generation != c->generation) { + c->physdisks[i] = NULL; + free(pd); + } + } +} + +static void +mpt_scan_controller(struct mpt_controller *c) +{ + + /* Bump the overall generation count. */ + c->generation++; + + mpt_scan_volumes(c); + mpt_scan_drives(c); +} + +static void +mpt_scan_all(void) +{ + int i; + + for (i = 0; i < ncontrollers; i++) + mpt_scan_controller(&controllers[i]); +} + +static int +mpt_open(void) +{ + CONFIG_PAGE_IOC_2 *ioc2; + char path[MAXPATHLEN]; + int fd, unit; + + ncontrollers = 0; + for (unit = 0; unit < MAX_UNIT; unit++) { + snprintf(path, sizeof(path), "/dev/mpt%d", unit); + fd = open(path, O_RDWR); + if (fd < 0) + continue; + + /* + * Don't bother monitoring controllers that don't + * support RAID volumes. The emulated mpt(4) + * controllers in VMWare crash the VM when queried for + * a list of hot spare drives via IOC page 5, so this + * test lets us avoid them altogether. + */ + ioc2 = mpt_read_ioc_page(fd, 2); + if (ioc2 == NULL || ioc2->MaxPhysDisks == 0) { + if (ioc2) + free(ioc2); + close(fd); + continue; + } + free(ioc2); + controllers[ncontrollers].fd = fd; + controllers[ncontrollers].unit = unit; + ncontrollers++; + } + if (ncontrollers == 0) + return (ncontrollers); + + mpt_scan_all(); + + return (ncontrollers); +} + +static FILE * +mailer_open(void) +{ + FILE *fp; + + if (dostdout) + fp = stdout; + else + fp = popen("/usr/sbin/sendmail -t", "w"); + fprintf(fp, "To: %s\n", mailto); + return fp; +} + +static void +mailer_close(FILE *fp) +{ + + if (dostdout == 0) + pclose(fp); + else + fflush(fp); +} + +static void +mailer_write(FILE *fp, const char *fmt, ...) +{ + va_list ap; + char *mfmt, *pfmt = NULL; + + pfmt = mfmt = strdup(fmt); + + va_start (ap, fmt); + vfprintf (fp, fmt, ap); + va_end (ap); + + /* XXX: Hack for Subject: */ + if (strncmp(fmt, "Subject: ", 9) == 0) { + char *p; + pfmt += strlen("Subject: "); + if ((p = strchr(pfmt, '\n')) != NULL) + *p = '\0'; + } + + if (dostdout == 0) { + va_start (ap, fmt); + vsyslog(LOG_CRIT, pfmt, ap); + va_end (ap); + } + + if (mfmt) + free(mfmt); +} + +/* Look for any failed disks in this volume. */ +char * +mpt_show_failed(struct mpt_controller *c, struct mpt_volume *v) +{ + RAID_VOL0_PHYS_DISK *disk; + struct mpt_physdisk *pd; + int i, comma = 0, instate; + char *str, *p; + + instate = 0; + disk = v->config->PhysDisk; + for (i = 0; i < v->config->NumPhysDisks; disk++, i++) { + pd = c->physdisks[disk->PhysDiskNum]; + if (pd == NULL) + continue; + if (DRIVE_FAILED(pd->Status)) + instate++; + } + + if (instate == 0) + return (NULL); + + str = calloc(instate * 64, sizeof(char)); + if (str == NULL) + return (NULL); + + p = str; + *p++ = '('; + + disk = v->config->PhysDisk; + for (i = 0; i < v->config->NumPhysDisks; disk++, i++) { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Fri Nov 18 18:18:09 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 30357106566B; Fri, 18 Nov 2011 18:18:09 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 071878FC08; Fri, 18 Nov 2011 18:18:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pAIII8bn090307; Fri, 18 Nov 2011 18:18:08 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pAIII8do090306; Fri, 18 Nov 2011 18:18:08 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201111181818.pAIII8do090306@svn.freebsd.org> From: Sean Bruno Date: Fri, 18 Nov 2011 18:18:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227670 - user/sbruno/firewire_test X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Nov 2011 18:18:09 -0000 Author: sbruno Date: Fri Nov 18 18:18:08 2011 New Revision: 227670 URL: http://svn.freebsd.org/changeset/base/227670 Log: Branch the firewire code for a bit to overhaul fwohci init routines. Added: - copied from r227669, head/sys/dev/firewire/ Directory Properties: user/sbruno/firewire_test/ (props changed) From owner-svn-src-user@FreeBSD.ORG Fri Nov 18 19:10:57 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 134A7106564A; Fri, 18 Nov 2011 19:10:57 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DE7BD8FC1F; Fri, 18 Nov 2011 19:10:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pAIJAu2h092680; Fri, 18 Nov 2011 19:10:56 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pAIJAujb092679; Fri, 18 Nov 2011 19:10:56 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201111181910.pAIJAujb092679@svn.freebsd.org> From: Sean Bruno Date: Fri, 18 Nov 2011 19:10:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227672 - user/sbruno/firewire_test X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Nov 2011 19:10:57 -0000 Author: sbruno Date: Fri Nov 18 19:10:56 2011 New Revision: 227672 URL: http://svn.freebsd.org/changeset/base/227672 Log: Delete such that I can try again Deleted: user/sbruno/firewire_test/ From owner-svn-src-user@FreeBSD.ORG Fri Nov 18 19:12:12 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 78768106566B; Fri, 18 Nov 2011 19:12:12 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4F9A38FC15; Fri, 18 Nov 2011 19:12:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pAIJCCbZ092784; Fri, 18 Nov 2011 19:12:12 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pAIJCCAp092783; Fri, 18 Nov 2011 19:12:12 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201111181912.pAIJCCAp092783@svn.freebsd.org> From: Sean Bruno Date: Fri, 18 Nov 2011 19:12:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227673 - user/sbruno/1394dev X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Nov 2011 19:12:12 -0000 Author: sbruno Date: Fri Nov 18 19:12:12 2011 New Revision: 227673 URL: http://svn.freebsd.org/changeset/base/227673 Log: Start with empty dir to play around with module building Added: user/sbruno/1394dev/ From owner-svn-src-user@FreeBSD.ORG Fri Nov 18 19:43:03 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 38F9A1065678; Fri, 18 Nov 2011 19:43:03 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0FFF58FC1B; Fri, 18 Nov 2011 19:43:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pAIJh2b7094188; Fri, 18 Nov 2011 19:43:02 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pAIJh2sM094187; Fri, 18 Nov 2011 19:43:02 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201111181943.pAIJh2sM094187@svn.freebsd.org> From: Sean Bruno Date: Fri, 18 Nov 2011 19:43:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227676 - user/sbruno/1394dev/firewire X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Nov 2011 19:43:03 -0000 Author: sbruno Date: Fri Nov 18 19:43:02 2011 New Revision: 227676 URL: http://svn.freebsd.org/changeset/base/227676 Log: Branch firewire device code for development Added: - copied from r227675, head/sys/dev/firewire/ Directory Properties: user/sbruno/1394dev/firewire/ (props changed)