From owner-svn-src-user@freebsd.org Fri Aug 5 16:53:27 2016 Return-Path: Delivered-To: svn-src-user@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4E117BB093F for ; Fri, 5 Aug 2016 16:53:27 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1B22810CD; Fri, 5 Aug 2016 16:53:27 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u75GrQOL053047; Fri, 5 Aug 2016 16:53:26 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u75GrOhk053028; Fri, 5 Aug 2016 16:53:24 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201608051653.u75GrOhk053028@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Fri, 5 Aug 2016 16:53:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r303775 - in user/alc/PQ_LAUNDRY: sbin/etherswitchcfg sbin/pfctl share/man/man9 sys/amd64/amd64 sys/cddl/compat/opensolaris/sys sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/c... X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.22 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, 05 Aug 2016 16:53:27 -0000 Author: alc Date: Fri Aug 5 16:53:24 2016 New Revision: 303775 URL: https://svnweb.freebsd.org/changeset/base/303775 Log: MFH r303774 Modified: user/alc/PQ_LAUNDRY/sbin/etherswitchcfg/etherswitchcfg.8 user/alc/PQ_LAUNDRY/sbin/etherswitchcfg/etherswitchcfg.c user/alc/PQ_LAUNDRY/sbin/pfctl/parse.y user/alc/PQ_LAUNDRY/sbin/pfctl/pfctl.c user/alc/PQ_LAUNDRY/sbin/pfctl/pfctl_altq.c user/alc/PQ_LAUNDRY/sbin/pfctl/pfctl_optimize.c user/alc/PQ_LAUNDRY/sbin/pfctl/pfctl_osfp.c user/alc/PQ_LAUNDRY/sbin/pfctl/pfctl_parser.c user/alc/PQ_LAUNDRY/share/man/man9/Makefile user/alc/PQ_LAUNDRY/share/man/man9/lock.9 user/alc/PQ_LAUNDRY/sys/amd64/amd64/mem.c user/alc/PQ_LAUNDRY/sys/cddl/compat/opensolaris/sys/vnode.h user/alc/PQ_LAUNDRY/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_dir.h user/alc/PQ_LAUNDRY/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h user/alc/PQ_LAUNDRY/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h user/alc/PQ_LAUNDRY/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c user/alc/PQ_LAUNDRY/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c user/alc/PQ_LAUNDRY/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_sa.c user/alc/PQ_LAUNDRY/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c user/alc/PQ_LAUNDRY/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c user/alc/PQ_LAUNDRY/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c user/alc/PQ_LAUNDRY/sys/compat/freebsd32/freebsd32_syscall.h user/alc/PQ_LAUNDRY/sys/dev/cxgbe/t4_main.c user/alc/PQ_LAUNDRY/sys/dev/cxgbe/tom/t4_ddp.c user/alc/PQ_LAUNDRY/sys/dev/etherswitch/arswitch/arswitch.c user/alc/PQ_LAUNDRY/sys/dev/etherswitch/arswitch/arswitch_8327.c user/alc/PQ_LAUNDRY/sys/dev/etherswitch/arswitch/arswitch_8327.h user/alc/PQ_LAUNDRY/sys/dev/etherswitch/arswitch/arswitchvar.h user/alc/PQ_LAUNDRY/sys/dev/etherswitch/etherswitch.h user/alc/PQ_LAUNDRY/sys/dev/hyperv/vmbus/vmbus_brvar.h user/alc/PQ_LAUNDRY/sys/dev/ioat/ioat.c user/alc/PQ_LAUNDRY/sys/dev/usb/input/ukbd.c user/alc/PQ_LAUNDRY/sys/dev/xen/netfront/netfront.c user/alc/PQ_LAUNDRY/sys/kern/init_sysent.c user/alc/PQ_LAUNDRY/sys/kern/makesyscalls.sh user/alc/PQ_LAUNDRY/sys/kern/syscalls.c user/alc/PQ_LAUNDRY/sys/net/iflib.c user/alc/PQ_LAUNDRY/sys/netinet/tcp_lro.c user/alc/PQ_LAUNDRY/sys/sys/buf.h user/alc/PQ_LAUNDRY/sys/sys/bus.h user/alc/PQ_LAUNDRY/sys/sys/lockmgr.h user/alc/PQ_LAUNDRY/sys/sys/syscall.h user/alc/PQ_LAUNDRY/sys/sys/syscall.mk user/alc/PQ_LAUNDRY/sys/sys/sysproto.h user/alc/PQ_LAUNDRY/sys/vm/vm_pageout.c user/alc/PQ_LAUNDRY/sys/x86/iommu/intel_drv.c Directory Properties: user/alc/PQ_LAUNDRY/ (props changed) user/alc/PQ_LAUNDRY/sys/cddl/contrib/opensolaris/ (props changed) Modified: user/alc/PQ_LAUNDRY/sbin/etherswitchcfg/etherswitchcfg.8 ============================================================================== --- user/alc/PQ_LAUNDRY/sbin/etherswitchcfg/etherswitchcfg.8 Fri Aug 5 16:49:32 2016 (r303774) +++ user/alc/PQ_LAUNDRY/sbin/etherswitchcfg/etherswitchcfg.8 Fri Aug 5 16:53:24 2016 (r303775) @@ -33,26 +33,26 @@ .Sh SYNOPSIS .Nm .Op Fl "f control file" -.Ar info +.Cm info .Nm .Op Fl "f control file" -.Ar config +.Cm config .Ar command parameter .Nm .Op Fl "f control file" -.Ar phy +.Cm phy .Ar phy.register[=value] .Nm .Op Fl "f control file" -.Ar port%d +.Cm port%d .Ar [flags] command parameter .Nm .Op Fl "f control file" -.Ar reg +.Cm reg .Ar register[=value] .Nm .Op Fl "f control file" -.Ar vlangroup%d +.Cm vlangroup%d .Ar command parameter .Sh DESCRIPTION The @@ -81,8 +81,8 @@ The config command provides access to gl parameters. It support the following commands: .Pp -.Bl -tag -width ".Ar vlan_mode mode" -compact -.It Ar vlan_mode mode +.Bl -tag -width ".Cm vlan_mode mode" -compact +.It Cm vlan_mode Ar mode Sets the switch VLAN mode (depends on the hardware). .El .Ss phy @@ -103,51 +103,60 @@ The port command selects one of the port It supports the following commands: .Pp .Bl -tag -width ".Ar pvid number" -compact -.It Ar pvid number +.It Cm pvid Ar number Sets the default port VID that is used to process incoming frames that are not tagged. -.It Ar media mediaspec +.It Cm media Ar mediaspec Specifies the physical media configuration to be configured for a port. -.It Ar mediaopt mediaoption +.It Cm mediaopt Ar mediaoption Specifies a list of media options for a port. See .Xr ifconfig 8 for details on -.Ar media +.Cm media and -.Ar mediaopt . +.Cm mediaopt . +.It Cm led Ar number style +Sets the display style for a given LED. Available styles are: +.Cm default +(usually flash on activity), +.Cm on , +.Cm off , +and +.Cm blink . +Not all switches will support all styles. .El .Pp And the following flags (please note that not all flags are supported by all switch drivers): .Pp -.Bl -tag -width ".Ar addtag" -compact -.It Ar addtag +.Bl -tag -width ".Fl addtag" -compact +.It Cm addtag Add VLAN tag to each packet sent by the port. -.It Ar -addtag +.It Fl addtag Disable the add VLAN tag option. -.It Ar striptag +.It Cm striptag Strip the VLAN tags from the packets sent by the port. -.It Ar -striptag +.It Fl striptag Disable the strip VLAN tag option. -.It Ar firstlock +.It Cm firstlock This options makes the switch port lock on the first MAC address it sees. After that, usually you need to reset the switch to learn different MAC addresses. -.It Ar -firstlock +.It Fl firstlock Disable the first lock option. Note that sometimes you need to reset the switch to really disable this option. -.It Ar dropuntagged +.It Cm dropuntagged Drop packets without a VLAN tag. -.It Ar -dropuntagged +.It Fl dropuntagged Disable the drop untagged packets option. -.It Ar doubletag +.It Cm doubletag Enable QinQ for the port. -.It Ar -doubletag +.It Fl doubletag Disable QinQ for the port. -.It Ar ingress +.It Cm ingress Enable the ingress filter on the port. -.It Ar -ingress +.It Fl ingress Disable the ingress filter. .El .Ss reg @@ -156,14 +165,14 @@ The reg command provides access to the r The vlangroup command selects one of the VLAN groups for configuration. It supports the following commands: .Pp -.Bl -tag -width ".Ar vlangroup" -compact -.It Ar vlan VID +.Bl -tag -width ".Cm members" -compact +.It Cm vlan Ar VID Sets the VLAN ID (802.1q VID) for this VLAN group. Frames transmitted on tagged member ports of this group will be tagged with this VID. Incoming frames carrying this tag will be forwarded according to the configuration of this VLAN group. -.It Ar members port,... +.It Cm members Ar port,... Configures which ports are to be a member of this VLAN group. The port numbers are given as a comma-separated list. Each port can optionally be followed by Modified: user/alc/PQ_LAUNDRY/sbin/etherswitchcfg/etherswitchcfg.c ============================================================================== --- user/alc/PQ_LAUNDRY/sbin/etherswitchcfg/etherswitchcfg.c Fri Aug 5 16:49:32 2016 (r303774) +++ user/alc/PQ_LAUNDRY/sbin/etherswitchcfg/etherswitchcfg.c Fri Aug 5 16:53:24 2016 (r303775) @@ -83,6 +83,8 @@ struct cmds { }; static struct cmds cmds[]; +/* Must match the ETHERSWITCH_PORT_LED_* enum order */ +static const char *ledstyles[] = { "default", "on", "off", "blink", NULL }; /* * Print a value a la the %b format of the kernel's printf. @@ -270,6 +272,38 @@ set_port_mediaopt(struct cfg *cfg, char } static void +set_port_led(struct cfg *cfg, char *argv[]) +{ + etherswitch_port_t p; + int led; + int i; + + bzero(&p, sizeof(p)); + p.es_port = cfg->unit; + if (ioctl(cfg->fd, IOETHERSWITCHGETPORT, &p) != 0) + err(EX_OSERR, "ioctl(IOETHERSWITCHGETPORT)"); + + led = strtol(argv[1], NULL, 0); + if (led < 1 || led > p.es_nleds) + errx(EX_USAGE, "invalid led number %s; must be between 1 and %d", + argv[1], p.es_nleds); + + led--; + + for (i=0; ledstyles[i] != NULL; i++) { + if (strcmp(argv[2], ledstyles[i]) == 0) { + p.es_led[led] = i; + break; + } + } + if (ledstyles[i] == NULL) + errx(EX_USAGE, "invalid led style \"%s\"", argv[2]); + + if (ioctl(cfg->fd, IOETHERSWITCHSETPORT, &p) != 0) + err(EX_OSERR, "ioctl(IOETHERSWITCHSETPORT)"); +} + +static void set_vlangroup_vid(struct cfg *cfg, char *argv[]) { int v; @@ -334,10 +368,10 @@ set_register(struct cfg *cfg, char *arg) if (c==arg) return (1); if (*c == '=') { - v = strtol(c+1, NULL, 0); + v = strtoul(c+1, NULL, 0); write_register(cfg, a, v); } - printf("\treg 0x%04x=0x%04x\n", a, read_register(cfg, a)); + printf("\treg 0x%04x=0x%08x\n", a, read_register(cfg, a)); return (0); } @@ -357,7 +391,7 @@ set_phyregister(struct cfg *cfg, char *a if (d == c) return (1); if (*c == '=') { - val = strtol(c+1, NULL, 0); + val = strtoul(c+1, NULL, 0); write_phyregister(cfg, phy, reg, val); } printf("\treg %d.0x%02x=0x%04x\n", phy, reg, read_phyregister(cfg, phy, reg)); @@ -442,6 +476,13 @@ print_port(struct cfg *cfg, int port) printf("\tpvid: %d\n", p.es_pvid); printb("\tflags", p.es_flags, ETHERSWITCH_PORT_FLAGS_BITS); printf("\n"); + if (p.es_nleds) { + printf("\tled: "); + for (i = 0; i < p.es_nleds; i++) { + printf("%d:%s%s", i+1, ledstyles[p.es_led[i]], (i==p.es_nleds-1)?"":" "); + } + printf("\n"); + } printf("\tmedia: "); print_media_word(p.es_ifmr.ifm_current, 1); if (p.es_ifmr.ifm_active != p.es_ifmr.ifm_current) { @@ -540,7 +581,7 @@ usage(struct cfg *cfg __unused, char *ar "phy.register[=value]\n"); fprintf(stderr, "\tetherswitchcfg [-f control file] portX " "[flags] command parameter\n"); - fprintf(stderr, "\t\tport commands: pvid, media, mediaopt\n"); + fprintf(stderr, "\t\tport commands: pvid, media, mediaopt, led\n"); fprintf(stderr, "\tetherswitchcfg [-f control file] reg " "register[=value]\n"); fprintf(stderr, "\tetherswitchcfg [-f control file] vlangroupX " @@ -651,7 +692,7 @@ main(int argc, char *argv[]) for(i=0; cmds[i].name != NULL; i++) { if (cfg.mode == cmds[i].mode && strcmp(argv[0], cmds[i].name) == 0) { if (argc < (cmds[i].args + 1)) { - printf("%s needs an argument\n", cmds[i].name); + printf("%s needs %d argument%s\n", cmds[i].name, cmds[i].args, (cmds[i].args==1)?"":","); break; } (cmds[i].f)(&cfg, argv); @@ -691,6 +732,7 @@ static struct cmds cmds[] = { { MODE_PORT, "pvid", 1, set_port_vid }, { MODE_PORT, "media", 1, set_port_media }, { MODE_PORT, "mediaopt", 1, set_port_mediaopt }, + { MODE_PORT, "led", 2, set_port_led }, { MODE_PORT, "addtag", 0, set_port_flag }, { MODE_PORT, "-addtag", 0, set_port_flag }, { MODE_PORT, "ingress", 0, set_port_flag }, Modified: user/alc/PQ_LAUNDRY/sbin/pfctl/parse.y ============================================================================== --- user/alc/PQ_LAUNDRY/sbin/pfctl/parse.y Fri Aug 5 16:49:32 2016 (r303774) +++ user/alc/PQ_LAUNDRY/sbin/pfctl/parse.y Fri Aug 5 16:53:24 2016 (r303775) @@ -80,7 +80,7 @@ static int blockpolicy = PFRULE_DROP; static int require_order = 1; static int default_statelock; -TAILQ_HEAD(files, file) files = TAILQ_HEAD_INITIALIZER(files); +static TAILQ_HEAD(files, file) files = TAILQ_HEAD_INITIALIZER(files); static struct file { TAILQ_ENTRY(file) entry; FILE *stream; @@ -100,7 +100,7 @@ int lgetc(int); int lungetc(int); int findeol(void); -TAILQ_HEAD(symhead, sym) symhead = TAILQ_HEAD_INITIALIZER(symhead); +static TAILQ_HEAD(symhead, sym) symhead = TAILQ_HEAD_INITIALIZER(symhead); struct sym { TAILQ_ENTRY(sym) entry; int used; @@ -196,7 +196,7 @@ struct peer { struct node_port *port; }; -struct node_queue { +static struct node_queue { char queue[PF_QNAME_SIZE]; char parent[PF_QNAME_SIZE]; char ifname[IFNAMSIZ]; @@ -210,7 +210,7 @@ struct node_qassign { char *pqname; }; -struct filter_opts { +static struct filter_opts { int marker; #define FOM_FLAGS 0x01 #define FOM_ICMP 0x02 @@ -250,12 +250,12 @@ struct filter_opts { } divert; } filter_opts; -struct antispoof_opts { +static struct antispoof_opts { char *label; u_int rtableid; } antispoof_opts; -struct scrub_opts { +static struct scrub_opts { int marker; #define SOM_MINTTL 0x01 #define SOM_MAXMSS 0x02 @@ -273,7 +273,7 @@ struct scrub_opts { u_int rtableid; } scrub_opts; -struct queue_opts { +static struct queue_opts { int marker; #define QOM_BWSPEC 0x01 #define QOM_SCHEDULER 0x02 @@ -287,13 +287,13 @@ struct queue_opts { int qlimit; } queue_opts; -struct table_opts { +static struct table_opts { int flags; int init_addr; struct node_tinithead init_nodes; } table_opts; -struct pool_opts { +static struct pool_opts { int marker; #define POM_TYPE 0x01 #define POM_STICKYADDRESS 0x02 @@ -304,10 +304,10 @@ struct pool_opts { } pool_opts; -struct codel_opts codel_opts; -struct node_hfsc_opts hfsc_opts; -struct node_fairq_opts fairq_opts; -struct node_state_opt *keep_state_defaults = NULL; +static struct codel_opts codel_opts; +static struct node_hfsc_opts hfsc_opts; +static struct node_fairq_opts fairq_opts; +static struct node_state_opt *keep_state_defaults = NULL; int disallow_table(struct node_host *, const char *); int disallow_urpf_failed(struct node_host *, const char *); @@ -352,7 +352,7 @@ void remove_invalid_hosts(struct node_h int invalid_redirect(struct node_host *, sa_family_t); u_int16_t parseicmpspec(char *, sa_family_t); -TAILQ_HEAD(loadanchorshead, loadanchors) +static TAILQ_HEAD(loadanchorshead, loadanchors) loadanchorshead = TAILQ_HEAD_INITIALIZER(loadanchorshead); struct loadanchors { @@ -4460,6 +4460,16 @@ timeout_spec : STRING NUMBER } free($1); } + | INTERVAL NUMBER { + if (check_rulestate(PFCTL_STATE_OPTION)) + YYERROR; + if ($2 < 0 || $2 > UINT_MAX) { + yyerror("only positive values permitted"); + YYERROR; + } + if (pfctl_set_timeout(pf, "interval", $2, 0) != 0) + YYERROR; + } ; timeout_list : timeout_list comma timeout_spec optnl @@ -5572,10 +5582,10 @@ lookup(char *s) #define MAXPUSHBACK 128 -char *parsebuf; -int parseindex; -char pushback_buffer[MAXPUSHBACK]; -int pushback_index = 0; +static char *parsebuf; +static int parseindex; +static char pushback_buffer[MAXPUSHBACK]; +static int pushback_index = 0; int lgetc(int quotec) Modified: user/alc/PQ_LAUNDRY/sbin/pfctl/pfctl.c ============================================================================== --- user/alc/PQ_LAUNDRY/sbin/pfctl/pfctl.c Fri Aug 5 16:49:32 2016 (r303774) +++ user/alc/PQ_LAUNDRY/sbin/pfctl/pfctl.c Fri Aug 5 16:53:24 2016 (r303775) @@ -102,29 +102,29 @@ int pfctl_load_ruleset(struct pfctl *, int pfctl_load_rule(struct pfctl *, char *, struct pf_rule *, int); const char *pfctl_lookup_option(char *, const char * const *); -struct pf_anchor_global pf_anchors; -struct pf_anchor pf_main_anchor; +static struct pf_anchor_global pf_anchors; +static struct pf_anchor pf_main_anchor; -const char *clearopt; -char *rulesopt; -const char *showopt; -const char *debugopt; -char *anchoropt; -const char *optiopt = NULL; -const char *pf_device = "/dev/pf"; -char *ifaceopt; -char *tableopt; -const char *tblcmdopt; -int src_node_killers; -char *src_node_kill[2]; -int state_killers; -char *state_kill[2]; -int loadopt; -int altqsupport; - -int dev = -1; -int first_title = 1; -int labels = 0; +static const char *clearopt; +static char *rulesopt; +static const char *showopt; +static const char *debugopt; +static char *anchoropt; +static const char *optiopt = NULL; +static const char *pf_device = "/dev/pf"; +static char *ifaceopt; +static char *tableopt; +static const char *tblcmdopt; +static int src_node_killers; +static char *src_node_kill[2]; +static int state_killers; +static char *state_kill[2]; +int loadopt; +int altqsupport; + +int dev = -1; +static int first_title = 1; +static int labels = 0; #define INDENT(d, o) do { \ if (o) { \ Modified: user/alc/PQ_LAUNDRY/sbin/pfctl/pfctl_altq.c ============================================================================== --- user/alc/PQ_LAUNDRY/sbin/pfctl/pfctl_altq.c Fri Aug 5 16:49:32 2016 (r303774) +++ user/alc/PQ_LAUNDRY/sbin/pfctl/pfctl_altq.c Fri Aug 5 16:53:24 2016 (r303775) @@ -50,8 +50,8 @@ __FBSDID("$FreeBSD$"); #define is_sc_null(sc) (((sc) == NULL) || ((sc)->m1 == 0 && (sc)->m2 == 0)) -TAILQ_HEAD(altqs, pf_altq) altqs = TAILQ_HEAD_INITIALIZER(altqs); -LIST_HEAD(gen_sc, segment) rtsc, lssc; +static TAILQ_HEAD(altqs, pf_altq) altqs = TAILQ_HEAD_INITIALIZER(altqs); +static LIST_HEAD(gen_sc, segment) rtsc, lssc; struct pf_altq *qname_to_pfaltq(const char *, const char *); u_int32_t qname_to_qid(const char *); Modified: user/alc/PQ_LAUNDRY/sbin/pfctl/pfctl_optimize.c ============================================================================== --- user/alc/PQ_LAUNDRY/sbin/pfctl/pfctl_optimize.c Fri Aug 5 16:49:32 2016 (r303774) +++ user/alc/PQ_LAUNDRY/sbin/pfctl/pfctl_optimize.c Fri Aug 5 16:53:24 2016 (r303775) @@ -90,7 +90,7 @@ enum { COMBINED, /* the field may itself be combined with other rules */ DC, /* we just don't care about the field */ NEVER}; /* we should never see this field set?!? */ -struct pf_rule_field { +static struct pf_rule_field { const char *prf_name; int prf_type; size_t prf_offset; @@ -242,8 +242,9 @@ int superblock_inclusive(struct superblo void superblock_free(struct pfctl *, struct superblock *); -int (*skip_comparitors[PF_SKIP_COUNT])(struct pf_rule *, struct pf_rule *); -const char *skip_comparitors_names[PF_SKIP_COUNT]; +static int (*skip_comparitors[PF_SKIP_COUNT])(struct pf_rule *, + struct pf_rule *); +static const char *skip_comparitors_names[PF_SKIP_COUNT]; #define PF_SKIP_COMPARITORS { \ { "ifp", PF_SKIP_IFP, skip_cmp_ifp }, \ { "dir", PF_SKIP_DIR, skip_cmp_dir }, \ @@ -255,8 +256,8 @@ const char *skip_comparitors_names[PF_SK { "dport", PF_SKIP_DST_PORT, skip_cmp_dst_port } \ } -struct pfr_buffer table_buffer; -int table_identifier; +static struct pfr_buffer table_buffer; +static int table_identifier; int Modified: user/alc/PQ_LAUNDRY/sbin/pfctl/pfctl_osfp.c ============================================================================== --- user/alc/PQ_LAUNDRY/sbin/pfctl/pfctl_osfp.c Fri Aug 5 16:49:32 2016 (r303774) +++ user/alc/PQ_LAUNDRY/sbin/pfctl/pfctl_osfp.c Fri Aug 5 16:53:24 2016 (r303775) @@ -16,6 +16,9 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include +__FBSDID("$FreeBSD$"); + #include #include #include @@ -64,9 +67,9 @@ struct name_entry { struct name_list nm_sublist; int nm_sublist_num; }; -struct name_list classes = LIST_HEAD_INITIALIZER(&classes); -int class_count; -int fingerprint_count; +static struct name_list classes = LIST_HEAD_INITIALIZER(&classes); +static int class_count; +static int fingerprint_count; void add_fingerprint(int, int, struct pf_osfp_ioctl *); struct name_entry *fingerprint_name_entry(struct name_list *, char *); Modified: user/alc/PQ_LAUNDRY/sbin/pfctl/pfctl_parser.c ============================================================================== --- user/alc/PQ_LAUNDRY/sbin/pfctl/pfctl_parser.c Fri Aug 5 16:49:32 2016 (r303774) +++ user/alc/PQ_LAUNDRY/sbin/pfctl/pfctl_parser.c Fri Aug 5 16:53:24 2016 (r303775) @@ -1147,7 +1147,7 @@ check_netmask(struct node_host *h, sa_fa /* interface lookup routines */ -struct node_host *iftab; +static struct node_host *iftab; void ifa_load(void) Modified: user/alc/PQ_LAUNDRY/share/man/man9/Makefile ============================================================================== --- user/alc/PQ_LAUNDRY/share/man/man9/Makefile Fri Aug 5 16:49:32 2016 (r303774) +++ user/alc/PQ_LAUNDRY/share/man/man9/Makefile Fri Aug 5 16:53:24 2016 (r303775) @@ -1015,7 +1015,6 @@ MLINKS+=lock.9 lockdestroy.9 \ lock.9 lockmgr_printinfo.9 \ lock.9 lockmgr_recursed.9 \ lock.9 lockmgr_rw.9 \ - lock.9 lockmgr_waiters.9 \ lock.9 lockstatus.9 MLINKS+=LOCK_PROFILING.9 MUTEX_PROFILING.9 MLINKS+=make_dev.9 destroy_dev.9 \ Modified: user/alc/PQ_LAUNDRY/share/man/man9/lock.9 ============================================================================== --- user/alc/PQ_LAUNDRY/share/man/man9/lock.9 Fri Aug 5 16:49:32 2016 (r303774) +++ user/alc/PQ_LAUNDRY/share/man/man9/lock.9 Fri Aug 5 16:53:24 2016 (r303775) @@ -39,7 +39,6 @@ .Nm lockmgr_printinfo , .Nm lockmgr_recursed , .Nm lockmgr_rw , -.Nm lockmgr_waiters , .Nm lockstatus , .Nm lockmgr_assert .Nd "lockmgr family of functions" @@ -66,8 +65,6 @@ .Ft int .Fn lockmgr_rw "struct lock *lkp" "u_int flags" "struct rwlock *ilk" .Ft int -.Fn lockmgr_waiters "const struct lock *lkp" -.Ft int .Fn lockstatus "const struct lock *lkp" .Pp .Cd "options INVARIANTS" @@ -279,10 +276,6 @@ function returns true if the lock is rec otherwise. .Pp The -.Fn lockmgr_waiters -function returns true if the lock has waiters, 0 otherwise. -.Pp -The .Fn lockstatus function returns the status of the lock in relation to the current thread. .Pp Modified: user/alc/PQ_LAUNDRY/sys/amd64/amd64/mem.c ============================================================================== --- user/alc/PQ_LAUNDRY/sys/amd64/amd64/mem.c Fri Aug 5 16:49:32 2016 (r303774) +++ user/alc/PQ_LAUNDRY/sys/amd64/amd64/mem.c Fri Aug 5 16:53:24 2016 (r303775) @@ -168,9 +168,11 @@ int memmmap(struct cdev *dev, vm_ooffset_t offset, vm_paddr_t *paddr, int prot __unused, vm_memattr_t *memattr __unused) { - if (dev2unit(dev) == CDEV_MINOR_MEM) + if (dev2unit(dev) == CDEV_MINOR_MEM) { + if (offset >= (1ULL << cpu_maxphyaddr)) + return (-1); *paddr = offset; - else if (dev2unit(dev) == CDEV_MINOR_KMEM) + } else if (dev2unit(dev) == CDEV_MINOR_KMEM) *paddr = vtophys(offset); /* else panic! */ return (0); Modified: user/alc/PQ_LAUNDRY/sys/cddl/compat/opensolaris/sys/vnode.h ============================================================================== --- user/alc/PQ_LAUNDRY/sys/cddl/compat/opensolaris/sys/vnode.h Fri Aug 5 16:49:32 2016 (r303774) +++ user/alc/PQ_LAUNDRY/sys/cddl/compat/opensolaris/sys/vnode.h Fri Aug 5 16:53:24 2016 (r303775) @@ -87,8 +87,6 @@ vn_is_readonly(vnode_t *vp) #define VN_RELE(v) vrele(v) #define VN_URELE(v) vput(v) -#define VOP_REALVP(vp, vpp, ct) (*(vpp) = (vp), 0) - #define vnevent_create(vp, ct) do { } while (0) #define vnevent_link(vp, ct) do { } while (0) #define vnevent_remove(vp, dvp, name, ct) do { } while (0) Modified: user/alc/PQ_LAUNDRY/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_dir.h ============================================================================== --- user/alc/PQ_LAUNDRY/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_dir.h Fri Aug 5 16:49:32 2016 (r303774) +++ user/alc/PQ_LAUNDRY/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_dir.h Fri Aug 5 16:53:24 2016 (r303775) @@ -48,18 +48,18 @@ extern "C" { #define IS_ROOT_NODE 0x01 /* create a root node */ #define IS_XATTR 0x02 /* create an extended attribute node */ -extern int zfs_dirent_lock(zfs_dirlock_t **, znode_t *, char *, znode_t **, - int, int *, pathname_t *); -extern void zfs_dirent_unlock(zfs_dirlock_t *); -extern int zfs_link_create(zfs_dirlock_t *, znode_t *, dmu_tx_t *, int); -extern int zfs_link_destroy(zfs_dirlock_t *, znode_t *, dmu_tx_t *, int, +extern int zfs_dirent_lookup(znode_t *, const char *, znode_t **, int); +extern int zfs_link_create(znode_t *, const char *, znode_t *, dmu_tx_t *, int); +extern int zfs_link_destroy(znode_t *, const char *, znode_t *, dmu_tx_t *, int, boolean_t *); -extern int zfs_dirlook(znode_t *, char *, vnode_t **, int, int *, - pathname_t *); +#if 0 +extern int zfs_dirlook(vnode_t *, const char *, vnode_t **, int); +#else +extern int zfs_dirlook(znode_t *, const char *name, znode_t **); +#endif extern void zfs_mknode(znode_t *, vattr_t *, dmu_tx_t *, cred_t *, uint_t, znode_t **, zfs_acl_ids_t *); extern void zfs_rmnode(znode_t *); -extern void zfs_dl_name_switch(zfs_dirlock_t *dl, char *new, char **old); extern boolean_t zfs_dirempty(znode_t *); extern void zfs_unlinked_add(znode_t *, dmu_tx_t *); extern void zfs_unlinked_drain(zfsvfs_t *zfsvfs); Modified: user/alc/PQ_LAUNDRY/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h ============================================================================== --- user/alc/PQ_LAUNDRY/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h Fri Aug 5 16:49:32 2016 (r303774) +++ user/alc/PQ_LAUNDRY/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h Fri Aug 5 16:53:24 2016 (r303775) @@ -75,6 +75,7 @@ struct zfsvfs { boolean_t z_use_fuids; /* version allows fuids */ boolean_t z_replay; /* set during ZIL replay */ boolean_t z_use_sa; /* version allow system attributes */ + boolean_t z_use_namecache;/* make use of FreeBSD name cache */ uint64_t z_version; /* ZPL version */ uint64_t z_shares_dir; /* hidden shares dir */ kmutex_t z_lock; Modified: user/alc/PQ_LAUNDRY/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h ============================================================================== --- user/alc/PQ_LAUNDRY/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h Fri Aug 5 16:49:32 2016 (r303774) +++ user/alc/PQ_LAUNDRY/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h Fri Aug 5 16:53:24 2016 (r303775) @@ -181,10 +181,12 @@ typedef struct znode { struct zfsvfs *z_zfsvfs; vnode_t *z_vnode; uint64_t z_id; /* object ID for this znode */ +#ifdef illumos kmutex_t z_lock; /* znode modification lock */ krwlock_t z_parent_lock; /* parent lock for directories */ krwlock_t z_name_lock; /* "master" lock for dirent locks */ zfs_dirlock_t *z_dirlocks; /* directory entry lock list */ +#endif kmutex_t z_range_lock; /* protects changes to z_range_avl */ avl_tree_t z_range_avl; /* avl tree of file range locks */ uint8_t z_unlinked; /* file has been unlinked */ Modified: user/alc/PQ_LAUNDRY/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c ============================================================================== --- user/alc/PQ_LAUNDRY/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c Fri Aug 5 16:49:32 2016 (r303774) +++ user/alc/PQ_LAUNDRY/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c Fri Aug 5 16:53:24 2016 (r303775) @@ -1055,8 +1055,7 @@ zfs_mode_compute(uint64_t fmode, zfs_acl * create a new acl and leave any cached acl in place. */ static int -zfs_acl_node_read(znode_t *zp, boolean_t have_lock, zfs_acl_t **aclpp, - boolean_t will_modify) +zfs_acl_node_read(znode_t *zp, zfs_acl_t **aclpp, boolean_t will_modify) { zfs_acl_t *aclp; int aclsize; @@ -1065,26 +1064,15 @@ zfs_acl_node_read(znode_t *zp, boolean_t zfs_acl_phys_t znode_acl; int version; int error; - boolean_t drop_lock = B_FALSE; ASSERT(MUTEX_HELD(&zp->z_acl_lock)); + ASSERT_VOP_LOCKED(ZTOV(zp), __func__); if (zp->z_acl_cached && !will_modify) { *aclpp = zp->z_acl_cached; return (0); } - /* - * close race where znode could be upgrade while trying to - * read the znode attributes. - * - * But this could only happen if the file isn't already an SA - * znode - */ - if (!zp->z_is_sa && !have_lock) { - mutex_enter(&zp->z_lock); - drop_lock = B_TRUE; - } version = zfs_znode_acl_version(zp); if ((error = zfs_acl_znode_info(zp, &aclsize, @@ -1130,8 +1118,6 @@ zfs_acl_node_read(znode_t *zp, boolean_t if (!will_modify) zp->z_acl_cached = aclp; done: - if (drop_lock) - mutex_exit(&zp->z_lock); return (error); } @@ -1158,10 +1144,10 @@ zfs_acl_chown_setattr(znode_t *zp) int error; zfs_acl_t *aclp; - ASSERT(MUTEX_HELD(&zp->z_lock)); + ASSERT_VOP_ELOCKED(ZTOV(zp), __func__); ASSERT(MUTEX_HELD(&zp->z_acl_lock)); - if ((error = zfs_acl_node_read(zp, B_TRUE, &aclp, B_FALSE)) == 0) + if ((error = zfs_acl_node_read(zp, &aclp, B_FALSE)) == 0) zp->z_mode = zfs_mode_compute(zp->z_mode, aclp, &zp->z_pflags, zp->z_uid, zp->z_gid); return (error); @@ -1453,18 +1439,17 @@ zfs_acl_chmod_setattr(znode_t *zp, zfs_a int error = 0; mutex_enter(&zp->z_acl_lock); - mutex_enter(&zp->z_lock); + ASSERT_VOP_ELOCKED(ZTOV(zp), __func__); if (zp->z_zfsvfs->z_acl_mode == ZFS_ACL_DISCARD) *aclp = zfs_acl_alloc(zfs_acl_version_zp(zp)); else - error = zfs_acl_node_read(zp, B_TRUE, aclp, B_TRUE); + error = zfs_acl_node_read(zp, aclp, B_TRUE); if (error == 0) { (*aclp)->z_hints = zp->z_pflags & V4_ACL_WIDE_FLAGS; zfs_acl_chmod(ZTOV(zp)->v_type, mode, B_TRUE, (zp->z_zfsvfs->z_acl_mode == ZFS_ACL_GROUPMASK), *aclp); } - mutex_exit(&zp->z_lock); mutex_exit(&zp->z_acl_lock); return (error); @@ -1617,6 +1602,7 @@ zfs_acl_ids_create(znode_t *dzp, int fla boolean_t trim = B_FALSE; boolean_t inherited = B_FALSE; + ASSERT_VOP_ELOCKED(ZTOV(dzp), __func__); bzero(acl_ids, sizeof (zfs_acl_ids_t)); acl_ids->z_mode = MAKEIMODE(vap->va_type, vap->va_mode); @@ -1700,12 +1686,10 @@ zfs_acl_ids_create(znode_t *dzp, int fla if (acl_ids->z_aclp == NULL) { mutex_enter(&dzp->z_acl_lock); - mutex_enter(&dzp->z_lock); if (!(flag & IS_ROOT_NODE) && (dzp->z_pflags & ZFS_INHERIT_ACE) && !(dzp->z_pflags & ZFS_XATTR)) { - VERIFY(0 == zfs_acl_node_read(dzp, B_TRUE, - &paclp, B_FALSE)); + VERIFY(0 == zfs_acl_node_read(dzp, &paclp, B_FALSE)); acl_ids->z_aclp = zfs_acl_inherit(zfsvfs, vap->va_type, paclp, acl_ids->z_mode); inherited = B_TRUE; @@ -1714,7 +1698,6 @@ zfs_acl_ids_create(znode_t *dzp, int fla zfs_acl_alloc(zfs_acl_version_zp(dzp)); acl_ids->z_aclp->z_hints |= ZFS_ACL_TRIVIAL; } - mutex_exit(&dzp->z_lock); mutex_exit(&dzp->z_acl_lock); if (vap->va_type == VDIR) @@ -1783,7 +1766,8 @@ zfs_getacl(znode_t *zp, vsecattr_t *vsec mutex_enter(&zp->z_acl_lock); - error = zfs_acl_node_read(zp, B_FALSE, &aclp, B_FALSE); + ASSERT_VOP_LOCKED(ZTOV(zp), __func__); + error = zfs_acl_node_read(zp, &aclp, B_FALSE); if (error != 0) { mutex_exit(&zp->z_acl_lock); return (error); @@ -1931,6 +1915,7 @@ zfs_setacl(znode_t *zp, vsecattr_t *vsec boolean_t fuid_dirtied; uint64_t acl_obj; + ASSERT_VOP_ELOCKED(ZTOV(zp), __func__); if (mask == 0) return (SET_ERROR(ENOSYS)); @@ -1955,7 +1940,6 @@ zfs_setacl(znode_t *zp, vsecattr_t *vsec } top: mutex_enter(&zp->z_acl_lock); - mutex_enter(&zp->z_lock); tx = dmu_tx_create(zfsvfs->z_os); @@ -1987,7 +1971,6 @@ top: zfs_sa_upgrade_txholds(tx, zp); error = dmu_tx_assign(tx, TXG_NOWAIT); if (error) { - mutex_exit(&zp->z_lock); mutex_exit(&zp->z_acl_lock); if (error == ERESTART) { @@ -2013,7 +1996,6 @@ top: if (fuidp) zfs_fuid_info_free(fuidp); dmu_tx_commit(tx); - mutex_exit(&zp->z_lock); mutex_exit(&zp->z_acl_lock); return (error); @@ -2117,7 +2099,8 @@ zfs_zaccess_aces_check(znode_t *zp, uint mutex_enter(&zp->z_acl_lock); - error = zfs_acl_node_read(zp, B_FALSE, &aclp, B_FALSE); + ASSERT_VOP_LOCKED(ZTOV(zp), __func__); + error = zfs_acl_node_read(zp, &aclp, B_FALSE); if (error != 0) { mutex_exit(&zp->z_acl_lock); return (error); Modified: user/alc/PQ_LAUNDRY/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c ============================================================================== --- user/alc/PQ_LAUNDRY/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c Fri Aug 5 16:49:32 2016 (r303774) +++ user/alc/PQ_LAUNDRY/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c Fri Aug 5 16:53:24 2016 (r303775) @@ -58,96 +58,64 @@ #include /* - * zfs_match_find() is used by zfs_dirent_lock() to peform zap lookups + * zfs_match_find() is used by zfs_dirent_lookup() to peform zap lookups * of names after deciding which is the appropriate lookup interface. */ static int -zfs_match_find(zfsvfs_t *zfsvfs, znode_t *dzp, char *name, boolean_t exact, - boolean_t update, int *deflags, pathname_t *rpnp, uint64_t *zoid) +zfs_match_find(zfsvfs_t *zfsvfs, znode_t *dzp, const char *name, + boolean_t exact, uint64_t *zoid) { int error; if (zfsvfs->z_norm) { - matchtype_t mt = MT_FIRST; - boolean_t conflict = B_FALSE; - size_t bufsz = 0; - char *buf = NULL; - - if (rpnp) { - buf = rpnp->pn_buf; - bufsz = rpnp->pn_bufsize; - } - if (exact) - mt = MT_EXACT; + matchtype_t mt = exact? MT_EXACT : MT_FIRST; + /* * In the non-mixed case we only expect there would ever * be one match, but we need to use the normalizing lookup. */ error = zap_lookup_norm(zfsvfs->z_os, dzp->z_id, name, 8, 1, - zoid, mt, buf, bufsz, &conflict); - if (!error && deflags) - *deflags = conflict ? ED_CASE_CONFLICT : 0; + zoid, mt, NULL, 0, NULL); } else { error = zap_lookup(zfsvfs->z_os, dzp->z_id, name, 8, 1, zoid); } *zoid = ZFS_DIRENT_OBJ(*zoid); - if (error == ENOENT && update) - dnlc_update(ZTOV(dzp), name, DNLC_NO_VNODE); - return (error); } /* - * Lock a directory entry. A dirlock on protects that name - * in dzp's directory zap object. As long as you hold a dirlock, you can - * assume two things: (1) dzp cannot be reaped, and (2) no other thread - * can change the zap entry for (i.e. link or unlink) this name. + * Look up a directory entry under a locked vnode. + * dvp being locked gives us a guarantee that there are no concurrent + * modification of the directory and, thus, if a node can be found in + * the directory, then it must not be unlinked. * * Input arguments: * dzp - znode for directory * name - name of entry to lock * flag - ZNEW: if the entry already exists, fail with EEXIST. * ZEXISTS: if the entry does not exist, fail with ENOENT. - * ZSHARED: allow concurrent access with other ZSHARED callers. * ZXATTR: we want dzp's xattr directory - * ZCILOOK: On a mixed sensitivity file system, - * this lookup should be case-insensitive. - * ZCIEXACT: On a purely case-insensitive file system, - * this lookup should be case-sensitive. - * ZRENAMING: we are locking for renaming, force narrow locks - * ZHAVELOCK: Don't grab the z_name_lock for this call. The - * current thread already holds it. * * Output arguments: * zpp - pointer to the znode for the entry (NULL if there isn't one) - * dlpp - pointer to the dirlock for this entry (NULL on error) - * direntflags - (case-insensitive lookup only) - * flags if multiple case-sensitive matches exist in directory - * realpnp - (case-insensitive lookup only) - * actual name matched within the directory * * Return value: 0 on success or errno on failure. * * NOTE: Always checks for, and rejects, '.' and '..'. - * NOTE: For case-insensitive file systems we take wide locks (see below), - * but return znode pointers to a single match. */ int -zfs_dirent_lock(zfs_dirlock_t **dlpp, znode_t *dzp, char *name, znode_t **zpp, - int flag, int *direntflags, pathname_t *realpnp) +zfs_dirent_lookup(znode_t *dzp, const char *name, znode_t **zpp, int flag) { zfsvfs_t *zfsvfs = dzp->z_zfsvfs; - zfs_dirlock_t *dl; - boolean_t update; boolean_t exact; uint64_t zoid; vnode_t *vp = NULL; int error = 0; - int cmpflags; + + ASSERT_VOP_LOCKED(ZTOV(dzp), __func__); *zpp = NULL; - *dlpp = NULL; /* * Verify that we are not trying to lock '.', '..', or '.zfs' @@ -161,280 +129,108 @@ zfs_dirent_lock(zfs_dirlock_t **dlpp, zn * Case sensitivity and normalization preferences are set when * the file system is created. These are stored in the * zfsvfs->z_case and zfsvfs->z_norm fields. These choices - * affect what vnodes can be cached in the DNLC, how we - * perform zap lookups, and the "width" of our dirlocks. + * affect how we perform zap lookups. * - * A normal dirlock locks a single name. Note that with - * normalization a name can be composed multiple ways, but - * when normalized, these names all compare equal. A wide - * dirlock locks multiple names. We need these when the file - * system is supporting mixed-mode access. It is sometimes - * necessary to lock all case permutations of file name at - * once so that simultaneous case-insensitive/case-sensitive - * behaves as rationally as possible. - */ - - /* * Decide if exact matches should be requested when performing * a zap lookup on file systems supporting case-insensitive * access. - */ - exact = - ((zfsvfs->z_case == ZFS_CASE_INSENSITIVE) && (flag & ZCIEXACT)) || - ((zfsvfs->z_case == ZFS_CASE_MIXED) && !(flag & ZCILOOK)); - - /* - * Only look in or update the DNLC if we are looking for the - * name on a file system that does not require normalization - * or case folding. We can also look there if we happen to be - * on a non-normalizing, mixed sensitivity file system IF we - * are looking for the exact name. * - * Maybe can add TO-UPPERed version of name to dnlc in ci-only - * case for performance improvement? + * NB: we do not need to worry about this flag for ZFS_CASE_SENSITIVE + * because in that case MT_EXACT and MT_FIRST should produce exactly + * the same result. */ - update = !zfsvfs->z_norm || - ((zfsvfs->z_case == ZFS_CASE_MIXED) && - !(zfsvfs->z_norm & ~U8_TEXTPREP_TOUPPER) && !(flag & ZCILOOK)); + exact = zfsvfs->z_case == ZFS_CASE_MIXED; - /* - * ZRENAMING indicates we are in a situation where we should - * take narrow locks regardless of the file system's - * preferences for normalizing and case folding. This will - * prevent us deadlocking trying to grab the same wide lock - * twice if the two names happen to be case-insensitive - * matches. - */ - if (flag & ZRENAMING) - cmpflags = 0; - else - cmpflags = zfsvfs->z_norm; - - /* - * Wait until there are no locks on this name. - * - * Don't grab the the lock if it is already held. However, cannot - * have both ZSHARED and ZHAVELOCK together. - */ - ASSERT(!(flag & ZSHARED) || !(flag & ZHAVELOCK)); - if (!(flag & ZHAVELOCK)) - rw_enter(&dzp->z_name_lock, RW_READER); - - mutex_enter(&dzp->z_lock); - for (;;) { - if (dzp->z_unlinked && !(flag & ZXATTR)) { - mutex_exit(&dzp->z_lock); - if (!(flag & ZHAVELOCK)) - rw_exit(&dzp->z_name_lock); - return (SET_ERROR(ENOENT)); - } *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***