aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--Makefile.inc14
-rw-r--r--UPDATING2
-rw-r--r--bin/dd/dd.c30
-rw-r--r--bin/echo/Makefile.depend1
-rw-r--r--bin/sleep/Makefile.depend1
-rw-r--r--cddl/contrib/opensolaris/cmd/ztest/ztest.c1
-rw-r--r--cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c43
-rw-r--r--cddl/contrib/opensolaris/lib/libdtrace/common/dt_cg.c45
-rw-r--r--cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c324
-rw-r--r--cddl/contrib/opensolaris/lib/libdtrace/common/dt_errtags.h2
-rw-r--r--cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h1
-rw-r--r--cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c4
-rw-r--r--cddl/lib/libdtrace/Makefile12
-rw-r--r--contrib/amd/AUTHORS145
-rw-r--r--contrib/amd/BUGS8
-rw-r--r--contrib/amd/COPYING9
-rw-r--r--contrib/amd/ChangeLog1118
-rw-r--r--contrib/amd/FAQ2
-rw-r--r--contrib/amd/INSTALL494
-rw-r--r--contrib/amd/MIRRORS.html28
-rw-r--r--contrib/amd/MIRRORS.txt30
-rw-r--r--contrib/amd/NEWS170
-rw-r--r--contrib/amd/README8
-rw-r--r--contrib/amd/README.attrcache4
-rw-r--r--contrib/amd/README.ldap10
-rw-r--r--contrib/amd/README.y2k5
-rw-r--r--contrib/amd/amd/am_ops.c45
-rw-r--r--contrib/amd/amd/amd.840
-rw-r--r--contrib/amd/amd/amd.c19
-rw-r--r--contrib/amd/amd/amd.h98
-rw-r--r--contrib/amd/amd/amfs_auto.c18
-rw-r--r--contrib/amd/amd/amfs_direct.c12
-rw-r--r--contrib/amd/amd/amfs_error.c12
-rw-r--r--contrib/amd/amd/amfs_generic.c243
-rw-r--r--contrib/amd/amd/amfs_host.c37
-rw-r--r--contrib/amd/amd/amfs_link.c14
-rw-r--r--contrib/amd/amd/amfs_linkx.c8
-rw-r--r--contrib/amd/amd/amfs_nfsl.c29
-rw-r--r--contrib/amd/amd/amfs_nfsx.c41
-rw-r--r--contrib/amd/amd/amfs_program.c30
-rw-r--r--contrib/amd/amd/amfs_root.c10
-rw-r--r--contrib/amd/amd/amfs_toplvl.c17
-rw-r--r--contrib/amd/amd/amfs_union.c14
-rw-r--r--contrib/amd/amd/amq_subr.c155
-rw-r--r--contrib/amd/amd/amq_svc.c175
-rw-r--r--contrib/amd/amd/autil.c123
-rw-r--r--contrib/amd/amd/clock.c8
-rw-r--r--contrib/amd/amd/conf.c145
-rw-r--r--contrib/amd/amd/conf_parse.y8
-rw-r--r--contrib/amd/amd/conf_tok.l31
-rw-r--r--contrib/amd/amd/get_args.c59
-rw-r--r--contrib/amd/amd/info_exec.c31
-rw-r--r--contrib/amd/amd/info_file.c45
-rw-r--r--contrib/amd/amd/info_hesiod.c15
-rw-r--r--contrib/amd/amd/info_ldap.c81
-rw-r--r--contrib/amd/amd/info_ndbm.c18
-rw-r--r--contrib/amd/amd/info_nis.c24
-rw-r--r--contrib/amd/amd/info_nisplus.c16
-rw-r--r--contrib/amd/amd/info_passwd.c19
-rw-r--r--contrib/amd/amd/info_sun.c53
-rw-r--r--contrib/amd/amd/info_union.c27
-rw-r--r--contrib/amd/amd/map.c294
-rw-r--r--contrib/amd/amd/mapc.c160
-rw-r--r--contrib/amd/amd/mntfs.c102
-rw-r--r--contrib/amd/amd/nfs_prot_svc.c199
-rw-r--r--contrib/amd/amd/nfs_start.c62
-rw-r--r--contrib/amd/amd/nfs_subr.c1197
-rw-r--r--contrib/amd/amd/ops_TEMPLATE.c12
-rw-r--r--contrib/amd/amd/ops_cachefs.c12
-rw-r--r--contrib/amd/amd/ops_cdfs.c27
-rw-r--r--contrib/amd/amd/ops_efs.c13
-rw-r--r--contrib/amd/amd/ops_ext.c223
-rw-r--r--contrib/amd/amd/ops_lofs.c10
-rw-r--r--contrib/amd/amd/ops_lustre.c203
-rw-r--r--contrib/amd/amd/ops_mfs.c8
-rw-r--r--contrib/amd/amd/ops_nfs.c138
-rw-r--r--contrib/amd/amd/ops_nfs3.c8
-rw-r--r--contrib/amd/amd/ops_nfs4.c50
-rw-r--r--contrib/amd/amd/ops_nullfs.c8
-rw-r--r--contrib/amd/amd/ops_pcfs.c10
-rw-r--r--contrib/amd/amd/ops_tfs.c8
-rw-r--r--contrib/amd/amd/ops_tmpfs.c152
-rw-r--r--contrib/amd/amd/ops_udf.c272
-rw-r--r--contrib/amd/amd/ops_ufs.c14
-rw-r--r--contrib/amd/amd/ops_umapfs.c8
-rw-r--r--contrib/amd/amd/ops_unionfs.c8
-rw-r--r--contrib/amd/amd/ops_xfs.c10
-rw-r--r--contrib/amd/amd/opts.c73
-rw-r--r--contrib/amd/amd/readdir.c533
-rw-r--r--contrib/amd/amd/restart.c34
-rw-r--r--contrib/amd/amd/rpc_fwd.c12
-rw-r--r--contrib/amd/amd/sched.c10
-rw-r--r--contrib/amd/amd/srvr_amfs_auto.c19
-rw-r--r--contrib/amd/amd/srvr_nfs.c159
-rw-r--r--contrib/amd/amd/sun2amd.892
-rw-r--r--contrib/amd/amd/sun2amd.c203
-rw-r--r--contrib/amd/amd/sun_map.c595
-rw-r--r--contrib/amd/amd/sun_map.h123
-rw-r--r--contrib/amd/amd/sun_map_parse.y492
-rw-r--r--contrib/amd/amd/sun_map_tok.l233
-rwxr-xr-xcontrib/amd/amd/test1.sh2
-rw-r--r--contrib/amd/amq/amq.850
-rw-r--r--contrib/amd/amq/amq.c247
-rw-r--r--contrib/amd/amq/amq.h10
-rw-r--r--contrib/amd/amq/amq_clnt.c39
-rw-r--r--contrib/amd/amq/amq_xdr.c61
-rw-r--r--contrib/amd/amq/pawd.111
-rw-r--r--contrib/amd/amq/pawd.c8
-rwxr-xr-xcontrib/amd/bootstrap74
-rw-r--r--contrib/amd/conf/checkmount/checkmount_bsd44.c11
-rw-r--r--contrib/amd/conf/mtab/mtab_bsd.c21
-rw-r--r--contrib/amd/conf/nfs_prot/nfs_prot_freebsd2.h10
-rw-r--r--contrib/amd/conf/nfs_prot/nfs_prot_freebsd3.h10
-rw-r--r--contrib/amd/conf/transp/transp_sockets.c137
-rw-r--r--contrib/amd/conf/umount/umount_bsd44.c9
-rw-r--r--contrib/amd/doc/am-utils.texi281
-rw-r--r--contrib/amd/doc/stamp-vti8
-rw-r--r--contrib/amd/doc/texinfo.tex5565
-rw-r--r--contrib/amd/doc/version.texi8
-rw-r--r--contrib/amd/fixmount/fixmount.811
-rw-r--r--contrib/amd/fixmount/fixmount.c20
-rw-r--r--contrib/amd/fsinfo/fsi_analyze.c64
-rw-r--r--contrib/amd/fsinfo/fsi_data.h8
-rw-r--r--contrib/amd/fsinfo/fsi_dict.c8
-rw-r--r--contrib/amd/fsinfo/fsi_gram.y12
-rw-r--r--contrib/amd/fsinfo/fsi_lex.l37
-rw-r--r--contrib/amd/fsinfo/fsi_util.c36
-rw-r--r--contrib/amd/fsinfo/fsinfo.833
-rw-r--r--contrib/amd/fsinfo/fsinfo.c12
-rw-r--r--contrib/amd/fsinfo/fsinfo.h14
-rw-r--r--contrib/amd/fsinfo/null_gram.c1414
-rw-r--r--contrib/amd/fsinfo/null_gram.h56
-rw-r--r--contrib/amd/fsinfo/null_gram.y8
-rw-r--r--contrib/amd/fsinfo/null_lex.c1716
-rw-r--r--contrib/amd/fsinfo/null_lex.l9
-rw-r--r--contrib/amd/fsinfo/wr_atab.c8
-rw-r--r--contrib/amd/fsinfo/wr_bparam.c10
-rw-r--r--contrib/amd/fsinfo/wr_dumpset.c8
-rw-r--r--contrib/amd/fsinfo/wr_exportfs.c8
-rw-r--r--contrib/amd/fsinfo/wr_fstab.c28
-rw-r--r--contrib/amd/hlfsd/hlfsd.821
-rw-r--r--contrib/amd/hlfsd/hlfsd.c51
-rw-r--r--contrib/amd/hlfsd/hlfsd.h8
-rw-r--r--contrib/amd/hlfsd/homedir.c28
-rw-r--r--contrib/amd/hlfsd/nfs_prot_svc.c8
-rw-r--r--contrib/amd/hlfsd/stubs.c27
-rw-r--r--contrib/amd/include/am_compat.h91
-rw-r--r--contrib/amd/include/am_defs.h80
-rw-r--r--contrib/amd/include/am_utils.h121
-rw-r--r--contrib/amd/include/am_xdr_func.h1049
-rw-r--r--contrib/amd/include/amq_defs.h50
-rw-r--r--contrib/amd/include/mount_headers1.h96
-rw-r--r--contrib/amd/include/mount_headers2.h8
-rw-r--r--contrib/amd/include/nfs_common.h99
-rw-r--r--contrib/amd/ldap-id.ms2
-rw-r--r--contrib/amd/ldap-id.txt2
-rw-r--r--contrib/amd/libamu/amu.h13
-rw-r--r--contrib/amd/libamu/hasmntopt.c12
-rw-r--r--contrib/amd/libamu/misc_rpc.c8
-rw-r--r--contrib/amd/libamu/mount_fs.c1097
-rw-r--r--contrib/amd/libamu/mtab.c12
-rw-r--r--contrib/amd/libamu/nfs_prot_xdr.c19
-rw-r--r--contrib/amd/libamu/strerror.c10
-rw-r--r--contrib/amd/libamu/strutil.c42
-rw-r--r--contrib/amd/libamu/wire.c19
-rw-r--r--contrib/amd/libamu/xdr_func.c2060
-rw-r--r--contrib/amd/libamu/xutil.c192
-rw-r--r--contrib/amd/mk-amd-map/mk-amd-map.812
-rw-r--r--contrib/amd/mk-amd-map/mk-amd-map.c16
-rw-r--r--contrib/amd/scripts/amd.conf-sample8
-rw-r--r--contrib/amd/scripts/amd.conf.541
-rw-r--r--contrib/amd/scripts/automount2amd.811
-rwxr-xr-xcontrib/amd/scripts/fixrmtab.in20
-rw-r--r--contrib/amd/vers.m42
-rw-r--r--contrib/amd/wire-test/wire-test.811
-rw-r--r--contrib/amd/wire-test/wire-test.c15
-rw-r--r--contrib/hyperv/tools/hv_vss_daemon.8 (renamed from share/man/man4/hv_ata_pci_disengage.4)86
-rw-r--r--contrib/hyperv/tools/hv_vss_daemon.c274
-rw-r--r--etc/devd/hyperv.conf16
-rw-r--r--etc/mtree/BSD.include.dist2
-rw-r--r--etc/rc.subr27
-rw-r--r--gnu/usr.bin/cc/Makefile.tgt2
-rw-r--r--include/Makefile14
-rw-r--r--lib/csu/mips/crti.S1
-rw-r--r--lib/csu/mips/crtn.S1
-rw-r--r--lib/libc/Makefile3
-rw-r--r--lib/libc/riscv/Makefile.inc4
-rw-r--r--lib/libc/riscv/Symbol.map18
-rw-r--r--lib/libc/riscv/gen/_setjmp.S64
-rw-r--r--lib/libc/riscv/gen/flt_rounds.c25
-rw-r--r--lib/libc/riscv/gen/setjmp.S60
-rw-r--r--lib/libc/riscv/softfloat/milieu.h48
-rw-r--r--lib/libc/riscv/softfloat/riscv-gcc.h86
-rw-r--r--lib/libc/riscv/softfloat/softfloat.h315
-rw-r--r--lib/libc/softfloat/Makefile.inc3
-rw-r--r--lib/libc/sys/sendfile.244
-rw-r--r--lib/libcapsicum/Makefile.depend11
-rw-r--r--lib/libcompiler_rt/Makefile.inc7
-rw-r--r--lib/libefivar/Makefile.depend18
-rw-r--r--lib/libgcc_eh/Makefile1
-rw-r--r--lib/libgcc_s/Makefile3
-rw-r--r--lib/libsysdecode/Makefile10
-rw-r--r--lib/libsysdecode/mktables17
-rw-r--r--lib/libutil/gr_util.c2
-rw-r--r--lib/libutil/pw_util.c2
-rw-r--r--lib/msun/riscv/Makefile.inc5
-rw-r--r--lib/msun/riscv/Symbol.map21
-rw-r--r--lib/msun/riscv/fenv.c11
-rw-r--r--lib/msun/riscv/fenv.h134
-rw-r--r--libexec/ftpd/ftpd.c3
-rw-r--r--libexec/rtld-elf/Makefile4
-rw-r--r--libexec/rtld-elf/aarch64/reloc.c5
-rw-r--r--libexec/rtld-elf/aarch64/rtld_machdep.h5
-rw-r--r--libexec/rtld-elf/amd64/reloc.c22
-rw-r--r--libexec/rtld-elf/amd64/rtld_machdep.h8
-rw-r--r--libexec/rtld-elf/arm/reloc.c5
-rw-r--r--libexec/rtld-elf/arm/rtld_machdep.h3
-rw-r--r--libexec/rtld-elf/i386/reloc.c42
-rw-r--r--libexec/rtld-elf/i386/rtld_machdep.h8
-rw-r--r--libexec/rtld-elf/mips/reloc.c5
-rw-r--r--libexec/rtld-elf/mips/rtld_machdep.h3
-rw-r--r--libexec/rtld-elf/powerpc/reloc.c5
-rw-r--r--libexec/rtld-elf/powerpc/rtld_machdep.h3
-rw-r--r--libexec/rtld-elf/powerpc64/reloc.c5
-rw-r--r--libexec/rtld-elf/powerpc64/rtld_machdep.h3
-rw-r--r--libexec/rtld-elf/riscv/reloc.c5
-rw-r--r--libexec/rtld-elf/riscv/rtld_machdep.h3
-rw-r--r--libexec/rtld-elf/rtld.c3
-rw-r--r--libexec/rtld-elf/rtld.h1
-rw-r--r--libexec/rtld-elf/sparc64/reloc.c5
-rw-r--r--libexec/rtld-elf/sparc64/rtld_machdep.h5
-rw-r--r--release/Makefile.vm4
-rw-r--r--release/doc/en_US.ISO8859-1/hardware/article.xml2
-rw-r--r--rescue/rescue/Makefile.depend1
-rw-r--r--sbin/etherswitchcfg/etherswitchcfg.c6
-rw-r--r--sbin/ifconfig/ifieee80211.c6
-rw-r--r--sbin/ipfw/ipfw2.c13
-rw-r--r--sbin/ipfw/ipfw2.h9
-rw-r--r--sbin/ipfw/ipv6.c23
-rw-r--r--sbin/md5/Makefile.depend1
-rw-r--r--sbin/zfsbootcfg/Makefile.depend32
-rw-r--r--share/examples/jails/rc.conf.jails22
-rw-r--r--share/examples/jails/rcjail.xxx.conf26
-rw-r--r--share/man/man4/Makefile4
-rw-r--r--share/man/man4/bnxt.4224
-rw-r--r--share/man/man4/hv_vmbus.42
-rw-r--r--share/man/man4/hv_vss.4366
-rw-r--r--share/man/man4/rtwn_pci.45
-rw-r--r--share/man/man4/smb.419
-rw-r--r--share/man/man4/snd_uaudio.44
-rw-r--r--share/man/man9/usbdi.966
-rw-r--r--share/man/man9/vm_page_alloc.916
-rw-r--r--share/misc/committers-src.dot5
-rw-r--r--share/mk/bsd.cpu.mk21
-rw-r--r--share/mk/bsd.dep.mk11
-rw-r--r--share/mk/bsd.init.mk33
-rw-r--r--share/mk/bsd.lib.mk3
-rw-r--r--share/mk/bsd.subdir.mk5
-rw-r--r--share/mk/bsd.sys.mk2
-rw-r--r--share/mk/local.meta.sys.mk2
-rw-r--r--share/mk/src.opts.mk6
-rw-r--r--share/mk/sys.mk2
-rw-r--r--share/zoneinfo/Makefile4
-rw-r--r--sys/amd64/amd64/trap.c4
-rw-r--r--sys/arm/allwinner/a10/a10_intc.c1
-rw-r--r--sys/arm/allwinner/a10_gpio.c3
-rw-r--r--sys/arm/allwinner/a10_hdmi.c2
-rw-r--r--sys/arm/allwinner/a10_mmc.c23
-rw-r--r--sys/arm/allwinner/a10_sramc.c1
-rw-r--r--sys/arm/allwinner/a20/a20_cpu_cfg.c1
-rw-r--r--sys/arm/allwinner/aw_ccu.c3
-rw-r--r--sys/arm/allwinner/aw_cir.c1
-rw-r--r--sys/arm/allwinner/aw_machdep.c2
-rw-r--r--sys/arm/allwinner/aw_nmi.c1
-rw-r--r--sys/arm/allwinner/aw_thermal.c77
-rw-r--r--sys/arm/allwinner/aw_ts.c1
-rw-r--r--sys/arm/allwinner/aw_wdog.c1
-rw-r--r--sys/arm/allwinner/clk/aw_gate.c1
-rw-r--r--sys/arm/allwinner/clk/aw_mmcclk.c2
-rw-r--r--sys/arm/allwinner/clk/aw_pll.c10
-rw-r--r--sys/arm/allwinner/if_emac.c1
-rw-r--r--sys/arm/allwinner/timer.c1
-rw-r--r--sys/arm/altera/socfpga/socfpga_common.c29
-rw-r--r--sys/arm/altera/socfpga/socfpga_gpio.c1
-rw-r--r--sys/arm/altera/socfpga/socfpga_manager.c1
-rw-r--r--sys/arm/altera/socfpga/socfpga_rstmgr.c8
-rw-r--r--sys/arm/amlogic/aml8726/aml8726_ccm.c1
-rw-r--r--sys/arm/amlogic/aml8726/aml8726_fb.c1
-rw-r--r--sys/arm/amlogic/aml8726/aml8726_gpio.c1
-rw-r--r--sys/arm/amlogic/aml8726/aml8726_i2c.c1
-rw-r--r--sys/arm/amlogic/aml8726/aml8726_mmc.c1
-rw-r--r--sys/arm/amlogic/aml8726/aml8726_pic.c1
-rw-r--r--sys/arm/amlogic/aml8726/aml8726_pinctrl.c3
-rw-r--r--sys/arm/amlogic/aml8726/aml8726_rng.c1
-rw-r--r--sys/arm/amlogic/aml8726/aml8726_rtc.c1
-rw-r--r--sys/arm/amlogic/aml8726/aml8726_sdxc-m8.c1
-rw-r--r--sys/arm/amlogic/aml8726/aml8726_timer.c1
-rw-r--r--sys/arm/amlogic/aml8726/aml8726_usb_phy-m6.c1
-rw-r--r--sys/arm/amlogic/aml8726/aml8726_wdt.c1
-rw-r--r--sys/arm/amlogic/aml8726/uart_dev_aml8726.c1
-rw-r--r--sys/arm/annapurna/alpine/alpine_machdep.c2
-rw-r--r--sys/arm/annapurna/alpine/alpine_machdep_mp.c3
-rw-r--r--sys/arm/arm/generic_timer.c1
-rw-r--r--sys/arm/arm/gic.c3
-rw-r--r--sys/arm/arm/gic_fdt.c1
-rw-r--r--sys/arm/arm/mp_machdep.c1
-rw-r--r--sys/arm/arm/mpcore_timer.c1
-rw-r--r--sys/arm/arm/pl190.c1
-rw-r--r--sys/arm/arm/pl310.c1
-rw-r--r--sys/arm/arm/pmap-v6.c24
-rw-r--r--sys/arm/arm/pmu.c1
-rw-r--r--sys/arm/at91/at91_aic.c1
-rw-r--r--sys/arm/at91/at91_cfata.c2
-rw-r--r--sys/arm/at91/at91_common.c3
-rw-r--r--sys/arm/at91/at91_mci.c1
-rw-r--r--sys/arm/at91/at91_ohci_fdt.c1
-rw-r--r--sys/arm/at91/at91_pinctrl.c1
-rw-r--r--sys/arm/at91/at91_pio.c1
-rw-r--r--sys/arm/at91/at91_pit.c1
-rw-r--r--sys/arm/at91/at91_pmc.c1
-rw-r--r--sys/arm/at91/at91_rst.c1
-rw-r--r--sys/arm/at91/at91_sdramc.c1
-rw-r--r--sys/arm/at91/at91_shdwc.c1
-rw-r--r--sys/arm/at91/at91_spi.c1
-rw-r--r--sys/arm/at91/at91_tcb.c1
-rw-r--r--sys/arm/at91/at91_twi.c1
-rw-r--r--sys/arm/at91/at91_wdt.c1
-rw-r--r--sys/arm/at91/if_ate.c1
-rw-r--r--sys/arm/at91/if_macb.c1
-rw-r--r--sys/arm/broadcom/bcm2835/bcm2835_cpufreq.c4
-rw-r--r--sys/arm/broadcom/bcm2835/bcm2835_dma.c1
-rw-r--r--sys/arm/broadcom/bcm2835/bcm2835_fb.c9
-rw-r--r--sys/arm/broadcom/bcm2835/bcm2835_fbd.c1
-rw-r--r--sys/arm/broadcom/bcm2835/bcm2835_ft5406.c1
-rw-r--r--sys/arm/broadcom/bcm2835/bcm2835_intr.c1
-rw-r--r--sys/arm/broadcom/bcm2835/bcm2835_machdep.c10
-rw-r--r--sys/arm/broadcom/bcm2835/bcm2835_sdhci.c1
-rw-r--r--sys/arm/broadcom/bcm2835/bcm2835_spi.c1
-rw-r--r--sys/arm/broadcom/bcm2835/bcm2835_systimer.c1
-rw-r--r--sys/arm/broadcom/bcm2835/bcm2835_wdog.c1
-rw-r--r--sys/arm/conf/GENERIC27
-rw-r--r--sys/arm/conf/PANDABOARD3
-rw-r--r--sys/arm/freescale/imx/imx51_ccm.c1
-rw-r--r--sys/arm/freescale/imx/imx51_ipuv3.c5
-rw-r--r--sys/arm/freescale/imx/imx51_ipuv3_fbd.c5
-rw-r--r--sys/arm/freescale/imx/imx6_audmux.c1
-rw-r--r--sys/arm/freescale/imx/imx6_ipu.c1
-rw-r--r--sys/arm/freescale/imx/imx6_sdma.c1
-rw-r--r--sys/arm/freescale/imx/imx6_ssi.c9
-rw-r--r--sys/arm/freescale/imx/imx_gpio.c1
-rw-r--r--sys/arm/freescale/imx/imx_gpt.c1
-rw-r--r--sys/arm/freescale/imx/imx_i2c.c1
-rw-r--r--sys/arm/freescale/imx/imx_iomux.c3
-rw-r--r--sys/arm/freescale/imx/imx_wdog.c1
-rw-r--r--sys/arm/freescale/imx/tzic.c1
-rw-r--r--sys/arm/freescale/vybrid/vf_adc.c1
-rw-r--r--sys/arm/freescale/vybrid/vf_anadig.c1
-rw-r--r--sys/arm/freescale/vybrid/vf_common.c29
-rw-r--r--sys/arm/freescale/vybrid/vf_dcu4.c31
-rw-r--r--sys/arm/freescale/vybrid/vf_dmamux.c1
-rw-r--r--sys/arm/freescale/vybrid/vf_edma.c5
-rw-r--r--sys/arm/freescale/vybrid/vf_ehci.c2
-rw-r--r--sys/arm/freescale/vybrid/vf_gpio.c1
-rw-r--r--sys/arm/freescale/vybrid/vf_i2c.c1
-rw-r--r--sys/arm/freescale/vybrid/vf_iomuxc.c6
-rw-r--r--sys/arm/freescale/vybrid/vf_machdep.c2
-rw-r--r--sys/arm/freescale/vybrid/vf_mscm.c1
-rw-r--r--sys/arm/freescale/vybrid/vf_port.c1
-rw-r--r--sys/arm/freescale/vybrid/vf_sai.c17
-rw-r--r--sys/arm/freescale/vybrid/vf_spi.c1
-rw-r--r--sys/arm/freescale/vybrid/vf_src.c1
-rw-r--r--sys/arm/freescale/vybrid/vf_tcon.c1
-rw-r--r--sys/arm/lpc/lpc_fb.c4
-rw-r--r--sys/arm/lpc/lpc_intc.c2
-rw-r--r--sys/arm/lpc/lpc_machdep.c2
-rw-r--r--sys/arm/lpc/lpc_timer.c5
-rw-r--r--sys/arm/mv/armadaxp/armadaxp.c1
-rw-r--r--sys/arm/mv/gpio.c24
-rw-r--r--sys/arm/mv/mv_common.c14
-rw-r--r--sys/arm/mv/mv_machdep.c25
-rw-r--r--sys/arm/mv/mv_pci.c4
-rw-r--r--sys/arm/mv/mv_ts.c1
-rw-r--r--sys/arm/nvidia/tegra124/tegra124_machdep.c1
-rw-r--r--sys/arm/nvidia/tegra124/tegra124_pmc.c1
-rw-r--r--sys/arm/nvidia/tegra_abpmisc.c1
-rw-r--r--sys/arm/nvidia/tegra_ahci.c1
-rw-r--r--sys/arm/nvidia/tegra_efuse.c1
-rw-r--r--sys/arm/nvidia/tegra_gpio.c1
-rw-r--r--sys/arm/nvidia/tegra_i2c.c1
-rw-r--r--sys/arm/nvidia/tegra_pcie.c1
-rw-r--r--sys/arm/nvidia/tegra_rtc.c1
-rw-r--r--sys/arm/nvidia/tegra_uart.c3
-rw-r--r--sys/arm/nvidia/tegra_usbphy.c1
-rw-r--r--sys/arm/rockchip/files.rk30xx1
-rw-r--r--sys/arm/rockchip/rk30xx_gpio.c16
-rw-r--r--sys/arm/rockchip/rk30xx_grf.c1
-rw-r--r--sys/arm/rockchip/rk30xx_machdep.c2
-rw-r--r--sys/arm/rockchip/rk30xx_pmu.c1
-rw-r--r--sys/arm/rockchip/rk30xx_wdog.c1
-rw-r--r--sys/arm/samsung/exynos/exynos5_common.c22
-rw-r--r--sys/arm/ti/aintc.c5
-rw-r--r--sys/arm/ti/am335x/am335x_ecap.c1
-rw-r--r--sys/arm/ti/am335x/am335x_ehrpwm.c1
-rw-r--r--sys/arm/ti/am335x/am335x_gpio.c6
-rw-r--r--sys/arm/ti/am335x/am335x_lcd.c4
-rw-r--r--sys/arm/ti/am335x/am335x_lcd_syscons.c15
-rw-r--r--sys/arm/ti/am335x/am335x_musb.c1
-rw-r--r--sys/arm/ti/am335x/am335x_prcm.c1
-rw-r--r--sys/arm/ti/am335x/am335x_pwmss.c1
-rw-r--r--sys/arm/ti/am335x/am335x_scm_padconf.c2
-rw-r--r--sys/arm/ti/am335x/am335x_scm_padconf.h2
-rw-r--r--sys/arm/ti/am335x/am335x_usbss.c1
-rw-r--r--sys/arm/ti/cpsw/if_cpsw.c1
-rw-r--r--sys/arm/ti/omap4/files.omap42
-rw-r--r--sys/arm/ti/omap4/omap4_gpio.c5
-rw-r--r--sys/arm/ti/omap4/omap4_mp.c8
-rw-r--r--sys/arm/ti/omap4/omap4_mp.h33
-rw-r--r--sys/arm/ti/omap4/omap4_prcm_clks.c1
-rw-r--r--sys/arm/ti/omap4/omap4_scm_padconf.c2
-rw-r--r--sys/arm/ti/omap4/omap4_scm_padconf.h2
-rw-r--r--sys/arm/ti/omap4/pandaboard/files.pandaboard3
-rw-r--r--sys/arm/ti/omap4/pandaboard/pandaboard.c41
-rw-r--r--sys/arm/ti/omap4/pandaboard/pandaboard.h32
-rw-r--r--sys/arm/ti/omap4/pandaboard/std.pandaboard4
-rw-r--r--sys/arm/ti/ti_adc.c20
-rw-r--r--sys/arm/ti/ti_cpuid.c10
-rw-r--r--sys/arm/ti/ti_cpuid.h11
-rw-r--r--sys/arm/ti/ti_edma3.c1
-rw-r--r--sys/arm/ti/ti_gpio.c14
-rw-r--r--sys/arm/ti/ti_hwmods.c1
-rw-r--r--sys/arm/ti/ti_machdep.c32
-rw-r--r--sys/arm/ti/ti_mbox.c1
-rw-r--r--sys/arm/ti/ti_pinmux.c46
-rw-r--r--sys/arm/ti/ti_pruss.c1
-rw-r--r--sys/arm/ti/ti_scm.c3
-rw-r--r--sys/arm/ti/ti_sdhci.c5
-rw-r--r--sys/arm/ti/ti_sdma.c1
-rw-r--r--sys/arm/ti/ti_spi.c1
-rw-r--r--sys/arm/ti/ti_wdt.c1
-rw-r--r--sys/arm/ti/usb/omap_ehci.c18
-rw-r--r--sys/arm/ti/usb/omap_host.c1
-rw-r--r--sys/arm/ti/usb/omap_tll.c1
-rw-r--r--sys/arm/versatile/pl050.c1
-rw-r--r--sys/arm/versatile/sp804.c5
-rw-r--r--sys/arm/versatile/versatile_clcd.c1
-rw-r--r--sys/arm/versatile/versatile_common.c3
-rw-r--r--sys/arm/versatile/versatile_machdep.c2
-rw-r--r--sys/arm/versatile/versatile_pci.c1
-rw-r--r--sys/arm/versatile/versatile_sic.c1
-rw-r--r--sys/arm/versatile/versatile_timer.c1
-rw-r--r--sys/arm/xilinx/zy7_devcfg.c1
-rw-r--r--sys/arm/xilinx/zy7_ehci.c1
-rw-r--r--sys/arm/xilinx/zy7_gpio.c1
-rw-r--r--sys/arm/xilinx/zy7_machdep.c25
-rw-r--r--sys/arm/xilinx/zy7_slcr.c5
-rw-r--r--sys/arm64/conf/GENERIC1
-rw-r--r--sys/boot/common/commands.c6
-rw-r--r--sys/boot/common/dev_net.c9
-rw-r--r--sys/boot/common/install.c20
-rw-r--r--sys/boot/common/md.c11
-rw-r--r--sys/boot/efi/libefi/efinet.c4
-rw-r--r--sys/boot/efi/libefi/efipart.c4
-rw-r--r--sys/boot/fdt/dts/arm/sun7i-a20-hdmi.dtsi22
-rw-r--r--sys/boot/fdt/dts/powerpc/p2041rdb.dts41
-rw-r--r--sys/boot/fdt/dts/powerpc/p2041si.dtsi48
-rw-r--r--sys/boot/fdt/dts/powerpc/p3041ds.dts41
-rw-r--r--sys/boot/fdt/dts/powerpc/p3041si.dtsi54
-rw-r--r--sys/boot/fdt/dts/powerpc/p5020ds.dts41
-rw-r--r--sys/boot/fdt/dts/powerpc/p5020si.dtsi48
-rw-r--r--sys/boot/forth/loader.conf1
-rw-r--r--sys/boot/i386/libfirewire/firewire.c4
-rw-r--r--sys/boot/i386/libi386/bioscd.c7
-rw-r--r--sys/boot/i386/libi386/biosdisk.c7
-rw-r--r--sys/boot/i386/libi386/pxe.c3
-rw-r--r--sys/boot/mips/beri/loader/beri_disk_cfi.c4
-rw-r--r--sys/boot/mips/beri/loader/beri_disk_sdcard.c6
-rw-r--r--sys/boot/pc98/libpc98/bioscd.c7
-rw-r--r--sys/boot/pc98/libpc98/biosdisk.c7
-rw-r--r--sys/boot/uboot/lib/disk.c7
-rw-r--r--sys/boot/usb/storage/umass_loader.c4
-rw-r--r--sys/boot/userboot/userboot/host.c4
-rw-r--r--sys/boot/userboot/userboot/userboot_disk.c7
-rw-r--r--sys/boot/zfs/zfs.c7
-rw-r--r--sys/boot/zfs/zfsimpl.c4
-rw-r--r--sys/cam/scsi/scsi_xpt.c4
-rw-r--r--sys/cddl/compat/opensolaris/sys/vnode.h3
-rw-r--r--sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c90
-rw-r--r--sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h1
-rw-r--r--sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil_impl.h5
-rw-r--r--sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h2
-rw-r--r--sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_log.c37
-rw-r--r--sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c8
-rw-r--r--sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c121
-rw-r--r--sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c15
-rw-r--r--sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c50
-rw-r--r--sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h3
-rw-r--r--sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c4
-rw-r--r--sys/conf/Makefile.mips2
-rw-r--r--sys/conf/NOTES2
-rw-r--r--sys/conf/files49
-rw-r--r--sys/conf/files.amd644
-rw-r--r--sys/conf/files.arm641
-rw-r--r--sys/conf/files.i3864
-rw-r--r--sys/conf/kern.pre.mk2
-rw-r--r--sys/conf/newvers.sh33
-rw-r--r--sys/conf/options5
-rw-r--r--sys/conf/options.riscv2
-rw-r--r--sys/contrib/ncsw/inc/xx_ext.h5
-rw-r--r--sys/contrib/ncsw/user/env/xx.c114
-rw-r--r--sys/contrib/vchiq/interface/compat/vchi_bsd.c1
-rw-r--r--sys/dev/acpi_support/acpi_hp.c351
-rw-r--r--sys/dev/bhnd/bcma/bcma.c6
-rw-r--r--sys/dev/bhnd/bcma/bcma_dmp.h2
-rw-r--r--sys/dev/bnxt/bnxt.h568
-rw-r--r--sys/dev/bnxt/bnxt_hwrm.c1485
-rw-r--r--sys/dev/bnxt/bnxt_hwrm.h102
-rw-r--r--sys/dev/bnxt/bnxt_ioctl.h192
-rw-r--r--sys/dev/bnxt/bnxt_sysctl.c618
-rw-r--r--sys/dev/bnxt/bnxt_sysctl.h41
-rw-r--r--sys/dev/bnxt/bnxt_txrx.c641
-rwxr-xr-xsys/dev/bnxt/convert_hsi.pl356
-rw-r--r--sys/dev/bnxt/hsi_struct_def.h17576
-rw-r--r--sys/dev/bnxt/if_bnxt.c2360
-rw-r--r--sys/dev/cpuctl/cpuctl.c2
-rw-r--r--sys/dev/dme/if_dme.c1061
-rw-r--r--sys/dev/dme/if_dmereg.h137
-rw-r--r--sys/dev/dme/if_dmevar.h39
-rw-r--r--sys/dev/dpaa/bman_fdt.c38
-rw-r--r--sys/dev/dpaa/dpaa.c184
-rw-r--r--sys/dev/dpaa/fman.c32
-rw-r--r--sys/dev/dpaa/fman.h3
-rw-r--r--sys/dev/dpaa/if_dtsec.c4
-rw-r--r--sys/dev/dpaa/if_dtsec_fdt.c45
-rw-r--r--sys/dev/dpaa/if_dtsec_rm.c2
-rw-r--r--sys/dev/dpaa/qman_fdt.c83
-rw-r--r--sys/dev/drm2/drmP.h207
-rw-r--r--sys/dev/drm2/drm_memory.c4
-rw-r--r--sys/dev/drm2/drm_os_freebsd.c2
-rw-r--r--sys/dev/drm2/drm_os_freebsd.h2
-rw-r--r--sys/dev/drm2/ttm/ttm_bo_util.c3
-rw-r--r--sys/dev/e1000/if_em.c14
-rw-r--r--sys/dev/etherswitch/e6000sw/e6060sw.c703
-rw-r--r--sys/dev/etherswitch/infineon/adm6996fc.c858
-rw-r--r--sys/dev/etherswitch/ip17x/ip175c.c7
-rw-r--r--sys/dev/etherswitch/ip17x/ip175c.h3
-rw-r--r--sys/dev/etherswitch/rtl8366/rtl8366rb.c364
-rw-r--r--sys/dev/etherswitch/rtl8366/rtl8366rbvar.h193
-rw-r--r--sys/dev/fdt/fdt_arm_platform.c3
-rw-r--r--sys/dev/fdt/fdt_common.c18
-rw-r--r--sys/dev/fdt/fdt_common.h1
-rw-r--r--sys/dev/fdt/fdt_powerpc.c2
-rw-r--r--sys/dev/gpio/gpiobus.c3
-rw-r--r--sys/dev/gpio/gpiopower.c137
-rw-r--r--sys/dev/hyperv/pcib/vmbus_pcib.c1791
-rw-r--r--sys/dev/hyperv/utilities/hv_snapshot.c1061
-rw-r--r--sys/dev/hyperv/utilities/hv_snapshot.h56
-rw-r--r--sys/dev/hyperv/vmbus/vmbus.c246
-rw-r--r--sys/dev/hyperv/vmbus/vmbus_if.m6
-rw-r--r--sys/dev/hyperv/vmbus/vmbus_var.h10
-rw-r--r--sys/dev/ic/ns16550.h10
-rw-r--r--sys/dev/iicbus/iicsmb.c18
-rw-r--r--sys/dev/intpm/intpm.c39
-rw-r--r--sys/dev/ioat/ioat.c9
-rw-r--r--sys/dev/iwm/if_iwm.c40
-rw-r--r--sys/dev/kbdmux/kbdmux.c79
-rw-r--r--sys/dev/rtwn/if_rtwn_tx.h2
-rw-r--r--sys/dev/rtwn/pci/rtwn_pci_attach.c19
-rw-r--r--sys/dev/rtwn/pci/rtwn_pci_rx.c52
-rw-r--r--sys/dev/rtwn/pci/rtwn_pci_tx.c33
-rw-r--r--sys/dev/rtwn/rtl8192c/pci/r92ce_attach.c14
-rw-r--r--sys/dev/rtwn/rtl8192c/usb/r92cu_attach.c1
-rw-r--r--sys/dev/rtwn/rtl8812a/r12a_rom.c19
-rw-r--r--sys/dev/rtwn/rtl8812a/r12a_var.h18
-rw-r--r--sys/dev/rtwn/rtl8812a/usb/r12au_attach.c1
-rw-r--r--sys/dev/rtwn/rtl8821a/usb/r21au_attach.c1
-rw-r--r--sys/dev/rtwn/usb/rtwn_usb_rx.c3
-rw-r--r--sys/dev/smbus/smb.c10
-rw-r--r--sys/dev/smbus/smb.h7
-rw-r--r--sys/dev/uart/uart_bus_fdt.c2
-rw-r--r--sys/dev/uart/uart_core.c7
-rw-r--r--sys/dev/uart/uart_dev_ns8250.c43
-rw-r--r--sys/dev/usb/controller/dwc_otg.c27
-rw-r--r--sys/dev/usb/controller/dwc_otg.h7
-rw-r--r--sys/dev/usb/controller/dwc_otg_fdt.c3
-rw-r--r--sys/dev/usb/controller/dwc_otg_fdt.h1
-rw-r--r--sys/dev/usb/net/if_smsc.c10
-rw-r--r--sys/dev/virtio/console/virtio_console.c5
-rw-r--r--sys/fs/autofs/autofs.c2
-rw-r--r--sys/fs/nfs/nfs_commonsubs.c26
-rw-r--r--sys/fs/tmpfs/tmpfs_subr.c9
-rw-r--r--sys/geom/mirror/g_mirror.c66
-rw-r--r--sys/geom/mirror/g_mirror.h1
-rw-r--r--sys/geom/multipath/g_multipath.c2
-rw-r--r--sys/gnu/dts/include/dt-bindings/dma/jz4780-dma.h49
-rw-r--r--sys/gnu/dts/include/dt-bindings/net/rfkill-regulator.h23
-rw-r--r--sys/gnu/dts/mips/ingenic/canna.dts42
-rw-r--r--sys/gnu/dts/mips/ingenic/ci20.dts395
-rw-r--r--sys/gnu/dts/mips/ingenic/jz4780.dtsi768
-rw-r--r--sys/gnu/dts/mips/ingenic/x1000.dtsi420
-rw-r--r--sys/i386/i386/trap.c16
-rw-r--r--sys/kern/kern_exec.c2
-rw-r--r--sys/kern/kern_sendfile.c93
-rw-r--r--sys/kern/kern_umtx.c2
-rw-r--r--sys/kern/sched_4bsd.c67
-rw-r--r--sys/kern/subr_bus.c39
-rw-r--r--sys/kern/uipc_mqueue.c11
-rw-r--r--sys/kern/uipc_shm.c9
-rw-r--r--sys/kern/vfs_bio.c19
-rw-r--r--sys/kern/vfs_cache.c17
-rw-r--r--sys/kern/vfs_export.c4
-rw-r--r--sys/kern/vfs_mount.c44
-rw-r--r--sys/mips/atheros/ar531x/files.ar531513
-rw-r--r--sys/mips/atheros/ar531x/if_are.c104
-rw-r--r--sys/mips/atheros/ar531x/if_arereg.h31
-rw-r--r--sys/mips/include/cpufunc.h10
-rw-r--r--sys/mips/include/cpuregs.h8
-rw-r--r--sys/mips/include/locore.h3
-rw-r--r--sys/mips/include/param.h39
-rw-r--r--sys/mips/mediatek/mtk_soc.c2
-rw-r--r--sys/mips/mips/cpu.c14
-rw-r--r--sys/mips/mips/pmap.c14
-rw-r--r--sys/modules/Makefile1
-rw-r--r--sys/modules/bnxt/Makefile14
-rw-r--r--sys/modules/dtrace/dtrace/Makefile4
-rw-r--r--sys/modules/hyperv/pcib/Makefile12
-rw-r--r--sys/modules/hyperv/utilities/Makefile2
-rw-r--r--sys/modules/hyperv/vmbus/Makefile2
-rw-r--r--sys/modules/kbdmux/Makefile3
-rw-r--r--sys/modules/rpi_ft5406/Makefile2
-rw-r--r--sys/net/iflib.c136
-rw-r--r--sys/net/rtsock.c42
-rw-r--r--sys/net80211/_ieee80211.h67
-rw-r--r--sys/net80211/ieee80211_adhoc.c28
-rw-r--r--sys/net80211/ieee80211_crypto.c49
-rw-r--r--sys/net80211/ieee80211_crypto.h7
-rw-r--r--sys/net80211/ieee80211_crypto_ccmp.c40
-rw-r--r--sys/net80211/ieee80211_crypto_tkip.c77
-rw-r--r--sys/net80211/ieee80211_hostap.c45
-rw-r--r--sys/net80211/ieee80211_ioctl.c20
-rw-r--r--sys/net80211/ieee80211_node.c17
-rw-r--r--sys/net80211/ieee80211_output.c38
-rw-r--r--sys/net80211/ieee80211_scan_sta.c3
-rw-r--r--sys/net80211/ieee80211_sta.c67
-rw-r--r--sys/net80211/ieee80211_tdma.c7
-rw-r--r--sys/net80211/ieee80211_var.h64
-rw-r--r--sys/net80211/ieee80211_wds.c21
-rw-r--r--sys/netgraph/ng_l2tp.c10
-rw-r--r--sys/netinet/tcp_input.c3
-rw-r--r--sys/netinet/tcp_stacks/fastpath.c3
-rw-r--r--sys/netinet/tcp_subr.c5
-rw-r--r--sys/netinet/tcp_timewait.c1
-rw-r--r--sys/powerpc/booke/pmap.c41
-rw-r--r--sys/powerpc/conf/MPC85XX3
-rw-r--r--sys/powerpc/conf/MPC85XXSPE4
-rw-r--r--sys/powerpc/conf/dpaa/files.dpaa2
-rw-r--r--sys/powerpc/include/pmap.h4
-rw-r--r--sys/powerpc/mpc85xx/mpc85xx.h2
-rw-r--r--sys/powerpc/mpc85xx/platform_mpc85xx.c4
-rw-r--r--sys/powerpc/mpc85xx/qoriq_gpio.c4
-rw-r--r--sys/riscv/conf/GENERIC2
-rw-r--r--sys/riscv/include/fpe.h (renamed from sys/arm/rockchip/rk30xx_common.c)45
-rw-r--r--sys/riscv/include/pcb.h25
-rw-r--r--sys/riscv/include/reg.h5
-rw-r--r--sys/riscv/include/riscvreg.h8
-rw-r--r--sys/riscv/riscv/genassym.c2
-rw-r--r--sys/riscv/riscv/machdep.c82
-rw-r--r--sys/riscv/riscv/mp_machdep.c7
-rw-r--r--sys/riscv/riscv/pmap.c2
-rw-r--r--sys/riscv/riscv/swtch.S167
-rw-r--r--sys/riscv/riscv/trap.c13
-rw-r--r--sys/riscv/riscv/vm_machdep.c4
-rw-r--r--sys/sys/kerneldump.h4
-rw-r--r--sys/sys/queue.h39
-rw-r--r--sys/sys/sf_buf.h1
-rw-r--r--sys/sys/socket.h1
-rw-r--r--sys/ufs/ffs/ffs_vfsops.c20
-rw-r--r--sys/vm/swap_pager.c5
-rw-r--r--sys/vm/vm_fault.c83
-rw-r--r--sys/vm/vm_mmap.c3
-rw-r--r--sys/vm/vm_object.c39
-rw-r--r--sys/vm/vm_object.h8
-rw-r--r--sys/vm/vm_page.c364
-rw-r--r--sys/vm/vm_page.h6
-rw-r--r--sys/vm/vm_reserv.c39
-rw-r--r--sys/vm/vm_reserv.h1
-rw-r--r--sys/vm/vnode_pager.c49
-rw-r--r--targets/pseudo/userland/gnu/Makefile.depend4
-rw-r--r--targets/pseudo/userland/misc/Makefile.depend9
-rwxr-xr-xtools/sched/make_ktr.sh37
-rwxr-xr-xtools/sched/schedgraph.d135
-rwxr-xr-xtools/tools/git/arcgit2
-rwxr-xr-xtools/tools/git/importgit30
-rwxr-xr-xtools/tools/nanobsd/defaults.sh171
-rw-r--r--tools/tools/nanobsd/legacy.sh203
-rwxr-xr-xtools/tools/nanobsd/nanobsd.sh37
-rw-r--r--tools/tools/nanobsd/pcengines/common.conf2
-rw-r--r--usr.bin/basename/Makefile.depend1
-rw-r--r--usr.bin/cmp/Makefile.depend1
-rw-r--r--usr.bin/col/Makefile.depend1
-rw-r--r--usr.bin/dc/Makefile.depend1
-rw-r--r--usr.bin/dirname/Makefile.depend2
-rw-r--r--usr.bin/elfdump/Makefile.depend1
-rw-r--r--usr.bin/fold/Makefile.depend1
-rw-r--r--usr.bin/fold/fold.c4
-rw-r--r--usr.bin/gcore/gcore.c17
-rw-r--r--usr.bin/getopt/Makefile.depend2
-rw-r--r--usr.bin/jot/Makefile.depend1
-rw-r--r--usr.bin/kdump/Makefile.depend1
-rw-r--r--usr.bin/locale/locale.c36
-rw-r--r--usr.bin/locate/bigram/Makefile.depend2
-rw-r--r--usr.bin/logname/Makefile.depend2
-rw-r--r--usr.bin/netstat/mbuf.c3
-rw-r--r--usr.bin/printenv/Makefile.depend1
-rw-r--r--usr.bin/tee/Makefile.depend1
-rw-r--r--usr.bin/tr/Makefile.depend1
-rw-r--r--usr.bin/vmstat/vmstat.c2
-rw-r--r--usr.bin/whois/whois.c79
-rw-r--r--usr.bin/write/Makefile.depend1
-rw-r--r--usr.bin/yes/Makefile.depend2
-rw-r--r--usr.sbin/amd/amd/Makefile34
-rw-r--r--usr.sbin/amd/fsinfo/Makefile29
-rw-r--r--usr.sbin/amd/include/config.h299
-rw-r--r--usr.sbin/bhyvectl/bhyvectl.84
-rw-r--r--usr.sbin/bsnmpd/modules/snmp_bridge/bridge_if.c2
-rw-r--r--usr.sbin/crunch/crunchide/crunchide.c3
-rw-r--r--usr.sbin/crunch/crunchide/exec_elf32.c4
-rw-r--r--usr.sbin/daemon/Makefile.depend1
-rw-r--r--usr.sbin/efivar/Makefile.depend19
-rw-r--r--usr.sbin/hyperv/Makefile4
-rw-r--r--usr.sbin/hyperv/tools/Makefile.inc4
-rw-r--r--usr.sbin/hyperv/tools/kvp/Makefile (renamed from usr.sbin/hyperv/tools/Makefile)4
-rw-r--r--usr.sbin/hyperv/tools/kvp/Makefile.depend (renamed from usr.sbin/hyperv/tools/Makefile.depend)0
-rw-r--r--usr.sbin/hyperv/tools/vss/Makefile14
-rw-r--r--usr.sbin/hyperv/tools/vss/Makefile.depend18
-rw-r--r--usr.sbin/pw/grupd.c1
-rw-r--r--usr.sbin/pw/pw_nis.c1
-rw-r--r--usr.sbin/pw/pwupd.c1
-rw-r--r--usr.sbin/smbmsg/smbmsg.c18
739 files changed, 59179 insertions, 8271 deletions
diff --git a/Makefile b/Makefile
index 5904a3f967e3..7e76ac915fc7 100644
--- a/Makefile
+++ b/Makefile
@@ -239,7 +239,7 @@ _MAKE+= MK_META_MODE=no
_TARGET_ARCH= ${TARGET:S/pc98/i386/:S/arm64/aarch64/}
.elif !defined(TARGET) && defined(TARGET_ARCH) && \
${TARGET_ARCH} != ${MACHINE_ARCH}
-_TARGET= ${TARGET_ARCH:C/mips(n32|64)?(el)?(hf)?/mips/:C/arm(v6)?(eb)?/arm/:C/aarch64/arm64/:C/powerpc64/powerpc/:C/powerpcspe/powerpc/:C/riscv64/riscv/}
+_TARGET= ${TARGET_ARCH:C/mips(n32|64)?(el)?(hf)?/mips/:C/arm(v6)?(eb)?/arm/:C/aarch64/arm64/:C/powerpc64/powerpc/:C/powerpcspe/powerpc/:C/riscv64(sf)?/riscv/}
.endif
.if defined(TARGET) && !defined(_TARGET)
_TARGET=${TARGET}
diff --git a/Makefile.inc1 b/Makefile.inc1
index c48be4c00337..b718afeef05d 100644
--- a/Makefile.inc1
+++ b/Makefile.inc1
@@ -364,6 +364,7 @@ KNOWN_ARCHES?= aarch64/arm64 \
powerpc64/powerpc \
powerpcspe/powerpc \
riscv64/riscv \
+ riscv64sf/riscv \
sparc64
.if ${TARGET} == ${TARGET_ARCH}
@@ -676,9 +677,6 @@ _worldtmp: .PHONY
.endif
.else
rm -rf ${WORLDTMP}/legacy/usr/include
-# XXX - These can depend on any header file.
- rm -f ${OBJTREE}${.CURDIR}/lib/libsysdecode/ioctl.c
- rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/kdump_subr.c
.endif
.for _dir in \
lib lib/casper usr legacy/bin legacy/usr
diff --git a/UPDATING b/UPDATING
index fb869480ebc9..3240f5f5c56e 100644
--- a/UPDATING
+++ b/UPDATING
@@ -130,7 +130,7 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW:
20160527:
CAM will now strip leading spaces from SCSI disks' serial numbers.
- This will effect users who create UFS filesystems on SCSI disks using
+ This will affect users who create UFS filesystems on SCSI disks using
those disk's diskid device nodes. For example, if /etc/fstab
previously contained a line like
"/dev/diskid/DISK-%20%20%20%20%20%20%20ABCDEFG0123456", you should
diff --git a/bin/dd/dd.c b/bin/dd/dd.c
index 56f8efef7a53..a13213dcc8c6 100644
--- a/bin/dd/dd.c
+++ b/bin/dd/dd.c
@@ -48,10 +48,13 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/stat.h>
#include <sys/conf.h>
+#include <sys/capsicum.h>
#include <sys/disklabel.h>
#include <sys/filio.h>
+#include <sys/mtio.h>
#include <assert.h>
+#include <capsicum_helpers.h>
#include <ctype.h>
#include <err.h>
#include <errno.h>
@@ -92,6 +95,10 @@ main(int argc __unused, char *argv[])
jcl(argv);
setup();
+ caph_cache_catpages();
+ if (cap_enter() == -1 && errno != ENOSYS)
+ err(1, "unable to enter capability mode");
+
(void)signal(SIGINFO, siginfo_handler);
(void)signal(SIGINT, terminate);
@@ -125,6 +132,8 @@ static void
setup(void)
{
u_int cnt;
+ cap_rights_t rights;
+ unsigned long cmds[] = { FIODTYPE, MTIOCTOP };
if (in.name == NULL) {
in.name = "stdin";
@@ -133,13 +142,20 @@ setup(void)
in.fd = open(in.name, O_RDONLY, 0);
if (in.fd == -1)
err(1, "%s", in.name);
+ if (caph_limit_stdin() == -1)
+ err(1, "unable to limit capability rights");
}
getfdtype(&in);
+ cap_rights_init(&rights, CAP_READ, CAP_SEEK);
+ if (cap_rights_limit(in.fd, &rights) == -1 && errno != ENOSYS)
+ err(1, "unable to limit capability rights");
+
if (files_cnt > 1 && !(in.flags & ISTAPE))
errx(1, "files is not supported for non-tape devices");
+ cap_rights_set(&rights, CAP_WRITE, CAP_FTRUNCATE, CAP_IOCTL);
if (out.name == NULL) {
/* No way to check for read access here. */
out.fd = STDOUT_FILENO;
@@ -156,13 +172,27 @@ setup(void)
if (out.fd == -1) {
out.fd = open(out.name, O_WRONLY | OFLAGS, DEFFILEMODE);
out.flags |= NOREAD;
+ cap_rights_clear(&rights, CAP_READ);
}
if (out.fd == -1)
err(1, "%s", out.name);
+ if (caph_limit_stdout() == -1)
+ err(1, "unable to limit capability rights");
}
getfdtype(&out);
+ if (cap_rights_limit(out.fd, &rights) == -1 && errno != ENOSYS)
+ err(1, "unable to limit capability rights");
+ if (cap_ioctls_limit(out.fd, cmds, nitems(cmds)) == -1 &&
+ errno != ENOSYS)
+ err(1, "unable to limit capability rights");
+
+ if (in.fd != STDERR_FILENO && out.fd != STDERR_FILENO) {
+ if (caph_limit_stderr() == -1)
+ err(1, "unable to limit capability rights");
+ }
+
/*
* Allocate space for the input and output buffers. If not doing
* record oriented I/O, only need a single buffer.
diff --git a/bin/echo/Makefile.depend b/bin/echo/Makefile.depend
index 3646e2e2b1af..4def626103ce 100644
--- a/bin/echo/Makefile.depend
+++ b/bin/echo/Makefile.depend
@@ -8,6 +8,7 @@ DIRDEPS = \
include/xlocale \
lib/${CSU_DIR} \
lib/libc \
+ lib/libcapsicum \
lib/libcompiler_rt \
diff --git a/bin/sleep/Makefile.depend b/bin/sleep/Makefile.depend
index 3646e2e2b1af..4def626103ce 100644
--- a/bin/sleep/Makefile.depend
+++ b/bin/sleep/Makefile.depend
@@ -8,6 +8,7 @@ DIRDEPS = \
include/xlocale \
lib/${CSU_DIR} \
lib/libc \
+ lib/libcapsicum \
lib/libcompiler_rt \
diff --git a/cddl/contrib/opensolaris/cmd/ztest/ztest.c b/cddl/contrib/opensolaris/cmd/ztest/ztest.c
index 5fc571774e30..bfc80e3b0287 100644
--- a/cddl/contrib/opensolaris/cmd/ztest/ztest.c
+++ b/cddl/contrib/opensolaris/cmd/ztest/ztest.c
@@ -1371,7 +1371,6 @@ ztest_log_write(ztest_ds_t *zd, dmu_tx_t *tx, lr_write_t *lr)
itx->itx_private = zd;
itx->itx_wr_state = write_state;
itx->itx_sync = (ztest_random(8) == 0);
- itx->itx_sod += (write_state == WR_NEED_COPY ? lr->lr_length : 0);
bcopy(&lr->lr_common + 1, &itx->itx_lr + 1,
sizeof (*lr) - sizeof (lr_t));
diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c
index ef10e0bc7e94..1216a389e239 100644
--- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c
+++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c
@@ -1058,46 +1058,6 @@ dt_action_printm(dtrace_hdl_t *dtp, dt_node_t *dnp, dtrace_stmtdesc_t *sdp)
}
static void
-dt_action_printt(dtrace_hdl_t *dtp, dt_node_t *dnp, dtrace_stmtdesc_t *sdp)
-{
- dtrace_actdesc_t *ap = dt_stmt_action(dtp, sdp);
-
- dt_node_t *size = dnp->dn_args;
- dt_node_t *addr = dnp->dn_args->dn_list;
-
- char n[DT_TYPE_NAMELEN];
-
- if (dt_node_is_posconst(size) == 0) {
- dnerror(size, D_PRINTT_SIZE, "printt( ) argument #1 must "
- "be a non-zero positive integral constant expression\n");
- }
-
- if (addr == NULL || addr->dn_kind != DT_NODE_FUNC ||
- addr->dn_ident != dt_idhash_lookup(dtp->dt_globals, "typeref")) {
- dnerror(addr, D_PRINTT_ADDR,
- "printt( ) argument #2 is incompatible with "
- "prototype:\n\tprototype: typeref()\n"
- "\t argument: %s\n",
- dt_node_type_name(addr, n, sizeof (n)));
- }
-
- dt_cg(yypcb, addr);
- ap->dtad_difo = dt_as(yypcb);
- ap->dtad_kind = DTRACEACT_PRINTT;
-
- ap->dtad_difo->dtdo_rtype.dtdt_flags |= DIF_TF_BYREF;
-
- /*
- * Allow additional buffer space for the data size, type size,
- * type string length and a stab in the dark (32 bytes) for the
- * type string. The type string is part of the typeref() that
- * this action references.
- */
- ap->dtad_difo->dtdo_rtype.dtdt_size = size->dn_value + 3 * sizeof(uintptr_t) + 32;
-
-}
-
-static void
dt_action_commit(dtrace_hdl_t *dtp, dt_node_t *dnp, dtrace_stmtdesc_t *sdp)
{
dtrace_actdesc_t *ap = dt_stmt_action(dtp, sdp);
@@ -1169,9 +1129,6 @@ dt_compile_fun(dtrace_hdl_t *dtp, dt_node_t *dnp, dtrace_stmtdesc_t *sdp)
case DT_ACT_PRINTM:
dt_action_printm(dtp, dnp->dn_expr, sdp);
break;
- case DT_ACT_PRINTT:
- dt_action_printt(dtp, dnp->dn_expr, sdp);
- break;
case DT_ACT_RAISE:
dt_action_raise(dtp, dnp->dn_expr, sdp);
break;
diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cg.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cg.c
index e748ff2b3ade..e4580a8ab340 100644
--- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cg.c
+++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cg.c
@@ -1353,40 +1353,6 @@ dt_cg_inline(dt_node_t *dnp, dt_irlist_t *dlp, dt_regset_t *drp)
}
}
-static void
-dt_cg_func_typeref(dtrace_hdl_t *dtp, dt_node_t *dnp)
-{
- dtrace_typeinfo_t dtt;
- dt_node_t *addr = dnp->dn_args;
- dt_node_t *nelm = addr->dn_list;
- dt_node_t *strp = nelm->dn_list;
- dt_node_t *typs = strp->dn_list;
- char buf[DT_TYPE_NAMELEN];
- char *p;
-
- ctf_type_name(addr->dn_ctfp, addr->dn_type, buf, sizeof (buf));
-
- /*
- * XXX Hack alert! XXX
- * The prototype has two dummy args that we munge to represent
- * the type string and the type size.
- *
- * Yes, I hear your grumble, but it works for now. We'll come
- * up with a more elegant implementation later. :-)
- */
- free(strp->dn_string);
-
- if ((p = strchr(buf, '*')) != NULL)
- *p = '\0';
-
- strp->dn_string = strdup(buf);
-
- if (dtrace_lookup_by_type(dtp, DTRACE_OBJ_EVERY, buf, &dtt) < 0)
- return;
-
- typs->dn_value = ctf_type_size(dtt.dtt_ctfp, dtt.dtt_type);
-}
-
typedef struct dt_xlmemb {
dt_ident_t *dtxl_idp; /* translated ident */
dt_irlist_t *dtxl_dlp; /* instruction list */
@@ -2002,8 +1968,6 @@ dt_cg_node(dt_node_t *dnp, dt_irlist_t *dlp, dt_regset_t *drp)
switch (dnp->dn_kind) {
case DT_NODE_FUNC: {
- dtrace_hdl_t *dtp = yypcb->pcb_hdl;
-
if ((idp = dnp->dn_ident)->di_kind != DT_IDENT_FUNC) {
dnerror(dnp, D_CG_EXPR, "%s %s( ) may not be "
"called from a D expression (D program "
@@ -2011,15 +1975,6 @@ dt_cg_node(dt_node_t *dnp, dt_irlist_t *dlp, dt_regset_t *drp)
dt_idkind_name(idp->di_kind), idp->di_name);
}
- switch (idp->di_id) {
- case DIF_SUBR_TYPEREF:
- dt_cg_func_typeref(dtp, dnp);
- break;
-
- default:
- break;
- }
-
dt_cg_arglist(dnp->dn_ident, dnp->dn_args, dlp, drp);
dnp->dn_reg = dt_regset_alloc(drp);
diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c
index 04c022b7ad00..de574a330268 100644
--- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c
+++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c
@@ -1537,314 +1537,6 @@ dt_print_umod(dtrace_hdl_t *dtp, FILE *fp, const char *format, caddr_t addr)
return (err);
}
-int
-dt_print_memory(dtrace_hdl_t *dtp, FILE *fp, caddr_t addr)
-{
- int quiet = (dtp->dt_options[DTRACEOPT_QUIET] != DTRACEOPT_UNSET);
- size_t nbytes = *((uintptr_t *) addr);
-
- return (dt_print_bytes(dtp, fp, addr + sizeof(uintptr_t),
- nbytes, 50, quiet, 1));
-}
-
-typedef struct dt_type_cbdata {
- dtrace_hdl_t *dtp;
- dtrace_typeinfo_t dtt;
- caddr_t addr;
- caddr_t addrend;
- const char *name;
- int f_type;
- int indent;
- int type_width;
- int name_width;
- FILE *fp;
-} dt_type_cbdata_t;
-
-static int dt_print_type_data(dt_type_cbdata_t *, ctf_id_t);
-
-static int
-dt_print_type_member(const char *name, ctf_id_t type, ulong_t off, void *arg)
-{
- dt_type_cbdata_t cbdata;
- dt_type_cbdata_t *cbdatap = arg;
- ssize_t ssz;
-
- if ((ssz = ctf_type_size(cbdatap->dtt.dtt_ctfp, type)) <= 0)
- return (0);
-
- off /= 8;
-
- cbdata = *cbdatap;
- cbdata.name = name;
- cbdata.addr += off;
- cbdata.addrend = cbdata.addr + ssz;
-
- return (dt_print_type_data(&cbdata, type));
-}
-
-static int
-dt_print_type_width(const char *name, ctf_id_t type, ulong_t off, void *arg)
-{
- char buf[DT_TYPE_NAMELEN];
- char *p;
- dt_type_cbdata_t *cbdatap = arg;
- size_t sz = strlen(name);
-
- ctf_type_name(cbdatap->dtt.dtt_ctfp, type, buf, sizeof (buf));
-
- if ((p = strchr(buf, '[')) != NULL)
- p[-1] = '\0';
- else
- p = "";
-
- sz += strlen(p);
-
- if (sz > cbdatap->name_width)
- cbdatap->name_width = sz;
-
- sz = strlen(buf);
-
- if (sz > cbdatap->type_width)
- cbdatap->type_width = sz;
-
- return (0);
-}
-
-static int
-dt_print_type_data(dt_type_cbdata_t *cbdatap, ctf_id_t type)
-{
- caddr_t addr = cbdatap->addr;
- caddr_t addrend = cbdatap->addrend;
- char buf[DT_TYPE_NAMELEN];
- char *p;
- int cnt = 0;
- uint_t kind = ctf_type_kind(cbdatap->dtt.dtt_ctfp, type);
- ssize_t ssz = ctf_type_size(cbdatap->dtt.dtt_ctfp, type);
-
- ctf_type_name(cbdatap->dtt.dtt_ctfp, type, buf, sizeof (buf));
-
- if ((p = strchr(buf, '[')) != NULL)
- p[-1] = '\0';
- else
- p = "";
-
- if (cbdatap->f_type) {
- int type_width = roundup(cbdatap->type_width + 1, 4);
- int name_width = roundup(cbdatap->name_width + 1, 4);
-
- name_width -= strlen(cbdatap->name);
-
- dt_printf(cbdatap->dtp, cbdatap->fp, "%*s%-*s%s%-*s = ",cbdatap->indent * 4,"",type_width,buf,cbdatap->name,name_width,p);
- }
-
- while (addr < addrend) {
- dt_type_cbdata_t cbdata;
- ctf_arinfo_t arinfo;
- ctf_encoding_t cte;
- uintptr_t *up;
- void *vp = addr;
- cbdata = *cbdatap;
- cbdata.name = "";
- cbdata.addr = addr;
- cbdata.addrend = addr + ssz;
- cbdata.f_type = 0;
- cbdata.indent++;
- cbdata.type_width = 0;
- cbdata.name_width = 0;
-
- if (cnt > 0)
- dt_printf(cbdatap->dtp, cbdatap->fp, "%*s", cbdatap->indent * 4,"");
-
- switch (kind) {
- case CTF_K_INTEGER:
- if (ctf_type_encoding(cbdatap->dtt.dtt_ctfp, type, &cte) != 0)
- return (-1);
- if ((cte.cte_format & CTF_INT_SIGNED) != 0)
- switch (cte.cte_bits) {
- case 8:
- if (isprint(*((char *) vp)))
- dt_printf(cbdatap->dtp, cbdatap->fp, "'%c', ", *((char *) vp));
- dt_printf(cbdatap->dtp, cbdatap->fp, "%d (0x%x);\n", *((char *) vp), *((char *) vp));
- break;
- case 16:
- dt_printf(cbdatap->dtp, cbdatap->fp, "%hd (0x%hx);\n", *((short *) vp), *((u_short *) vp));
- break;
- case 32:
- dt_printf(cbdatap->dtp, cbdatap->fp, "%d (0x%x);\n", *((int *) vp), *((u_int *) vp));
- break;
- case 64:
- dt_printf(cbdatap->dtp, cbdatap->fp, "%jd (0x%jx);\n", *((long long *) vp), *((unsigned long long *) vp));
- break;
- default:
- dt_printf(cbdatap->dtp, cbdatap->fp, "CTF_K_INTEGER: format %x offset %u bits %u\n",cte.cte_format,cte.cte_offset,cte.cte_bits);
- break;
- }
- else
- switch (cte.cte_bits) {
- case 8:
- dt_printf(cbdatap->dtp, cbdatap->fp, "%u (0x%x);\n", *((uint8_t *) vp) & 0xff, *((uint8_t *) vp) & 0xff);
- break;
- case 16:
- dt_printf(cbdatap->dtp, cbdatap->fp, "%hu (0x%hx);\n", *((u_short *) vp), *((u_short *) vp));
- break;
- case 32:
- dt_printf(cbdatap->dtp, cbdatap->fp, "%u (0x%x);\n", *((u_int *) vp), *((u_int *) vp));
- break;
- case 64:
- dt_printf(cbdatap->dtp, cbdatap->fp, "%ju (0x%jx);\n", *((unsigned long long *) vp), *((unsigned long long *) vp));
- break;
- default:
- dt_printf(cbdatap->dtp, cbdatap->fp, "CTF_K_INTEGER: format %x offset %u bits %u\n",cte.cte_format,cte.cte_offset,cte.cte_bits);
- break;
- }
- break;
- case CTF_K_FLOAT:
- dt_printf(cbdatap->dtp, cbdatap->fp, "CTF_K_FLOAT: format %x offset %u bits %u\n",cte.cte_format,cte.cte_offset,cte.cte_bits);
- break;
- case CTF_K_POINTER:
- dt_printf(cbdatap->dtp, cbdatap->fp, "%p;\n", *((void **) addr));
- break;
- case CTF_K_ARRAY:
- if (ctf_array_info(cbdatap->dtt.dtt_ctfp, type, &arinfo) != 0)
- return (-1);
- dt_printf(cbdatap->dtp, cbdatap->fp, "{\n%*s",cbdata.indent * 4,"");
- dt_print_type_data(&cbdata, arinfo.ctr_contents);
- dt_printf(cbdatap->dtp, cbdatap->fp, "%*s};\n",cbdatap->indent * 4,"");
- break;
- case CTF_K_FUNCTION:
- dt_printf(cbdatap->dtp, cbdatap->fp, "CTF_K_FUNCTION:\n");
- break;
- case CTF_K_STRUCT:
- cbdata.f_type = 1;
- if (ctf_member_iter(cbdatap->dtt.dtt_ctfp, type,
- dt_print_type_width, &cbdata) != 0)
- return (-1);
- dt_printf(cbdatap->dtp, cbdatap->fp, "{\n");
- if (ctf_member_iter(cbdatap->dtt.dtt_ctfp, type,
- dt_print_type_member, &cbdata) != 0)
- return (-1);
- dt_printf(cbdatap->dtp, cbdatap->fp, "%*s};\n",cbdatap->indent * 4,"");
- break;
- case CTF_K_UNION:
- cbdata.f_type = 1;
- if (ctf_member_iter(cbdatap->dtt.dtt_ctfp, type,
- dt_print_type_width, &cbdata) != 0)
- return (-1);
- dt_printf(cbdatap->dtp, cbdatap->fp, "{\n");
- if (ctf_member_iter(cbdatap->dtt.dtt_ctfp, type,
- dt_print_type_member, &cbdata) != 0)
- return (-1);
- dt_printf(cbdatap->dtp, cbdatap->fp, "%*s};\n",cbdatap->indent * 4,"");
- break;
- case CTF_K_ENUM:
- dt_printf(cbdatap->dtp, cbdatap->fp, "%s;\n", ctf_enum_name(cbdatap->dtt.dtt_ctfp, type, *((int *) vp)));
- break;
- case CTF_K_TYPEDEF:
- dt_print_type_data(&cbdata, ctf_type_reference(cbdatap->dtt.dtt_ctfp,type));
- break;
- case CTF_K_VOLATILE:
- if (cbdatap->f_type)
- dt_printf(cbdatap->dtp, cbdatap->fp, "volatile ");
- dt_print_type_data(&cbdata, ctf_type_reference(cbdatap->dtt.dtt_ctfp,type));
- break;
- case CTF_K_CONST:
- if (cbdatap->f_type)
- dt_printf(cbdatap->dtp, cbdatap->fp, "const ");
- dt_print_type_data(&cbdata, ctf_type_reference(cbdatap->dtt.dtt_ctfp,type));
- break;
- case CTF_K_RESTRICT:
- if (cbdatap->f_type)
- dt_printf(cbdatap->dtp, cbdatap->fp, "restrict ");
- dt_print_type_data(&cbdata, ctf_type_reference(cbdatap->dtt.dtt_ctfp,type));
- break;
- default:
- break;
- }
-
- addr += ssz;
- cnt++;
- }
-
- return (0);
-}
-
-static int
-dt_print_type(dtrace_hdl_t *dtp, FILE *fp, caddr_t addr)
-{
- caddr_t addrend;
- char *p;
- dtrace_typeinfo_t dtt;
- dt_type_cbdata_t cbdata;
- int num = 0;
- int quiet = (dtp->dt_options[DTRACEOPT_QUIET] != DTRACEOPT_UNSET);
- ssize_t ssz;
-
- if (!quiet)
- dt_printf(dtp, fp, "\n");
-
- /* Get the total number of bytes of data buffered. */
- size_t nbytes = *((uintptr_t *) addr);
- addr += sizeof(uintptr_t);
-
- /*
- * Get the size of the type so that we can check that it matches
- * the CTF data we look up and so that we can figure out how many
- * type elements are buffered.
- */
- size_t typs = *((uintptr_t *) addr);
- addr += sizeof(uintptr_t);
-
- /*
- * Point to the type string in the buffer. Get it's string
- * length and round it up to become the offset to the start
- * of the buffered type data which we would like to be aligned
- * for easy access.
- */
- char *strp = (char *) addr;
- int offset = roundup(strlen(strp) + 1, sizeof(uintptr_t));
-
- /*
- * The type string might have a format such as 'int [20]'.
- * Check if there is an array dimension present.
- */
- if ((p = strchr(strp, '[')) != NULL) {
- /* Strip off the array dimension. */
- *p++ = '\0';
-
- for (; *p != '\0' && *p != ']'; p++)
- num = num * 10 + *p - '0';
- } else
- /* No array dimension, so default. */
- num = 1;
-
- /* Lookup the CTF type from the type string. */
- if (dtrace_lookup_by_type(dtp, DTRACE_OBJ_EVERY, strp, &dtt) < 0)
- return (-1);
-
- /* Offset the buffer address to the start of the data... */
- addr += offset;
-
- ssz = ctf_type_size(dtt.dtt_ctfp, dtt.dtt_type);
-
- if (typs != ssz) {
- printf("Expected type size from buffer (%lu) to match type size looked up now (%ld)\n", (u_long) typs, (long) ssz);
- return (-1);
- }
-
- cbdata.dtp = dtp;
- cbdata.dtt = dtt;
- cbdata.name = "";
- cbdata.addr = addr;
- cbdata.addrend = addr + nbytes;
- cbdata.indent = 1;
- cbdata.f_type = 1;
- cbdata.type_width = 0;
- cbdata.name_width = 0;
- cbdata.fp = fp;
-
- return (dt_print_type_data(&cbdata, dtt.dtt_type));
-}
-
static int
dt_print_sym(dtrace_hdl_t *dtp, FILE *fp, const char *format, caddr_t addr)
{
@@ -1904,6 +1596,16 @@ dt_print_mod(dtrace_hdl_t *dtp, FILE *fp, const char *format, caddr_t addr)
return (0);
}
+static int
+dt_print_memory(dtrace_hdl_t *dtp, FILE *fp, caddr_t addr)
+{
+ int quiet = (dtp->dt_options[DTRACEOPT_QUIET] != DTRACEOPT_UNSET);
+ size_t nbytes = *((uintptr_t *) addr);
+
+ return (dt_print_bytes(dtp, fp, addr + sizeof(uintptr_t),
+ nbytes, 50, quiet, 1));
+}
+
typedef struct dt_normal {
dtrace_aggvarid_t dtnd_id;
uint64_t dtnd_normal;
@@ -2644,12 +2346,6 @@ dt_consume_cpu(dtrace_hdl_t *dtp, FILE *fp, int cpu,
goto nextrec;
}
- if (act == DTRACEACT_PRINTT) {
- if (dt_print_type(dtp, fp, addr) < 0)
- return (-1);
- goto nextrec;
- }
-
if (DTRACEACT_ISPRINTFLIKE(act)) {
void *fmtdata;
int (*func)(dtrace_hdl_t *, FILE *, void *,
diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_errtags.h b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_errtags.h
index 6bc392ff65fa..d95de2dfa992 100644
--- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_errtags.h
+++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_errtags.h
@@ -265,8 +265,6 @@ typedef enum {
D_NOREG, /* no available internal registers */
D_PRINTM_ADDR, /* printm() memref bad type */
D_PRINTM_SIZE, /* printm() size bad type */
- D_PRINTT_ADDR, /* printt() typeref bad type */
- D_PRINTT_SIZE /* printt() size bad type */
} dt_errtag_t;
extern const char *dt_errtag(dt_errtag_t);
diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h
index e71e9d71aeff..f2c60a2b07d4 100644
--- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h
+++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h
@@ -488,7 +488,6 @@ struct dtrace_hdl {
#define DT_ACT_SETOPT DT_ACT(28) /* setopt() action */
#define DT_ACT_PRINT DT_ACT(29) /* print() action */
#define DT_ACT_PRINTM DT_ACT(30) /* printm() action */
-#define DT_ACT_PRINTT DT_ACT(31) /* printt() action */
/*
* Sentinel to tell freopen() to restore the saved stdout. This must not
diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c
index a56b98681d3b..77d8386bc80f 100644
--- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c
+++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c
@@ -392,8 +392,6 @@ static const dt_ident_t _dtrace_globals[] = {
&dt_idops_func, "void(@, ...)" },
{ "printm", DT_IDENT_ACTFUNC, 0, DT_ACT_PRINTM, DT_ATTR_STABCMN, DT_VERS_1_0,
&dt_idops_func, "void(size_t, uintptr_t *)" },
-{ "printt", DT_IDENT_ACTFUNC, 0, DT_ACT_PRINTT, DT_ATTR_STABCMN, DT_VERS_1_0,
- &dt_idops_func, "void(size_t, uintptr_t *)" },
{ "probefunc", DT_IDENT_SCALAR, 0, DIF_VAR_PROBEFUNC,
DT_ATTR_STABCMN, DT_VERS_1_0, &dt_idops_type, "string" },
{ "probemod", DT_IDENT_SCALAR, 0, DIF_VAR_PROBEMOD,
@@ -505,8 +503,6 @@ static const dt_ident_t _dtrace_globals[] = {
&dt_idops_func, "void(@, size_t, ...)" },
{ "trunc", DT_IDENT_ACTFUNC, 0, DT_ACT_TRUNC, DT_ATTR_STABCMN,
DT_VERS_1_0, &dt_idops_func, "void(...)" },
-{ "typeref", DT_IDENT_FUNC, 0, DIF_SUBR_TYPEREF, DT_ATTR_STABCMN, DT_VERS_1_1,
- &dt_idops_func, "uintptr_t *(void *, size_t, string, size_t)" },
{ "uaddr", DT_IDENT_ACTFUNC, 0, DT_ACT_UADDR, DT_ATTR_STABCMN,
DT_VERS_1_2, &dt_idops_func, "_usymaddr(uintptr_t)" },
{ "ucaller", DT_IDENT_SCALAR, 0, DIF_VAR_UCALLER, DT_ATTR_STABCMN,
diff --git a/cddl/lib/libdtrace/Makefile b/cddl/lib/libdtrace/Makefile
index 83a93cf0cb50..17e1eb9bdf5c 100644
--- a/cddl/lib/libdtrace/Makefile
+++ b/cddl/lib/libdtrace/Makefile
@@ -121,12 +121,10 @@ LIBADD= ctf elf proc pthread rtld_db
CLEANFILES= dt_errtags.c dt_names.c
-dt_errtags.c:
- sh ${OPENSOLARIS_USR_DISTDIR}/lib/libdtrace/common/mkerrtags.sh < ${OPENSOLARIS_USR_DISTDIR}/lib/libdtrace/common/dt_errtags.h > dt_errtags.c
-
-dt_names.c:
- sh ${OPENSOLARIS_USR_DISTDIR}/lib/libdtrace/common/mknames.sh < ${OPENSOLARIS_SYS_DISTDIR}/uts/common/sys/dtrace.h > dt_names.c
+.include <bsd.lib.mk>
-beforedepend: dt_errtags.c dt_names.c
+dt_errtags.c: ${OPENSOLARIS_USR_DISTDIR}/lib/libdtrace/common/dt_errtags.h
+ sh ${OPENSOLARIS_USR_DISTDIR}/lib/libdtrace/common/mkerrtags.sh < ${.ALLSRC} > ${.TARGET}
-.include <bsd.lib.mk>
+dt_names.c: ${OPENSOLARIS_SYS_DISTDIR}/uts/common/sys/dtrace.h
+ sh ${OPENSOLARIS_USR_DISTDIR}/lib/libdtrace/common/mknames.sh < ${.ALLSRC} > ${.TARGET}
diff --git a/contrib/amd/AUTHORS b/contrib/amd/AUTHORS
index 3c241d016bb9..1ae6dcd2d72e 100644
--- a/contrib/amd/AUTHORS
+++ b/contrib/amd/AUTHORS
@@ -6,22 +6,22 @@ This file lists the ones who contributed major code changes, in no
particular order, and I thank them all. This is of course not to diminish
the smaller contributes of the many others. Thank you all.
-* Erez Zadok <ezk@cs.sunysb.edu>
+* Erez Zadok <ezk AT cs.sunysb.edu>
The most significant changes were made by Erez Zadok in terms of bug fixes,
ports, and new features added. Erez Zadok is the current maintainer of
am-utils, as of January 1997.
-* Ion Badulescu <ion@cs.columbia.edu>
+* Ion Badulescu <ion AT cs.columbia.edu>
Co-maintainer of am-utils since late 1999: Linux and Solaris autofs support,
Linux NFSv3 support, major code reorganization, etc...
-* Randall S. Winchester <rsw@glue.umd.edu>
+* Randall S. Winchester <rsw AT glue.umd.edu>
May 7, 1997: contributed a special version of upl102 that included NFS V.3
support. Some of the code was contributed by Christos Zoulas
-<christos@deshaw.com>. I (Erez) ported these changes to am-utils.
+<christos AT deshaw.com>. I (Erez) ported these changes to am-utils.
September 12, 1997: lots of small prototype cleanups and fixes to numerous
files.
@@ -35,12 +35,12 @@ February 1, 1998: fixes for NetBSD to better detect its features.
September 4, 1999: assorted fixes for NetBSD 1.4+.
-* Hannes Reinecke <hare@MathI.UNI-Heidelberg.DE>
+* Hannes Reinecke <hare AT MathI.UNI-Heidelberg.DE>
Back in 1995, contributed code for linux. A new parser for file system
specific options that only exist under linux.
-* Leif Johansson <leifj@matematik.su.se>
+* Leif Johansson <leifj AT matematik.su.se>
June 22, 1997: minor patch to ensure that systems without an RE library work.
@@ -52,7 +52,7 @@ functions. Contributed scripts/amd2ldif.pl.
August 4, 1997: info_ldap.c fixes and adding two new amd.conf ldap
variables: ldap_cache_seconds and ldap_cache_maxmem.
-* Andreas Stolcke <stolcke@speech.sri.com>
+* Andreas Stolcke <stolcke AT speech.sri.com>
June 22, 1997: patches to ensure that proto= and vers= options work
properly in mount tables and can be overridden. Later on, more code
@@ -68,11 +68,11 @@ message.
December 19, 1997: detected an FMR (Free Memory Read) in amd/mntfs.c,
uninit_mntfs().
-* Danny Braniss <danny@cs.huji.ac.il>
+* Danny Braniss <danny AT cs.huji.ac.il>
July, 6 1997: contributed patches to hesiod on bsdi3.
-* Tom Schmidt <tschmidt@micron.com>
+* Tom Schmidt <tschmidt AT micron.com>
July 10, 1997: Recommdation to include libgdbm if libc has no dbm_open.
Patches for netgrp(host) command. Mods to aux/config.guess to recognize
@@ -86,7 +86,7 @@ IFF_ROUTE instead of IFF_LOOPBACK.
May 30, 2000: correct logging types for addopts/mergeopts messages.
-* Daniel S. Riley <dsr@mail.lns.cornell.edu>
+* Daniel S. Riley <dsr AT mail.lns.cornell.edu>
July 11, 1997: fixes to DU-4.0 to support string POSIX.1 signals, and struct
sockaddr with sa_len field.
@@ -99,15 +99,15 @@ grpid, nosuid, and actimo.
August 15, 1998: fix memory leak in processing of /defaults, and avoid
accessing uninitialized memory in osf1.
-* Roman Hodek <Roman.Hodek@informatik.uni-erlangen.de>
+* Roman Hodek <Roman.Hodek AT informatik.uni-erlangen.de>
July 23, 1997: Got lots of patches from the Debian Linux folks, who fixed
several generic bugs, and one serious one for Linux. The latter involved
using connected sockets for NFS mounts on kernels 1.3.10 and older. Roman's
-work is baed on amd-upl102, and work from Ian Murdock <imurdock@debian.org>
-and Dominik Kubla <dominik@debian.org>.
+work is baed on amd-upl102, and work from Ian Murdock <imurdock AT debian.org>
+and Dominik Kubla <dominik AT debian.org>.
-* Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
+* Rainer Orth <ro AT TechFak.Uni-Bielefeld.DE>
August 6, 1997: assorted fixes to support hesiod-1.3, solaris 2.4 (which I
already fixed but did not release yet), and support for $LDFLAGS at
@@ -132,34 +132,34 @@ mount tables in Solaris 8.
February 9, 2000: new debug options hrtime (hi-res timer) and xdrtrace. bug
fixes.
-* Jason Thorpe <thorpej@nas.nasa.gov>
+* Jason Thorpe <thorpej AT nas.nasa.gov>
August 25, 1997: make amd work when talking to NIS+ servers in NIS
compatibility mode. Fix originally came from Matthieu Herrb
-<matthieu@laas.fr>.
+<matthieu AT laas.fr>.
-* Chris Metcalf <metcalf@catfish.lcs.mit.edu>
+* Chris Metcalf <metcalf AT catfish.lcs.mit.edu>
August 29, 1997: patch to make amd use FQHN for NFS/RPC authentication,
useful esp. for cross-domain NFS mounts.
September 2, 1997: if plock() succeeded, don't display errno string.
-* Enami Tsugutomo <enami@cv.sony.co.jp>
+* Enami Tsugutomo <enami AT cv.sony.co.jp>
September 4, 1997: don't ping remote servers with NFS V.3 always, but V.2,
regardless of client's NFS version. (conf/transp/transp_sockets.c)
-* Dan Riley <dsr@mail.lns.cornell.edu>
+* Dan Riley <dsr AT mail.lns.cornell.edu>
September 19, 1997: make sure that amd works with more secure portmappers
that do not allow forwarding of RPC messages to other services.
-* Wolfgang Rupprecht <wolfgang@wsrcc.com>
+* Wolfgang Rupprecht <wolfgang AT wsrcc.com>
August 10, 1997: netbsd and other bsd systems have a mask flag for
pcfs_args (msdos mount).
-* Christos Zoulas <christos@zoulas.com>
+* Christos Zoulas <christos AT zoulas.com>
September 25, 1997: fix to initialize uid/gid fields of pcfs_args_t on
netbsd.
@@ -181,7 +181,7 @@ TLI implementations. Patch to print version string (amd -v) after all
options had been initialized, so we can print domain, host, and hostd.
Linux patch to use umount2(2) if umount(2) fails.
-* Bill Paul <wpaul@ctr.columbia.edu>
+* Bill Paul <wpaul AT ctr.columbia.edu>
November 5, 1997: NFS v.3 support for AIX 4.2.1, which does *not* include
headers for this. Bill had to guess at the right structures, field names,
@@ -189,26 +189,26 @@ sizes, alignment, etc.
January 15, 1999: small ldap bug fixes.
-* Stefan Vogel <vogel@physik-rzu.unizh.ch>
+* Stefan Vogel <vogel AT physik-rzu.unizh.ch>
November 14, 1997: typo in the subscription instructions to amd-dev.
-* Guntram Wolski <gwolsk@sei.com>
+* Guntram Wolski <gwolsk AT sei.com>
November 15, 1997: pointed out mismatching documentation for the -o option.
-* Michael Hucka <hucka@eecs.umich.edu>
+* Michael Hucka <hucka AT eecs.umich.edu>
January 11, 1997: pointed out reversed definition of NFS mount options vers
and proto.
-* Albert Chin <china@pprd.abbott.com>
+* Albert Chin <china AT pprd.abbott.com>
January 12, 1998: minor bug in output of amd -H.
June 23, 2005: assortment of small compile bugs on aix4, and solaris 5/6/7.
-* Thomas Richter <richter@chemie.fu-berlin.de>
+* Thomas Richter <richter AT chemie.fu-berlin.de>
January 13, 1998: use case insensitive comparisons for variables that need
it (such as all hostname related ones, and more).
@@ -216,11 +216,11 @@ it (such as all hostname related ones, and more).
July 20, 1998: don't leak memory in the private version of yp_all (when
vendor yp_all is bad).
-* Fred Korz <korz@smarts.com>
+* Fred Korz <korz AT smarts.com>
January 30, 1998: minor typo fixed to tftp example in am-utils.texi.
-* Donald Buczek <buczek@MPIMG-Berlin-Dahlem.MPG.DE>
+* Donald Buczek <buczek AT MPIMG-Berlin-Dahlem.MPG.DE>
March 6, 1998: correctly inherit existing NFS V.3 mounts upon restart.
@@ -230,36 +230,36 @@ March 20, 1998: do not close stdout in case it gets reused elsewhere and to
allow startup script to redirect it. Set a temporary secure umask(0022)
before writing log file and restore it afterwards.
-* Matthew Crosby <mcrosby@ms.com>
+* Matthew Crosby <mcrosby AT ms.com>
April 20, 1998: allow arbitrary number of interfaces in wire listing.
-* David O'Brien <obrien@NUXI.com>
+* David O'Brien <obrien AT NUXI.com>
September 4, 1998: bug fix to avoid overrunning hostname buffer, and minor
amd.conf man page typo correction.
September 22, 1999: use more secure vsnprintf in real_plog().
-* Danny Rathjens <dkr@cs.fiu.edu>
+* Danny Rathjens <dkr AT cs.fiu.edu>
October 29, 1998: swap arguments to kill(2) in amd.c.
-* Mike Mitchell <mcm@unx.sas.com>
+* Mike Mitchell <mcm AT unx.sas.com>
November 3, 1998: amd/nfs_subr.c (nfsproc_lookup_2_svc): try to avoid a race
condition between unmounting and re-mounting an entry, by increasing the ttl
of a looked up entry before unmounting it.
-* Douglas K. Rand" <rand@aero.und.edu>
+* Douglas K. Rand" <rand AT aero.und.edu>
December 3, 1998: case insensitive host name match for nfsl.
-* David Wolfskill <dhw@whistle.com>
+* David Wolfskill <dhw AT whistle.com>
January 28, 1999: don't turn on/off noconn option if it was already in that
state.
-* Jeffrey C Honig <jch@BSDI.COM>
+* Jeffrey C Honig <jch AT BSDI.COM>
March 14, 1999: clean up more autogenerated files upon "make distclean".
March 15, 1999: avoid overly verbose NIS warning even on systems that don't
@@ -271,30 +271,30 @@ detection for bsdi4.
September 17, 1999: fixes to expn.
-* Paul Balyoz <pbalyoz@sedona.ch.intel.com>
+* Paul Balyoz <pbalyoz AT sedona.ch.intel.com>
March 26, 1999: ensure lostaltmail displays Y2K compliant dates.
-* Jon Peatfield <J.S.Peatfield@damtp.cam.ac.uk>
+* Jon Peatfield <J.S.Peatfield AT damtp.cam.ac.uk>
March 30, 1999: turn off incomplete NFS V.3 support in HPUX 10.20.
September 22, 1999: safe reloading of maps without first clearing old
copies, and using cached copies if map failed to reload.
-* Peter Breitenlohner <peb@mppmu.mpg.de>
+* Peter Breitenlohner <peb AT mppmu.mpg.de>
July 24, 1999: patch for linux 2.2.x to work with older libc5 systems, and
nis_isup mis-logic fixes.
December 13, 2001: report typos in scripts/amd.conf.5.
-* Dale Talcott <aeh@quest.cc.purdue.edu>
+* Dale Talcott <aeh AT quest.cc.purdue.edu>
July 26, 1999: added NFS3 support for AIX mounting.
-* Christophe Kalt <Christophe-Kalt@deshaw.com>
+* Christophe Kalt <Christophe-Kalt AT deshaw.com>
July 14, 1999: add netgrpd() syntax function which uses FQHN.
-* Andrew J. Korty <ajk@purdue.edu>
+* Andrew J. Korty <ajk AT purdue.edu>
September 5, 1999: pawd works for type:=nfsl.
-* Nick Williams <njw@ms.com>
+* Nick Williams <njw AT ms.com>
September 1, 1999: bug fix for incorrect symlinks when two locations are
requested simultaneously.
@@ -306,38 +306,38 @@ doing rapid mounts and umounts in succession.
June 5, 2000: better handling of potential race-conditions during rapid
u/mounts. Correctly update d_drops stats for amq -s.
-* Johann Pfefferl <johann.pfefferl.jp@germany.agfa.com>
+* Johann Pfefferl <johann.pfefferl.jp AT germany.agfa.com>
November 16, 1999: fix to ldap code so repeated calls to string2he don't
corrupt the string passed.
-* Amitha Perera <perera@cs.rpi.edu>
+* Amitha Perera <perera AT cs.rpi.edu>
December 9, 1999: detect all wire() interfaces correctly.
-* Steven Danz <sdanz@awc.kc.noaa.gov>
+* Steven Danz <sdanz AT awc.kc.noaa.gov>
January 25, 2000: allow browsable auto maps.
-* Wolfram Klaus <klaus@physik.fu-berlin.de>.
+* Wolfram Klaus <klaus AT physik.fu-berlin.de>.
November 21, 2000: recognize proplist mnttab flag.
-* Thomas Klausner <tk@giga.or.at>
+* Thomas Klausner <tk AT giga.or.at>
November 21, 2000: lots of NetBSD fixes (many of which are generic).
April 18, 2003: patch to reference am-utils info pages in man page.
November 28, 2004: small fixes to typos in amd.conf(5) man page.
-* Olaf Kirch <okir@caldera.de>
+* Olaf Kirch <okir AT caldera.de>
February 1, 2001: important Linux NFS error number mapping fixed
-* Ahmon Dancy <dancy@franz.com>
+* Ahmon Dancy <dancy AT franz.com>
February 9, 2001: Apple Rhapsody/Darwin/OS X port
-* Sebastien Bahloul <sebastien.bahloul@mangoosta.fr>
+* Sebastien Bahloul <sebastien.bahloul AT mangoosta.fr>
July 3, 2001: LDAP fixes and updates to support new APIs
March 27, 2002: LDAP bug and port to HPUX-11.
-* Philippe Troin <phil@fifi.org>
+* Philippe Troin <phil AT fifi.org>
July 12, 2001: Proper handling of GNU getopt, support for optionally
disabling LDAP/Hesiod, fixes for the dev/nodev option on Linux. Texi
documentation fix.
@@ -348,65 +348,65 @@ generic mount option.
July 17, 2003: pref:=null core dump fix. libgdbm portability. tcpd/librap
support. And a few other things for the 6.0 branch.
-* Trond Myklebust <trond.myklebust@fys.uio.no>
+* Trond Myklebust <trond.myklebust AT fys.uio.no>
January 10, 2002: Proper initialization of the timeo parameter on Linux, TCP
_must_ have a timeout 2 orders of magnitude larger than UDP
-* George Ross <gdmr@dcs.ed.ac.uk>
+* George Ross <gdmr AT dcs.ed.ac.uk>
April 29, 2002: Rework of old code, support for wildcards in LDAP queries,
and an FD leak fix. Amd -A support.
October 21, 2002: ldap_unbind fix for SIGPIPE, and support for LDAPv3
-protocol version parameter (with Tim Colles <timc@inf.ed.ac.uk>).
+protocol version parameter (with Tim Colles <timc AT inf.ed.ac.uk>).
-* Matthias Scheler <tron@zhadum.de>
+* Matthias Scheler <tron AT zhadum.de>
June 14, 2002: patch to use "xlatecookie" NFS mount option.
-* Jun-ichiro itojun Hagino <itojun@iijlab.net>.
+* Jun-ichiro itojun Hagino <itojun AT iijlab.net>.
June 11, 2002: minor fixes to support NetBSD 1.6A.
-* Sean Fagan <sef@apple.com>
+* Sean Fagan <sef AT apple.com>
March 14, 2003: detect and use the MNT2_GEN_OPT_AUTOMNTFS mount flag
on OS X / Darwin.
-* Hendrik Scholz <hscholz@raisdorf.net>
+* Hendrik Scholz <hscholz AT raisdorf.net>
June 9, 2003: mk-amd-map should open temp db file using O_EXCL.
-* Mark Davies <mark@mcs.vuw.ac.nz>
+* Mark Davies <mark AT mcs.vuw.ac.nz>
July 14, 2003: define "xlatecookie" mnttab option if not defined (for
NetBSD). Support null hesiod entries if they start with a ".".
-* Eric S. Raymond <esr@thyrsus.com>
+* Eric S. Raymond <esr AT thyrsus.com>
December 9, 2003: fix unbalanced [] typo in fsinfo man page.
-* Martin Blapp <mb@imp.ch>
+* Martin Blapp <mb AT imp.ch>
July 6, 2004: recognize fields in pcfs_args_t in FreeBSD 5.
-* Dan Nelson <dnelson@allantgroup.com>
+* Dan Nelson <dnelson AT allantgroup.com>
August 2, 2004: pawd to recognize "host" type mounts.
-* Hauke Fath <hauke@Espresso.Rhein-Neckar.DE>
+* Hauke Fath <hauke AT Espresso.Rhein-Neckar.DE>
August 3, 2004: pawd to recognize "linkx" type mounts.
-* Michael van Elst <M.van.Elst@science-computing.de>
+* Michael van Elst <M.van.Elst AT science-computing.de>
September 1, 2004: bug fix to avoid race condition in calls to mntctl on
AIX.
-* Jonathan Chen <jon+amd@spock.org>
+* Jonathan Chen <jon+amd AT spock.org>
October 22, 2004: patch/fix to move mlock/mlockall/plock code after the
fork().
June 29, 2005: core dump going off end of exported_ap[] array.
September 29, 2005: patch/fix for pawd not to go into an infinite loop.
October 25, 2005: patch/fix for pawd to repeatedly resolve path.
-* David Rage <rage@ucl.ac.uk>
+* David Rage <rage AT ucl.ac.uk>
January 17, 2005: prevent Amd from logging 'Read-only filesystem' errors
when the mount point has an ancestor (i.e. '/') that is mounted read-only.
-* Kevin Layer <layer@franz.com>
+* Kevin Layer <layer AT franz.com>
January 28, 2005: basic instructions how to setup Amd on Mac OS-X.
-* Dan Ottavio <dottavio@ic.sunysb.edu>
+* Dan Ottavio <dottavio AT ic.sunysb.edu>
March 2, 2005: new global amd.conf option debug_mtab_file, to set the debug
mtab file when using debug_options=mtab. Default has changed from "./mtab"
to "/tmp/mtab" to avoid security problem. Bug fixed to ensure that Amd
@@ -415,16 +415,13 @@ terminates properly even mtab file doesn't exist.
* Erik Kline <ekline at ekline dot com>
January 3, 2005: implementation of executable maps for Amd.
-* Jim Zajkowski <jim.zajkowski@gmail.com>
+* Jim Zajkowski <jim.zajkowski AT gmail.com>
March 14, 2005: small patch to amd2ldif.
* Adam Morley <adam at gmi dot com>
January 27, 2005: synchronize what amd2ldif does vs. what the ldap.schema
expects.
-* Graeme Wilford <G.Wilford@surrey.ac.uk>
+* Graeme Wilford <G.Wilford AT surrey.ac.uk>
July 4, 2005: buffer overflow in pawd.
-* Steve Plite <splite-amutils@sigint.cs.purdue.edu>
-September 22, 2005: repair reversed meaning of D_AMQ, so amq will unregister
-on exit.
diff --git a/contrib/amd/BUGS b/contrib/amd/BUGS
index 3a3ba6b367d4..8e87e859cbac 100644
--- a/contrib/amd/BUGS
+++ b/contrib/amd/BUGS
@@ -1,7 +1,7 @@
LIST OF KNOWN BUGS IN AM-UTILS OR OPERATING SYSTEMS
Note: report am-utils bugs via Bugzilla to https://bugzilla.am-utils.org/ or
-by email to the am-utils@am-utils.org mailing list.
+by email to the am-utils mailing list (see www.am-utils.org).
(1) mips-sgi-irix*
@@ -98,11 +98,11 @@ diff -u -r1.1 utsname.h
(4) powerpc-ibm-aix4.2.1.0
-[4A] "Randall S. Winchester" <rsw@Glue.umd.edu> reports that for amd to
+[4A] "Randall S. Winchester" <rsw AT Glue.umd.edu> reports that for amd to
start, you need to kill and restart rpc.mountd and possibly also make sure
that nfsd is running. Normally these are not required.
-[4B] "Stefan Vogel" <vogel@physik.unizh.ch> reports that if your amq
+[4B] "Stefan Vogel" <vogel AT physik.unizh.ch> reports that if your amq
executable dump core unexpectedly, then it may be a bug in gcc 2.7.x.
Upgrade to gcc 2.8.x or use IBM's xlC compiler.
@@ -123,7 +123,7 @@ but it is not yet in the glibc-2.0.7-19 RPM.
A bug in libc results in an amq binary that doesn't work; amq -v dumps core
in xdr_string. There is no known fix (source code or vendor patch) at this
-time. (Please let am-utils@am-utils.org know if you know of a fix.)
+time. (Please let us know if you have a fix; see www.am-utils.org.)
(7) *-aix4.3.2.0
diff --git a/contrib/amd/COPYING b/contrib/amd/COPYING
index 035f6239c935..f54191d75fea 100644
--- a/contrib/amd/COPYING
+++ b/contrib/amd/COPYING
@@ -1,4 +1,4 @@
-Copyright (c) 1997-2006 Erez Zadok
+Copyright (c) 1997-2014 Erez Zadok
Copyright (c) 1989 Jan-Simon Pendry
Copyright (c) 1989 Imperial College of Science, Technology & Medicine
Copyright (c) 1989 The Regents of the University of California.
@@ -15,12 +15,7 @@ are met:
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. All advertising materials mentioning features or use of this software
- must display the following acknowledgment:
- This product includes software developed by the University of
- California, Berkeley and its contributors, as well as the Trustees of
- Columbia University.
-4. Neither the name of the University nor the names of its contributors
+3. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
diff --git a/contrib/amd/ChangeLog b/contrib/amd/ChangeLog
index 12f2c5fb8e65..d996f8e75082 100644
--- a/contrib/amd/ChangeLog
+++ b/contrib/amd/ChangeLog
@@ -1,14 +1,564 @@
-2006-05-11 Erez Zadok <ezk@cs.sunysb.edu>
+2014-10-28 Christos Zoulas <christos@zoulas.com>
*******************************************************************
- *** Released am-utils-6.1.5 ***
+ *** Released am-utils-6.2 ***
*******************************************************************
-2006-05-10 Erez Zadok <ezk@cs.sunysb.edu>
+ * add ylwrap.amd, sick and tired of patching broken ylwrap.
+
+2014-09-05 Christos Zoulas <christos@zoulas.com>
+
+ * factor out the size check for both readdir methods
+ (raven at themaw.net)
+
+2014-09-03 Christos Zoulas <christos@zoulas.com>
+
+ * configure test for 64 bit xdr function (raven at themaw.net)
+
+2014-09-01 Christos Zoulas <christos@zoulas.com>
+
+ * bug fix from raven at themaw.net to prevent writing v3 handle
+ to a v2 structure.
+
+2014-07-21 Christos Zoulas <christos@zoulas.com>
+
+ * fix permission problems with access
+ * auto_nfs_version = 3 now works for me.
+
+2014-07-20 Christos Zoulas <christos@zoulas.com>
+
+ * refresh some autoconf files
+ * force autoconf version since earlier versions don't work
+ * changes from raven at themaw.net to support NFSv3 for automounted
+ toplevel filesystems presented to the list in May. A few bug fixes
+ and integration changes by me. The code now works well enough to
+ mount the filesystem with NFSv3 and automount children but readdir
+ does not work yet (so no listing of automounted filesystems).
+ The new code is not enabled by default. To enable use
+ auto_nfs_version = 3
+ in your configuration file.
+
+2014-03-26 Christos Zoulas <christos@zoulas.com>
+
+ From Ian Kent <ikent@redhat.com>
+
+ * use mktemp in scripts/fixrmtab
+ * fix documentatio nits
+ * [linux] Add ext2, ext3, ext4 specific mount options
+ * fix tcpwrappers (hosts.{allow,deny} problems for specific host
+ entries
+
+2014-03-20 Christos Zoulas <christos@zoulas.com>
+
+
+ * don't background autofs umount
+ * avoid fh NULL dereference on umount
+ * handle ENOENT umount return for autofs mounts
+ * fix error message in get_nfs_version
+ * fix debug log deadlock
+ * [linux] retry umount on EBUSY
+ * handle failed umount on exit
+
+2014-03-09 Christos Zoulas <christos@zoulas.com>
+
+ * Remove BSD advertising clause.
+ * Remove expn program which is not used by anything
+
+2013-12-05 Christos Zoulas <christos@zoulas.com>
+
+ * Change the way we handle multiple lex scanners and yacc parsers
+ in a single program. Our old patch to ylwrap does not work anymore
+ because the bison parsers need shared symbols that start with yy
+ and we can't easily select which ones work. So now we use -P and
+ -p to let lex and yacc do the work for us. This requires a patch
+ to ylwrap, but it is smaller.
+
+
+2013-12-05 Christos Zoulas <christos@zoulas.com>
+
+ * Change the way we handle multiple lex scanners and yacc parsers
+ in a single program. Our old patch to ylwrap does not work anymore
+ because the bison parsers need shared symbols that start with yy
+ and we can't easily select which ones work. So now we use -P and
+ -p to let lex and yacc do the work for us. This requires a patch
+ to ylwrap, but it is smaller.
+
+2013-05-14 Christos Zoulas <christos@zoulas.com>
+
+ * update to handle new autoconf and regen files
+
+2012-11-23 Christos Zoulas <christos@zoulas.com>
+
+ * recognize mountport=, noacl options
+ * simplify the bootstrap process, by forcing
+ all the files to be rebuild with autoreconf -f - i
+
+2012-10-03 Christos Zoulas <christos@zoulas.com>
+
+ * add missing ops_nfs4.c to the Makefile.am
+
+2012-09-14 Christos Zoulas <christos@zoulas.com>
+
+ * add locking option handling for lustre
+ * fix noatime, nodiratime, mandlock for linux
+
+2012-07-25 Christos Zoulas <christos@zoulas.com>
+
+ * bug fixes for lustre rhost parsing
+
+2012-06-27 Christos Zoulas <christos@zoulas.com>
+
+ * Disable 1/2-baked sun map support to avoid SIGSEGV
+
+2012-06-16 Christos Zoulas <christos@zoulas.com>
+
+ *******************************************************************
+ *** Released am-utils-6.2-rc1 ***
+ *******************************************************************
+
+ * Fix libtool.m4 to work with later versions of autoconf.
+ * In buildall, use eval so that quoted strings work
+ * Centralize nfs version checking function, and introduce
+ new configuration variable nfs_vers_ping, which is the
+ max version we ping for. This is not documented yet, because
+ there might be a better way separate the max version we can
+ use vs the max version we ping for.
+
+2012-06-09 Christos Zoulas <christos@zoulas.com>
+
+ * fix issue with parsing nfsv4 security option strings
+
+2012-05-01 Christos Zoulas <christos@zoulas.com>
+
+ * Handle EPERM return from v4 file handles
+ in old linux kernels
+
+2012-03-09 Christos Zoulas <christos@zoulas.com>
+
+ * fix linux autofs detection
+ * fix wrong types in new amq mount xdr processing
+
+2012-01-25 Christos Zoulas <christos@zoulas.com>
+
+ * FreeBSD portability fixes
+
+2012-01-23 Christos Zoulas <christos@zoulas.com>
+
+ * Avoid type punned warnings
+
+2011-12-29 Christos Zoulas <christos@zoulas.com>
+
+ * fix bug I introduced in get_nfs_version that caused it to return 0
+ * add direct support for ext{2,3,4}
+
+2011-12-15 Christos Zoulas <christos@zoulas.com>
+
+ * Include <linux/fs.h> on linux, to grab extra mount flags
+ * Add support for lustre
+
+2011-11-28 Christos Zoulas <christos@zoulas.com>
+
+ * For nfsl mounts, match against either the short local
+ host name or the fqdn name.
+
+2011-10-06 Christos Zoulas <christos@zoulas.com>
+
+ * Add NFSv4 support (loosely based on Ramya's code).
+ Currently if the NFSv4 mount fails with ENOENT we fail
+ back to NFSv3, unless -DNO_FALLBACK.
+ * Replace strdup with xstrdup. It is not nice to replace
+ system functions with ones that behave differently.
+ * Add various consistency checks (caller function checks
+ variable for NULL, but callee does not).
+ * Fix error handling in various paths.
+ * Don't check before using XFREE(). free(NULL) works.
+
+2011-09-15 Christos Zoulas <christos@zoulas.com>
+
+ * amq -i addition (prints info about the map files)
+
+2011-09-14 Christos Zoulas <christos@zoulas.com>
+
+ * Solaris OS and compiler fixes from:
+ Hofmann, Frank <Frank.Hofmann@morganstanley.com>
+ Sayle, Alex <Alex.Sayle@morganstanley.com>
+ - (void)&var generates warnings, removed
+ - __inline is invalid, changed with inline
+ - <sys/socket.h> and other headers have extra dependendcies
+ `
+2011-08-11 Christos Zoulas <christos@zoulas.com>
+
+ * fix potential buffer overflow in expand_error()
+ (Richard Kettlewell). Does not seem to be exploitable.
+
+ * simplify %option parsing to appease ancient flex.
+
+2011-06-21 Christos Zoulas <christos@zoulas.com>
+
+ * add support for linux autofs version 5 (untested)
+
+2011-06-18 Christos Zoulas <christos@zoulas.com>
+
+ * roll back to an older version of libtool that works
+
+ * newer versions of config.guess and config.sub
+
+ * minor fixes to buildall
+
+2011-05-19 Christos Zoulas <christos@zoulas.com>
+
+ * m4/macros/libtool.m4: for AIX AC_LANG_PROGRAM is incorrectly
+ used and the latest autoconf gives an error. For now just
+ quote it.
+
+ * configure.in: Fedora Core 15 and RedHat 6 now don't define
+ af_family_t in <linux/socket.h>, but in <bits/sockaddr.h>.
+ Include <sys/socket.h> so that we get <bits/sockaddr.h>
+ indirectly. This caused the <linux/nfs_mount.h> detection
+ test to fail.
+
+2010-11-24 Erez Zadok <ezk@fsl.cs.sunysb.edu>
+
+ * m4/macros/os_cflags.m4: for linux, define _GNU_SOURCE (to get
+ definitions for O_LARGEFILE and more).
+
+2010-11-20 Christos Zoulas <christos@zoulas.com>
+
+ * Update news items, add release readme, mark as rc1
+
+ * Fix addopts code to work with options that are key=value
+ when the built-in hasmntopt() code is not used. The problem
+ was that the code passed "key=" to hasmntopt not "key".
+
+2009-12-10 Christos Zoulas <christos@zoulas.com>
+
+ * Copy all fields of the am_opts structure
+ When we introduced am_loc we also added a function to
+ create a duplicate of an am_opts structure. As it turns
+ out, that only made a partial copy of the struct and some
+ fields (e.g. opt_cache) was left blank in the new structure.
+ Unfortunately any code that was checking the options
+ through the mntfs structure was mislead by the partial
+ copy: caching was disabled completely, for example, and
+ since browsing relies on caching being enabled it wasn't
+ working either.
+ From: Krisztian Kovacs <Kris.Kovacs@morganstanley.com>
+
+ * Initialize RPC authentication flavor to AUTH_UNIX instead
+ of zero. RHEL 5 uses version 6 of the mount_arg structure
+ that includes the desired RPC authorization flavour.
+ Unfortunately amd initializes that value to zero, meaning
+ AUTH_NULL, resulting in all NFS servers denying operations.
+ From: Krisztian Kovacs <Kris.Kovacs@morganstanley.com>
+
+ * Make sure to remove nodes in the proper order when going
+ down. Depending on what order the nodes got created it's
+ possible that the parent of a node has a bigger am_mapno
+ (index in exported_ap[]) so that it gets freed before
+ its child while the child's am_parent pointer is still
+ pointing to the already freed block of memory.
+ This change makes sure that umount_exported() cleans up
+ all children of a node first before freeing the node.
+ From: Krisztian Kovacs <Kris.Kovacs@morganstanley.com>
+
+ * Fix Linux-specific stuff in ops_tmpfs.c
+ AUTOFS_TMPFS_FS_FLAGS is defined only in the Linux-specific
+ conf_linux.c file, so it cannot be built on Solaris.
+ From: Krisztian Kovacs <Kris.Kovacs@morganstanley.com>
+
+ * Add missing parenthesis to fix defined(XXX
+ From: Krisztian Kovacs <Kris.Kovacs@morganstanley.com>
+
+ * In the previous commit we've already made a change that
+ makes this code unnecessary since the node is returned
+ even if the backing file server is known to be down.
+ Since the code path is unused it should be removed.
+ From: Krisztian Kovacs <Kris.Kovacs@morganstanley.com>
+
+ * amfs_generic_lookup_child() tries to find an alternate
+ file server if it detects that the current one is down.
+ However, in the comparison used to decide if a possible
+ mount is the same as the current one it compares the am_loc
+ pointers instead of the actual mntfs pointers. Since
+ amfs_lookup_one_location() creates a brand new am_loc
+ structure for the returned mntfs structure the am_loc
+ pointer will be different even if the mntfs it's pointing
+ to is the same.
+ This tricks amfs_generic_lookup_child() think it has
+ found an alternate file server while it hasn't and thus
+ starts multiple racing mounts for the very same node and
+ mntfs.
+ From: Krisztian Kovacs <Kris.Kovacs@morganstanley.com>
+
+ * In the new am_loc scheme mounted mntfs structures still
+ have their mf_fo structure left intact. So when restart
+ creates a fake mntfs for an already mounted filesystem it
+ should not free mf_fo right away.
+ From: Krisztian Kovacs <Kris.Kovacs@morganstanley.com>
+
+ * Setting the error flag of the mntfs for which the share
+ is already mounted results in the mount point not being
+ removed when it times out. (Amd considers it an error
+ mntfs and thus umount becomse a no-op.)
+ From: Krisztian Kovacs <Kris.Kovacs@morganstanley.com>
+
+ * Right now AMD sets all timeout values to their defaults
+ even if you explicitly set them to zero. This patch
+ introduces separate flags that store if the respective
+ values have been set and the code path setting default
+ values checks these flags instead of testing the values
+ for zero. [Linux only]
+ From: Krisztian Kovacs <Kris.Kovacs@morganstanley.com>
+
+ * Fix mntfs related lookup/(un)mount race conditions, by
+ introducing a new structure linking an mntfs to a node.
+ From: Krisztian Kovacs <Kris.Kovacs@morganstanley.com>
+
+ * We have to free the buffers allocated by the XDR routines when
+ decoding the mount response after copying them to their final place.
+ From: Krisztian Kovacs <Kris.Kovacs@morganstanley.com>
+
+2009-12-09 Christos Zoulas <christos@zoulas.com>
+
+ * Free continuation in amfs_retry() if we don't call amfs_bgmount()
+ Normally it's amfs_bgmount() which frees the continuation. However, if
+ the mount is already in progress and we're in amfs_retry() for another
+ node we don't try mounting the filesystem once again. Still, we have
+ to free the continuation as we won't get called again and thus would
+ leak the continuation structure and our am_loc references.
+ From: Krisztian Kovacs <Kris.Kovacs@morganstanley.com>
+
+ * Fix use-after-free and double free of mntfs private data
+ ops_nfs.c(nfs_init) does not clear private data pointer after free().
+ This leads to use-after-free and double free in case mount() fails.
+ (found by valgrind)
+ From: Krisztian Kovacs <Kris.Kovacs@morganstanley.com>
+
+2009-11-23 Christos Zoulas <christos@zoulas.com>
+
+ * The temporary filename buffer was leaked in lock_mtab().
+ From: Krisztian Kovacs <Kris.Kovacs@morganstanley.com>
+
+2009-10-27 Christos Zoulas <christos@zoulas.com>
+
+ * Deal with errno.h->sys/errno.h better
+
+2009-10-26 Christos Zoulas <christos@zoulas.com>
+
+ * Fix issue with autoconf 2.63
+
+ * Fix compile warnings for gcc-4.4.x
+
+2009-04-15 Christos Zoulas <christos@zoulas.com>
+
+ * Share the LDAP connection between different maps to save resources
+ on the LDAP server. (Olaf Flebbe <o.flebbe@science-computing.de>)
+
+2009-03-20 Christos Zoulas <christos@zoulas.com>
+
+ * Fix largefile re-definitions
+
+ * Fix compilation error caused in previous patch
+
+2009-02-19 Christos Zoulas <christos@zoulas.com>
+
+ * Add a synchronous unmount amq rpc that will wait for the remote
+ filesystem to be unmounted, or return an error. Enabled by amq -uu
+
+2009-01-11 Erez Zadok <ezk@fsl.cs.sunysb.edu>
+
+ * amd/ops_udf.c: don't define functions/variables which may not be
+ used.
+
+ * amd/ops_tmpfs.c (mount_tmpfs): force gcc not to complain about
+ unused variables.
+
+ * config.guess.long: properly support Fedora Core.
+
+2009-01-09 Christos Zoulas <christos@zoulas.com>
+
+ * Fix nfs mounts on linux 2.6.26 by explicitly initializing context.
+
+ * Treat an empty sublink as an unset sublink; this allows us to
+ say sublink:=; in a spec to override the default. (This produces
+ Bad selector error, but it works. XXX: We need to decide how to
+ unset a selector. I proposed an unset keyword a while ago).
+
+2009-01-06 Christos Zoulas <christos@zoulas.com>
+
+ * re-renerate all generated files with newer versions of the
+ auto-tools.
+
+ * move INSTALL to INSTALL.am-utils to avoid conflicts
+
+ * fix incompatibilities with new m4 and new autoconf.
+
+ * add UDF filesystem support.
+
+ * fix NetBSD nfs file handle detection.
+
+2009-01-02 Christos Zoulas <christos@zoulas.com>
+
+ * add nocasetrans, nojoliet, rrcaseins for cd9660 filesystems
+
+2008-12-03 Christos Zoulas <christos@zoulas.com>
+
+ * allow ldap queries try a comma-separated list of servers given as:
+
+ ldap_hostports = host1:port1,host2,host3:port3
+
+ original patch from Florian Geyer
+
+2008-09-19 Christos Zoulas <christos@zoulas.com>
+
+ * the auth_create gid on NetBSD is int
+
+ * deal with lossage from flex -P
+
+ * fix missing/incorrect prototypes
+
+2008-09-17 Christos Zoulas <christos@zoulas.com>
+
+ * fix manual page section issues (sorting, non-existant)
+
+ * add missing forward declarations
+
+ * avoid null pointer derefs (coverity)
+
+ * more portable endian detection support
+
+ * implement tmpfs support
+
+ * use sizeof var instead of constant
+
+ * fix yyerror declaration and definition
+
+ * fix yy function renaming, and correct some renaming issues.
+
+ * work around automake < 1.9 issue where ylwrap is not being run
+ for a single yacc or lex file.
+
+ * NetBSD
+ - handle headers that need other headers to compile
+ - add exfs and tmpfs specific glue
+ - add options log, noatime, nocoredump, nodevmtime, softdep,
+ symperm, union
+ - NetBSD's new mount system call needs the size of the opaque
+ filesystem specific structure, but passing 0 for now works.
+ We would need to change a lot more code to pass the size from
+ the fs-specific calls, so for now punt.
+ - recvfrom takes socklen_t * on NetBSD
+ - handle newer NetBSD using statvfs
+ - NetBSD calls its ufs ffs
+
+ * Linux
+ - Most recent kernels have trouble with trying to parse the pid
+ hostname and do locking. What before was a silent failure, now
+ there is a warning printed and the mount is rejected. This is
+ the simplest fix:
+ (http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=479884)
+
+2007-04-13 Erez Zadok <ezk@cs.sunysb.edu>
+
+ * amd/sun_map.c (sun_append_str): When translating '&' from Sun
+ automounter maps, replace it with "${key}" in the Amd map, not
+ with the value of the key at the time. This way '*' maps work
+ too.
+
+ * config.guess.long: don't use -q option to grep because some
+ systems don't support it. Bug fix for solaris.
+
+2007-03-11 Christos Zoulas <christos@zoulas.com>
+
+ * amd/opts.c (expand_op): Don't call xstrlcpy() to truncate a
+ string. It causes spurious xstrlcpy() syslog() errors. Use
+ memcpy() and explicitly terminate the string.
+
+2007-01-20 Erez Zadok <ezk@cs.sunysb.edu>
+
+ * updated copyright year to 2007 on all files.
+
+2006-12-27 Erez Zadok <ezk@cs.sunysb.edu>
+
+ * minor new port: ia64-hp-hpux11.23
+
+ * m4/macros/check_libwrap_severity.m4 (LIBS): also test if caller
+ needs to define rfc931_timeout.
+
+ * amd/sun2amd.c: define rfc931_timeout and allow/deny_severity for
+ libwrap.
+
+ * amd/amq_svc.c: some versions of libwrap require the caller to
+ define rfc931_timeout in addition to allow/deny_severity.
+
+ * amd/amfs_toplvl.c (amfs_toplvl_init): properly detect when
+ forced unmount functionality exists for all systems.
+
+ * libamu/mount_fs.c (compute_nfs_args): reset nfs_args_t->pathconf
+ only if field exists.
+
+ * conf/nfs_prot/nfs_prot_hpux11.h: prevent HPUX 11.23 from
+ including <tiuser> or <sys/tiuser> (TLI definitions are already
+ included from elsewhere).
+
+ * configure.in: detect nfs_args_t->pathconf field.
+
+2006-11-27 Erez Zadok <ezk@cs.sunysb.edu>
+
+ * doc/Makefile.am: properly publish html files using newer
+ text2html.
+
+2006-11-27 Erez Zadok <ezk@shekel.local>
+
+ * doc/Makefile.am: obfuscate emails in ChangeLog before it is
+ published on web site.
+
+ * obfuscate many more emails in the distro, esp. of files which get
+ posted on the am-utils web site.
+
+2006-11-26 Erez Zadok <ezk@shekel.local>
+
+ * minor new port: i386-apple-darwin8.8.1.
+
+ * doc/am-utils.texi: remove obvious URLs used by spammers, and
+ replace them with links to the am-utils web site, which uses PNG
+ images to obfuscate the actual email/mailman URLs.
+
+2006-10-30 Erez Zadok <ezk@cs.sunysb.edu>
+
+ * doc/am-utils.texi (Password maps): minor typo reported by
+ Christoph P. Kukulies.
+
+2006-10-26 Erez Zadok <ezk@cs.sunysb.edu>
+
+ * minor new port: i386-pc-linux-fc6.
+
+ * m4/macros/linux_headers.m4: handle newer Linux kernels which
+ removed UTS_RELEASE from <linux/version.h>.
+
+2006-10-25 Erez Zadok <ezk@cs.sunysb.edu>
+
+ * minor new ports: i386-pc-linux-centos4.4 and
+ powerpc-apple-darwin8.7.0.
+
+ * config.guess.long: recognize CentOS Linux.
+
+2006-06-20 Erez Zadok <ezk@cs.sunysb.edu>
+
+ * minor new port: i386-pc-solaris2.11-nexentaos (GNU/OpenSolaris).
+
+ * config.guess.long: recognize NexentaOS (GNU/OpenSolaris)
- * Minor new ports: i386-unknown-freebsd6.1 (RELEASE)
+ * config.guess, config.sub: updates from latest official GNU
+ distributions.
+
+2006-05-11 Erez Zadok <ezk@cs.sunysb.edu>
+
+ * Minor new ports: i386-unknown-freebsd6.1 (RELEASE),
powerpc-apple-darwin8.6.0, and i386-unknown-openbsd3.9.
+2006-05-10 Erez Zadok <ezk@cs.sunysb.edu>
+
* libamu/mount_fs.c (compute_nfs_attrcache_flags): fix signedness
problems on IRIX-6.5.
@@ -188,11 +738,14 @@
same $ac_cv_* variable name). Some systems support one header or
another. Patch inspired by work Debian did.
-2006-02-10 Erez Zadok <ezk@cs.sunysb.edu>
+2006-02-16 Daniel P. Ottavio <ottavio@vm.fsl.cs.sunysb.edu>
- *******************************************************************
- *** Released am-utils-6.1.4 ***
- *******************************************************************
+ * amd/sum_map_tok.l: Fixed a bug in a regular expression that
+ prevented dashes in hostnames. This was posted in BZ by Thomas
+ A. Fine.
+
+ * README.sun2amd: Fixed a typo. Sentence mentions use of autofs
+ type when it should be host type.
2006-01-04 Erez Zadok <ezk@cs.sunysb.edu>
@@ -302,9 +855,31 @@
2005-10-10 Erez Zadok <ezk@cs.sunysb.edu>
*******************************************************************
- *** Released am-utils-6.1.3 ***
+ *** Released am-utils-6.1a1 ***
*******************************************************************
+ * README.sun2amd: revised.
+
+2005-10-09 Daniel P. Ottavio <dottavio@ic.sunysb.edu>
+
+ * amd/info_nis.c (nis_search): Bug fix for bugzilla #428; make
+ sure that sun_entry2amd() is not called when yp_match() returns an
+ error, this is done by checking that 'res' is 0. Bug fix (same
+ BZ#); free the output allocated by yp_match() instead of freeing
+ the return value of sun_entry2amd().
+
+ * amd/sun_map.c (sun_entry2amd): Fix a comment.
+
+ * README.sun2amd: Made a first pass at describing the status of
+ the sun2amd feature.
+ Moved the date.
+
+2005-10-09 Erez Zadok <ezk@cs.sunysb.edu>
+
+ * README.sun2amd: place holder.
+
+ * Makefile.am (EXTRA_DIST): distribute new README.sun2amd file.
+
2005-10-07 Erez Zadok <ezk@cs.sunysb.edu>
* m4/macros/check_mnttab_type.m4: move the test for MOUNT_* to the
@@ -343,6 +918,10 @@
* amd/info_exec.c (exec_map_open): break assignment from inside
conditional, to work around an IRIX-6.5 cc bug.
+ * amd/Makefile.am (amd_LDADD, sun2amd_LDADD): put libaminfo.a
+ before libamu.la. Some linkers (e.g., IRIX-6.5) incorrectly
+ complain about undefined symbols.
+
* fsinfo/fsi_util.c (set_ether_if), amd/map.c (unmount_mp),
libamu/xutil.c (expand_error), libamu/strutil.c (xsnprintf): avoid
comparison between signed and unsigned integers.
@@ -479,15 +1058,10 @@
2005-10-02 Erez Zadok <ezk@cs.sunysb.edu>
- * include/am_utils.h: extern for xvsnprintf().
-
- * amd/autil.c: move strsplit() to libamu/strutil.c.
-
* libamu/Makefile.am: use strutil.c, not util.c.
* libamu/strutil.c: rename from util.c to explain better purpose
- of file. Move xvsnprintf and xsnprintf from xutil.c to this
- file. Sync up with 6.2 version of file.
+ of file. Move xvsnprintf and xsnprintf from xutil.c to this file.
* libamu/xutil.c: explain purpose of file. Move mkdirs/rmdirs
code from old util.c.
@@ -555,22 +1129,13 @@
2005-09-26 Erez Zadok <ezk@cs.sunysb.edu>
- * libamu/xutil.c (unregister_amq): repair broken meaning of D_AMQ,
- which was reversed in am-utils-6.2. Bug fix from Steve Plite
- <splite-amutils at sigint.cs.purdue.edu>.
-
* hlfsd/stubs.c (nfsproc_getattr_2_svc, nfsproc_lookup_2_svc,
nfsproc_readlink_2_svc, nfsproc_readdir_2_svc), hlfsd/hlfsd.c
(hlfsd_init): use new clocktime() function.
2005-09-18 Erez Zadok <ezk@cs.sunysb.edu>
- *******************************************************************
- *** Released am-utils-6.1.2.1 ***
- *******************************************************************
-
- * README.attrcache: Update status of freebsd and openbsd.
- Document netbsd's patchs to support noac.
+ * README.attrcache: document netbsd's patchs to support noac.
* libamu/mount_fs.c (compute_nfs_attrcache_flags): cleanup the
code that sets the ac{reg,dir}{min,max} fields so it also sets the
@@ -578,13 +1143,10 @@
* configure.in: check for nfs_args fields acregmax and acdirmax.
- *******************************************************************
- *** Released am-utils-6.1.2 ***
- *******************************************************************
-
* README.attrcache: new file documenting in detail OS bugs
relating to attribute caching, which can affect Amd's reliability
under heavy load.
+ Update status of freebsd and openbsd.
* doc/Makefile.am: install README.attrcache file as attrache.txt
file on am-utils Web site.
@@ -665,6 +1227,54 @@
amfs_bgmount, amfs_generic_mount_child), amd/amd.c (main): pass
NULL to clocktime().
+2005-09-15 Erez Zadok <ezk@cs.sunysb.edu>
+
+ * amd/nfs_subr.c (nfsproc_getattr_2_svc): initialize 'retry', just
+ in case.
+ (fh_to_mp3): increment amd_stats.d_stale counter only if we are
+ actually returning ESTALE.
+
+ * amd/info_exec.c (exec_parse_qanswer), amd/info_file.c
+ (file_search_or_reload), amd/info_hesiod.c (hesiod_search),
+ amd/info_ldap.c (amu_ldap_search), amd/info_ndbm.c (search_ndbm),
+ amd/info_nis.c (nis_search), amd/info_nisplus.c (nisplus_search,
+ nisplus_search): don't dereference mnt_map->cfm which may be null
+ if we're not using an amd.conf file.
+
+2005-09-14 Erez Zadok <ezk@cs.sunysb.edu>
+
+ * libamu/xutil.c (unregister_amq): if failed to de-register Amd
+ from portmapper, report it under dlog (debugging), not as an
+ annoying plog that always shows up.
+
+2005-09-13 Erez Zadok <ezk@cs.sunysb.edu>
+
+ * mk-amd-map/mk-amd-map.c (read_file_file), libamu/util.c
+ (strsplit), libamu/hasmntopt.c (nextmntopt), amd/sun_map.c
+ (sun_entry2amd), amd/sun2amd.c (sun2amd_convert_convert),
+ amd/mapc.c (mapc_add_kv), amd/info_file.c (file_search_or_reload),
+ amd/info_exec.c (exec_parse_qanswer): cast isspace() and isascii()
+ arg to unsigned char, which is safer as per Christos.
+
+ * amd/sun_map.c (sun_entry2amd): isspace takes an int, not a char.
+
+ * configure.in: keep a dummy unused AM_PROG_LEX, because old
+ Automake (1.6.3) looks for it if you refer to LEX in your
+ Makefile.am files. Silly thing, fixed in newer versions of
+ Automake (1.9.2).
+
+2005-09-11 Erez Zadok <ezk@cs.sunysb.edu>
+
+ * Makefile.am (EXTRA_DIST_M4): add prog_{lex,yacc}.m4 to distro.
+
+ * configure.in: use new macros AMU_PROG_YACC and AMU_PROG_LEX.
+
+ * m4/macros/prog_yacc.m4: new macro to check if bison/yacc/byacc
+ exist, but exist with an error if none found.
+
+ * m4/macros/prog_lex.m4: new macro to check if f/lex exist, but
+ exit with an error if not found (am-utils requires f/lex).
+
2005-09-07 Erez Zadok <ezk@cs.sunysb.edu>
* minor new port: powerpc-apple-darwin8.2.0.
@@ -683,8 +1293,48 @@
file system on this system (probably because /proc isn't mounted),
then provide some default definition for this file to compile.
+2005-08-28 Daniel P. Ottavio <dottavio@ic.sunysb.edu>
+
+ * amd/sun_map.c (sun_entry2amd) : Wipe out any trailing white
+ spaces or '\n' before passing strings to the parser.
+
+ * amd/amd.h : oops, reverting bad changes
+
+ * amd/info_file.c : oops, reverting bad changes
+
+ * amd/mapc.c : oops, reverting bad changes
+
+ * amd/sun_map_parse.y : oops, reverting bad changes
+
2005-08-27 Erez Zadok <ezk@cs.sunysb.edu>
+ * libamu/xutil.c: amd_program_number is a u_long now.
+ (unregister_amq): if pmap_unset failed to de-register Amd from the
+ portmapper, print an error message.
+ (get_amd_program_number): returns a u_long now.
+ (set_amd_program_number): take a u_long now.
+
+ * include/am_utils.h: get_amd_program_number() returns u_long now.
+ set_amd_program_number() takes a u_long now.
+
+ * amq/amq.c: amd_program_number is a u_long, not int.
+
+ * amd/nfs_start.c (mount_automounter): when registering Amd with
+ the portmapper (for Amq service), don't fail if just one of TCP or
+ UDP failed to register, but only if both transports failed. That
+ way Amq can still contact Amd using the transport that did
+ register correctly. However, now, if both transports failed to
+ register, then set amd_state to "Done" so it would shutdown
+ cleanly.
+
+ * conf/transp/transp_{sockets,tli{}.c (amu_svc_register): better
+ comments.
+
+ * libamu/xutil.c: debug_flags should always be initialized to
+ D_CONTROL (amq,daemon,fork).
+ (debug_option): allow setting initial immutable debug_flags via
+ amd.conf; afterward, prevent it (i.e., one tries it via "amq -D").
+
* Makefile.am (DISTCLEANFILES): also remove amu_autofs_prot.h,
config.cache.old, and dbgcf.h on "make distclean".
(CLEANFILES): remove dbgcf on plain "make clean".
@@ -692,13 +1342,199 @@
* amd/Makefile.am (DISTCLEANFILES): also remove ops_autofs.c on
"make distclean".
+2005-08-27 Daniel P. Ottavio <dottavio@ic.sunysb.edu>
+
+ * amd/info_file.c (file_search_or_reload): Changed the key
+ variable that is passed to the sun_entry2amd.
+
+ * amd/mapc.c (mapc_add_kv): Add support for multiple entries
+ packed into one line. This is a workaround for handling Sun style
+ mounts that contains multiple entries on one line: "multi-mount
+ entries". The sun2amd conversion tools will convert such entries
+ into type:=auto and pack each of the auto-entries into one line
+ separated by '\n'. The mapc_add_kv function will now recognize
+ such entries and add then.
+
+ * amd/sun2amd.c (sun2amd_convert): Add print statement that
+ includes the line number during a parser failure.
+
+ * sun_map.c: Fix the AMD_MAP_PREF_KW definition. Fix spelling.
+ (sun_mountpts2amd): removed this function
+ (sun_hsfs2amd): added some more comments
+ (sun_nfs2amd): moved support for multi-mount entries from this
+ function to sun_multi2amd().
+ (sun_multi2amd): New function to handle multi-mount entries. This
+ function will convert the Sun version to an Amd type:=auto. Each
+ extra auto entry will be appended to the same line separated by a
+ '\n'.
+ (sun_entry2amd): Fixed a bug if-statement. This function now
+ checks for multi-mount entries.
+
+ * amd/sun_map.h: Add a fstype member to the sun_mountpt struct.
+
+ * amd/sun_map_parse.y: Parser now supports fstype for multi-mount
+ entries.
+
+ * amd/sun_map_tok.l: No longer print the line and column number
+ when parsing. This is because the parser is handed strings not
+ files. Therefore, the line number will always be 1. It is now up
+ to the higher level tools to echo line information during error
+ when they feed the parser.
+
2005-08-24 Erez Zadok <ezk@cs.sunysb.edu>
* configure.in: wrap all LDAP and HESIOD tests in test whether
--with-OPT was used.
+2005-08-20 Daniel P. Ottavio <dottavio@ic.sunysb.edu>
+
+ * amd/sun_map.c: Clean up #defines
+ (sun_entry2amd) : Verify that the key and entry values passed are
+ not NULL. Free the Sun entry struct when done.
+
+ * amd/sun_map.h: Add some "not implemented yet" comments to the
+ map and mmap structures.
+
+ * amd/sun_map_parse.y: Removed automap include functionality, it
+ will need to be re-implemented using a pre-processor.
+ Clean up function calls.
+
+2005-08-16 Daniel P. Ottavio <dottavio@ic.sunysb.edu>
+
+ * amd/sun2amd.c (sun2amd_convert): If the input line is too long
+ don't return an error just null terminate and continue. Fix bug:
+ the map key was not written.
+
+ * amd/sun_map.c: Add a new Amd device, and cdfs constant.
+ (sun_locations2amd): Write the NFS type keyword
+ for each host of the mount entry. Add a space between each mount
+ location.
+ (sun_hsfs2amd): New function to support hsfs to
+ cdfs.
+ (sun_nfs2amd): Don't write the nfs type here. Fix
+ comments.
+ (sun_entry2amd): Change function parameter var for
+ clarity. Add support for hsfs.
+
+ * amd/sun_map_parse.y (sun_map_parse_read): Reset the entry list
+ after it has been returned.
+
2005-08-16 Erez Zadok <ezk@cs.sunysb.edu>
+ * amd/get_args.c (get_args): initialize debug_flags if they've
+ never been set.
+
+2005-08-15 Erez Zadok <ezk@cs.sunysb.edu>
+
+ * amd/mapc.c (mapc_create): mapc find takes 4th arg, the mount
+ point. Now, we can properly initialize the cfm structure of the
+ mnt_map, so we can have access to the flags (e.g., SUN_MAP_SYNTAX)
+ inside each info_*.c file.
+ (mapc_find): takes 4rd arg (mntpt) and passes it to calls to
+ mapc_create.
+ (root_newmap): pass NULL as 4th arg (mntpt).
+
+ * amd/amfs_generic.c (amfs_parse_defaults): remove ugly hack to
+ initialize map cfm structure (including flags) so late.
+
+ * amd/autil.c (amfs_mkcacheref): pass mount point as 4th arg to
+ mapc_find.
+
+ * amd/amfs_root.c (amfs_root_mount): pass NULL as new 4th arg to
+ mapc_find.
+
+ * amd/amd.h: extern for mapc_find changed to pass the mount point.
+
+ * libamu/xutil.c: debug_flags should be unsigned.
+ (dbg_opt): fix comments for updated debug_flags, add "defaults".
+ (debug_option): Don't allow "immutable" (D_IMMUTABLE) flags to be
+ changed, because they could mess Amd's state and only make sense
+ to be set once when Amd starts. Currently these immutable flags
+ are "daemon," "fork," "amq," and "mtab." If Amd not compiled with
+ debugging, set default "control" options (daemon,fork,amq).
+ (unregister_amq): proper use of D_AMQ.
+
+ * include/am_utils.h: define new D_BASIC, D_CONTROL, D_DEFAULT,
+ D_IMMUTABLE, and D_MASK. Updated definitions of D_ALL and D_TEST.
+ debug_flags extern should be unsigned.
+
+ * scripts/amd.conf-sample (debug_options): mention new "defaults"
+ option.
+
+ * scripts/amd.conf.5,doc/am-utils.texi: document new debug option
+ "defaults" and properly explain the corrected meanings of
+ "daemon," "fork," "amq," and their "no" inversions. Better
+ explain "all" and "test" too. Correct default debug_mtab file to
+ /tmp/mtab.
+
+ * hlfsd/stubs.c (nfsproc_readlink_2_svc): proper use of D_FORK.
+
+ * hlfsd/homedir.c (homedir): proper use of D_FORK.
+
+ * hlfsd/hlfsd.c (main, hlfsd_init, cleanup): proper use of
+ D_DAEMON.
+
+ * amd/nfs_start.c (mount_automounter): proper use of D_AMQ.
+
+ * amd/amd.h (DEBUG_MNTTAB_FILE): change default to /tmp/mtab,
+ which is more common on more systems (instead of /tmp/mnttab).
+
+ * amd/amd.c (main): properly use D_DAEMON.
+
+2005-08-14 Erez Zadok <ezk@cs.sunysb.edu>
+
+ * libamu/xutil.c (xlog_opt): define new pseudo log_option named
+ "defaults", which is an alias for "fatal,error,user,warning,info".
+
+ * scripts/amd.conf.5, doc/am-utils.texi, amd/amd.8: document new
+ log_option "defaults".
+
+ * amq/amq.8: typo. Arg name for -D is "debug_options" not
+ "log_options".
+
+ * libamu/xutil.c: make xlog_level static, and initialize it to
+ XLOG_DEFAULT.
+ (cmdoption): take unsigned int as flags argument, and print any
+ errors as XLOG_ERROR (which cannot be turned off).
+ (switch_option): remove old code which disallowed you from turning
+ off flags that were set when Amd started up. Now, you can turn
+ any log option on/off at start time or later on (via amq -x),
+ other than the two mandatory options (fatal+error).
+
+ * include/am_utils.h (XLOG_*): remove unused XLOG_DEFSTR. Define
+ XLOG_MASK to mask out unused flag bits. Define XLOG_DEFAULT to be
+ what it was before (fatal + error + user + warning + info), but
+ use the new mask. Remove extern's for xlog_level and
+ xlog_level_init. Change extern for cmdoption() to take an
+ unsigned flags argument.
+
+ * doc/am-utils.texi, amq/amq.8, scripts/amd.conf.5, amd/amd.8:
+ document mandatory log options
+ (fatal+error) which cannot be turned off and are always on by
+ default. They must be on so that Amd can report crucial errors,
+ including those related to setting flags on/off.
+
+ * hlfsd/hlfsd.c (main): remove hack to initialize log_options.
+
+ * wire-test/wire-test.c: remove reference to unused xlog_level.
+
+ * amd/mapc.c (mapc_create): 'alloc' flags variable should be
+ unsigned.
+
+ * amd/get_args.c (get_args): no need for hack using
+ xlog_level_init.
+
+ * amd/Makefile.am: separate sources common to amd and sun2amd into
+ a special, locally-built only, static library called libaminfo.a.
+
+ * libamu/xutil.c (real_plog, xsnprintf): call new xvsnprintf()
+ wrapper function.
+ (xvsnprintf): new function which already gets a va_list. This was
+ needed to avoid nesting va_list's (which apparently isn't
+ allowed).
+
+ * include/am_utils.h: prototype for new xvsnprintf wrapper.
+
* configure.in: sinclude([vers.m4]) version number file.
* vers.m4: new file to separate version number out of
@@ -707,24 +1543,248 @@
* Makefile.am (EXTRA_DIST_M4): include vers.m4 in distro.
+2005-08-14 Daniel P. Ottavio <dottavio@ic.sunysb.edu>
+
+ * amd/info_file.c: add key to sun_entry2amd()'s parameters
+
+ * amd/info_hesiod.c: add key to sun_entry2amd()'s parameters
+
+ * amd/info_ldap.c: add key to sun_entry2amd()'s parameters
+
+ * amd/info_ndbm.c: add key to sun_entry2amd()'s parameters
+
+ * amd/info_nis.c: add key to sun_entry2amd()'s parameters
+
+ * amd/info_nisplus.c: add key to sun_entry2amd()'s parameters
+
+ * amd/sun_map.c: New functions to support sun translation to amd.
+ The function sun_entry2amd's parameters were expanded to include
+ the key value. sun_entry_2amd() now returns NULL on error.
+
+ * amd/sun_map.h: Expand sun_entry2amd's parameters to include key
+ value.
+
+ * amd/sun_map_parse.y: Change how file system types are parsed out
+ of the list of options for each entry. The previous way was not
+ working properly so now we just look for the 'fstype' keyword in
+ each option. If it exists we copy its key value.
+ Added some comments to sun_map_parse_read().
+
+ * amd/amd.h: Added an extern from info_file.c called
+ file_read_line(). Previously this function was static but is now
+ used in sun2amd.c.
+
+ * amd/info_file.c: Changed the static function read_line() to a
+ public function called file_read_line(). This function is now
+ used in sun2amd.c
+
+ * amd/sun2amd.8: Filled in the contents of this man page. This is
+ a conversion utility that converts Sun maps to Amd maps.
+
+ * amd/sun2amd.c: Implemented a working version of this utility.
+
2005-08-11 Erez Zadok <ezk@cs.sunysb.edu>
+ * amd/sun_map_parse.y: instead of using a custom FOO_alloc()
+ function, use Amd's CALLOC(struct FOO) macro.
+
+ * amd/sun_map.h: remove extern definitions to functions no longer
+ needed.
+
+ * amd/sun_map.c: removed superfluous *_alloc() functions, some of
+ which caused conflicts with same-named symbols in the parser
+ (since we rename 'yyalloc' to 'sun_map_alloc').
+
* configure.in: keep AC_INIT on same line, for nightly snapshot
build script.
+ * amd/Makefile.am: f/lex libraries are incompatible with multiple
+ scanners, so don't link Amd with libl.a/libfl.a.
+
+2005-08-10 Daniel P. Ottavio <dottavio@ic.sunysb.edu>
+
+ * amd/sun_map_tok.l: Clean up regular expression so HPUX stops
+ whining.
+
+2005-08-09 Daniel P. Ottavio <dottavio@ic.sunysb.edu>
+
+ * amd/sun_map_parse.y: Moved license below special yacc bracket to
+ be portable with HPUX's yacc. Clean up externs.
+
+ * amd/sun_map_tok.l: Moved license below special lex bracket to be
+ portable with HPUX's lex. Fixed definitions to allow for a
+ non-flex lex to parse strings instead of files. Added some casts
+ to strlcpy usage to silence warnings. Moved the % options because
+ HPUX was complaining,
+
+2005-08-08 Daniel P. Ottavio <dottavio@ic.sunysb.edu>
+
+ * amd/sun_map_tok.l: Applied some definition goop to handle the
+ ECHO symbol that lex defines. This symbol causes problems on
+ RedHat-EL-powerPC platforms. Replaced strncpy with strlcpy.
+ Renamed the function sun_map_yyinput to sun_map_input. This
+ function is a utility function that is not generated by lex.
+ Therefore, the 'yy' may cause confusion.
+
+2005-08-08 Erez Zadok <ezk@cs.sunysb.edu>
+
+ * amd/sun_map_tok.l: allocate more output slots so lex scanners
+ don't run out of memory.
+
+ * amd/sun_map_parse.y: declare extern for sun_map_parse().
+
+ * libamu/xutil.c (xsnprintf): ensure proper comparisons between
+ signed and unsigned quantities.
+
+2005-08-06 Erez Zadok <ezk@cs.sunysb.edu>
+
+ * libamu/util.c, amd/autil.c (strsplit): moved strsplit() function
+ from Amd code to to libamu, so sun2amd could use it.
+
+ * amd/Makefile.am (sbin_PROGRAMS): build sun2amd binary and man
+ page.
+ (EXTRA_sun2amd_OBJECTS): sun2amd needs to link with all info_*.c files
+
+ * amd/sun2amd.8: placeholder for man page.
+
+ * amd/sun2amd.c: placeholder for C version of translator from Sun
+ syntax maps to Amd maps.
+
+ * */*.[0-9]: include file name in nroff source comment.
+
+ * ALL: use '0' properly when assigning or passing it to functions.
+ If in the context pointer, use NULL. If in the context of a
+ single char (say within a string), the use '\0'. This is just to
+ make the code clearer.
+
+ * m4/macros/header_templates.m4: template for HAVE_MAP_SUN.
+
+ * amd/mapc.c (maptypes): add placeholder for Sun-syntax map
+ methods.
+
+ * amd/Makefile.am (EXTRA_amd_SOURCES): compile info_sun.c
+
+ * amd/info_sun.c: placeholder for meta info parser to get info
+ from Sun automount-style /etc/auto_master, possibly following
+ into multiple info services (via /etc/nsswitch.conf).
+
+ * libamu/xutil.c (xsnprintf): if vsnprintf truncated the output
+ string to avoid an overflow, print an error. Include some code to
+ break out any possible infinite loop between plog() and
+ xsnprintf().
+ (real_plog): now we can use (carefully) xsnprintf() directly.
+
+ * amd/sun_map.[hc]: cleanup and formatting.
+
+ * amd/sun_map_parse.y: to match the literal string "fstype=" use
+ double quotes, not single quotes.
+
+ * amd/get_args.c (get_args): call conf_parse() using conf_in.
+
+ * amd/amd.h: use renamed parser symbols (yyparse -> conf_parse;
+ yyin -> conf_in).
+
+ * ylwrap: Enhance wrapper to avoid the #define hacks done by Gdb,
+ and suggested by the Automake manual. This enhanced parser will
+ prefix each conflicting yacc/lex symbol with a unique name
+ produced from INPUT. For example, if INPUT is foo_parse.y, then
+ yyparse() becomes foo_parse(). This requires that both your .l
+ and corresponding .y files have the same prefix (e.g., foo_parse.y
+ and foo_tok.l).
+
+ * amd/Makefile.am (BUILT_SOURCES): define which yacc/lex .h/.c
+ source files are built automatically, and therefore should not be
+ in the distro (IMHO), and should be cleaned upon "make clean".
+ (amd_SOURCES): include new sun_map_parse.y and sun_map_tok.l files.
+
+ * ylwrap: new file needed because we have two parsers now.
+
+ * amd/sun_map_{parse.y,tok.l}: cleanup and formatting.
+
+2005-08-06 Daniel P. Ottavio <dottavio@ic.sunysb.edu>
+
+ * amd/Makefile.am: Added new files sun_map.h, sun_map.c,
+ sun_map_parse.y, and sun_map_tok.l. These files add support for
+ parsing Sun style maps. The yacc/lex files needed custom rules so
+ they don't cause symbol conflicts with each other.
+
+ * amd/amd.h: Added "#define INFO_MAX_LINE_LEN" that specifies the
+ line limit for info services.
+
+ * amd/info_exec.c: Replaced MAX_LINE_LEN with INFO_MAX_LINE_LEN
+
+ * amd/info_file.c: Replaced MAX_LINE_LEN with INFO_MAX_LINE_LEN,
+ added support for parsing Sun style maps. The support for Sun
+ maps is done using the sun_entry2amd() function. This function is
+ called for each entry line that is read only when Sun parsing is
+ enabled. For each entry line that is passed to the function a
+ copy of the Amd equivalent is returned.
+
+ * amd/sun_map.h: new header file for Sun style map support
+
+ * amd/sun_map.c: new source file for Sun style map support, clean
+ up comments, additional sun2amd conversion routines
+
+ * amd/sun_map_parse.y: new yacc file for parsing Sun style maps,
+ fix copyright notice, put filename below license.
+
+ * amd/sun_map_tok.l: new lex file for parsing Sun style maps, fix
+ copyright notice, put filename below license.
+
+ * amd/get_args.c: replace usage of strlcat with xstrlcat
+
+ * include/am_utils.h: added 'extern void xstrlcat()'
+
+ * libamu/util.c: Added a xstrlcat() function that wraps the
+ syscall strlcat() so that string truncations can be logged.
+
2005-08-06 Erez Zadok <ezk@cs.sunysb.edu>
+ * amd/info_file.c (file_search, file_reload): pass mnt_map to
+ file_search_or_reload.
+ (file_search_or_reload): ensure that mnt_map is never NULL.
+
+ * amd/info_nis.c (nis_search): call sun_entry2amd() if
+ sun_map_syntax=yes.
+
+ * amd/info_ldap.c (amu_ldap_search): call sun_entry2amd() if
+ sun_map_syntax=yes.
+
+ * amd/info_hesiod.c (hesiod_search): call sun_entry2amd() if
+ sun_map_syntax=yes.
+
+ * amd/info_ndbm.c (ndbm_search): pass mnt_map to search_ndbm.
+ (search_ndbm): call sun_entry2amd() if sun_map_syntax=yes.
+
+ * amd/info_nisplus.c (nisplus_search): call sun_entry2amd() if
+ sun_map_syntax=yes.
+
+ * amd/info_exec.c (exec_search): pass mnt_map to
+ exec_parse_qanswer.
+ (exec_parse_qanswer): call sun_entry2amd() if sun_map_syntax=yes.
+
+ * doc/am-utils.texi (sun_map_syntax Parameter): document new
+ common parameter.
+
* scripts/amd.conf.5: selectors_in_defaults is a common parameter,
not just [global]. Use consistent capitalization of Amd/Amq.
+ Document new sun_map_syntax parameter.
* scripts/amd.conf-sample: properly list all of the parameters
which are common to both the [global] and the per-map sections.
+ (sun_map_syntax): example of new parameter.
* doc/am-utils.texi (Common Parameters): selectors_in_defaults is
a common parameter, not just [global].
* scripts/amd.conf-sample (sun_map_syntax): example of new flag.
+ * amd/conf.c ({ropt,gopt}_sun_map_syntax): new function to parse
+ sun_map_syntax flag (global or per map).
+
+ * amd/amd.h (CFM_SUN_MAP_SYNTAX): new flag for users to say if the
+ map uses Sun automounter syntax.
+
* cvs-server.txt: update instructions after branching 6.1-stable.
2005-08-02 Erez Zadok <ezk@cs.sunysb.edu>
diff --git a/contrib/amd/FAQ b/contrib/amd/FAQ
index 18e73a3fab20..3fbcb4cdb1d0 100644
--- a/contrib/amd/FAQ
+++ b/contrib/amd/FAQ
@@ -26,7 +26,7 @@ answer your questions, see information in the following sources:
listed in bugzilla in https://bugzilla.am-utils.org/
If you have additions to this FAQ, please let us know at
-am-utils@am-utils.org.
+the am-utils list (see www.am-utils.org).
Thank you,
The Am-utils development team.
diff --git a/contrib/amd/INSTALL b/contrib/amd/INSTALL
index 273fe02f4548..2099840756e6 100644
--- a/contrib/amd/INSTALL
+++ b/contrib/amd/INSTALL
@@ -1,124 +1,370 @@
- am-utils 6.1 compatibility list
-
-For each system, list if it autoconfigures, compiles, or runs. Fill in
-email id of person who confirms the fact. A missing entry means unverified.
-A 'no' or 'X' means verified broken or nonexistent (static library).
-
-SYSTEM CONFIG COMPILE RUN SHLIB AUTOFS
-========================= ======= ======= ======= ======= ======
-alpha-dec-osf4.0f ro ro ro - -
-alpha-dec-osf5.1 ro ro ro - -
-alpha-unknown-linux-gentoo1.4.16 ezk ezk ezk ezk -
-alphaev56-dec-osf4.0f ezk ezk ezk ezk -
-i386-apple-darwin6.0 ezk ezk ezk ezk -
-i386-pc-bsdi2.1 ion ion ion ion[X] ion[X]
-i386-pc-linux-deb3.0 ezk ezk ezk ezk -
-i386-pc-linux-deb3.1 ezk ezk ezk ezk -
-i386-pc-linux-fc1 ezk ezk ezk ezk -
-i386-pc-linux-fc2 ezk ezk ezk ezk -
-i386-pc-linux-fc3 ezk ezk ezk ezk -
-i386-pc-linux-fc4 ezk ezk ezk ezk -
-i386-pc-linux-gentoo1.4.16 ezk ezk ezk ezk -
-i386-pc-linux-rh6.2 ion ion ion ion ion
-i386-pc-linux-rh7.1 ion ion ion ion ion
-i386-pc-linux-rh7.2 ion ion ion ion ion
-i386-pc-linux-rh7.3 ion ion ion ion ion
-i386-pc-linux-rh8.0 ezk ezk ezk ezk -
-i386-pc-linux-rh9 ion ion ion ion ion
-i386-pc-linux-rhel3 ezk ezk ezk ezk -
-i386-pc-linux-rhel4 ezk ezk ezk ezk -
-i386-pc-linux-suse8.2 ezk ezk ezk ezk -
-i386-pc-linux-suse9.1 ezk ezk ezk ezk -
-i386-pc-linux-suse9.2 ezk ezk ezk ezk -
-i386-pc-linux-suse9.3 ezk ezk ezk ezk -
-i386-pc-solaris2.10 ro ro ro - -
-i386-pc-solaris2.9 ro ro ro - -
-i386-unknown-freebsd4.10 ezk ezk ezk ezk -
-i386-unknown-freebsd4.11 ezk ezk ezk ezk -
-i386-unknown-freebsd4.8 ezk ezk ezk ezk -
-i386-unknown-freebsd4.9 ezk ezk ezk ezk -
-i386-unknown-freebsd5.0 ezk ezk - ezk -
-i386-unknown-freebsd5.1 ezk ezk ezk ezk -
-i386-unknown-freebsd5.2 ezk ezk ezk ezk -
-i386-unknown-freebsd5.2.1 ezk ezk ezk ezk -
-i386-unknown-freebsd5.3 ezk ezk ezk ezk -
-i386-unknown-freebsd5.4 ezk ezk ezk ezk -
-i386-unknown-freebsd6 (BETA5) ezk ezk ezk ezk -
-i386-unknown-netbsd1.6A ezk ezk ezk ezk -
-i386-unknown-netbsdelf1.6.1 ezk ezk ezk ezk -
-i386-unknown-netbsdelf1.6.2 ezk ezk ezk ezk -
-i386-unknown-netbsdelf2.0 ezk ezk ezk ezk -
-i386-unknown-netbsdelf2.0.2 ezk ezk ezk ezk -
-i386-unknown-netbsdelf3.0 ezk ezk ezk ezk -
-i386-unknown-openbsd3.3 ezk ezk ezk ezk -
-i386-unknown-openbsd3.6 ezk ezk ezk ezk -
-i386-unknown-openbsd3.7 ezk ezk ezk ezk -
-i686-apple-darwin6.6 ezk ezk ezk ezk -
-ia64-hp-hpux11.20 ezk ezk ezk ezk -
-ia64-unknown-linux-rh2.1AS ezk ezk - ezk -
-ia64-unknown-linux-rh2.1AW ezk ezk ezk ezk -
-ia64-unknown-linux-rhel4 ezk ezk ezk ezk -
-mips-sgi-irix6.2 ro ro ro - -[3]
-mips-sgi-irix6.5 ro ro ro - -[3]
-mips-unknown-linux-gentoo1.4.16 ezk ezk ezk ezk -
-mipsel-unknown-linux-rhPS2 ezk ezk ezk ezk -
-powerpc-apple-darwin7.6.0 ezk ezk ezk ezk -
-powerpc-apple-darwin7.7.0 ezk ezk ezk ezk -
-powerpc-apple-darwin7.8.0 ezk ezk ezk ezk -
-powerpc-apple-darwin7.9.0 ezk ezk ezk ezk -
-powerpc-apple-darwin8.2.0 ezk ezk ezk ezk -
-powerpc-ibm-aix5.1.0.0 ion ion ion ion[X] ion[1,2]
-powerpc-ibm-aix5.2.0.0 ezk ezk ezk ezk -
-powerpc-ibm-aix5.3.0.0 ezk ezk ezk ezk -
-powerpc-unknown-linux-yellowdog2.3 ezk ezk ezk ezk -
-sparc-sun-solaris2.10 ro ro ro - -
-sparc-sun-solaris2.5.1 ion ion ion ion ion[1]
-sparc-sun-solaris2.6 ion ion ion ion ion
-sparc-sun-solaris2.7 ion ion ion ion ion
-sparc-sun-solaris2.8 ion ion ion ion ion
-sparc-sun-solaris2.9 ro ro ro - -
-sparc-unknown-linux-rh62 ion ion ion ion ion
-sparc64-unknown-linux-aurora10 ion ion ion ion ion
-sparc64-unknown-linux-deb3.0 ezk ezk ezk ezk -
-sparc64-unknown-linux-gentoo1.4.16 ezk ezk ezk ezk -
-sparc64-unknown-linux-rh62 ion ion ion ion ion
-sparc64-unknown-linux-suse7.3 ezk ezk - ezk -
-x86_64-unknown-linux-rh2.9.5AS ezk ezk ezk ezk -
-x86_64-unknown-linux-rh3.0.0AS ion ion ion ion ion
-
-
-EMAIL ID LEGEND:
-
-bking: Bevis R W King <B.King@ee.surrey.ac.uk>
-dsr: Dan Riley <dsr@mail.lns.cornell.edu>
-ezk: Erez Zadok <ezk@cs.columbia.edu>
-finkel: Raphael Finkel <raphael@cs.uky.edu>
-ion: Ion Badulescu <ion@cs.columbia.edu>
-jose: Jose Nazario <jose@biocserver.BIOC.CWRU.Edu>
-nrh: Nick Hall <nrh@dcs.ed.ac.uk>
-ro: Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
-stolke: Andreas Stolcke <stolcke@speech.sri.com>
-wpaul: Bill Paul <wpaul@ctr.columbia.edu>
-
-
-FOOTNOTES:
-
-[1] Due to limitations in the Sun autofs v1 implementation, some amd features
-cannot be properly supported. More precisely, trying to access a link mount
-pointing to another amd entry will result in failure and/or deadlock.
-Ordinary nfs and link mounts work well, however.
-
-[2] AIX autofs appears to be a variant of the Sun autofs v1 protocol, but
-IBM don't provide any sort of documentation or even header files from it.
-It is currently unsupported; we may add some experimental support for it at
-some point, though it won't be pretty. Assistance from IBM-ers would be
-highly appreciated, hint hint.
-
-[3] IRIX 6 autofs uses the Sun autofs v1 protocol, too. The header files
-are part of the onc3_eoe.sw.autofs (IRIX 6.2) or nfs.sw.autofs (IRIX 6.5)
-package, which may not be installed. The autofs code is known to compile,
-but hasn't been run yet. SGI's autofsd uses a barely documented system
-call, syssgi(SGI_AUTOFS_SYS, ...), which may be required to get working
-autofs support. Additional help from SGI would be highly appreciated.
-
-Erez & Ion
+Installation Instructions
+*************************
+
+Copyright (C) 1994-1996, 1999-2002, 2004-2013 Free Software Foundation,
+Inc.
+
+ Copying and distribution of this file, with or without modification,
+are permitted in any medium without royalty provided the copyright
+notice and this notice are preserved. This file is offered as-is,
+without warranty of any kind.
+
+Basic Installation
+==================
+
+ Briefly, the shell command `./configure && make && make install'
+should configure, build, and install this package. The following
+more-detailed instructions are generic; see the `README' file for
+instructions specific to this package. Some packages provide this
+`INSTALL' file but do not implement all of the features documented
+below. The lack of an optional feature in a given package is not
+necessarily a bug. More recommendations for GNU packages can be found
+in *note Makefile Conventions: (standards)Makefile Conventions.
+
+ The `configure' shell script attempts to guess correct values for
+various system-dependent variables used during compilation. It uses
+those values to create a `Makefile' in each directory of the package.
+It may also create one or more `.h' files containing system-dependent
+definitions. Finally, it creates a shell script `config.status' that
+you can run in the future to recreate the current configuration, and a
+file `config.log' containing compiler output (useful mainly for
+debugging `configure').
+
+ It can also use an optional file (typically called `config.cache'
+and enabled with `--cache-file=config.cache' or simply `-C') that saves
+the results of its tests to speed up reconfiguring. Caching is
+disabled by default to prevent problems with accidental use of stale
+cache files.
+
+ If you need to do unusual things to compile the package, please try
+to figure out how `configure' could check whether to do them, and mail
+diffs or instructions to the address given in the `README' so they can
+be considered for the next release. If you are using the cache, and at
+some point `config.cache' contains results you don't want to keep, you
+may remove or edit it.
+
+ The file `configure.ac' (or `configure.in') is used to create
+`configure' by a program called `autoconf'. You need `configure.ac' if
+you want to change it or regenerate `configure' using a newer version
+of `autoconf'.
+
+ The simplest way to compile this package is:
+
+ 1. `cd' to the directory containing the package's source code and type
+ `./configure' to configure the package for your system.
+
+ Running `configure' might take a while. While running, it prints
+ some messages telling which features it is checking for.
+
+ 2. Type `make' to compile the package.
+
+ 3. Optionally, type `make check' to run any self-tests that come with
+ the package, generally using the just-built uninstalled binaries.
+
+ 4. Type `make install' to install the programs and any data files and
+ documentation. When installing into a prefix owned by root, it is
+ recommended that the package be configured and built as a regular
+ user, and only the `make install' phase executed with root
+ privileges.
+
+ 5. Optionally, type `make installcheck' to repeat any self-tests, but
+ this time using the binaries in their final installed location.
+ This target does not install anything. Running this target as a
+ regular user, particularly if the prior `make install' required
+ root privileges, verifies that the installation completed
+ correctly.
+
+ 6. You can remove the program binaries and object files from the
+ source code directory by typing `make clean'. To also remove the
+ files that `configure' created (so you can compile the package for
+ a different kind of computer), type `make distclean'. There is
+ also a `make maintainer-clean' target, but that is intended mainly
+ for the package's developers. If you use it, you may have to get
+ all sorts of other programs in order to regenerate files that came
+ with the distribution.
+
+ 7. Often, you can also type `make uninstall' to remove the installed
+ files again. In practice, not all packages have tested that
+ uninstallation works correctly, even though it is required by the
+ GNU Coding Standards.
+
+ 8. Some packages, particularly those that use Automake, provide `make
+ distcheck', which can by used by developers to test that all other
+ targets like `make install' and `make uninstall' work correctly.
+ This target is generally not run by end users.
+
+Compilers and Options
+=====================
+
+ Some systems require unusual options for compilation or linking that
+the `configure' script does not know about. Run `./configure --help'
+for details on some of the pertinent environment variables.
+
+ You can give `configure' initial values for configuration parameters
+by setting variables in the command line or in the environment. Here
+is an example:
+
+ ./configure CC=c99 CFLAGS=-g LIBS=-lposix
+
+ *Note Defining Variables::, for more details.
+
+Compiling For Multiple Architectures
+====================================
+
+ You can compile the package for more than one kind of computer at the
+same time, by placing the object files for each architecture in their
+own directory. To do this, you can use GNU `make'. `cd' to the
+directory where you want the object files and executables to go and run
+the `configure' script. `configure' automatically checks for the
+source code in the directory that `configure' is in and in `..'. This
+is known as a "VPATH" build.
+
+ With a non-GNU `make', it is safer to compile the package for one
+architecture at a time in the source code directory. After you have
+installed the package for one architecture, use `make distclean' before
+reconfiguring for another architecture.
+
+ On MacOS X 10.5 and later systems, you can create libraries and
+executables that work on multiple system types--known as "fat" or
+"universal" binaries--by specifying multiple `-arch' options to the
+compiler but only a single `-arch' option to the preprocessor. Like
+this:
+
+ ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
+ CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
+ CPP="gcc -E" CXXCPP="g++ -E"
+
+ This is not guaranteed to produce working output in all cases, you
+may have to build one architecture at a time and combine the results
+using the `lipo' tool if you have problems.
+
+Installation Names
+==================
+
+ By default, `make install' installs the package's commands under
+`/usr/local/bin', include files under `/usr/local/include', etc. You
+can specify an installation prefix other than `/usr/local' by giving
+`configure' the option `--prefix=PREFIX', where PREFIX must be an
+absolute file name.
+
+ You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files. If you
+pass the option `--exec-prefix=PREFIX' to `configure', the package uses
+PREFIX as the prefix for installing programs and libraries.
+Documentation and other data files still use the regular prefix.
+
+ In addition, if you use an unusual directory layout you can give
+options like `--bindir=DIR' to specify different values for particular
+kinds of files. Run `configure --help' for a list of the directories
+you can set and what kinds of files go in them. In general, the
+default for these options is expressed in terms of `${prefix}', so that
+specifying just `--prefix' will affect all of the other directory
+specifications that were not explicitly provided.
+
+ The most portable way to affect installation locations is to pass the
+correct locations to `configure'; however, many packages provide one or
+both of the following shortcuts of passing variable assignments to the
+`make install' command line to change installation locations without
+having to reconfigure or recompile.
+
+ The first method involves providing an override variable for each
+affected directory. For example, `make install
+prefix=/alternate/directory' will choose an alternate location for all
+directory configuration variables that were expressed in terms of
+`${prefix}'. Any directories that were specified during `configure',
+but not in terms of `${prefix}', must each be overridden at install
+time for the entire installation to be relocated. The approach of
+makefile variable overrides for each directory variable is required by
+the GNU Coding Standards, and ideally causes no recompilation.
+However, some platforms have known limitations with the semantics of
+shared libraries that end up requiring recompilation when using this
+method, particularly noticeable in packages that use GNU Libtool.
+
+ The second method involves providing the `DESTDIR' variable. For
+example, `make install DESTDIR=/alternate/directory' will prepend
+`/alternate/directory' before all installation names. The approach of
+`DESTDIR' overrides is not required by the GNU Coding Standards, and
+does not work on platforms that have drive letters. On the other hand,
+it does better at avoiding recompilation issues, and works well even
+when some directory options were not specified in terms of `${prefix}'
+at `configure' time.
+
+Optional Features
+=================
+
+ If the package supports it, you can cause programs to be installed
+with an extra prefix or suffix on their names by giving `configure' the
+option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
+
+ Some packages pay attention to `--enable-FEATURE' options to
+`configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to `--with-PACKAGE' options, where PACKAGE
+is something like `gnu-as' or `x' (for the X Window System). The
+`README' should mention any `--enable-' and `--with-' options that the
+package recognizes.
+
+ For packages that use the X Window System, `configure' can usually
+find the X include and library files automatically, but if it doesn't,
+you can use the `configure' options `--x-includes=DIR' and
+`--x-libraries=DIR' to specify their locations.
+
+ Some packages offer the ability to configure how verbose the
+execution of `make' will be. For these packages, running `./configure
+--enable-silent-rules' sets the default to minimal output, which can be
+overridden with `make V=1'; while running `./configure
+--disable-silent-rules' sets the default to verbose, which can be
+overridden with `make V=0'.
+
+Particular systems
+==================
+
+ On HP-UX, the default C compiler is not ANSI C compatible. If GNU
+CC is not installed, it is recommended to use the following options in
+order to use an ANSI C compiler:
+
+ ./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
+
+and if that doesn't work, install pre-built binaries of GCC for HP-UX.
+
+ HP-UX `make' updates targets which have the same time stamps as
+their prerequisites, which makes it generally unusable when shipped
+generated files such as `configure' are involved. Use GNU `make'
+instead.
+
+ On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
+parse its `<wchar.h>' header file. The option `-nodtk' can be used as
+a workaround. If GNU CC is not installed, it is therefore recommended
+to try
+
+ ./configure CC="cc"
+
+and if that doesn't work, try
+
+ ./configure CC="cc -nodtk"
+
+ On Solaris, don't put `/usr/ucb' early in your `PATH'. This
+directory contains several dysfunctional programs; working variants of
+these programs are available in `/usr/bin'. So, if you need `/usr/ucb'
+in your `PATH', put it _after_ `/usr/bin'.
+
+ On Haiku, software installed for all users goes in `/boot/common',
+not `/usr/local'. It is recommended to use the following options:
+
+ ./configure --prefix=/boot/common
+
+Specifying the System Type
+==========================
+
+ There may be some features `configure' cannot figure out
+automatically, but needs to determine by the type of machine the package
+will run on. Usually, assuming the package is built to be run on the
+_same_ architectures, `configure' can figure that out, but if it prints
+a message saying it cannot guess the machine type, give it the
+`--build=TYPE' option. TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name which has the form:
+
+ CPU-COMPANY-SYSTEM
+
+where SYSTEM can have one of these forms:
+
+ OS
+ KERNEL-OS
+
+ See the file `config.sub' for the possible values of each field. If
+`config.sub' isn't included in this package, then this package doesn't
+need to know the machine type.
+
+ If you are _building_ compiler tools for cross-compiling, you should
+use the option `--target=TYPE' to select the type of system they will
+produce code for.
+
+ If you want to _use_ a cross compiler, that generates code for a
+platform different from the build platform, you should specify the
+"host" platform (i.e., that on which the generated programs will
+eventually be run) with `--host=TYPE'.
+
+Sharing Defaults
+================
+
+ If you want to set default values for `configure' scripts to share,
+you can create a site shell script called `config.site' that gives
+default values for variables like `CC', `cache_file', and `prefix'.
+`configure' looks for `PREFIX/share/config.site' if it exists, then
+`PREFIX/etc/config.site' if it exists. Or, you can set the
+`CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all `configure' scripts look for a site script.
+
+Defining Variables
+==================
+
+ Variables not defined in a site shell script can be set in the
+environment passed to `configure'. However, some packages may run
+configure again during the build, and the customized values of these
+variables may be lost. In order to avoid this problem, you should set
+them in the `configure' command line, using `VAR=value'. For example:
+
+ ./configure CC=/usr/local2/bin/gcc
+
+causes the specified `gcc' to be used as the C compiler (unless it is
+overridden in the site shell script).
+
+Unfortunately, this technique does not work for `CONFIG_SHELL' due to
+an Autoconf limitation. Until the limitation is lifted, you can use
+this workaround:
+
+ CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash
+
+`configure' Invocation
+======================
+
+ `configure' recognizes the following options to control how it
+operates.
+
+`--help'
+`-h'
+ Print a summary of all of the options to `configure', and exit.
+
+`--help=short'
+`--help=recursive'
+ Print a summary of the options unique to this package's
+ `configure', and exit. The `short' variant lists options used
+ only in the top level, while the `recursive' variant lists options
+ also present in any nested packages.
+
+`--version'
+`-V'
+ Print the version of Autoconf used to generate the `configure'
+ script, and exit.
+
+`--cache-file=FILE'
+ Enable the cache: use and save the results of the tests in FILE,
+ traditionally `config.cache'. FILE defaults to `/dev/null' to
+ disable caching.
+
+`--config-cache'
+`-C'
+ Alias for `--cache-file=config.cache'.
+
+`--quiet'
+`--silent'
+`-q'
+ Do not print messages saying which checks are being made. To
+ suppress all normal output, redirect it to `/dev/null' (any error
+ messages will still be shown).
+
+`--srcdir=DIR'
+ Look for the package's source code in directory DIR. Usually
+ `configure' can determine that directory automatically.
+
+`--prefix=DIR'
+ Use DIR as the installation prefix. *note Installation Names::
+ for more details, including other options available for fine-tuning
+ the installation locations.
+
+`--no-create'
+`-n'
+ Run the configure checks, but stop before creating any output
+ files.
+
+`configure' also accepts some other, not widely useful, options. Run
+`configure --help' for more details.
diff --git a/contrib/amd/MIRRORS.html b/contrib/amd/MIRRORS.html
index 0deeefe32c77..511df2b905cc 100644
--- a/contrib/amd/MIRRORS.html
+++ b/contrib/amd/MIRRORS.html
@@ -11,8 +11,8 @@
Note: in case of any problems accessing the individual FTP sites, please
contact their respective maintainers. If you wish to be added to the
-official mirror list, please send mail to <A
-HREF="mailto:am-utils-developers@am-utils.org">am-utils-developers@am-utils.org</A> with the
+official mirror list, please send mail to
+"am-utils-developers AT am-utils.org" with the
full URL, maintainer's email, and geographical location.
<P>
@@ -24,8 +24,8 @@ full URL, maintainer's email, and geographical location.
<UL>
<LI> FTP: <A
HREF="ftp://ftp.am-utils.org/pub/am-utils">ftp.am-utils.org</A>.
- Contact person in case of problems <A
- HREF="mailto:am-utils-developers@am-utils.org">am-utils-developers@am-utils.org</A>.
+ Contact person in case of problems
+"am-utils-developers AT am-utils.org".
</LI>
</UL>
@@ -33,14 +33,14 @@ full URL, maintainer's email, and geographical location.
<UL>
<LI> FTP: <A
HREF="ftp://ftp.cs.umn.edu/pub/am-utils">ftp.cs.umn.edu</A>.
- Maintainer <A HREF="mailto:dokas@cs.umn.edu">dokas@cs.umn.edu</A>.
+ Maintainer <A HREF="mailto:dokas AT cs.umn.edu">dokas AT cs.umn.edu</A>.
</LI>
</UL>
<LI> Florida (University of Florida)
<UL>
<LI> FTP: <A HREF="ftp://ftp.cise.ufl.edu/pub/mirrors/am-utils">ftp.cise.ufl.edu</A>.
- Maintainer <A HREF="mailto:mirror@cise.ufl.edu">mirror@cise.ufl.edu</A>.
+ Maintainer <A HREF="mailto:mirror AT cise.ufl.edu">mirror AT cise.ufl.edu</A>.
</LI>
</UL>
@@ -52,24 +52,24 @@ full URL, maintainer's email, and geographical location.
<LI> Germany
<UL>
<LI> FTP: <A HREF="ftp://ftp.fu-berlin.de/unix/network/am-utils">ftp.fu-berlin.de</A>.
- Maintainer <A HREF="mailto:ftp-adm@ftp.fu-berlin.de">ftp-adm@ftp.fu-berlin.de</A>.
+ Maintainer <A HREF="mailto:ftp-adm AT ftp.fu-berlin.de">ftp-adm AT ftp.fu-berlin.de</A>.
</LI>
<LI> FTP: <A HREF="ftp://ftp.tu-darmstadt.de/pub/networking/filesystems/am-utils/">ftp.tu-darmstadt.de</A>.
- Maintainer <A HREF="mailto:networking@ftp.tu-darmstadt.de">networking@ftp.tu-darmstadt.de</A>.
+ Maintainer <A HREF="mailto:networking AT ftp.tu-darmstadt.de">networking AT ftp.tu-darmstadt.de</A>.
</LI>
</UL>
<LI> Sweden
<UL>
<LI> FTP: <A HREF="ftp://ftp.sunet.se/pub/unix/admin/am-utils">ftp.sunet.se</A>.
- Maintainer <A HREF="mailto:archive@ftp.sunet.se">archive@ftp.sunet.se</A>.
+ Maintainer <A HREF="mailto:archive AT ftp.sunet.se">archive AT ftp.sunet.se</A>.
</LI>
</UL>
<LI> UK
<UL>
<LI> FTP: <A HREF="ftp://sunsite.org.uk/package/am-utils">sunsite.org.uk</A>.
- Maintainer <A HREF="mailto:lmjm@icparc.ic.ac.uk">lmjm@icparc.ic.ac.uk</A>.
+ Maintainer <A HREF="mailto:lmjm AT icparc.ic.ac.uk">lmjm AT icparc.ic.ac.uk</A>.
</LI>
</UL>
@@ -81,21 +81,21 @@ full URL, maintainer's email, and geographical location.
<LI> Japan
<UL>
<LI> FTP: <A HREF="ftp://ftp.u-aizu.ac.jp/pub/net/amd/am-utils">ftp.u-aizu.ac.jp</A>.
- Maintainer <A HREF="mailto:ftp-admin@u-aizu.ac.jp">ftp-admin@u-aizu.ac.jp</A>.
+ Maintainer <A HREF="mailto:ftp-admin AT u-aizu.ac.jp">ftp-admin AT u-aizu.ac.jp</A>.
</LI>
<LI> FTP: <A HREF="ftp://core.ring.gr.jp/pub/net/am-utils/">core.ring.gr.jp</A>.
- Maintainer <A HREF="mailto:ftpadmin@ring.gr.jp">ftpadmin@ring.gr.jp</A>.
+ Maintainer <A HREF="mailto:ftpadmin AT ring.gr.jp">ftpadmin AT ring.gr.jp</A>.
</LI>
<LI> FTP: <A HREF="ftp://ftp.ring.gr.jp/pub/net/am-utils/">ftp.ring.gr.jp</A>.
- Maintainer <A HREF="mailto:ftpadmin@ring.gr.jp">ftpadmin@ring.gr.jp</A>.
+ Maintainer <A HREF="mailto:ftpadmin AT ring.gr.jp">ftpadmin AT ring.gr.jp</A>.
</LI>
</UL>
</UL>
<HR>
-<I> Last updated: Jan 5, 2004</I>
+<I> Last updated: 2006-11-27</I>
</BODY>
</HTML>
diff --git a/contrib/amd/MIRRORS.txt b/contrib/amd/MIRRORS.txt
index b5093e8f4aa4..087c6ccd0cce 100644
--- a/contrib/amd/MIRRORS.txt
+++ b/contrib/amd/MIRRORS.txt
@@ -2,59 +2,59 @@
Note: in case of any problems accessing the individual FTP sites, please
contact their respective maintainers. If you wish to be added to the
-official mirror list, please send mail to am-utils-developers@am-utils.org
+official mirror list, please send mail to am-utils-developers AT am-utils.org
with the full URL, maintainer's email, and geographical location.
U.S.A:
New York (Stony Brook, Primary Site):
ftp://ftp.am-utils.org/pub/am-utils
- Maintainer: ezk@am-utils.org
+ Maintainer: ezk AT am-utils.org
Minnesota:
ftp://ftp.cs.umn.edu/pub/am-utils
- Maintainer: dokas@cs.umn.edu
+ Maintainer: dokas AT cs.umn.edu
#Avoid for now: empty directory
# Virginia (Newport News):
# ftp://ftp.ferginc.com/pub/unix/am-utils
-# Maintainer: Branson.Matheson@FergInc.com
+# Maintainer: Branson.Matheson AT FergInc.com
#server gone? (Jan 5, 2004)
# Ohio (Kent State University):
# ftp://info.mcs.kent.edu/pub/am-utils
-# Maintainer: root@mcs.kent.edu
+# Maintainer: root AT mcs.kent.edu
Florida (University of Florida)
ftp://ftp.cise.ufl.edu/pub/mirrors/am-utils
- Maintainer: mirror@cise.ufl.edu
+ Maintainer: mirror AT cise.ufl.edu
Europe:
Germany:
ftp://ftp.fu-berlin.de/unix/network/am-utils
- Maintainer: ftp-adm@ftp.fu-berlin.de
+ Maintainer: ftp-adm AT ftp.fu-berlin.de
Germany:
ftp://ftp.tu-darmstadt.de/pub/networking/filesystems/am-utils/
- Maintainer: networking@ftp.tu-darmstadt.de
+ Maintainer: networking AT ftp.tu-darmstadt.de
Sweden:
ftp://ftp.sunet.se/pub/unix/admin/am-utils
- Maintainer: archive@ftp.sunet.se
+ Maintainer: archive AT ftp.sunet.se
# not responding (Jan 5, 2004)
# Sweden (Stockholm University, Math Depat):
# ftp://mirror.matematik.su.se/pub/am-utils
-# Maintainer: leifj@matematik.su.se
+# Maintainer: leifj AT matematik.su.se
UK:
ftp://sunsite.org.uk/package/am-utils
- Maintainer: lmjm@icparc.ic.ac.uk
+ Maintainer: lmjm AT icparc.ic.ac.uk
Asia:
Japan:
ftp://ftp.u-aizu.ac.jp/pub/net/amd/am-utils
- Maintainer: ftp-admin@u-aizu.ac.jp
+ Maintainer: ftp-admin AT u-aizu.ac.jp
Japan:
ftp://core.ring.gr.jp/pub/net/am-utils/
- Maintainer: ftpadmin@ring.gr.jp
+ Maintainer: ftpadmin AT ring.gr.jp
Japan:
ftp://ftp.ring.gr.jp/pub/net/am-utils/
- Maintainer: ftpadmin@ring.gr.jp
+ Maintainer: ftpadmin AT ring.gr.jp
# gone? (Jan 5, 2004)
# Australia:
# Melbourne:
# ftp://ftp.sage-au.org.au/pub/network/filesystem/am-utils
-# Maintainer: mirror@ftp.sage-au.org.au
+# Maintainer: mirror AT ftp.sage-au.org.au
diff --git a/contrib/amd/NEWS b/contrib/amd/NEWS
index 5cde984ed518..b7fbedac6d02 100644
--- a/contrib/amd/NEWS
+++ b/contrib/amd/NEWS
@@ -1,4 +1,44 @@
-*** Notes specific to am-utils version 6.1.5
+*** Notes specific to am-utils version 6.2
+
+ - Removed license advertising clause
+ - Removed expn program
+
+*** Notes specific to am-utils version 6.2-rc1
+
+Filesystem Support:
+ - Add support for NFSv4
+ - Add support for Lustre
+ - Add support for ext{2,3,4}
+ - Add support for linux autofs version 5
+ - Add support for TMPFS and UDF
+New features:
+ - Add amq -i (prints information about maps)
+ - Add synchronous unmount code for amq -uu
+ - Allow a comma-separated list of LDAP servers for failover
+Changes in behavior:
+ - Empty variable assignments, now unset the variable value.
+ - Share LDAP connections between different maps to save resources
+Portability fixes:
+ - Changes to work with Linux-2.6.x, Linux-3.x and NetBSD-5.x, NetBSD-6.x,
+ FreeBSD 7.x, Solaris
+Bug fixes:
+ - Many bug fixes, see ChangeLog
+
+*** Notes specific to am-utils version 6.2a3
+
+- minor new ports:
+ i386-apple-darwin8.8.1
+ i386-pc-linux-centos4.4 (RHEL4 clone)
+ i386-pc-linux-fc6 (Fedora Core 6)
+ i386-pc-solaris2.11-nexentaos (GNU/OpenSolaris)
+ ia64-hp-hpux11.23 (gcc and cc)
+ powerpc-apple-darwin8.7.0
+
+- Bugs fixed:
+ * reduce annoying warnings from xstrlcpy when expanding options.
+ * translate '*' Sun maps correctly with "${key}"
+
+*** Notes specific to am-utils version 6.2a2
New amd.conf global parameter: nfs_allow_any_interface. By default it is
set to 'no' which means that Amd accepts local NFS packets only from
@@ -11,21 +51,6 @@ Add support for specifying the host to match in the mount selectors netgrp
and netgrpd. Now one can use either netgrp(<group-name>) or
netgrp(<group-name>,<host-name>).
-- Bugs fixed:
- * handle old-style filehandles correctly (for mount points longer
- than 28 chars)
- * don't turn off attribute cache for regular NFS mounts (improves
- performance)
- * detect G/DBM support via gdbm_compat library (Debian)
- * detect NDBM support in libc (FreeBSD 6)
-
-- minor new ports:
- i386-unknown-freebsd6.1 (RELEASE)
- i386-unknown-openbsd3.9
- powerpc-apple-darwin8.6.0
-
-*** Notes specific to am-utils version 6.1.4
-
Support new mount options for type:=pcfs mounts: longname, nowin95,
shortname, user=N, group=N, mask=N, and dirmask=N.
@@ -41,44 +66,28 @@ better tune Amd's responsiveness under heavy scheduler loads.
i386-pc-linux-fc5 (Fedora Core 5)
i386-pc-linux-suse10.1 (beta 8)
i386-unknown-freebsd6.0 (RELEASE)
+ i386-unknown-freebsd6.1 (RELEASE)
i386-unknown-netbsdelf2.1
i386-unknown-netbsdelf3.0 (RELEASE)
i386-unknown-openbsd3.8
+ i386-unknown-openbsd3.9
powerpc-apple-darwin8.5.0
+ powerpc-apple-darwin8.6.0
- Bugs fixed:
* one serious memory leak in amfs_generic (caught by Coverity)
* assorted potential (but rare) NULL pointer dereferences (Coverity)
* correctly print nfs_args->addr info (sin_family/port/addr)
* pawd should resolve path repeatedly until no more to do
+ * handle old-style filehandles correctly (for mount points longer
+ than 28 chars)
* use-after-free bug in amfs_lookup_mntfs (Coverity)
+ * don't turn off attribute cache for regular NFS mounts (improves
+ performance)
+ * detect G/DBM support via gdbm_compat library (Debian)
+ * detect NDBM support in libc (FreeBSD 6)
-*** Notes specific to am-utils version 6.1.3
-
-- Bugs fixed:
- * amq should de-register properly on exit
- * convert all sprintf to safer xsnprintf
- * convert all strcat to safer xstrlcat
- * convert all strcpy to safer xstrlcpy
- * fix three buffer overruns in expand_op (amd/opts.c)
- * pawd was trying UDP only, now try TCP if UDP failed
-
-Moved pawd's path-matching functionality into Amd, where it can be done a
-lot more efficiently (we no longer need to construct and send the whole
-mounted tree, only to match small parts of it). This will lessen the CPU
-and network load on systems that use pawd heavily, and also minimize the
-chance that we exceed default or hard-coded UDP/TCP RPC packet sizes.
-
-*** Notes specific to am-utils version 6.1.2.1
-
-- Bugs fixed:
- * properly turn off the attrcache in freebsd and openbsd
- * can turn off attrcache on netbsd, but need kernel patch, see
- README.attrcache
- * pawd goes into an infinite loop on type:=auto
- * consistent search for file system mnttab/mount names
-
-*** Notes specific to am-utils version 6.1.2
+*** Notes specific to am-utils version 6.2a1
MAJOR BUG FIXES: Synchronize Amd's view of its file systems with the
kernel's NFS client-side DNLC/dcache. Amd changes its view when it reloads
@@ -114,13 +123,82 @@ Amd.
Tell syslog not to log automatically to /dev/console; it's unfriendly. If
user really wants to, they can set it in /etc/syslog.conf.
+Moved pawd's path-matching functionality into Amd, where it can be done a
+lot more efficiently (we no longer need to construct and send the whole
+mounted tree, only to match small parts of it). This will lessen the CPU
+and network load on systems that use pawd heavily, and also minimize the
+chance that we exceed default or hard-coded UDP/TCP RPC packet sizes.
+
+Changed slightly how Amd behaves when you try to change log_options after
+Amd started (options can be turned on/off via "amq -x ARG"). It used to be
+that Amd won't let you turn off options which were on when Amd started.
+That limited users' ability to reduce Amd's logging levels to a minimum.
+Now, Amd will allow you to turn on/off any option, other than the two
+options "fatal" and "error." Both are on by default and considered
+mandatory. These two don't produce a lot of log messages, so your logs will
+remain small, but they are important to keep on, so Amd can report serious
+problems (including errors relating to incorrectly setting other log
+options).
+
+Amd now understands a new log_option called "defaults" which is synonymous
+with "fatal,error,user,warning,info" (and is also what logging happens by
+default).
+
+Amd now understands a new debug_option called "defaults" which is synonymous
+with "all,nohrtime,nomtab,noxdrtrace".
+
+Changed the misleading inverted logic of certain debug_options:
+
+1. "xdrtrace" is included in "all" because "all" (as the name implies),
+ should be *all* options, not just a subset. If you want the old behavior
+ of "all" then use "defaults" (all only adds "xdrtrace" which can be
+ chatty on some systems).
+
+2. Certain debug options are hereby declared immutable: they may not be
+ changed by "amq -D" after Amd starts, because it doesn't make much sense
+ to change them after Amd starts, and it could really mess up Amd. These
+ immutable flags are currently "daemon," "fork," "amq," and "mtab."
+
+3. the debug option "daemon" *will* cause Amd to daemonize. Before, it was
+ causing Amd NOT to daemonize. This was greatly confusing, especially
+ since the code, documentation, and comments often conflicted with each
+ other. If you don't want Amd to daemonize, which is useful for debugging
+ it, then use the debug option "nodaemon" -- it makes a lot more sense.
+
+4. Similarly, the "fork" option *will* cause Hlfsd to fork. Use "nofork" if
+ you don't want Hlfsd to fork. This option is only applicable to Hlfsd.
+
+5. Similarly, the "amq" option, which is now on by default, will cause Amd
+ to register itself with the RPC portmapper (for Amq), as is done
+ normally. If you don't want Amd to register with the portmapper, use
+ "noamq" -- this naming convention makes more sense. This was also
+ confusingly documented and coded in places.
+
+ Note: unfortunately, these changes to the "daemon," "fork," and "amq"
+ debug options may be incompatible with people's previous use of Amd.
+ Some of you may have to update your amd.conf slightly or your startup
+ options (if they're hard-coded in your amd startup script). Sorry, but
+ we have to fix those old problems sooner or later. However, if you never
+ set any debug_options, or you used to "all," then you won't be affected
+ by the change in meaning of these three flags.
+
- minor new ports:
i386-pc-linux-deb3.1
- i386-unknown-netbsdelf3.0
+ i386-unknown-netbsdelf3.0 (BETA)
powerpc-apple-darwin8.2.0
-- bugs fixed:
- * minor documentation corrections
+- Bugs fixed:
+ * abort with an error if yacc/lex programs not found
+ * properly turn off the attrcache in freebsd and openbsd
+ * can turn off attrcache on netbsd, but need kernel patch, see
+ README.attrcache
+ * pawd goes into an infinite loop on type:=auto
+ * consistent search for file system mnttab/mount names
+ * convert all sprintf to safer xsnprintf
+ * convert all strcat to safer xstrlcat
+ * convert all strcpy to safer xstrlcpy
+ * fix three buffer overruns in expand_op (amd/opts.c)
+ * pawd was trying UDP only, now try TCP if UDP failed
*** Notes specific to am-utils version 6.1.1
@@ -328,7 +406,7 @@ version (10.3.x) than uname(3) reports.
Useful with firewalls and NAT'ed environments.
- new amd.conf option "debug_mtab_file". Allows user to define the mtab
- file during debug-mtab mode. The default path is "/tmp/mnttab".
+ file during debug-mtab mode. The default path is "/tmp/mtab".
- new function selector xhost(ARG) which will match ARG against the current
host name. This works even if ARG is a CNAME (unlike the host==ARG
diff --git a/contrib/amd/README b/contrib/amd/README
index 0b3ce46beb63..4b4aec0e8c0c 100644
--- a/contrib/amd/README
+++ b/contrib/amd/README
@@ -81,7 +81,7 @@ or
./buildall -K
To be a developer and be able to run "bootstrap", you must have
-autoconf-2.50, automake-1.5, and libtool 1.4 installed on your system (or
+autoconf-2.68, automake-1.11.1, and libtool 2.2.6b installed on your system (or
later versions thereof). You no longer need to get my special version of
automake. Contact me if you'd like to be a maintainer and get access to the
CVS server.
@@ -94,9 +94,9 @@ before. Let me know if you are having any problems with them. I fully
expect, at least initially, to have to be the sole developers of the M4
macros and let others concentrate on C sources.
-[E] Report all bugs to am-utils@am-utils.org. Avoid reporting to my
-personal email address. It is important to involve the whole list in bug
-fixes etc.
+[E] Report all bugs via Bugzilla or the am-utils list (see
+www.am-utils.org). Avoid reporting to my personal email address. It is
+important to involve the whole list in bug fixes etc.
Good luck.
diff --git a/contrib/amd/README.attrcache b/contrib/amd/README.attrcache
index e8522d226ebe..7bd10874bf8c 100644
--- a/contrib/amd/README.attrcache
+++ b/contrib/amd/README.attrcache
@@ -122,8 +122,8 @@ OS. You can run this script as root as follows:
# sh test-attrcache
If you run this script on an OS whose status is known (and not listed
-above), please report it to am-utils@am-utils.org, so we can record it in
-this file.
+above), please report it to us via Bugzilla or the am-utils mailing list
+(see www.am-utils.org), so we can record it in this file.
Sincerely,
Erez.
diff --git a/contrib/amd/README.ldap b/contrib/amd/README.ldap
index 715113442552..24095cafa9ca 100644
--- a/contrib/amd/README.ldap
+++ b/contrib/amd/README.ldap
@@ -1,12 +1,12 @@
LDAP support for am-utils was originally done by Leif Johansson
-<leifj@it.su.se>. He no longer maintains it.
+<leifj AT it.su.se>. He no longer maintains it.
The current LDAP support for am-utils is for LDAPv2 only. Reportedly,
LDAPv3 mostly works. Volunteers and patches are welcome.
The IANA has assigned the following Private Enterprise Number to:
- 10180 Am-utils Organization Erez Zadok ezk@am-utils.org
+ 10180 Am-utils Organization Erez Zadok ezk AT am-utils.org
There are three files in this directory that relate to LDAP:
@@ -33,8 +33,8 @@ Erez.
------- Forwarded Message
-From: "IANA Private Enterprise Number" <iana-pen@icann.org>
-To: "Erez Zadok" <ezk@cs.columbia.edu>
+From: "IANA Private Enterprise Number" <iana-pen AT icann.org>
+To: "Erez Zadok" <ezk AT cs.columbia.edu>
Subject: RE: Application for Enterprise-number (10180)
Date: Sun, 15 Jul 2001 14:43:45 -0700
@@ -43,7 +43,7 @@ Dear Erez,
The IANA has assigned the following Private Enterprise
Number to:
-10180 Am-utils Organization Erez Zadok ezk@am-utils.org
+10180 Am-utils Organization Erez Zadok ezk AT am-utils.org
Please notify the IANA if there is a change in your contact
or company information.
diff --git a/contrib/amd/README.y2k b/contrib/amd/README.y2k
index e75bd122590e..b0b887c500a9 100644
--- a/contrib/amd/README.y2k
+++ b/contrib/amd/README.y2k
@@ -8,10 +8,10 @@ all, because it does not do anything with dates other than print the date on
the log file, in whatever format is provided by your os/libc --- especially
the ctime(3) call.
-However, on Friday, September 18th 1998, Matthew Crosby <mcrosby@ms.com>
+However, on Friday, September 18th 1998, Matthew Crosby <mcrosby AT ms.com>
reported that they evaluated 6.0a16 and found it to be compliant.
-On March 26, 1999, Paul Balyoz <pbalyoz@sedona.ch.intel.com> submitted a
+On March 26, 1999, Paul Balyoz <pbalyoz AT sedona.ch.intel.com> submitted a
patch to lostaltmail which makes it print Y2K compliant dates. He used a
code scanner and manually "eyeballed" the code and could not find any more
problems. Paul's patch is included in am-utils-6.0.1s7 and newer versions.
@@ -23,5 +23,4 @@ CERTIFY AM-UTILS AS Y2K COMPLIANT. USE AT YOUR OWN RISK.
---
Erez Zadok.
Maintainer, am-utils package and am-utils list.
-Email: am-utils@am-utils.org
WWW: http://www.am-utils.org
diff --git a/contrib/amd/amd/am_ops.c b/contrib/amd/amd/am_ops.c
index 5a5c33650eca..4d07dc807d90 100644
--- a/contrib/amd/amd/am_ops.c
+++ b/contrib/amd/amd/am_ops.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997-2006 Erez Zadok
+ * Copyright (c) 1997-2014 Erez Zadok
* Copyright (c) 1989 Jan-Simon Pendry
* Copyright (c) 1989 Imperial College of Science, Technology & Medicine
* Copyright (c) 1989 The Regents of the University of California.
@@ -16,11 +16,7 @@
* 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgment:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -96,6 +92,11 @@ static am_ops *vops[] =
#ifdef HAVE_FS_XFS
&xfs_ops, /* Unix (irix) F/S */
#endif /* HAVE_FS_XFS */
+#ifdef HAVE_FS_EXT
+ &ext2_ops, /* Unix (linux) F/S */
+ &ext3_ops, /* Unix (linux) F/S */
+ &ext4_ops, /* Unix (linux) F/S */
+#endif /* HAVE_FS_EXT */
#ifdef HAVE_FS_EFS
&efs_ops, /* Unix (irix) F/S */
#endif /* HAVE_FS_EFS */
@@ -111,6 +112,9 @@ static am_ops *vops[] =
#ifdef HAVE_FS_CACHEFS
&cachefs_ops, /* caching F/S */
#endif /* HAVE_FS_CACHEFS */
+#ifdef HAVE_FS_TMPFS
+ &tmpfs_ops, /* /tmp (in memory) F/S */
+#endif /* HAVE_FS_TMPFS */
#ifdef HAVE_FS_NULLFS
/* FILL IN */ /* null (loopback) F/S */
#endif /* HAVE_FS_NULLFS */
@@ -120,6 +124,12 @@ static am_ops *vops[] =
#ifdef HAVE_FS_UMAPFS
/* FILL IN */ /* uid/gid mapping F/S */
#endif /* HAVE_FS_UMAPFS */
+#ifdef HAVE_FS_UDF
+ &udf_ops, /* UDF F/S */
+#endif /* HAVE_FS_UDF */
+#ifdef HAVE_FS_LUSTRE
+ &lustre_ops, /* Lustre */
+#endif /* HAVE_FS_LUSTRE */
/*
* These 4 should be last, in the order:
@@ -316,7 +326,7 @@ merge_opts(const char *opts1, const char *opts2)
char oneopt[80]; /* one option w/o value if any */
char *revoneopt; /* reverse of oneopt */
size_t len = strlen(opts1) + strlen(opts2) + 2; /* space for "," and NULL */
- char *s1 = strdup(opts1); /* copy of opts1 to munge */
+ char *s1 = xstrdup(opts1); /* copy of opts1 to munge */
/* initialization */
mnt2.mnt_opts = (char *) opts2;
@@ -327,13 +337,13 @@ merge_opts(const char *opts1, const char *opts2)
tmpstr;
tmpstr = strtok(NULL, ",")) {
/* copy option to temp buffer */
- xstrlcpy(oneopt, tmpstr, 80);
+ xstrlcpy(oneopt, tmpstr, sizeof(oneopt));
/* if option has a value such as rsize=1024, chop the value part */
- if ((eq = haseq(oneopt)))
+ if ((eq = strchr(oneopt, '=')))
*eq = '\0';
/* find reverse option of oneopt */
revoneopt = reverse_option(oneopt);
- /* if option orits reverse exist in opts2, ignore it */
+ /* if option or its reverse exist in opts2, ignore it */
if (amu_hasmntopt(&mnt2, oneopt) || amu_hasmntopt(&mnt2, revoneopt))
continue;
/* add option to returned string */
@@ -362,7 +372,7 @@ am_ops *
ops_search(char *type)
{
am_ops **vp;
- am_ops *rop = 0;
+ am_ops *rop = NULL;
for (vp = vops; (rop = *vp); vp++)
if (STREQ(rop->fs_type, type))
break;
@@ -373,7 +383,7 @@ ops_search(char *type)
am_ops *
ops_match(am_opts *fo, char *key, char *g_key, char *path, char *keym, char *map)
{
- am_ops *rop = 0;
+ am_ops *rop = NULL;
char *link_dir;
/*
@@ -400,7 +410,7 @@ ops_match(am_opts *fo, char *key, char *g_key, char *path, char *keym, char *map
* Otherwise skip past any leading '-'.
*/
if (fo->opt_opts == 0)
- fo->opt_opts = strdup("rw,defaults");
+ fo->opt_opts = xstrdup("rw,defaults");
else if (*fo->opt_opts == '-') {
/*
* We cannot simply do fo->opt_opts++ here since the opts
@@ -408,7 +418,7 @@ ops_match(am_opts *fo, char *key, char *g_key, char *path, char *keym, char *map
* So just reallocate the thing -- stolcke 11/11/94
*/
char *old = fo->opt_opts;
- fo->opt_opts = strdup(old + 1);
+ fo->opt_opts = xstrdup(old + 1);
XFREE(old);
}
@@ -426,7 +436,7 @@ ops_match(am_opts *fo, char *key, char *g_key, char *path, char *keym, char *map
XFREE(fo->opt_opts);
XFREE(fo->opt_remopts);
fo->opt_opts = mergedstr;
- fo->opt_remopts = strdup(mergedstr);
+ fo->opt_remopts = xstrdup(mergedstr);
} else {
char *mergedstr, *remmergedstr;
mergedstr = merge_opts(fo->opt_opts, fo->opt_addopts);
@@ -451,7 +461,7 @@ ops_match(am_opts *fo, char *key, char *g_key, char *path, char *keym, char *map
/* Normalize the sublink and make it absolute */
link_dir = fo->opt_sublink;
if (link_dir && link_dir[0] && link_dir[0] != '/') {
- link_dir = str3cat((char *) 0, fo->opt_fs, "/", link_dir);
+ link_dir = str3cat((char *) NULL, fo->opt_fs, "/", link_dir);
normalize_slash(link_dir);
XFREE(fo->opt_sublink);
fo->opt_sublink = link_dir;
@@ -460,8 +470,7 @@ ops_match(am_opts *fo, char *key, char *g_key, char *path, char *keym, char *map
/*
* Check the filesystem is happy
*/
- if (fo->fs_mtab)
- XFREE(fo->fs_mtab);
+ XFREE(fo->fs_mtab);
fo->fs_mtab = rop->fs_match(fo);
if (fo->fs_mtab)
diff --git a/contrib/amd/amd/amd.8 b/contrib/amd/amd/amd.8
index ca6b6de39f59..35eba4c5baa8 100644
--- a/contrib/amd/amd/amd.8
+++ b/contrib/amd/amd/amd.8
@@ -1,5 +1,5 @@
.\"
-.\" Copyright (c) 1997-2006 Erez Zadok
+.\" Copyright (c) 1997-2014 Erez Zadok
.\" Copyright (c) 1989 Jan-Simon Pendry
.\" Copyright (c) 1989 Imperial College of Science, Technology & Medicine
.\" Copyright (c) 1989 The Regents of the University of California.
@@ -16,11 +16,7 @@
.\" 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. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgment:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
+.\" 3. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
@@ -36,9 +32,8 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" %W% (Berkeley) %G%
.\"
-.\" $Id: amd.8,v 1.14.2.1 2006/01/02 18:48:23 ezk Exp $
+.\" File: am-utils/amd/amd.8
.\" $FreeBSD$
.\"
.Dd February 26, 2016
@@ -232,20 +227,20 @@ Specify an
in seconds, between attempts to dismount
file systems that have exceeded their cached times.
The default is 2 minutes.
+.TP
.It Fl x Ar options
-Specify run-time logging options.
-The options are a comma separated
+Specify run-time logging options. The options are a comma separated
list chosen from:
-.Li fatal , error , user , warn , info , map , stats , all .
+.Li fatal, error, user, warn, info, map, stats, defaults, all .
+Note that "fatal" and "error" are mandatory and cannot be turned off.
+.TP
.It Fl y Ar domain
Specify an alternative
.Tn NIS
domain from which to fetch the
.Tn NIS
maps.
-The default is the system domain name.
-This option is ignored if
-.Tn NIS
+The default is the system domain name. This option is ignored if NIS
support is not available.
.It Fl A Ar arch
Specifies the OS architecture.
@@ -367,14 +362,15 @@ number of process context switches.
A weird imagination is most useful to gain full advantage of all
the features.
.Sh SEE ALSO
-.Xr domainname 1 ,
-.Xr hostname 1 ,
-.Xr syslog 3 ,
-.Xr amd.conf 5 ,
-.Xr mtab 5 ,
-.Xr amq 8 ,
-.Xr mount 8 ,
-.Xr umount 8
+.Xr domainname 1,
+.Xr hostname 1,
+.Xr syslog 3.
+.Xr amd.conf 5,
+.Xr mtab 5,
+.Xr amq 8,
+.Xr automount 8,
+.Xr mount 8,
+.Xr umount 8,
.Pp
.Dq am-utils
.Xr info 1
diff --git a/contrib/amd/amd/amd.c b/contrib/amd/amd/amd.c
index 3fc25f833dbb..7ec49ce1cec5 100644
--- a/contrib/amd/amd/amd.c
+++ b/contrib/amd/amd/amd.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997-2006 Erez Zadok
+ * Copyright (c) 1997-2014 Erez Zadok
* Copyright (c) 1989 Jan-Simon Pendry
* Copyright (c) 1989 Imperial College of Science, Technology & Medicine
* Copyright (c) 1989 The Regents of the University of California.
@@ -16,11 +16,7 @@
* 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgment:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -379,7 +375,7 @@ do_memory_locking(void)
#endif /* HAVE_PLOCK || HAVE_MLOCKALL */
#if defined(HAVE_MADVISE) && defined(MADV_PROTECT)
- madvise(0, 0, MADV_PROTECT); /* may be redundant of the above worked out */
+ madvise(NULL, 0, MADV_PROTECT); /* may be redundant of the above worked out */
#endif /* defined(HAVE_MADVISE) && defined(MADV_PROTECT) */
}
@@ -431,6 +427,7 @@ main(int argc, char *argv[])
if (gethostname(hostname, sizeof(hostname)) < 0) {
plog(XLOG_FATAL, "gethostname: %m");
going_down(1);
+ return 1;
}
hostname[sizeof(hostname) - 1] = '\0';
@@ -440,6 +437,7 @@ main(int argc, char *argv[])
if (!*hostname) {
plog(XLOG_FATAL, "host name is not set");
going_down(1);
+ return 1;
}
/*
@@ -498,7 +496,8 @@ main(int argc, char *argv[])
getwire(&PrimNetName, &PrimNetNum);
/*
- * Determine command-line arguments
+ * Determine command-line arguments.
+ * (Also initialize amd.conf parameters, maps, and more.)
*/
get_args(argc, argv);
@@ -532,6 +531,7 @@ main(int argc, char *argv[])
if (geteuid() != 0) {
plog(XLOG_FATAL, "Must be root to mount filesystems (euid = %ld)", (long) geteuid());
going_down(1);
+ return 1;
}
#ifdef HAVE_MAP_NIS
@@ -543,10 +543,11 @@ main(int argc, char *argv[])
if (gopt.nis_domain && yp_bind(gopt.nis_domain)) {
plog(XLOG_FATAL, "Can't bind to NIS domain \"%s\"", gopt.nis_domain);
going_down(1);
+ return 1;
}
#endif /* HAVE_MAP_NIS */
- if (!amuDebug(D_DAEMON))
+ if (amuDebug(D_DAEMON))
ppid = daemon_mode();
/*
diff --git a/contrib/amd/amd/amd.h b/contrib/amd/amd/amd.h
index 0e371b72a5b0..f66f5b75169f 100644
--- a/contrib/amd/amd/amd.h
+++ b/contrib/amd/amd/amd.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997-2006 Erez Zadok
+ * Copyright (c) 1997-2014 Erez Zadok
* Copyright (c) 1990 Jan-Simon Pendry
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
* Copyright (c) 1990 The Regents of the University of California.
@@ -16,11 +16,7 @@
* 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgment:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -54,9 +50,12 @@
* that support mtab on file.
*/
#ifdef MOUNT_TABLE_ON_FILE
-# define DEBUG_MNTTAB_FILE "/tmp/mnttab"
+# define DEBUG_MNTTAB_FILE "/tmp/mtab"
#endif /* MOUNT_TABLE_ON_FILE */
+/* Max line length that info services can handle */
+#define INFO_MAX_LINE_LEN 1500
+
/* options for amd.conf */
#define CFM_BROWSABLE_DIRS 0x00000001
#define CFM_MOUNT_TYPE_AUTOFS 0x00000002 /* use kernel autofs support */
@@ -76,10 +75,7 @@
#define CFM_NORMALIZE_SLASHES 0x00008000 /* normalize slashes? */
#define CFM_FORCED_UNMOUNTS 0x00010000 /* forced unmounts? */
#define CFM_TRUNCATE_LOG 0x00020000 /* truncate log file? */
-#if 0
-/* XXX: reserved to sync up with am-utils-6.2 */
#define CFM_SUN_MAP_SYNTAX 0x00040000 /* Sun map syntax? */
-#endif
#define CFM_NFS_ANY_INTERFACE 0x00080000 /* all interfaces are acceptable */
/* defaults global flags: plock, tcpwrappers, and autofs/lofs */
@@ -212,6 +208,7 @@ typedef struct cf_map cf_map_t;
typedef struct kv kv;
typedef struct am_node am_node;
typedef struct mntfs mntfs;
+typedef struct am_loc am_loc;
typedef struct am_opts am_opts;
typedef struct am_ops am_ops;
typedef struct am_stats am_stats;
@@ -245,13 +242,17 @@ typedef int (*vmount_fs) (am_node *, mntfs *);
typedef int (*vumount_fs) (am_node *, mntfs *);
typedef am_node *(*vlookup_child) (am_node *, char *, int *, int);
typedef am_node *(*vmount_child) (am_node *, int *);
-typedef int (*vreaddir) (am_node *, nfscookie, nfsdirlist *, nfsentry *, u_int);
+typedef int (*vreaddir) (am_node *, voidp, voidp, voidp, u_int);
typedef am_node *(*vreadlink) (am_node *, int *);
typedef void (*vmounted) (mntfs *);
typedef void (*vumounted) (mntfs *);
typedef fserver *(*vffserver) (mntfs *);
typedef wchan_t (*vget_wchan) (mntfs *);
+/*
+ * NFS progran dispatcher
+ */
+typedef void (*dispatcher_t)(struct svc_req *rqstp, SVCXPRT *transp);
/*
@@ -314,6 +315,7 @@ struct amu_global_options {
#endif /* HAVE_MAP_NIS */
char *nfs_proto; /* NFS protocol (NULL, udp, tcp) */
int nfs_vers; /* NFS version (0, 2, 3, 4) */
+ int nfs_vers_ping; /* NFS rpc ping version (0, 2, 3, 4) */
u_int exec_map_timeout; /* timeout (seconds) for executable maps */
};
@@ -349,6 +351,7 @@ struct mnt_map {
short alloc; /* Allocation mode */
time_t modify; /* Modify time of map */
u_int reloads; /* Number of times map was reloaded */
+ u_int nentries; /* Number of entries in the map */
char *map_name; /* Name of this map */
char *wildcard; /* Wildcard value */
reload_fn *reload; /* Function to be used for reloads */
@@ -420,7 +423,7 @@ struct mntfs {
am_opts *mf_fo; /* File opts */
char *mf_mount; /* "/a/kiska/home/kiska" */
char *mf_info; /* Mount info */
- char *mf_auto; /* Automount opts */
+ char *mf_auto; /* Mount info */
char *mf_mopts; /* FS mount opts */
char *mf_remopts; /* Remote FS mount opts */
char *mf_loopdev; /* loop device name for /dev/loop mounts */
@@ -435,6 +438,16 @@ struct mntfs {
};
/*
+ * Locations: bindings between keys and mntfs
+ */
+struct am_loc {
+ am_opts *al_fo;
+ mntfs *al_mnt;
+ int al_refc;
+};
+
+
+/*
* List of fileservers
*/
struct fserver {
@@ -463,6 +476,8 @@ struct am_stats {
int s_readdir; /* Count of readdirs */
int s_readlink; /* Count of readlinks */
int s_statfs; /* Count of statfs */
+ int s_fsinfo; /* Count of fsinfo */
+ int s_pathconf; /* Count of pathconf */
};
/*
@@ -482,8 +497,8 @@ extern struct amd_stats amd_stats;
*/
struct am_node {
int am_mapno; /* Map number */
- mntfs *am_mnt; /* Mounted filesystem */
- mntfs **am_mfarray; /* Filesystem sources to try to mount */
+ am_loc *am_al; /* Mounted filesystem */
+ am_loc **am_alarray; /* Filesystem sources to try to mount */
char *am_name; /* "kiska": name of this node */
char *am_path; /* "/home/kiska": path of this node's mount point */
char *am_link; /* "/a/kiska/home/kiska/this/that": link to sub-dir */
@@ -508,6 +523,7 @@ struct am_node {
autofs_fh_t *am_autofs_fh;
time_t am_autofs_ttl; /* Time to expire autofs nodes */
#endif /* HAVE_FS_AUTOFS */
+ int am_fd[2]; /* parent child pipe fd's for sync umount */
};
/*
@@ -527,13 +543,18 @@ extern int *amqproc_getpid_1_svc(voidp argp, struct svc_req *rqstp);
extern int *amqproc_mount_1_svc(voidp argp, struct svc_req *rqstp);
extern int *amqproc_setopt_1_svc(voidp argp, struct svc_req *rqstp);
extern voidp amqproc_null_1_svc(voidp argp, struct svc_req *rqstp);
-extern voidp amqproc_umnt_1_svc(voidp argp, struct svc_req *rqstp);
+extern int *amqproc_umnt_1_svc(voidp argp, struct svc_req *rqstp);
+extern int *amqproc_sync_umnt_1_svc_parent(voidp argp, struct svc_req *rqstp);
+extern amq_sync_umnt *amqproc_sync_umnt_1_svc_child(voidp argp, struct svc_req *rqstp);
+extern amq_sync_umnt *amqproc_sync_umnt_1_svc_async(voidp argp, struct svc_req *rqstp);
+extern amq_map_info_list *amqproc_getmapinfo_1_svc(voidp argp, struct svc_req *rqstp);
/* other external definitions */
-extern am_nfs_fh *get_root_nfs_fh(char *dir);
+extern am_nfs_handle_t *get_root_nfs_fh(char *dir, am_nfs_handle_t *nfh);
extern am_node *find_ap(char *);
extern am_node *get_ap_child(am_node *, char *);
extern bool_t xdr_amq_mount_info_qelem(XDR *xdrs, qelem *qhead);
+extern bool_t xdr_amq_map_info_qelem(XDR *xdrs, qelem *qhead);
extern fserver *find_nfs_srvr(mntfs *mf);
extern int mount_nfs_fh(am_nfs_handle_t *fhp, char *mntdir, char *fs_name, mntfs *mf);
extern int process_all_regular_maps(void);
@@ -541,7 +562,8 @@ extern cf_map_t *find_cf_map(const char *name);
extern int set_conf_kv(const char *section, const char *k, const char *v);
extern int mount_node(opaque_t arg);
extern int unmount_mp(am_node *mp);
-extern int yyparse (void);
+extern int conf_parse(void); /* "yyparse" renamed */
+extern FILE *conf_in; /* "yyin" renamed */
extern void amfs_mkcacheref(mntfs *mf);
extern int amfs_mount(am_node *mp, mntfs *mf, char *opts);
@@ -566,12 +588,15 @@ extern int get_mountd_port(fserver *, u_short *, wchan_t);
extern void flush_nfs_fhandle_cache(fserver *);
extern mntfs *dup_mntfs(mntfs *);
+extern am_loc *dup_loc(am_loc *);
extern mntfs *find_mntfs(am_ops *, am_opts *, char *, char *, char *, char *, char *);
extern mntfs *locate_mntfs(am_ops *, am_opts *, char *, char *, char *, char *, char *);
+extern am_loc *new_loc(void);
extern mntfs *new_mntfs(void);
extern mntfs *realloc_mntfs(mntfs *, am_ops *, am_opts *, char *, char *, char *, char *, char *);
extern void flush_mntfs(void);
extern void free_mntfs(voidp);
+extern void free_loc(voidp);
extern void amq_program_1(struct svc_req *rqstp, SVCXPRT *transp);
@@ -579,9 +604,11 @@ extern int background(void);
extern void deslashify(char *);
extern void do_task_notify(void);
extern int eval_fs_opts(am_opts *, char *, char *, char *, char *, char *);
+extern int file_read_line(char *, int, FILE *);
extern void forcibly_timeout_mp(am_node *);
extern void free_map(am_node *);
extern void free_opts(am_opts *);
+extern am_opts *copy_opts(am_opts *);
extern void free_srvr(fserver *);
extern int fwd_init(void);
extern int fwd_packet(int, char *, int, struct sockaddr_in *, struct sockaddr_in *, opaque_t, fwd_fun *);
@@ -596,7 +623,7 @@ extern int make_nfs_auth(void);
extern void make_root_node(void);
extern void map_flush_srvr(fserver *);
extern void mapc_add_kv(mnt_map *, char *, char *);
-extern mnt_map *mapc_find(char *, char *, const char *);
+extern mnt_map *mapc_find(char *, char *, const char *, const char *);
extern void mapc_free(opaque_t);
extern int mapc_keyiter(mnt_map *, key_fun, opaque_t);
extern void mapc_reload(void);
@@ -608,9 +635,11 @@ extern int mount_auto_node(char *, opaque_t);
extern int mount_automounter(int);
extern int mount_exported(void);
extern void mp_to_fh(am_node *, am_nfs_fh *);
+extern void mp_to_fh3(am_node *mp, am_nfs_fh3 *fhp);
extern void new_ttl(am_node *);
extern void nfs_quick_reply(am_node *mp, int error);
extern void normalize_slash(char *);
+extern void notify_child(am_node *, au_etype, int, int);
extern void ops_showamfstypes(char *buf, size_t l);
extern void ops_showfstypes(char *outbuf, size_t l);
extern void rem_que(qelem *);
@@ -639,8 +668,8 @@ extern char hostd[SIZEOF_HOSTD]; /* Host+domain */
/*
* Global variables.
*/
-extern FILE *yyin;
extern SVCXPRT *current_transp; /* For nfs_quick_reply() */
+extern dispatcher_t nfs_dispatcher;
extern char *conf_tag;
#define SIZEOF_UID_STR 12
#define SIZEOF_GID_STR 12
@@ -724,6 +753,19 @@ extern am_ops pcfs_ops;
#endif /* HAVE_FS_PCFS */
/*
+ * UDF File System
+ * Many systems can't support this, and in any case most of the
+ * functionality is available with program FS.
+ */
+#ifdef HAVE_FS_UDF
+extern am_ops udf_ops;
+#endif /* HAVE_FS_UDF */
+
+#ifdef HAVE_FS_LUSTRE
+extern am_ops lustre_ops;
+#endif /* HAVE_FS_LUSTRE */
+
+/*
* Caching File System (Solaris)
*/
#ifdef HAVE_FS_CACHEFS
@@ -731,6 +773,12 @@ extern am_ops cachefs_ops;
#endif /* HAVE_FS_CACHEFS */
/*
+ * In memory /tmp filesystem (Linux, NetBSD)
+ */
+#ifdef HAVE_FS_TMPFS
+extern am_ops tmpfs_ops;
+#endif /* HAVE_FS_TMPFS */
+/*
* Network File System
* Good, slow, NFS V.2.
*/
@@ -753,6 +801,13 @@ extern am_ops ufs_ops; /* Un*x file system */
extern am_ops xfs_ops; /* Un*x file system */
#endif /* HAVE_FS_XFS */
+/* Unix file system (ext*) */
+#ifdef HAVE_FS_EXT
+extern am_ops ext2_ops; /* Un*x file system */
+extern am_ops ext3_ops; /* Un*x file system */
+extern am_ops ext4_ops; /* Un*x file system */
+#endif /* HAVE_FS_EXT */
+
/* Unix file system (irix) */
#ifdef HAVE_FS_EFS
extern am_ops efs_ops; /* Un*x file system */
@@ -772,7 +827,7 @@ extern am_ops amfs_root_ops; /* Root file system */
*/
extern am_node *amfs_generic_lookup_child(am_node *mp, char *fname, int *error_return, int op);
extern am_node *amfs_generic_mount_child(am_node *ap, int *error_return);
-extern int amfs_generic_readdir(am_node *mp, nfscookie cookie, nfsdirlist *dp, nfsentry *ep, u_int count);
+extern int amfs_generic_readdir(am_node *mp, voidp cookie, voidp dp, voidp ep, u_int count);
extern int amfs_generic_umount(am_node *mp, mntfs *mf);
extern void amfs_generic_mounted(mntfs *mf);
extern char *amfs_generic_match(am_opts *fo);
@@ -808,7 +863,8 @@ extern am_ops amfs_direct_ops; /* Direct Automount file system (this too) */
extern am_ops amfs_error_ops; /* Error file system */
extern am_node *amfs_error_lookup_child(am_node *mp, char *fname, int *error_return, int op);
extern am_node *amfs_error_mount_child(am_node *ap, int *error_return);
-extern int amfs_error_readdir(am_node *mp, nfscookie cookie, nfsdirlist *dp, nfsentry *ep, u_int count);
+extern int amfs_error_readdir(am_node *mp, voidp cookie, voidp dp, voidp ep, u_int count);
+
#endif /* HAVE_AMU_FS_ERROR */
/*
diff --git a/contrib/amd/amd/amfs_auto.c b/contrib/amd/amd/amfs_auto.c
index 75a451fd111d..34fdb00f501c 100644
--- a/contrib/amd/amd/amfs_auto.c
+++ b/contrib/amd/amd/amfs_auto.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997-2006 Erez Zadok
+ * Copyright (c) 1997-2014 Erez Zadok
* Copyright (c) 1990 Jan-Simon Pendry
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
* Copyright (c) 1990 The Regents of the University of California.
@@ -16,11 +16,7 @@
* 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgment:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -101,6 +97,8 @@ am_ops amfs_auto_ops =
static int
amfs_auto_mount(am_node *mp, mntfs *mf)
{
+ if (mp->am_parent == NULL)
+ return EINVAL;
/*
* Pseudo-directories are used to provide some structure
* to the automounted directories instead
@@ -115,7 +113,7 @@ amfs_auto_mount(am_node *mp, mntfs *mf)
* Historical - not documented.
*/
if (mf->mf_info[0] == '.' && mf->mf_info[1] == '\0')
- mf->mf_info = strealloc(mf->mf_info, mp->am_parent->am_mnt->mf_info);
+ mf->mf_info = strealloc(mf->mf_info, mp->am_parent->am_al->al_mnt->mf_info);
/*
* Compute prefix:
@@ -131,12 +129,12 @@ amfs_auto_mount(am_node *mp, mntfs *mf)
if (mf->mf_fo->opt_pref) {
/* allow pref:=null to set a real null prefix */
if (STREQ(mf->mf_fo->opt_pref, "null")) {
- mp->am_pref = strdup("");
+ mp->am_pref = xstrdup("");
} else {
/*
* the prefix specified as an option
*/
- mp->am_pref = strdup(mf->mf_fo->opt_pref);
+ mp->am_pref = xstrdup(mf->mf_fo->opt_pref);
}
} else {
/*
@@ -147,7 +145,7 @@ amfs_auto_mount(am_node *mp, mntfs *mf)
char *ppref = mp->am_parent->am_pref;
if (ppref == 0)
ppref = "";
- mp->am_pref = str3cat((char *) 0, ppref, mp->am_name, "/");
+ mp->am_pref = str3cat((char *) NULL, ppref, mp->am_name, "/");
}
#ifdef HAVE_FS_AUTOFS
diff --git a/contrib/amd/amd/amfs_direct.c b/contrib/amd/amd/amfs_direct.c
index dbef743d0d7e..b911c2a1e2ce 100644
--- a/contrib/amd/amd/amfs_direct.c
+++ b/contrib/amd/amd/amfs_direct.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997-2006 Erez Zadok
+ * Copyright (c) 1997-2014 Erez Zadok
* Copyright (c) 1990 Jan-Simon Pendry
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
* Copyright (c) 1990 The Regents of the University of California.
@@ -16,11 +16,7 @@
* 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgment:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -93,8 +89,8 @@ amfs_direct_readlink(am_node *mp, int *error_return)
xp = next_nonerror_node(mp->am_child);
if (!xp) {
- if (!mp->am_mnt->mf_private)
- amfs_mkcacheref(mp->am_mnt); /* XXX */
+ if (!mp->am_al->al_mnt->mf_private)
+ amfs_mkcacheref(mp->am_al->al_mnt);
xp = amfs_generic_lookup_child(mp, mp->am_path + 1, &rc, VLOOK_CREATE);
if (xp && rc < 0)
xp = amfs_generic_mount_child(xp, &rc);
diff --git a/contrib/amd/amd/amfs_error.c b/contrib/amd/amd/amfs_error.c
index 51bdaa6db14d..58a623102c1e 100644
--- a/contrib/amd/amd/amfs_error.c
+++ b/contrib/amd/amd/amfs_error.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997-2006 Erez Zadok
+ * Copyright (c) 1997-2014 Erez Zadok
* Copyright (c) 1989 Jan-Simon Pendry
* Copyright (c) 1989 Imperial College of Science, Technology & Medicine
* Copyright (c) 1989 The Regents of the University of California.
@@ -16,11 +16,7 @@
* 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgment:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -92,7 +88,7 @@ am_ops amfs_error_ops =
static char *
amfs_error_match(am_opts *fo)
{
- return strdup("(error-hook)");
+ return xstrdup("(error-hook)");
}
@@ -145,7 +141,7 @@ amfs_error_mount_child(am_node *ap, int *error_return)
* If we do then just give an error.
*/
int
-amfs_error_readdir(am_node *mp, nfscookie cookie, nfsdirlist *dp, nfsentry *ep, u_int count)
+amfs_error_readdir(am_node *mp, voidp cookie, voidp dp, voidp ep, u_int count)
{
return ESTALE;
}
diff --git a/contrib/amd/amd/amfs_generic.c b/contrib/amd/amd/amfs_generic.c
index 0d5996969cf8..25d734bbde00 100644
--- a/contrib/amd/amd/amfs_generic.c
+++ b/contrib/amd/amd/amfs_generic.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997-2006 Erez Zadok
+ * Copyright (c) 1997-2014 Erez Zadok
* Copyright (c) 1990 Jan-Simon Pendry
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
* Copyright (c) 1990 The Regents of the University of California.
@@ -16,11 +16,7 @@
* 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgment:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -55,7 +51,7 @@
/****************************************************************************
*** MACROS ***
****************************************************************************/
-#define IN_PROGRESS(cp) ((cp)->mp->am_mnt->mf_flags & MFF_MOUNTING)
+#define IN_PROGRESS(cp) ((cp)->mp->am_al->al_mnt->mf_flags & MFF_MOUNTING)
/****************************************************************************
@@ -80,7 +76,7 @@ struct continuation {
int retry; /* Try again? */
time_t start; /* Time we started this mount */
int callout; /* Callout identifier */
- mntfs **mf; /* Current mntfs */
+ am_loc **al; /* Current location */
};
@@ -88,9 +84,9 @@ struct continuation {
*** FORWARD DEFINITIONS ***
****************************************************************************/
static am_node *amfs_lookup_node(am_node *mp, char *fname, int *error_return);
-static mntfs *amfs_lookup_one_mntfs(am_node *new_mp, mntfs *mf, char *ivec,
+static am_loc *amfs_lookup_one_location(am_node *new_mp, mntfs *mf, char *ivec,
char *def_opts, char *pfname);
-static mntfs **amfs_lookup_mntfs(am_node *new_mp, int *error_return);
+static am_loc **amfs_lookup_loc(am_node *new_mp, int *error_return);
static void amfs_cont(int rc, int term, opaque_t arg);
static void amfs_retry(int rc, int term, opaque_t arg);
static void free_continuation(struct continuation *cp);
@@ -108,7 +104,7 @@ amfs_lookup_node(am_node *mp, char *fname, int *error_return)
int error = 0; /* Error so far */
int in_progress = 0; /* # of (un)mount in progress */
mntfs *mf;
- char *expanded_fname = 0;
+ char *expanded_fname = NULL;
dlog("in amfs_lookup_node");
@@ -118,7 +114,7 @@ amfs_lookup_node(am_node *mp, char *fname, int *error_return)
* about the mount point.
*/
if (amd_state == Finishing) {
- if (mp->am_mnt == 0 || mp->am_mnt->mf_fsflags & FS_DIRECT) {
+ if (mp->am_al == NULL || mp->am_al->al_mnt == NULL || mp->am_al->al_mnt->mf_fsflags & FS_DIRECT) {
dlog("%s mount ignored - going down", fname);
} else {
dlog("%s/%s mount ignored - going down", mp->am_path, fname);
@@ -170,7 +166,7 @@ amfs_lookup_node(am_node *mp, char *fname, int *error_return)
* If the error code is undefined then it must be
* in progress.
*/
- mf = new_mp->am_mnt;
+ mf = new_mp->am_al->al_mnt;
if (mf->mf_error < 0)
goto in_progrss;
@@ -240,7 +236,7 @@ amfs_lookup_node(am_node *mp, char *fname, int *error_return)
*/
new_mp = get_ap_child(mp, expanded_fname);
XFREE(expanded_fname);
- if (new_mp == 0)
+ if (new_mp == NULL)
ereturn(ENOSPC);
*error_return = -1;
@@ -249,19 +245,25 @@ amfs_lookup_node(am_node *mp, char *fname, int *error_return)
-static mntfs *
-amfs_lookup_one_mntfs(am_node *new_mp, mntfs *mf, char *ivec,
- char *def_opts, char *pfname)
+static am_loc *
+amfs_lookup_one_location(am_node *new_mp, mntfs *mf, char *ivec,
+ char *def_opts, char *pfname)
{
am_ops *p;
am_opts *fs_opts;
+ am_loc *new_al;
mntfs *new_mf;
- char *mp_dir = 0;
+ char *mp_dir = NULL;
#ifdef HAVE_FS_AUTOFS
int on_autofs = 1;
#endif /* HAVE_FS_AUTOFS */
/* match the operators */
+ /*
+ * although we alloc the fs_opts here, the pointer is 'owned' by the am_loc and will
+ * be free'd on destruction of the am_loc. If we don't allocate a loc, then we need
+ * to free this.
+ */
fs_opts = CALLOC(am_opts);
p = ops_match(fs_opts, ivec, def_opts, new_mp->am_path,
pfname, mf->mf_info);
@@ -269,7 +271,7 @@ amfs_lookup_one_mntfs(am_node *new_mp, mntfs *mf, char *ivec,
/* XXX: this should be factored out into an autofs-specific function */
if (new_mp->am_flags & AMF_AUTOFS) {
/* ignore user-provided fs if we're using autofs */
- if (fs_opts->opt_sublink) {
+ if (fs_opts->opt_sublink && fs_opts->opt_sublink[0]) {
/*
* For sublinks we need to use a hack with autofs:
* mount the filesystem on the original opt_fs (which is NOT an
@@ -292,6 +294,9 @@ amfs_lookup_one_mntfs(am_node *new_mp, mntfs *mf, char *ivec,
/*
* Find or allocate a filesystem for this node.
+ * we search for a matching backend share, since
+ * we will construct our own al_loc to handle
+ * any customisations for this usage.
*/
new_mf = find_mntfs(p, fs_opts,
mp_dir,
@@ -300,6 +305,7 @@ amfs_lookup_one_mntfs(am_node *new_mp, mntfs *mf, char *ivec,
fs_opts->opt_opts,
fs_opts->opt_remopts);
+
/*
* See whether this is a real filesystem
*/
@@ -307,10 +313,16 @@ amfs_lookup_one_mntfs(am_node *new_mp, mntfs *mf, char *ivec,
if (p == &amfs_error_ops) {
plog(XLOG_MAP, "Map entry %s for %s did not match", ivec, new_mp->am_path);
free_mntfs(new_mf);
+ free_opts(fs_opts);
+ XFREE(fs_opts);
return NULL;
}
dlog("Got a hit with %s", p->fs_type);
+ new_al = new_loc();
+ free_mntfs(new_al->al_mnt);
+ new_al->al_mnt = new_mf;
+ new_al->al_fo = fs_opts; /* now the loc is in charge of free'ing this mem */
#ifdef HAVE_FS_AUTOFS
if (new_mp->am_flags & AMF_AUTOFS && on_autofs) {
@@ -332,12 +344,12 @@ amfs_lookup_one_mntfs(am_node *new_mp, mntfs *mf, char *ivec,
new_mf->mf_flags |= MFF_IS_AUTOFS;
#endif /* HAVE_FS_AUTOFS */
- return new_mf;
+ return new_al;
}
-static mntfs **
-amfs_lookup_mntfs(am_node *new_mp, int *error_return)
+static am_loc **
+amfs_lookup_loc(am_node *new_mp, int *error_return)
{
am_node *mp;
char *info; /* Mount info - where to get the file system */
@@ -348,10 +360,11 @@ amfs_lookup_mntfs(am_node *new_mp, int *error_return)
int error = 0; /* Error so far */
char path_name[MAXPATHLEN]; /* General path name buffer */
char *pfname; /* Path for database lookup */
- mntfs *mf, **mf_array;
+ mntfs* mf; /* The mntfs for the map of our parent */
+ am_loc **al_array; /* the generated list of locations */
int count;
- dlog("in amfs_lookup_mntfs");
+ dlog("in amfs_lookup_loc");
mp = new_mp->am_parent;
@@ -369,7 +382,7 @@ amfs_lookup_mntfs(am_node *new_mp, int *error_return)
pfname = new_mp->am_name;
}
- mf = mp->am_mnt;
+ mf = mp->am_al->al_mnt;
dlog("will search map info in %s to find %s", mf->mf_info, pfname);
/*
@@ -404,8 +417,8 @@ amfs_lookup_mntfs(am_node *new_mp, int *error_return)
else
def_opts = "";
- orig_def_opts = amfs_parse_defaults(mp, mf, strdup(def_opts));
- def_opts = strdup(orig_def_opts);
+ orig_def_opts = amfs_parse_defaults(mp, mf, xstrdup(def_opts));
+ def_opts = xstrdup(orig_def_opts);
/* first build our defaults */
num_ivecs = 0;
@@ -423,11 +436,11 @@ amfs_lookup_mntfs(am_node *new_mp, int *error_return)
num_ivecs++;
}
- mf_array = calloc(num_ivecs + 1, sizeof(mntfs *));
+ al_array = calloc(num_ivecs + 1, sizeof(am_loc *));
- /* construct the array of struct mntfs for this mount point */
+ /* construct the array of struct locations for this key */
for (count = 0, cur_ivec = ivecs; *cur_ivec; cur_ivec++) {
- mntfs *new_mf;
+ am_loc *new_al;
if (**cur_ivec == '-') {
XFREE(def_opts);
@@ -436,18 +449,18 @@ amfs_lookup_mntfs(am_node *new_mp, int *error_return)
* If we have a single dash '-' than we need to reset the
* default options.
*/
- def_opts = strdup(orig_def_opts);
+ def_opts = xstrdup(orig_def_opts);
dlog("Resetting the default options, a single dash '-' was found.");
} else {
/* append options to /default options */
- def_opts = str3cat((char *) 0, orig_def_opts, ";", *cur_ivec + 1);
+ def_opts = str3cat((char *) NULL, orig_def_opts, ";", *cur_ivec + 1);
dlog("Resetting def_opts to \"%s\"", def_opts);
}
continue;
}
/*
- * If a mntfs has already been found, and we find
+ * If a loc has already been found, and we find
* a cut then don't try any more locations.
*
* XXX: we do not know when the "/" was added as an equivalent for "||".
@@ -455,16 +468,16 @@ amfs_lookup_mntfs(am_node *new_mp, int *error_return)
*/
if (STREQ(*cur_ivec, "/") || STREQ(*cur_ivec, "||")) {
if (count > 0) {
- dlog("Cut: not trying any more locations for %s", mp->am_path);
+ dlog("Cut: not trying any more locations for %s", pfname);
break;
}
continue;
}
- new_mf = amfs_lookup_one_mntfs(new_mp, mf, *cur_ivec, def_opts, pfname);
- if (new_mf == NULL)
+ new_al = amfs_lookup_one_location(new_mp, mf, *cur_ivec, def_opts, pfname);
+ if (new_al == NULL)
continue;
- mf_array[count++] = new_mf;
+ al_array[count++] = new_al;
}
/* We're done with ivecs */
@@ -473,11 +486,11 @@ amfs_lookup_mntfs(am_node *new_mp, int *error_return)
XFREE(orig_def_opts);
XFREE(def_opts);
if (count == 0) { /* no match */
- XFREE(mf_array);
+ XFREE(al_array);
ereturn(ENOENT);
}
- return mf_array;
+ return al_array;
}
@@ -491,7 +504,7 @@ amfs_cont(int rc, int term, opaque_t arg)
{
struct continuation *cp = (struct continuation *) arg;
am_node *mp = cp->mp;
- mntfs *mf = mp->am_mnt;
+ mntfs *mf = mp->am_al->al_mnt;
dlog("amfs_cont: '%s'", mp->am_path);
@@ -556,7 +569,7 @@ amfs_cont(int rc, int term, opaque_t arg)
mf->mf_error = rc;
mf->mf_flags |= MFF_ERROR;
errno = rc; /* XXX */
- if (!STREQ(mp->am_mnt->mf_ops->fs_type, "linkx"))
+ if (!STREQ(mp->am_al->al_mnt->mf_ops->fs_type, "linkx"))
plog(XLOG_ERROR, "%s: mount (amfs_cont): %m", mp->am_path);
}
}
@@ -568,7 +581,7 @@ amfs_cont(int rc, int term, opaque_t arg)
* call the background mount routine again
*/
amd_stats.d_merr++;
- cp->mf++;
+ cp->al++;
}
amfs_bgmount(cp);
if (mp->am_error > 0)
@@ -608,13 +621,21 @@ amfs_retry(int rc, int term, opaque_t arg)
*/
plog(XLOG_INFO, "mount of \"%s\" has timed out", mp->am_path);
error = ETIMEDOUT;
- while (*cp->mf)
- cp->mf++;
+ while (*cp->al)
+ cp->al++;
/* explicitly forbid further retries after timeout */
cp->retry = FALSE;
}
if (error || !IN_PROGRESS(cp))
error = amfs_bgmount(cp);
+ else
+ /* Normally it's amfs_bgmount() which frees the continuation. However, if
+ * the mount is already in progress and we're in amfs_retry() for another
+ * node we don't try mounting the filesystem once again. Still, we have
+ * to free the continuation as we won't get called again and thus would
+ * leak the continuation structure and our am_loc references.
+ */
+ free_continuation(cp);
reschedule_timeout_mp();
}
@@ -626,7 +647,7 @@ amfs_retry(int rc, int term, opaque_t arg)
static void
free_continuation(struct continuation *cp)
{
- mntfs **mfp;
+ am_loc **alp;
dlog("free_continuation");
if (cp->callout)
@@ -634,13 +655,12 @@ free_continuation(struct continuation *cp)
/*
* we must free the mntfs's in the list.
* so free all of them if there was an error,
- * or free all but the used one, if the mount succeeded.
*/
- for (mfp = cp->mp->am_mfarray; *mfp; mfp++) {
- free_mntfs(*mfp);
+ for (alp = cp->mp->am_alarray; *alp; alp++) {
+ free_loc(*alp);
}
- XFREE(cp->mp->am_mfarray);
- cp->mp->am_mfarray = 0;
+ XFREE(cp->mp->am_alarray);
+ cp->mp->am_alarray = 0;
XFREE(cp);
}
@@ -690,12 +710,13 @@ static int
amfs_bgmount(struct continuation *cp)
{
am_node *mp = cp->mp;
- mntfs *mf; /* Current mntfs */
+ am_loc *loc;
+ mntfs *mf;
int this_error = -1; /* Per-mount error */
int hard_error = -1; /* Cumulative per-node error */
- if (mp->am_mnt)
- free_mntfs(mp->am_mnt);
+ if (mp->am_al)
+ free_loc(mp->am_al);
/*
* Try to mount each location.
@@ -704,10 +725,11 @@ amfs_bgmount(struct continuation *cp)
* hard_error > 0 indicates everything failed with a hard error
* hard_error < 0 indicates nothing could be mounted now
*/
- for (mp->am_mnt = *cp->mf; *cp->mf; cp->mf++, mp->am_mnt = *cp->mf) {
+ for (mp->am_al = *cp->al; *cp->al; cp->al++, mp->am_al = *cp->al) {
am_ops *p;
- mf = dup_mntfs(mp->am_mnt);
+ loc = dup_loc(mp->am_al);
+ mf = loc->al_mnt;
p = mf->mf_ops;
if (hard_error < 0)
@@ -737,12 +759,11 @@ amfs_bgmount(struct continuation *cp)
goto failed;
}
- if (mp->am_link) {
- XFREE(mp->am_link);
- mp->am_link = NULL;
- }
- if (mf->mf_fo && mf->mf_fo->opt_sublink)
- mp->am_link = strdup(mf->mf_fo->opt_sublink);
+ XFREE(mp->am_link);
+ mp->am_link = NULL;
+
+ if (loc->al_fo && loc->al_fo->opt_sublink && loc->al_fo->opt_sublink[0])
+ mp->am_link = xstrdup(loc->al_fo->opt_sublink);
/*
* Will usually need to play around with the mount nodes
@@ -784,13 +805,13 @@ amfs_bgmount(struct continuation *cp)
if (this_error < 0)
goto retry;
- if (mf->mf_fo && mf->mf_fo->opt_delay) {
+ if (loc->al_fo && loc->al_fo->opt_delay) {
/*
- * If there is a delay timer on the mount
+ * If there is a delay timer on the location
* then don't try to mount if the timer
* has not expired.
*/
- int i = atoi(mf->mf_fo->opt_delay);
+ int i = atoi(loc->al_fo->opt_delay);
time_t now = clocktime(NULL);
if (i > 0 && now < (cp->start + i)) {
dlog("Mount of %s delayed by %lds", mf->mf_mount, (long) (i - now + cp->start));
@@ -866,22 +887,25 @@ amfs_bgmount(struct continuation *cp)
return -1;
failed:
- amd_stats.d_merr++;
- mf->mf_error = this_error;
- mf->mf_flags |= MFF_ERROR;
+ if (!FSRV_ISDOWN(mf->mf_server)) {
+ /* mark the mount as failed unless the server is down */
+ amd_stats.d_merr++;
+ mf->mf_error = this_error;
+ mf->mf_flags |= MFF_ERROR;
#ifdef HAVE_FS_AUTOFS
- if (mp->am_autofs_fh)
- autofs_release_fh(mp);
+ if (mp->am_autofs_fh)
+ autofs_release_fh(mp);
#endif /* HAVE_FS_AUTOFS */
- if (mf->mf_flags & MFF_MKMNT) {
- rmdirs(mf->mf_mount);
- mf->mf_flags &= ~MFF_MKMNT;
+ if (mf->mf_flags & MFF_MKMNT) {
+ rmdirs(mf->mf_mount);
+ mf->mf_flags &= ~MFF_MKMNT;
+ }
}
/*
* Wakeup anything waiting for this mount
*/
wakeup(get_mntfs_wchan(mf));
- free_mntfs(mf);
+ free_loc(loc);
/* continue */
}
@@ -890,7 +914,10 @@ amfs_bgmount(struct continuation *cp)
* there is no more mount information available.
*/
if (this_error) {
- mp->am_mnt = mf = new_mntfs();
+ if (mp->am_al)
+ free_loc(mp->am_al);
+ mp->am_al = loc = new_loc();
+ mf = loc->al_mnt;
#ifdef HAVE_FS_AUTOFS
if (mp->am_flags & AMF_AUTOFS)
@@ -920,7 +947,7 @@ amfs_bgmount(struct continuation *cp)
}
new_ttl(mp);
} else {
- mf = mp->am_mnt;
+ mf = loc->al_mnt;
/*
* Wakeup anything waiting for this mount
*/
@@ -959,19 +986,10 @@ amfs_parse_defaults(am_node *mp, mntfs *mf, char *def_opts)
/*
* Find out if amd.conf overrode any map-specific /defaults.
- *
- * HACK ALERT: there's no easy way to find out what the map mount point is
- * at this point, so I am forced to initialize the mnt_map->cfm field here
- * for the first time, upon the very first search for a /defaults entry in
- * this map. This initialization is much better done in mapc_create(),
- * but it's impossible to do that there with the current code structure.
*/
- if (mm->cfm == NULL) { /* then initialize it for first time */
- mm->cfm = find_cf_map(mf->mf_mount);
- }
if (mm->cfm && mm->cfm->cfm_defaults) {
dlog("map %s map_defaults override: %s", mf->mf_mount, mm->cfm->cfm_defaults);
- dflts = strdup(mm->cfm->cfm_defaults);
+ dflts = xstrdup(mm->cfm->cfm_defaults);
} else if (mapc_search(mm, "/defaults", &dflts) == 0) {
dlog("/defaults gave %s", dflts);
} else {
@@ -1009,7 +1027,7 @@ amfs_parse_defaults(am_node *mp, mntfs *mf, char *def_opts)
* get expanded to "/defaults"
*/
pt = ops_match(&ap, *sp, "", mp->am_path, "/defaults",
- mp->am_parent->am_mnt->mf_info);
+ mp->am_parent->am_al->al_mnt->mf_info);
free_opts(&ap); /* don't leak */
if (pt == &amfs_error_ops) {
plog(XLOG_MAP, "did not match defaults for \"%s\"", *sp);
@@ -1076,8 +1094,9 @@ amfs_generic_mount_child(am_node *new_mp, int *error_return)
*error_return = error = 0; /* Error so far */
/* we have an errorfs attached to the am_node, free it */
- free_mntfs(new_mp->am_mnt);
- new_mp->am_mnt = 0;
+ if (new_mp->am_al)
+ free_loc(new_mp->am_al);
+ new_mp->am_al = NULL;
/*
* Construct a continuation
@@ -1087,7 +1106,7 @@ amfs_generic_mount_child(am_node *new_mp, int *error_return)
cp->mp = new_mp;
cp->retry = TRUE;
cp->start = clocktime(NULL);
- cp->mf = new_mp->am_mfarray;
+ cp->al = new_mp->am_alarray;
/*
* Try and mount the file system. If this succeeds immediately (possible
@@ -1101,7 +1120,7 @@ amfs_generic_mount_child(am_node *new_mp, int *error_return)
/*
* Code for quick reply. If current_transp is set, then it's the
- * transp that's been passed down from nfs_program_2() or from
+ * transp that's been passed down from nfs_dispatcher() or from
* autofs_program_[123]().
* If new_mp->am_transp is not already set, set it by copying in
* current_transp. Once am_transp is set, nfs_quick_reply() and
@@ -1113,7 +1132,8 @@ amfs_generic_mount_child(am_node *new_mp, int *error_return)
new_mp->am_transp = (SVCXPRT *) xmalloc(sizeof(SVCXPRT));
*(new_mp->am_transp) = *current_transp;
}
- if (error && new_mp->am_mnt && (new_mp->am_mnt->mf_ops == &amfs_error_ops))
+ if (error && new_mp->am_al && new_mp->am_al->al_mnt &&
+ (new_mp->am_al->al_mnt->mf_ops == &amfs_error_ops))
new_mp->am_error = error;
if (new_mp->am_error > 0)
@@ -1132,7 +1152,7 @@ am_node *
amfs_generic_lookup_child(am_node *mp, char *fname, int *error_return, int op)
{
am_node *new_mp;
- mntfs **mf_array;
+ am_loc **al_array;
int mp_error;
dlog("in amfs_generic_lookup_child");
@@ -1145,7 +1165,7 @@ amfs_generic_lookup_child(am_node *mp, char *fname, int *error_return, int op)
return new_mp;
/* also return if it's already mounted and known to be up */
- if (*error_return == 0 && FSRV_ISUP(new_mp->am_mnt->mf_server))
+ if (*error_return == 0 && FSRV_ISUP(new_mp->am_al->al_mnt->mf_server))
return new_mp;
switch (op) {
@@ -1161,42 +1181,15 @@ amfs_generic_lookup_child(am_node *mp, char *fname, int *error_return, int op)
/* save error_return */
mp_error = *error_return;
- mf_array = amfs_lookup_mntfs(new_mp, error_return);
- if (!mf_array) {
- new_mp->am_error = new_mp->am_mnt->mf_error = *error_return;
+ al_array = amfs_lookup_loc(new_mp, error_return);
+ if (!al_array) {
+ new_mp->am_error = new_mp->am_al->al_mnt->mf_error = *error_return;
free_map(new_mp);
return NULL;
}
- /*
- * Already mounted but known to be down:
- * check if we have any alternatives to mount
- */
- if (mp_error == 0) {
- mntfs **mfp;
- for (mfp = mf_array; *mfp; mfp++)
- if (*mfp != new_mp->am_mnt)
- break;
- if (*mfp != NULL) {
- /*
- * we found an alternative, so try mounting again.
- */
- *error_return = -1;
- } else {
- for (mfp = mf_array; *mfp; mfp++)
- free_mntfs(*mfp);
- XFREE(mf_array);
- if (new_mp->am_flags & AMF_SOFTLOOKUP) {
- ereturn(EIO);
- } else {
- *error_return = 0;
- return new_mp;
- }
- }
- }
-
/* store the array inside the am_node */
- new_mp->am_mfarray = mf_array;
+ new_mp->am_alarray = al_array;
/*
* Note: while it might seem like a good idea to prioritize
@@ -1258,5 +1251,5 @@ amfs_generic_match(am_opts *fo)
/*
* mtab entry turns out to be the name of the mount map
*/
- return strdup(fo->opt_rfs ? fo->opt_rfs : ".");
+ return xstrdup(fo->opt_rfs ? fo->opt_rfs : ".");
}
diff --git a/contrib/amd/amd/amfs_host.c b/contrib/amd/amd/amfs_host.c
index 55423c46ea33..a3468ecd4b65 100644
--- a/contrib/amd/amd/amfs_host.c
+++ b/contrib/amd/amd/amfs_host.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997-2006 Erez Zadok
+ * Copyright (c) 1997-2014 Erez Zadok
* Copyright (c) 1990 Jan-Simon Pendry
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
* Copyright (c) 1990 The Regents of the University of California.
@@ -16,11 +16,7 @@
* 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgment:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -227,7 +223,14 @@ fetch_fhandle(CLIENT *client, char *dir, am_nfs_handle_t *fhp, u_long nfs_versio
plog(XLOG_INFO, "fetch_fhandle: NFS version %d", (int) nfs_version);
#ifdef HAVE_FS_NFS3
- if (nfs_version == NFS_VERSION3) {
+ if (nfs_version == NFS_VERSION3
+#ifdef HAVE_FS_NFS4
+#ifndef NO_FALLBACK
+ || nfs_version == NFS_VERSION4
+#endif /* NO_FALLBACK */
+#endif /* HAVE_FS_NFS4 */
+ ) {
+
memset((char *) &res3, 0, sizeof(res3));
clnt_stat = clnt_call(client,
MOUNTPROC_MNT,
@@ -303,8 +306,8 @@ amfs_host_mount(am_node *am, mntfs *mf)
int n_export;
int j, k;
exports exlist = 0, ex;
- exports *ep = 0;
- am_nfs_handle_t *fp = 0;
+ exports *ep = NULL;
+ am_nfs_handle_t *fp = NULL;
char *host;
int error = 0;
struct sockaddr_in sin;
@@ -449,13 +452,13 @@ amfs_host_mount(am_node *am, mntfs *mf)
/* Check and avoid a duplicated export entry */
if (j > k && ep[k] && STREQ(ep[j]->ex_dir, ep[k]->ex_dir)) {
dlog("avoiding dup fhandle requested for %s", ep[j]->ex_dir);
- ep[j] = 0;
+ ep[j] = NULL;
} else {
k = j;
error = fetch_fhandle(client, ep[j]->ex_dir, &fp[j],
mf->mf_server->fs_version);
if (error)
- ep[j] = 0;
+ ep[j] = NULL;
}
}
@@ -465,8 +468,8 @@ amfs_host_mount(am_node *am, mntfs *mf)
* error code 0 at the end. If they all fail then return
* the last error code.
*/
- xstrlcpy(fs_name, mf->mf_info, MAXPATHLEN);
- if ((rfs_dir = strchr(fs_name, ':')) == (char *) 0) {
+ xstrlcpy(fs_name, mf->mf_info, sizeof(fs_name));
+ if ((rfs_dir = strchr(fs_name, ':')) == (char *) NULL) {
plog(XLOG_FATAL, "amfs_host_mount: mf_info has no colon");
error = EINVAL;
goto out;
@@ -493,10 +496,8 @@ amfs_host_mount(am_node *am, mntfs *mf)
*/
out:
discard_mntlist(mlist);
- if (ep)
- XFREE(ep);
- if (fp)
- XFREE(fp);
+ XFREE(ep);
+ XFREE(fp);
if (sock != RPC_ANYSOCK)
(void) amu_close(sock);
if (client)
@@ -554,7 +555,7 @@ amfs_host_umount(am_node *am, mntfs *mf)
* Reverse list...
*/
ml = mlist;
- mprev = 0;
+ mprev = NULL;
while (ml) {
mntlist *ml2 = ml->mnext;
ml->mnext = mprev;
diff --git a/contrib/amd/amd/amfs_link.c b/contrib/amd/amd/amfs_link.c
index e75ab862f8bc..0751dd7047a0 100644
--- a/contrib/amd/amd/amfs_link.c
+++ b/contrib/amd/amd/amfs_link.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997-2006 Erez Zadok
+ * Copyright (c) 1997-2014 Erez Zadok
* Copyright (c) 1990 Jan-Simon Pendry
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
* Copyright (c) 1990 The Regents of the University of California.
@@ -16,11 +16,7 @@
* 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgment:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -109,13 +105,13 @@ amfs_link_match(am_opts *fo)
*/
if (fo->opt_fs[0] == '/') {
char *link_hack = str3cat(NULL, ".", fo->opt_fs, "");
- if (!fo->opt_sublink)
- fo->opt_sublink = strdup(fo->opt_fs);
+ if (fo->opt_sublink == NULL || fo->opt_sublink[0] == '\0')
+ fo->opt_sublink = xstrdup(fo->opt_fs);
XFREE(fo->opt_fs);
fo->opt_fs = link_hack;
}
- return strdup(fo->opt_fs);
+ return xstrdup(fo->opt_fs);
}
diff --git a/contrib/amd/amd/amfs_linkx.c b/contrib/amd/amd/amfs_linkx.c
index e306eda91d3b..be95fe5e1a27 100644
--- a/contrib/amd/amd/amfs_linkx.c
+++ b/contrib/amd/amd/amfs_linkx.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997-2006 Erez Zadok
+ * Copyright (c) 1997-2014 Erez Zadok
* Copyright (c) 1990 Jan-Simon Pendry
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
* Copyright (c) 1990 The Regents of the University of California.
@@ -16,11 +16,7 @@
* 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgment:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
diff --git a/contrib/amd/amd/amfs_nfsl.c b/contrib/amd/amd/amfs_nfsl.c
index bb48f0efd255..c70a3eeb97c4 100644
--- a/contrib/amd/amd/amfs_nfsl.c
+++ b/contrib/amd/amd/amfs_nfsl.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997-2006 Erez Zadok
+ * Copyright (c) 1997-2014 Erez Zadok
* Copyright (c) 1990 Jan-Simon Pendry
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
* Copyright (c) 1990 The Regents of the University of California.
@@ -16,11 +16,7 @@
* 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgment:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -101,7 +97,7 @@ amfs_nfsl_match(am_opts *fo)
char *retval;
struct stat stb;
- if (fo->opt_sublink)
+ if (fo->opt_sublink && fo->opt_sublink[0])
cp = fo->opt_sublink;
else
cp = fo->opt_fs;
@@ -116,8 +112,9 @@ amfs_nfsl_match(am_opts *fo)
* call nfs_ops.fs_match().
* If link value exists (or same host), call amfs_link_ops.fs_match().
*/
- if (!STRCEQ(ho, am_get_hostname())) {
- plog(XLOG_INFO, "amfs_nfsl: \"%s\" is not local host, using type:=nfs", ho);
+ if (!STRCEQ(ho, am_get_hostname()) && !STRCEQ(ho, hostd)) {
+ plog(XLOG_INFO, "amfs_nfsl: \"%s\" is not the local host \"%s\", "
+ "or \"%s\" using type:=nfs", ho, am_get_hostname(), hostd);
retval = nfs_ops.fs_match(fo);
} else if (lstat(cp, &stb) < 0) {
plog(XLOG_INFO, "amfs_nfsl: \"%s\" does not exist, using type:=nfs", cp);
@@ -213,11 +210,16 @@ amfs_nfsl_umounted(mntfs *mf)
static fserver *
amfs_nfsl_ffserver(mntfs *mf)
{
- char *cp;
- char *ho = mf->mf_fo->opt_rhost;
+ char *cp, *ho;
struct stat stb;
- if (mf->mf_fo->opt_sublink)
+ if (mf->mf_fo == NULL) {
+ plog(XLOG_ERROR, "%s: NULL mf_fo", __func__);
+ return NULL;
+ }
+ ho = mf->mf_fo->opt_rhost;
+
+ if (mf->mf_fo->opt_sublink && mf->mf_fo->opt_sublink[0])
cp = mf->mf_fo->opt_sublink;
else
cp = mf->mf_fo->opt_fs;
@@ -227,7 +229,8 @@ amfs_nfsl_ffserver(mntfs *mf)
* call amfs_link_ops.ffserver().
* If link value exists (or same host), then call ops_nfs.ffserver().
*/
- if (!STRCEQ(ho, am_get_hostname()) || lstat(cp, &stb) < 0) {
+ if ((!STRCEQ(ho, am_get_hostname()) &&
+ !STRCEQ(ho, hostd)) || lstat(cp, &stb) < 0) {
return nfs_ops.ffserver(mf);
} else {
mf->mf_flags |= MFF_NFSLINK;
diff --git a/contrib/amd/amd/amfs_nfsx.c b/contrib/amd/amd/amfs_nfsx.c
index 91be8af47e11..db1b9fafd119 100644
--- a/contrib/amd/amd/amfs_nfsx.c
+++ b/contrib/amd/amd/amfs_nfsx.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997-2006 Erez Zadok
+ * Copyright (c) 1997-2014 Erez Zadok
* Copyright (c) 1990 Jan-Simon Pendry
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
* Copyright (c) 1990 The Regents of the University of California.
@@ -16,11 +16,7 @@
* 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgment:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -118,7 +114,7 @@ amfs_nfsx_match(am_opts *fo)
}
/* set default sublink */
- if (fo->opt_sublink == 0) {
+ if (fo->opt_sublink == NULL || fo->opt_sublink[0] == '\0') {
ptr = strchr(fo->opt_rfs, ',');
if (ptr && ptr > (fo->opt_rfs + 1))
fo->opt_sublink = strnsave(fo->opt_rfs + 1, ptr - fo->opt_rfs - 1);
@@ -149,7 +145,7 @@ amfs_nfsx_match(am_opts *fo)
/*
* Determine magic cookie to put in mtab
*/
- xmtab = str3cat((char *) 0, fo->opt_rhost, ":", fo->opt_rfs);
+ xmtab = str3cat((char *) NULL, fo->opt_rhost, ":", fo->opt_rfs);
dlog("NFSX: mounting remote server \"%s\", remote fs \"%s\" on \"%s\"",
fo->opt_rhost, fo->opt_rfs, fo->opt_fs);
@@ -190,12 +186,15 @@ amfs_nfsx_init(mntfs *mf)
if (nx == 0) {
char **ivec;
- char *info = 0;
+ char *info = NULL;
char *host;
char *pref;
int error = 0;
- info = strdup(mf->mf_info);
+ info = xstrdup(mf->mf_info);
+ if (info == NULL)
+ return errno;
+
host = strchr(info, ':');
if (!host) {
error = EINVAL;
@@ -221,12 +220,12 @@ amfs_nfsx_init(mntfs *mf)
nx->nx_c = i - 1; /* i-1 because we don't want the prefix */
nx->nx_v = (amfs_nfsx_mnt *) xmalloc(nx->nx_c * sizeof(amfs_nfsx_mnt));
- nx->nx_mp = 0;
+ nx->nx_mp = NULL;
{
- char *mp = 0;
- char *xinfo = 0;
+ char *mp = NULL;
+ char *xinfo = NULL;
char *fs = mf->mf_fo->opt_fs;
- char *rfs = 0;
+ char *rfs = NULL;
for (i = 0; i < nx->nx_c; i++) {
char *path = ivec[i + 1];
rfs = str3cat(rfs, pref, "/", path);
@@ -251,18 +250,14 @@ amfs_nfsx_init(mntfs *mf)
/* propagate the on_autofs flag */
nx->nx_v[i].n_mnt->mf_flags |= mf->mf_flags & MFF_ON_AUTOFS;
}
- if (rfs)
- XFREE(rfs);
- if (mp)
- XFREE(mp);
- if (xinfo)
- XFREE(xinfo);
+ XFREE(rfs);
+ XFREE(mp);
+ XFREE(xinfo);
}
XFREE(ivec);
errexit:
- if (info)
- XFREE(info);
+ XFREE(info);
if (error)
return error;
}
@@ -503,7 +498,7 @@ amfs_nfsx_umount(am_node *am, mntfs *mf)
}
}
free_mntfs(m);
- n->n_mnt = 0;
+ n->n_mnt = NULL;
n->n_error = -1;
}
}
diff --git a/contrib/amd/amd/amfs_program.c b/contrib/amd/amd/amfs_program.c
index b0aed3752d75..6bf003fb2cf7 100644
--- a/contrib/amd/amd/amfs_program.c
+++ b/contrib/amd/amd/amfs_program.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997-2006 Erez Zadok
+ * Copyright (c) 1997-2014 Erez Zadok
* Copyright (c) 1989 Jan-Simon Pendry
* Copyright (c) 1989 Imperial College of Science, Technology & Medicine
* Copyright (c) 1989 The Regents of the University of California.
@@ -16,11 +16,7 @@
* 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgment:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -105,7 +101,7 @@ amfs_program_match(am_opts *fo)
}
prog = strchr(fo->opt_mount, ' ');
- return strdup(prog ? prog + 1 : fo->opt_mount);
+ return xstrdup(prog ? prog + 1 : fo->opt_mount);
}
@@ -116,11 +112,14 @@ amfs_program_init(mntfs *mf)
if (mf->mf_private != NULL)
return 0;
+ if (mf->mf_fo == NULL)
+ return 0;
+
/* save unmount (or umount) command */
if (mf->mf_fo->opt_unmount != NULL)
- mf->mf_private = (opaque_t) strdup(mf->mf_fo->opt_unmount);
+ mf->mf_private = (opaque_t) xstrdup(mf->mf_fo->opt_unmount);
else
- mf->mf_private = (opaque_t) strdup(mf->mf_fo->opt_umount);
+ mf->mf_private = (opaque_t) xstrdup(mf->mf_fo->opt_umount);
mf->mf_prfree = (void (*)(opaque_t)) free;
return 0;
@@ -136,9 +135,7 @@ amfs_program_exec(char *info)
/*
* Split copy of command info string
*/
- info = strdup(info);
- if (info == 0)
- return ENOBUFS;
+ info = xstrdup(info);
xivec = strsplit(info, ' ', '\'');
/*
@@ -148,11 +145,11 @@ amfs_program_exec(char *info)
if (!logfp)
logfp = stderr; /* initialize before possible first use */
if (dup(fileno(logfp)) == -1)
- return errno;
+ goto out;
if (fileno(logfp) != fileno(stderr)) {
(void) fclose(stderr);
if (dup(fileno(logfp)) == -1)
- return errno;
+ goto out;
}
/*
@@ -172,13 +169,16 @@ amfs_program_exec(char *info)
plog(XLOG_USER, "1st/2nd args missing to (un)mount program");
} else {
(void) execv(xivec[0], xivec + 1);
+ error = errno;
+ plog(XLOG_ERROR, "exec failed: %m");
+ errno = error;
}
+out:
/*
* Save error number
*/
error = errno;
- plog(XLOG_ERROR, "exec failed: %m");
/*
* Free allocate memory
diff --git a/contrib/amd/amd/amfs_root.c b/contrib/amd/amd/amfs_root.c
index 243267e71e86..f06c43ce0bac 100644
--- a/contrib/amd/amd/amfs_root.c
+++ b/contrib/amd/amd/amfs_root.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997-2006 Erez Zadok
+ * Copyright (c) 1997-2014 Erez Zadok
* Copyright (c) 1990 Jan-Simon Pendry
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
* Copyright (c) 1990 The Regents of the University of California.
@@ -16,11 +16,7 @@
* 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgment:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -92,7 +88,7 @@ static int
amfs_root_mount(am_node *mp, mntfs *mf)
{
mf->mf_mount = strealloc(mf->mf_mount, pid_fsname);
- mf->mf_private = (opaque_t) mapc_find(mf->mf_info, "", NULL);
+ mf->mf_private = (opaque_t) mapc_find(mf->mf_info, "", NULL, NULL);
mf->mf_prfree = mapc_free;
return 0;
diff --git a/contrib/amd/amd/amfs_toplvl.c b/contrib/amd/amd/amfs_toplvl.c
index 1b968f197f55..1b143157b4c7 100644
--- a/contrib/amd/amd/amfs_toplvl.c
+++ b/contrib/amd/amd/amfs_toplvl.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997-2006 Erez Zadok
+ * Copyright (c) 1997-2014 Erez Zadok
* Copyright (c) 1990 Jan-Simon Pendry
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
* Copyright (c) 1990 The Regents of the University of California.
@@ -16,11 +16,7 @@
* 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgment:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -148,7 +144,7 @@ amfs_toplvl_init(mntfs *mf)
{
int error = 0;
-#if defined(MNT2_GEN_OPT_FORCE) || defined(MNT2_GEN_OPT_DETACH)
+#if (defined(MNT2_GEN_OPT_FORCE) || defined(MNT2_GEN_OPT_DETACH)) && (defined(HAVE_UVMOUNT) || defined(HAVE_UMOUNT2))
if (gopt.flags & CFM_FORCED_UNMOUNTS) {
plog(XLOG_INFO, "amfs_toplvl_init: trying forced/lazy unmount of %s",
mf->mf_mount);
@@ -158,7 +154,7 @@ amfs_toplvl_init(mntfs *mf)
else
dlog("amfs_toplvl_init: forced/lazy unmount succeeded");
}
-#endif /* MNT2_GEN_OPT_FORCE || MNT2_GEN_OPT_DETACH */
+#endif /* (MNT2_GEN_OPT_FORCE || MNT2_GEN_OPT_DETACH) && (HAVE_UVMOUNT || HAVE_UMOUNT2) */
return error;
}
@@ -227,6 +223,11 @@ amfs_toplvl_mount(am_node *mp, mntfs *mf)
xstrlcat(opts, toplvl_opts, sizeof(opts));
}
+#ifdef MNTTAB_OPT_NOLOCK
+ xstrlcat(opts, ",", sizeof(opts));
+ xstrlcat(opts, MNTTAB_OPT_NOLOCK, sizeof(opts));
+#endif /* MNTTAB_OPT_NOLOCK */
+
#ifdef MNTTAB_OPT_NOAC
if (gopt.auto_attrcache == 0) {
xstrlcat(opts, ",", sizeof(opts));
diff --git a/contrib/amd/amd/amfs_union.c b/contrib/amd/amd/amfs_union.c
index 6adb5b0bd9cb..9f37a1b04dd1 100644
--- a/contrib/amd/amd/amfs_union.c
+++ b/contrib/amd/amd/amfs_union.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997-2006 Erez Zadok
+ * Copyright (c) 1997-2014 Erez Zadok
* Copyright (c) 1990 Jan-Simon Pendry
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
* Copyright (c) 1990 The Regents of the University of California.
@@ -16,11 +16,7 @@
* 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgment:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -95,7 +91,7 @@ create_amfs_union_node(char *dir, opaque_t arg)
am_node *am;
am = amfs_generic_lookup_child(arg, dir, &error, VLOOK_CREATE);
if (am && error < 0)
- am = amfs_generic_mount_child(am, &error);
+ (void)amfs_generic_mount_child(am, &error);
if (error > 0) {
errno = error; /* XXX */
plog(XLOG_ERROR, "unionfs: could not mount %s: %m", dir);
@@ -121,9 +117,9 @@ amfs_union_mounted(mntfs *mf)
for (mp = get_first_exported_ap(&index);
mp;
mp = get_next_exported_ap(&index)) {
- if (mp->am_mnt == mf) {
+ if (mp->am_al->al_mnt == mf) {
/* return value from create_amfs_union_node is ignored by mapc_keyiter */
- (void) mapc_keyiter((mnt_map *) mp->am_mnt->mf_private,
+ (void) mapc_keyiter((mnt_map *) mp->am_al->al_mnt->mf_private,
create_amfs_union_node,
mp);
break;
diff --git a/contrib/amd/amd/amq_subr.c b/contrib/amd/amd/amq_subr.c
index 79ecafc3d9b3..ba85c68b7425 100644
--- a/contrib/amd/amd/amq_subr.c
+++ b/contrib/amd/amd/amq_subr.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997-2006 Erez Zadok
+ * Copyright (c) 1997-2014 Erez Zadok
* Copyright (c) 1990 Jan-Simon Pendry
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
* Copyright (c) 1990 The Regents of the University of California.
@@ -16,11 +16,7 @@
* 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgment:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -80,16 +76,68 @@ amqproc_mnttree_1_svc(voidp argp, struct svc_req *rqstp)
/*
* Unmount a single node
*/
-voidp
+int *
amqproc_umnt_1_svc(voidp argp, struct svc_req *rqstp)
{
- static char res;
+ static int res = AMQ_UMNT_OK;
am_node *mp = find_ap(*(char **) argp);
if (mp)
forcibly_timeout_mp(mp);
- return (voidp) &res;
+ return &res;
+}
+
+
+/*
+ * Synchronously unmount a single node - parent side.
+ */
+int *
+amqproc_sync_umnt_1_svc_parent(voidp argp, struct svc_req *rqstp)
+{
+ amqproc_umnt_1_svc(argp, rqstp);
+ return NULL;
+}
+
+
+/*
+ * Synchronously unmount a single node - child side.
+ */
+amq_sync_umnt *
+amqproc_sync_umnt_1_svc_child(voidp argp, struct svc_req *rqstp)
+{
+ static amq_sync_umnt rv;
+ amq_sync_umnt buf;
+ ssize_t n;
+
+ am_node *mp = find_ap(*(char **) argp);
+
+ memset(&rv, 0, sizeof(rv));
+ rv.au_etype = AMQ_UMNT_READ;
+ if (mp && mp->am_fd[0] >= 0) {
+ n = read(mp->am_fd[0], &buf, sizeof(buf));
+ if (n == sizeof(buf))
+ rv = buf;
+ }
+ return &rv;
+}
+
+
+/*
+ * Synchronously unmount a single node - use if we can't fork (asynchronous).
+ */
+amq_sync_umnt *
+amqproc_sync_umnt_1_svc_async(voidp argp, struct svc_req *rqstp)
+{
+ static amq_sync_umnt rv;
+
+ memset(&rv, 0, sizeof(rv));
+ rv.au_etype = AMQ_UMNT_FORK;
+ rv.au_errno = errno;
+
+ amqproc_umnt_1_svc(argp, rqstp);
+
+ return &rv;
}
@@ -170,6 +218,12 @@ amqproc_getmntfs_1_svc(voidp argp, struct svc_req *rqstp)
return (amq_mount_info_list *) ((void *)&mfhead); /* XXX */
}
+extern qelem map_list_head;
+amq_map_info_list *
+amqproc_getmapinfo_1_svc(voidp argp, struct svc_req *rqstp)
+{
+ return (amq_map_info_list *) ((void *)&map_list_head); /* XXX */
+}
amq_string *
amqproc_getvers_1_svc(voidp argp, struct svc_req *rqstp)
@@ -218,11 +272,11 @@ amqproc_pawd_1_svc(voidp argp, struct svc_req *rqstp)
for (mp = get_first_exported_ap(&index);
mp;
mp = get_next_exported_ap(&index)) {
- if (STREQ(mp->am_mnt->mf_ops->fs_type, "toplvl"))
+ if (STREQ(mp->am_al->al_mnt->mf_ops->fs_type, "toplvl"))
continue;
- if (STREQ(mp->am_mnt->mf_ops->fs_type, "auto"))
+ if (STREQ(mp->am_al->al_mnt->mf_ops->fs_type, "auto"))
continue;
- mountpoint = (mp->am_link ? mp->am_link : mp->am_mnt->mf_mount);
+ mountpoint = (mp->am_link ? mp->am_link : mp->am_al->al_mnt->mf_mount);
len = strlen(mountpoint);
if (len == 0)
continue;
@@ -277,16 +331,16 @@ xdr_amq_mount_tree_node(XDR *xdrs, amq_mount_tree *objp)
am_node *mp = (am_node *) objp;
long mtime;
- if (!xdr_amq_string(xdrs, &mp->am_mnt->mf_info)) {
+ if (!xdr_amq_string(xdrs, &mp->am_al->al_mnt->mf_info)) {
return (FALSE);
}
if (!xdr_amq_string(xdrs, &mp->am_path)) {
return (FALSE);
}
- if (!xdr_amq_string(xdrs, mp->am_link ? &mp->am_link : &mp->am_mnt->mf_mount)) {
+ if (!xdr_amq_string(xdrs, mp->am_link ? &mp->am_link : &mp->am_al->al_mnt->mf_mount)) {
return (FALSE);
}
- if (!xdr_amq_string(xdrs, &mp->am_mnt->mf_ops->fs_type)) {
+ if (!xdr_amq_string(xdrs, &mp->am_al->al_mnt->mf_ops->fs_type)) {
return (FALSE);
}
mtime = mp->am_stats.s_mtime;
@@ -412,16 +466,15 @@ xdr_amq_mount_tree_list(XDR *xdrs, amq_mount_tree_list *objp)
}
-
-/*
- * Compute length of list
- */
bool_t
xdr_amq_mount_info_qelem(XDR *xdrs, qelem *qhead)
{
mntfs *mf;
u_int len = 0;
+ /*
+ * Compute length of list
+ */
for (mf = AM_LAST(mntfs, qhead); mf != HEAD(mntfs, qhead); mf = PREV(mntfs, mf)) {
if (!(mf->mf_fsflags & FS_AMQINFO))
continue;
@@ -468,6 +521,70 @@ xdr_amq_mount_info_qelem(XDR *xdrs, qelem *qhead)
return (TRUE);
}
+bool_t
+xdr_amq_map_info_qelem(XDR *xdrs, qelem *qhead)
+{
+ mnt_map *m;
+ u_int len = 0;
+ int x;
+ char *n;
+
+ /*
+ * Compute length of list
+ */
+ ITER(m, mnt_map, qhead) {
+ len++;
+ }
+
+ if (!xdr_u_int(xdrs, &len))
+ return (FALSE);
+
+ /*
+ * Send individual data items
+ */
+ ITER(m, mnt_map, qhead) {
+ if (!xdr_amq_string(xdrs, &m->map_name)) {
+ return (FALSE);
+ }
+
+ n = m->wildcard ? m->wildcard : "";
+ if (!xdr_amq_string(xdrs, &n)) {
+ return (FALSE);
+ }
+
+ if (!xdr_long(xdrs, (long *) &m->modify)) {
+ return (FALSE);
+ }
+
+ x = m->flags;
+ if (!xdr_int(xdrs, &x)) {
+ return (FALSE);
+ }
+
+ x = m->nentries;
+ if (!xdr_int(xdrs, &x)) {
+ return (FALSE);
+ }
+
+ x = m->reloads;
+ if (!xdr_int(xdrs, &x)) {
+ return (FALSE);
+ }
+
+ if (!xdr_int(xdrs, &m->refc)) {
+ return (FALSE);
+ }
+
+ if (m->isup)
+ x = (*m->isup)(m, m->map_name);
+ else
+ x = -1;
+ if (!xdr_int(xdrs, &x)) {
+ return (FALSE);
+ }
+ }
+ return (TRUE);
+}
bool_t
xdr_pri_free(XDRPROC_T_TYPE xdr_args, caddr_t args_ptr)
diff --git a/contrib/amd/amd/amq_svc.c b/contrib/amd/amd/amq_svc.c
index 6fadb160c121..1f2b3d6ff8d9 100644
--- a/contrib/amd/amd/amq_svc.c
+++ b/contrib/amd/amd/amq_svc.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997-2006 Erez Zadok
+ * Copyright (c) 1997-2014 Erez Zadok
* Copyright (c) 1990 Jan-Simon Pendry
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
* Copyright (c) 1990 The Regents of the University of California.
@@ -16,11 +16,7 @@
* 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgment:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -57,7 +53,7 @@ typedef char *(*amqsvcproc_t)(voidp, struct svc_req *);
* in libwrap, while others don't: so I need to know precisely iff
* to define these two severity variables.
*/
-int allow_severity=0, deny_severity=0;
+int allow_severity=0, deny_severity=0, rfc931_timeout=0;
# endif /* NEED_LIBWRAP_SEVERITY_VARIABLES */
/*
@@ -65,49 +61,88 @@ int allow_severity=0, deny_severity=0;
* Returns: 1=allowed, 0=denied.
*/
static int
-amqsvc_is_client_allowed(const struct sockaddr_in *addr, char *remote)
+amqsvc_is_client_allowed(const struct sockaddr_in *addr)
{
- struct hostent *h;
- char *name = NULL, **ad;
- int ret = 0; /* default is 0==denied */
-
- /* Check IP address */
- if (hosts_ctl(AMD_SERVICE_NAME, "", remote, "")) {
- ret = 1;
- goto out;
+ struct request_info req;
+
+ request_init(&req, RQ_DAEMON, AMD_SERVICE_NAME, RQ_CLIENT_SIN, addr, 0);
+ sock_methods(&req);
+
+ if (hosts_access(&req))
+ return 1;
+
+ return 0;
+}
+#endif /* defined(HAVE_TCPD_H) && defined(HAVE_LIBWRAP) */
+
+
+/*
+ * Prepare the parent and child:
+ * 1) Setup IPC pipe.
+ * 2) Set signal masks.
+ * 3) Fork by calling background() so that NumChildren is updated.
+ */
+static int
+amq_fork(opaque_t argp)
+{
+#ifdef HAVE_SIGACTION
+ sigset_t new, mask;
+#else /* not HAVE_SIGACTION */
+ int mask;
+#endif /* not HAVE_SIGACTION */
+ am_node *mp;
+ pid_t pid;
+
+ mp = find_ap(*(char **) argp);
+ if (mp == NULL) {
+ errno = 0;
+ return -1;
}
- /* Get address */
- if (!(h = gethostbyaddr((const char *)&(addr->sin_addr),
- sizeof(addr->sin_addr),
- AF_INET)))
- goto out;
- if (!(name = strdup(h->h_name)))
- goto out;
- /* Paranoia check */
- if (!(h = gethostbyname(name)))
- goto out;
- for (ad = h->h_addr_list; *ad; ad++)
- if (!memcmp(*ad, &(addr->sin_addr), h->h_length))
- break;
- if (!*ad)
- goto out;
- if (hosts_ctl(AMD_SERVICE_NAME, "", h->h_name, "")) {
- return 1;
- goto out;
+
+ if (pipe(mp->am_fd) == -1) {
+ mp->am_fd[0] = -1;
+ mp->am_fd[1] = -1;
+ return -1;
}
- /* Check aliases */
- for (ad = h->h_aliases; *ad; ad++)
- if (hosts_ctl(AMD_SERVICE_NAME, "", *ad, "")) {
- return 1;
- goto out;
- }
- out:
- if (name)
- XFREE(name);
- return ret;
+#ifdef HAVE_SIGACTION
+ sigemptyset(&new); /* initialize signal set we wish to block */
+ sigaddset(&new, SIGHUP);
+ sigaddset(&new, SIGINT);
+ sigaddset(&new, SIGQUIT);
+ sigaddset(&new, SIGCHLD);
+ sigprocmask(SIG_BLOCK, &new, &mask);
+#else /* not HAVE_SIGACTION */
+ mask =
+ sigmask(SIGHUP) |
+ sigmask(SIGINT) |
+ sigmask(SIGQUIT) |
+ sigmask(SIGCHLD);
+ mask = sigblock(mask);
+#endif /* not HAVE_SIGACTION */
+
+ switch ((pid = background())) {
+ case -1: /* error */
+ dlog("amq_fork failed");
+ return -1;
+
+ case 0: /* child */
+ close(mp->am_fd[1]); /* close output end of pipe */
+ mp->am_fd[1] = -1;
+ return 0;
+
+ default: /* parent */
+ close(mp->am_fd[0]); /* close input end of pipe */
+ mp->am_fd[0] = -1;
+
+#ifdef HAVE_SIGACTION
+ sigprocmask(SIG_SETMASK, &mask, NULL);
+#else /* not HAVE_SIGACTION */
+ sigsetmask(mask);
+#endif /* not HAVE_SIGACTION */
+ return pid;
+ }
}
-#endif /* defined(HAVE_TCPD_H) && defined(HAVE_LIBWRAP) */
void
@@ -121,13 +156,16 @@ amq_program_1(struct svc_req *rqstp, SVCXPRT *transp)
char *result;
xdrproc_t xdr_argument, xdr_result;
amqsvcproc_t local;
+ amqsvcproc_t child;
+ amqsvcproc_t parent;
+ pid_t pid;
#if defined(HAVE_TCPD_H) && defined(HAVE_LIBWRAP)
if (gopt.flags & CFM_USE_TCPWRAPPERS) {
struct sockaddr_in *remote_addr = svc_getcaller(rqstp->rq_xprt);
char *remote_hostname = inet_ntoa(remote_addr->sin_addr);
- if (!amqsvc_is_client_allowed(remote_addr, remote_hostname)) {
+ if (!amqsvc_is_client_allowed(remote_addr)) {
plog(XLOG_WARNING, "Amd denied remote amq service to %s", remote_hostname);
svcerr_auth(transp, AUTH_FAILED);
return;
@@ -137,6 +175,10 @@ amq_program_1(struct svc_req *rqstp, SVCXPRT *transp)
}
#endif /* defined(HAVE_TCPD_H) && defined(HAVE_LIBWRAP) */
+ local = NULL;
+ child = NULL;
+ parent = NULL;
+
switch (rqstp->rq_proc) {
case AMQPROC_NULL:
@@ -199,6 +241,21 @@ amq_program_1(struct svc_req *rqstp, SVCXPRT *transp)
local = (amqsvcproc_t) amqproc_pawd_1_svc;
break;
+ case AMQPROC_SYNC_UMNT:
+ xdr_argument = (xdrproc_t) xdr_amq_string;
+ xdr_result = (xdrproc_t) xdr_amq_sync_umnt;
+ parent = (amqsvcproc_t) amqproc_sync_umnt_1_svc_parent;
+ child = (amqsvcproc_t) amqproc_sync_umnt_1_svc_child;
+ /* used if fork fails */
+ local = (amqsvcproc_t) amqproc_sync_umnt_1_svc_async;
+ break;
+
+ case AMQPROC_GETMAPINFO:
+ xdr_argument = (xdrproc_t) xdr_void;
+ xdr_result = (xdrproc_t) xdr_amq_map_info_qelem;
+ local = (amqsvcproc_t) amqproc_getmapinfo_1_svc;
+ break;
+
default:
svcerr_noproc(transp);
return;
@@ -212,7 +269,28 @@ amq_program_1(struct svc_req *rqstp, SVCXPRT *transp)
return;
}
- result = (*local) (&argument, rqstp);
+ pid = -1;
+ result = NULL;
+
+ if (child) {
+ switch ((pid = amq_fork(&argument))) {
+ case -1: /* error */
+ break;
+
+ case 0: /* child */
+ result = (*child) (&argument, rqstp);
+ local = NULL;
+ break;
+
+ default: /* parent */
+ result = (*parent) (&argument, rqstp);
+ local = NULL;
+ break;
+ }
+ }
+
+ if (local)
+ result = (*local) (&argument, rqstp);
if (result != NULL && !svc_sendreply(transp,
(XDRPROC_T_TYPE) xdr_result,
@@ -226,4 +304,7 @@ amq_program_1(struct svc_req *rqstp, SVCXPRT *transp)
plog(XLOG_FATAL, "unable to free rpc arguments in amqprog_1");
going_down(1);
}
+
+ if (pid == 0)
+ exit(0); /* the child is done! */
}
diff --git a/contrib/amd/amd/autil.c b/contrib/amd/amd/autil.c
index a5ecd6d0d1f3..cd9514d44ef4 100644
--- a/contrib/amd/amd/autil.c
+++ b/contrib/amd/amd/autil.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997-2006 Erez Zadok
+ * Copyright (c) 1997-2014 Erez Zadok
* Copyright (c) 1990 Jan-Simon Pendry
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
* Copyright (c) 1990 The Regents of the University of California.
@@ -16,11 +16,7 @@
* 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgment:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -160,16 +156,23 @@ valid_key(char *key)
void
forcibly_timeout_mp(am_node *mp)
{
- mntfs *mf = mp->am_mnt;
+ mntfs *mf = mp->am_al->al_mnt;
/*
* Arrange to timeout this node
*/
if (mf && ((mp->am_flags & AMF_ROOT) ||
(mf->mf_flags & (MFF_MOUNTING | MFF_UNMOUNTING)))) {
+ /*
+ * We aren't going to schedule a timeout, so we need to notify the
+ * child here unless we are already unmounting, in which case that
+ * process is responsible for notifying the child.
+ */
if (mf->mf_flags & MFF_UNMOUNTING)
plog(XLOG_WARNING, "node %s is currently being unmounted, ignoring timeout request", mp->am_path);
- else
+ else {
plog(XLOG_WARNING, "ignoring timeout request for active node %s", mp->am_path);
+ notify_child(mp, AMQ_UMNT_FAILED, EBUSY, 0);
+ }
} else {
plog(XLOG_INFO, "\"%s\" forcibly timed out", mp->am_path);
mp->am_flags &= ~AMF_NOTIMEOUT;
@@ -207,24 +210,11 @@ mf_mounted(mntfs *mf, bool_t call_free_opts)
mf->mf_ops->mounted(mf);
/*
- * Be careful when calling free_ops and XFREE here. Some pseudo file
- * systems like nfsx call this function (mf_mounted), even though it
- * would be called by the lower-level amd file system functions. nfsx
- * needs to call this function because of the other actions it takes.
- * So we pass a boolean from the caller (yes, not so clean workaround)
- * to determine if we should free or not. If we're not freeing (often
- * because we're called from a callback function), then just to be sure,
- * we'll zero out the am_opts structure and set the pointer to NULL.
- * The parent mntfs node owns this memory and is going to free it with a
- * call to mf_mounted(mntfs,TRUE) (see comment in the am_mounted code).
+ * We used to free the mf_mo (options) here, however they're now stored
+ * and managed with the mntfs and do not need to be free'd here (this ensures
+ * that we use the same options to monitor/unmount the system as we used
+ * to mount it).
*/
- if (call_free_opts) {
- free_opts(mf->mf_fo); /* this free is needed to prevent leaks */
- XFREE(mf->mf_fo); /* (also this one) */
- } else {
- memset(mf->mf_fo, 0, sizeof(am_opts));
- mf->mf_fo = NULL;
- }
}
if (mf->mf_flags & MFF_RESTART) {
@@ -249,7 +239,7 @@ void
am_mounted(am_node *mp)
{
int notimeout = 0; /* assume normal timeouts initially */
- mntfs *mf = mp->am_mnt;
+ mntfs *mf = mp->am_al->al_mnt;
/*
* This is the parent mntfs which does the mf->mf_fo (am_opts type), and
@@ -266,7 +256,7 @@ am_mounted(am_node *mp)
/*
* Patch up path for direct mounts
*/
- if (mp->am_parent && mp->am_parent->am_mnt->mf_fsflags & FS_DIRECT)
+ if (mp->am_parent && mp->am_parent->am_al->al_mnt->mf_fsflags & FS_DIRECT)
mp->am_path = str3cat(mp->am_path, mp->am_parent->am_path, "/", ".");
/*
@@ -277,6 +267,7 @@ am_mounted(am_node *mp)
if (mf->mf_fsflags & FS_NOTIMEOUT)
notimeout = 1;
/* next, alter that decision by map flags */
+
if (mf->mf_mopts) {
mntent_t mnt;
mnt.mnt_opts = mf->mf_mopts;
@@ -321,7 +312,7 @@ am_mounted(am_node *mp)
/*
* Update mtime of parent node (copying "struct nfstime" in '=' below)
*/
- if (mp->am_parent && mp->am_parent->am_mnt)
+ if (mp->am_parent && mp->am_parent->am_al->al_mnt)
mp->am_parent->am_fattr.na_mtime = mp->am_fattr.na_mtime;
/*
@@ -360,21 +351,27 @@ assign_error_mntfs(am_node *mp)
{
int error;
dlog("assign_error_mntfs");
+
+ if (mp->am_al == NULL) {
+ plog(XLOG_ERROR, "%s: Can't assign error", __func__);
+ return;
+ }
/*
* Save the old error code
*/
error = mp->am_error;
if (error <= 0)
- error = mp->am_mnt->mf_error;
+ error = mp->am_al->al_mnt->mf_error;
/*
* Allocate a new error reference
*/
- mp->am_mnt = new_mntfs();
+ free_loc(mp->am_al);
+ mp->am_al = new_loc();
/*
* Put back the error code
*/
- mp->am_mnt->mf_error = error;
- mp->am_mnt->mf_flags |= MFF_ERROR;
+ mp->am_al->al_mnt->mf_error = error;
+ mp->am_al->al_mnt->mf_flags |= MFF_ERROR;
/*
* Zero the error in the mount point
*/
@@ -397,7 +394,8 @@ amfs_mkcacheref(mntfs *mf)
cache = "none";
mf->mf_private = (opaque_t) mapc_find(mf->mf_info,
cache,
- (mf->mf_fo ? mf->mf_fo->opt_maptype : NULL));
+ (mf->mf_fo ? mf->mf_fo->opt_maptype : NULL),
+ mf->mf_mount);
mf->mf_prfree = mapc_free;
}
@@ -418,7 +416,7 @@ next_nonerror_node(am_node *xp)
* containing hung automounts.
*/
while (xp &&
- (!(mf = xp->am_mnt) || /* No mounted filesystem */
+ (!(mf = xp->am_al->al_mnt) || /* No mounted filesystem */
mf->mf_error != 0 || /* There was a mntfs error */
xp->am_error != 0 || /* There was a mount error */
!(mf->mf_flags & MFF_MOUNTED) || /* The fs is not mounted */
@@ -453,8 +451,9 @@ amfs_mount(am_node *mp, mntfs *mf, char *opts)
mntent_t mnt;
MTYPE_TYPE type;
int forced_unmount = 0; /* are we using forced unmounts? */
+ u_long nfs_version = get_nfs_dispatcher_version(nfs_dispatcher);
- memset((voidp) &mnt, 0, sizeof(mnt));
+ memset(&mnt, 0, sizeof(mnt));
mnt.mnt_dir = dir;
mnt.mnt_fsname = pid_fsname;
mnt.mnt_opts = opts;
@@ -525,8 +524,7 @@ amfs_mount(am_node *mp, mntfs *mf, char *opts)
again:
if (!(mf->mf_flags & MFF_IS_AUTOFS)) {
nfs_args_t nfs_args;
- am_nfs_fh *fhp;
- am_nfs_handle_t anh;
+ am_nfs_handle_t *fhp, anh;
#ifndef HAVE_TRANSPORT_TYPE_TLI
u_short port;
struct sockaddr_in sin;
@@ -535,7 +533,7 @@ again:
/*
* get fhandle of remote path for automount point
*/
- fhp = get_root_nfs_fh(dir);
+ fhp = get_root_nfs_fh(dir, &anh);
if (!fhp) {
plog(XLOG_FATAL, "Can't find root file handle for %s", dir);
return EINVAL;
@@ -545,7 +543,7 @@ again:
/*
* Create sockaddr to point to the local machine.
*/
- memset((voidp) &sin, 0, sizeof(sin));
+ memset(&sin, 0, sizeof(sin));
/* as per POSIX, sin_len need not be set (used internally by kernel) */
sin.sin_family = AF_INET;
sin.sin_addr = myipaddr;
@@ -559,16 +557,15 @@ again:
#endif /* not HAVE_TRANSPORT_TYPE_TLI */
/* setup the many fields and flags within nfs_args */
- memmove(&anh.v2, fhp, sizeof(*fhp));
#ifdef HAVE_TRANSPORT_TYPE_TLI
compute_nfs_args(&nfs_args,
&mnt,
genflags,
nfsncp,
NULL, /* remote host IP addr is set below */
- NFS_VERSION, /* version 2 */
+ nfs_version,
"udp",
- &anh,
+ fhp,
fs_hostname,
pid_fsname);
/*
@@ -587,9 +584,9 @@ again:
genflags,
NULL,
&sin,
- NFS_VERSION, /* version 2 */
+ nfs_version,
"udp",
- &anh,
+ fhp,
fs_hostname,
pid_fsname);
#endif /* not HAVE_TRANSPORT_TYPE_TLI */
@@ -656,10 +653,17 @@ again:
void
am_unmounted(am_node *mp)
{
- mntfs *mf = mp->am_mnt;
+ mntfs *mf = mp->am_al->al_mnt;
- if (!foreground) /* firewall - should never happen */
+ if (!foreground) { /* firewall - should never happen */
+ /*
+ * This is a coding error. Make sure we hear about it!
+ */
+ plog(XLOG_FATAL, "am_unmounted: illegal use in background (%s)",
+ mp->am_name);
+ notify_child(mp, AMQ_UMNT_OK, 0, 0); /* XXX - be safe? */
return;
+ }
/*
* Do unmounted callback
@@ -707,26 +711,37 @@ am_unmounted(am_node *mp)
/*
* Update mtime of parent node
*/
- if (mp->am_parent && mp->am_parent->am_mnt)
+ if (mp->am_parent && mp->am_parent->am_al->al_mnt)
clocktime(&mp->am_parent->am_fattr.na_mtime);
if (mp->am_parent && (mp->am_flags & AMF_REMOUNT)) {
- char *fname = strdup(mp->am_name);
+ char *fname = xstrdup(mp->am_name);
am_node *mp_parent = mp->am_parent;
- mntfs *mf_parent = mp_parent->am_mnt;
+ mntfs *mf_parent = mp_parent->am_al->al_mnt;
+ am_node fake_mp;
int error = 0;
+ /*
+ * We need to use notify_child() after free_map(), so save enough
+ * to do that in fake_mp.
+ */
+ fake_mp.am_fd[1] = mp->am_fd[1];
+ mp->am_fd[1] = -1;
+
free_map(mp);
plog(XLOG_INFO, "am_unmounted: remounting %s", fname);
mp = mf_parent->mf_ops->lookup_child(mp_parent, fname, &error, VLOOK_CREATE);
if (mp && error < 0)
- mp = mf_parent->mf_ops->mount_child(mp, &error);
+ (void)mf_parent->mf_ops->mount_child(mp, &error);
if (error > 0) {
errno = error;
plog(XLOG_ERROR, "am_unmounted: could not remount %s: %m", fname);
+ notify_child(&fake_mp, AMQ_UMNT_OK, 0, 0);
+ } else {
+ notify_child(&fake_mp, AMQ_UMNT_FAILED, EBUSY, 0);
}
XFREE(fname);
- } else
+ } else {
/*
* We have a race here.
* If this node has a pending mount and amd is going down (unmounting
@@ -734,10 +749,12 @@ am_unmounted(am_node *mp)
* while a struct continuation still has a reference to it. So when
* amfs_cont is called, it blows up.
* We avoid the race by refusing to free any nodes that have
- * pending mounts (defined as having a non-NULL am_mfarray).
+ * pending mounts (defined as having a non-NULL am_alarray).
*/
- if (!mp->am_mfarray)
+ notify_child(mp, AMQ_UMNT_OK, 0, 0); /* do this regardless */
+ if (!mp->am_alarray)
free_map(mp);
+ }
}
diff --git a/contrib/amd/amd/clock.c b/contrib/amd/amd/clock.c
index 0caa7dff2c73..4c6aa5413763 100644
--- a/contrib/amd/amd/clock.c
+++ b/contrib/amd/amd/clock.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997-2006 Erez Zadok
+ * Copyright (c) 1997-2014 Erez Zadok
* Copyright (c) 1989 Jan-Simon Pendry
* Copyright (c) 1989 Imperial College of Science, Technology & Medicine
* Copyright (c) 1989 The Regents of the University of California.
@@ -16,11 +16,7 @@
* 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgment:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
diff --git a/contrib/amd/amd/conf.c b/contrib/amd/amd/conf.c
index 2fc587b0cadb..57e1b9ddbd02 100644
--- a/contrib/amd/amd/conf.c
+++ b/contrib/amd/amd/conf.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997-2006 Erez Zadok
+ * Copyright (c) 1997-2014 Erez Zadok
* Copyright (c) 1990 Jan-Simon Pendry
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
* Copyright (c) 1990 The Regents of the University of California.
@@ -16,11 +16,7 @@
* 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgment:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -77,6 +73,7 @@ struct _func_map {
static int gopt_arch(const char *val);
static int gopt_auto_attrcache(const char *val);
static int gopt_auto_dir(const char *val);
+static int gopt_auto_nfs_version(const char *val);
static int gopt_autofs_use_lofs(const char *val);
static int gopt_browsable_dirs(const char *val);
static int gopt_cache_duration(const char *val);
@@ -120,6 +117,7 @@ static int gopt_nfs_retry_interval_udp(const char *val);
static int gopt_nfs_retry_interval_tcp(const char *val);
static int gopt_nfs_retry_interval_toplvl(const char *val);
static int gopt_nfs_vers(const char *val);
+static int gopt_nfs_vers_ping(const char *val);
static int gopt_nis_domain(const char *val);
static int gopt_normalize_hostnames(const char *val);
static int gopt_normalize_slashes(const char *val);
@@ -132,6 +130,7 @@ static int gopt_restart_mounts(const char *val);
static int gopt_search_path(const char *val);
static int gopt_selectors_in_defaults(const char *val);
static int gopt_show_statfs_entries(const char *val);
+static int gopt_sun_map_syntax(const char *val);
static int gopt_truncate_log(const char *val);
static int gopt_unmount_on_exit(const char *val);
static int gopt_use_tcpwrappers(const char *val);
@@ -146,6 +145,7 @@ static int ropt_map_options(const char *val, cf_map_t *cfm);
static int ropt_map_type(const char *val, cf_map_t *cfm);
static int ropt_mount_type(const char *val, cf_map_t *cfm);
static int ropt_search_path(const char *val, cf_map_t *cfm);
+static int ropt_sun_map_syntax(const char *val, cf_map_t *cfm);
static int ropt_tag(const char *val, cf_map_t *cfm);
static void init_cf_map(cf_map_t *cfm);
@@ -159,6 +159,7 @@ static struct _func_map glob_functable[] = {
{"arch", gopt_arch},
{"auto_attrcache", gopt_auto_attrcache},
{"auto_dir", gopt_auto_dir},
+ {"auto_nfs_version", gopt_auto_nfs_version},
{"autofs_use_lofs", gopt_autofs_use_lofs},
{"browsable_dirs", gopt_browsable_dirs},
{"cache_duration", gopt_cache_duration},
@@ -202,6 +203,7 @@ static struct _func_map glob_functable[] = {
{"nfs_retry_interval_tcp", gopt_nfs_retry_interval_tcp},
{"nfs_retry_interval_toplvl", gopt_nfs_retry_interval_toplvl},
{"nfs_vers", gopt_nfs_vers},
+ {"nfs_vers_ping", gopt_nfs_vers_ping},
{"nis_domain", gopt_nis_domain},
{"normalize_hostnames", gopt_normalize_hostnames},
{"normalize_slashes", gopt_normalize_slashes},
@@ -215,6 +217,7 @@ static struct _func_map glob_functable[] = {
{"selectors_on_default", gopt_selectors_in_defaults},
{"selectors_in_defaults", gopt_selectors_in_defaults},
{"show_statfs_entries", gopt_show_statfs_entries},
+ {"sun_map_syntax", gopt_sun_map_syntax},
{"truncate_log", gopt_truncate_log},
{"unmount_on_exit", gopt_unmount_on_exit},
{"use_tcpwrappers", gopt_use_tcpwrappers},
@@ -255,12 +258,14 @@ init_cf_map(cf_map_t *cfm)
cfm->cfm_search_path = gopt.search_path;
/*
- * Initialize flags that are common both to [global] and a local map.
+ * Initialize flags that are common both to [global] and a local map
+ * (that is, they could be inherited from the global section).
*/
cfm->cfm_flags = gopt.flags & (CFM_BROWSABLE_DIRS |
CFM_BROWSABLE_DIRS_FULL |
CFM_MOUNT_TYPE_AUTOFS |
- CFM_SELECTORS_IN_DEFAULTS);
+ CFM_SELECTORS_IN_DEFAULTS |
+ CFM_SUN_MAP_SYNTAX );
}
@@ -366,7 +371,7 @@ process_global_option(const char *key, const char *val)
static int
gopt_arch(const char *val)
{
- gopt.arch = strdup((char *)val);
+ gopt.arch = xstrdup(val);
return 0;
}
@@ -386,10 +391,23 @@ gopt_auto_attrcache(const char *val)
static int
gopt_auto_dir(const char *val)
{
- gopt.auto_dir = strdup((char *)val);
+ gopt.auto_dir = xstrdup(val);
return 0;
}
+static int
+gopt_auto_nfs_version(const char *val)
+{
+ if (strcmp(val, "2") == 0)
+ nfs_dispatcher = nfs_program_2;
+ else if (strcmp(val, "3") == 0)
+ nfs_dispatcher = nfs_program_3;
+ else {
+ fprintf(stderr, "conf: bad auto nfs version : \"%s\"\n", val);
+ return 1;
+ }
+ return 0;
+}
static int
gopt_autofs_use_lofs(const char *val)
@@ -439,7 +457,7 @@ gopt_cache_duration(const char *val)
static int
gopt_cluster(const char *val)
{
- gopt.cluster = strdup((char *)val);
+ gopt.cluster = xstrdup(val);
return 0;
}
@@ -447,7 +465,7 @@ gopt_cluster(const char *val)
static int
gopt_debug_mtab_file(const char *val)
{
- gopt.debug_mtab_file = strdup((char*)val);
+ gopt.debug_mtab_file = xstrdup(val);
return 0;
}
@@ -547,7 +565,7 @@ gopt_forced_unmounts(const char *val)
static int
gopt_full_os(const char *val)
{
- gopt.op_sys_full = strdup((char *)val);
+ gopt.op_sys_full = xstrdup(val);
return 0;
}
@@ -572,7 +590,7 @@ static int
gopt_hesiod_base(const char *val)
{
#ifdef HAVE_MAP_HESIOD
- gopt.hesiod_base = strdup((char *)val);
+ gopt.hesiod_base = xstrdup(val);
return 0;
#else /* not HAVE_MAP_HESIOD */
fprintf(stderr, "conf: hesiod_base option ignored. No Hesiod support available.\n");
@@ -584,7 +602,7 @@ gopt_hesiod_base(const char *val)
static int
gopt_karch(const char *val)
{
- gopt.karch = strdup((char *)val);
+ gopt.karch = xstrdup(val);
return 0;
}
@@ -592,7 +610,7 @@ gopt_karch(const char *val)
static int
gopt_pid_file(const char *val)
{
- gopt.pid_file = strdup((char *)val);
+ gopt.pid_file = xstrdup(val);
return 0;
}
@@ -600,7 +618,7 @@ gopt_pid_file(const char *val)
static int
gopt_local_domain(const char *val)
{
- gopt.sub_domain = strdup((char *)val);
+ gopt.sub_domain = xstrdup(val);
return 0;
}
@@ -608,7 +626,7 @@ gopt_local_domain(const char *val)
static int
gopt_localhost_address(const char *val)
{
- gopt.localhost_address = strdup((char *)val);
+ gopt.localhost_address = xstrdup(val);
return 0;
}
@@ -617,7 +635,7 @@ static int
gopt_ldap_base(const char *val)
{
#ifdef HAVE_MAP_LDAP
- gopt.ldap_base = strdup((char *)val);
+ gopt.ldap_base = xstrdup(val);
return 0;
#else /* not HAVE_MAP_LDAP */
fprintf(stderr, "conf: ldap_base option ignored. No LDAP support available.\n");
@@ -668,7 +686,7 @@ static int
gopt_ldap_hostports(const char *val)
{
#ifdef HAVE_MAP_LDAP
- gopt.ldap_hostports = strdup((char *)val);
+ gopt.ldap_hostports = xstrdup(val);
return 0;
#else /* not HAVE_MAP_LDAP */
fprintf(stderr, "conf: ldap_hostports option ignored. No LDAP support available.\n");
@@ -719,7 +737,7 @@ gopt_ldap_proto_version(const char *val)
static int
gopt_log_file(const char *val)
{
- gopt.logfile = strdup((char *)val);
+ gopt.logfile = xstrdup(val);
return 0;
}
@@ -735,7 +753,7 @@ gopt_log_options(const char *val)
static int
gopt_map_defaults(const char *val)
{
- gopt.map_defaults = strdup((char *)val);
+ gopt.map_defaults = xstrdup(val);
return 0;
}
@@ -743,7 +761,7 @@ gopt_map_defaults(const char *val)
static int
gopt_map_options(const char *val)
{
- gopt.map_options = strdup((char *)val);
+ gopt.map_options = xstrdup(val);
return 0;
}
@@ -766,7 +784,7 @@ gopt_map_type(const char *val)
fprintf(stderr, "conf: no such map type \"%s\"\n", val);
return 1;
}
- gopt.map_type = strdup((char *)val);
+ gopt.map_type = xstrdup(val);
return 0;
}
@@ -863,7 +881,7 @@ static int
gopt_nfs_proto(const char *val)
{
if (STREQ(val, "udp") || STREQ(val, "tcp")) {
- gopt.nfs_proto = strdup((char *)val);
+ gopt.nfs_proto = xstrdup(val);
return 0;
}
fprintf(stderr, "conf: illegal nfs_proto \"%s\"\n", val);
@@ -946,7 +964,7 @@ gopt_nfs_vers(const char *val)
{
int i = atoi(val);
- if (i == 2 || i == 3) {
+ if (i == 2 || i == 3 || i == 4) {
gopt.nfs_vers = i;
return 0;
}
@@ -956,10 +974,23 @@ gopt_nfs_vers(const char *val)
static int
+gopt_nfs_vers_ping(const char *val)
+{
+ int i = atoi(val);
+
+ if (i == 2 || i == 3 || i == 4) {
+ gopt.nfs_vers_ping = i;
+ return 0;
+ }
+ fprintf(stderr, "conf: illegal nfs_vers_ping \"%s\"\n", val);
+ return 1;
+}
+
+static int
gopt_nis_domain(const char *val)
{
#ifdef HAVE_MAP_NIS
- gopt.nis_domain = strdup((char *)val);
+ gopt.nis_domain = xstrdup(val);
return 0;
#else /* not HAVE_MAP_NIS */
fprintf(stderr, "conf: nis_domain option ignored. No NIS support available.\n");
@@ -1003,7 +1034,7 @@ gopt_normalize_slashes(const char *val)
static int
gopt_os(const char *val)
{
- gopt.op_sys = strdup((char *)val);
+ gopt.op_sys = xstrdup(val);
return 0;
}
@@ -1011,7 +1042,7 @@ gopt_os(const char *val)
static int
gopt_osver(const char *val)
{
- gopt.op_sys_ver = strdup((char *)val);
+ gopt.op_sys_ver = xstrdup(val);
return 0;
}
@@ -1084,7 +1115,7 @@ gopt_restart_mounts(const char *val)
static int
gopt_search_path(const char *val)
{
- gopt.search_path = strdup((char *)val);
+ gopt.search_path = xstrdup(val);
return 0;
}
@@ -1122,6 +1153,22 @@ gopt_show_statfs_entries(const char *val)
static int
+gopt_sun_map_syntax(const char *val)
+{
+ if (STREQ(val, "yes")) {
+ gopt.flags |= CFM_SUN_MAP_SYNTAX;
+ return 0;
+ } else if (STREQ(val, "no")) {
+ gopt.flags &= ~CFM_SUN_MAP_SYNTAX;
+ return 0;
+ }
+
+ fprintf(stderr, "conf: unknown value to sun_map_syntax \"%s\"\n", val);
+ return 1; /* unknown value */
+}
+
+
+static int
gopt_truncate_log(const char *val)
{
if (STREQ(val, "yes")) {
@@ -1177,7 +1224,7 @@ gopt_use_tcpwrappers(const char *val)
static int
gopt_vendor(const char *val)
{
- gopt.op_sys_vendor = strdup((char *)val);
+ gopt.op_sys_vendor = xstrdup(val);
return 0;
}
@@ -1199,7 +1246,7 @@ process_regular_option(const char *section, const char *key, const char *val, cf
/* check if initializing a new map */
if (!cfm->cfm_dir)
- cfm->cfm_dir = strdup((char *)section);
+ cfm->cfm_dir = xstrdup(section);
/* check for each possible field */
if (STREQ(key, "browsable_dirs"))
@@ -1223,6 +1270,9 @@ process_regular_option(const char *section, const char *key, const char *val, cf
if (STREQ(key, "search_path"))
return ropt_search_path(val, cfm);
+ if (STREQ(key, "sun_map_syntax"))
+ return ropt_sun_map_syntax(val, cfm);
+
if (STREQ(key, "tag"))
return ropt_tag(val, cfm);
@@ -1254,7 +1304,7 @@ ropt_browsable_dirs(const char *val, cf_map_t *cfm)
static int
ropt_map_name(const char *val, cf_map_t *cfm)
{
- cfm->cfm_name = strdup((char *)val);
+ cfm->cfm_name = xstrdup(val);
return 0;
}
@@ -1262,7 +1312,7 @@ ropt_map_name(const char *val, cf_map_t *cfm)
static int
ropt_map_defaults(const char *val, cf_map_t *cfm)
{
- cfm->cfm_defaults = strdup((char *)val);
+ cfm->cfm_defaults = xstrdup(val);
return 0;
}
@@ -1270,7 +1320,7 @@ ropt_map_defaults(const char *val, cf_map_t *cfm)
static int
ropt_map_options(const char *val, cf_map_t *cfm)
{
- cfm->cfm_opts = strdup((char *)val);
+ cfm->cfm_opts = xstrdup(val);
return 0;
}
@@ -1283,7 +1333,7 @@ ropt_map_type(const char *val, cf_map_t *cfm)
fprintf(stderr, "conf: no such map type \"%s\"\n", val);
return 1;
}
- cfm->cfm_type = strdup((char *)val);
+ cfm->cfm_type = xstrdup(val);
return 0;
}
@@ -1313,15 +1363,32 @@ ropt_mount_type(const char *val, cf_map_t *cfm)
static int
ropt_search_path(const char *val, cf_map_t *cfm)
{
- cfm->cfm_search_path = strdup((char *)val);
+ cfm->cfm_search_path = xstrdup(val);
return 0;
}
static int
+ropt_sun_map_syntax(const char *val, cf_map_t *cfm)
+{
+ if (STREQ(val, "yes")) {
+ cfm->cfm_flags |= CFM_SUN_MAP_SYNTAX;
+ return 0;
+
+ } else if (STREQ(val, "no")) {
+ cfm->cfm_flags &= ~CFM_SUN_MAP_SYNTAX;
+ return 0;
+ }
+
+ fprintf(stderr, "conf: unknown value to sun_map_syntax \"%s\"\n", val);
+ return 1; /* unknown value */
+}
+
+
+static int
ropt_tag(const char *val, cf_map_t *cfm)
{
- cfm->cfm_tag = strdup((char *)val);
+ cfm->cfm_tag = xstrdup(val);
return 0;
}
@@ -1397,7 +1464,7 @@ find_cf_map(const char *name)
return NULL;
while (tmp_map) {
- if (STREQ(tmp_map->cfm_dir,name)) {
+ if (STREQ(tmp_map->cfm_dir, name)) {
return tmp_map;
}
tmp_map = tmp_map->cfm_next;
diff --git a/contrib/amd/amd/conf_parse.y b/contrib/amd/amd/conf_parse.y
index b397b0573242..26c1b7ac7903 100644
--- a/contrib/amd/amd/conf_parse.y
+++ b/contrib/amd/amd/conf_parse.y
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997-2006 Erez Zadok
+ * Copyright (c) 1997-2014 Erez Zadok
* Copyright (c) 1989 Jan-Simon Pendry
* Copyright (c) 1989 Imperial College of Science, Technology & Medicine
* Copyright (c) 1989 The Regents of the University of California.
@@ -16,11 +16,7 @@
* 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgment:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
diff --git a/contrib/amd/amd/conf_tok.l b/contrib/amd/amd/conf_tok.l
index b572e4d7d5a3..fea2d8bf43f5 100644
--- a/contrib/amd/amd/conf_tok.l
+++ b/contrib/amd/amd/conf_tok.l
@@ -1,6 +1,6 @@
%{
/*
- * Copyright (c) 1997-2006 Erez Zadok
+ * Copyright (c) 1997-2014 Erez Zadok
* Copyright (c) 1989 Jan-Simon Pendry
* Copyright (c) 1989 Imperial College of Science, Technology & Medicine
* Copyright (c) 1989 The Regents of the University of California.
@@ -17,11 +17,7 @@
* 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgment:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -74,7 +70,7 @@
*/
#ifdef FLEX_SCANNER
# ifndef ECHO
-# define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
+# define ECHO __IGNORE(fwrite( yytext, yyleng, 1, yyout ))
# endif /* not ECHO */
#endif /* FLEX_SCANNER */
@@ -86,9 +82,9 @@ int yylex(void);
* which automatically generates yywrap macros and symbols. So I must
* distinguish between them and when yywrap is actually needed.
*/
-#ifndef yywrap
+#if !defined(yywrap) || defined(yylex)
int yywrap(void);
-#endif /* not yywrap */
+#endif /* not yywrap or yylex */
#define TOK_DEBUG 0
@@ -108,6 +104,7 @@ int yywrap(void);
/* This option causes Solaris lex to fail. Use flex. See BUGS file */
/* no need to use yyunput() */
%option nounput
+%option noinput
/* allocate more output slots so lex scanners don't run out of mem */
%o 1024
@@ -131,19 +128,19 @@ NONQUOTE [^\"]
\[ {
dprintf("%8d: Left bracket \"%s\"\n", yytext);
- yylval.strtype = strdup((char *)yytext);
+ conf_lval.strtype = xstrdup(yytext);
amu_return(LEFT_BRACKET);
}
\] {
dprintf("%8d: Right bracket \"%s\"\n", yytext);
- yylval.strtype = strdup((char *)yytext);
+ conf_lval.strtype = xstrdup(yytext);
amu_return(RIGHT_BRACKET);
}
= {
dprintf("%8d: Equal \"%s\"\n", yytext);
- yylval.strtype = strdup((char *)yytext);
+ conf_lval.strtype = xstrdup(yytext);
amu_return(EQUAL);
}
@@ -159,7 +156,7 @@ NONQUOTE [^\"]
{NONWSCHAR}{NONWSCHAR}* {
dprintf("%8d: Non-WS string \"%s\"\n", yytext);
- yylval.strtype = strdup((char *)yytext);
+ conf_lval.strtype = xstrdup(yytext);
amu_return(NONWS_STRING);
}
@@ -167,13 +164,13 @@ NONQUOTE [^\"]
dprintf("%8d: QUOTED-Non-WS-EQ string \"%s\"\n", yytext);
/* must strip quotes */
yytext[strlen((char *)yytext)-1] = '\0';
- yylval.strtype = strdup((char *)&yytext[1]);
+ conf_lval.strtype = xstrdup(&yytext[1]);
amu_return(QUOTED_NONWSEQ_STRING);
}
{NONWSEQCHAR}{NONWSEQCHAR}* {
dprintf("%8d: Non-WS-EQ string \"%s\"\n", yytext);
- yylval.strtype = strdup((char *)yytext);
+ conf_lval.strtype = xstrdup(yytext);
amu_return(NONWSEQ_STRING);
}
@@ -184,9 +181,9 @@ NONQUOTE [^\"]
* which automatically generates yywrap macros and symbols. So I must
* distinguish between them and when yywrap is actually needed.
*/
-#ifndef yywrap
+#if !defined(yywrap) || defined(yylex)
int yywrap(void)
{
return 1;
}
-#endif /* not yywrap */
+#endif /* not yywrap or yylex */
diff --git a/contrib/amd/amd/get_args.c b/contrib/amd/amd/get_args.c
index 8f743e6b2f3c..724eff7cdbb1 100644
--- a/contrib/amd/amd/get_args.c
+++ b/contrib/amd/amd/get_args.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997-2006 Erez Zadok
+ * Copyright (c) 1997-2014 Erez Zadok
* Copyright (c) 1990 Jan-Simon Pendry
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
* Copyright (c) 1990 The Regents of the University of California.
@@ -16,11 +16,7 @@
* 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgment:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -84,38 +80,52 @@ get_version_string(void)
len = 2048 + wire_buf_len;
vers = xmalloc(len);
xsnprintf(vers, len, "%s\n%s\n%s\n%s\n",
- "Copyright (c) 1997-2006 Erez Zadok",
+ "Copyright (c) 1997-2014 Erez Zadok",
"Copyright (c) 1990 Jan-Simon Pendry",
"Copyright (c) 1990 Imperial College of Science, Technology & Medicine",
"Copyright (c) 1990 The Regents of the University of California.");
xsnprintf(tmpbuf, sizeof(tmpbuf), "%s version %s (build %d).\n",
PACKAGE_NAME, PACKAGE_VERSION, AMU_BUILD_VERSION);
- strlcat(vers, tmpbuf, len);
+ xstrlcat(vers, tmpbuf, len);
xsnprintf(tmpbuf, sizeof(tmpbuf), "Report bugs to %s.\n", PACKAGE_BUGREPORT);
- strlcat(vers, tmpbuf, len);
+ xstrlcat(vers, tmpbuf, len);
+#if 0
+ /*
+ * XXX This block (between from the #if 0 to #endif was in the
+ * XXX original was in the original merge however in the interest
+ * XXX of reproduceable builds and the fact that this is redundant
+ * XXX information, it is effectively removed.
+ */
+ xsnprintf(tmpbuf, sizeof(tmpbuf), "Configured by %s@%s on date %s.\n",
+ USER_NAME, HOST_NAME, CONFIG_DATE);
+ xstrlcat(vers, tmpbuf, len);
+ xsnprintf(tmpbuf, sizeof(tmpbuf), "Built by %s@%s on date %s.\n",
+ BUILD_USER, BUILD_HOST, BUILD_DATE);
+ xstrlcat(vers, tmpbuf, len);
+#endif
xsnprintf(tmpbuf, sizeof(tmpbuf), "cpu=%s (%s-endian), arch=%s, karch=%s.\n",
cpu, endian, gopt.arch, gopt.karch);
- strlcat(vers, tmpbuf, len);
+ xstrlcat(vers, tmpbuf, len);
xsnprintf(tmpbuf, sizeof(tmpbuf), "full_os=%s, os=%s, osver=%s, vendor=%s, distro=%s.\n",
gopt.op_sys_full, gopt.op_sys, gopt.op_sys_ver, gopt.op_sys_vendor, DISTRO_NAME);
- strlcat(vers, tmpbuf, len);
+ xstrlcat(vers, tmpbuf, len);
xsnprintf(tmpbuf, sizeof(tmpbuf), "domain=%s, host=%s, hostd=%s.\n",
hostdomain, am_get_hostname(), hostd);
- strlcat(vers, tmpbuf, len);
+ xstrlcat(vers, tmpbuf, len);
- strlcat(vers, "Map support for: ", len);
+ xstrlcat(vers, "Map support for: ", len);
mapc_showtypes(tmpbuf, sizeof(tmpbuf));
- strlcat(vers, tmpbuf, len);
- strlcat(vers, ".\nAMFS: ", len);
+ xstrlcat(vers, tmpbuf, len);
+ xstrlcat(vers, ".\nAMFS: ", len);
ops_showamfstypes(tmpbuf, sizeof(tmpbuf));
- strlcat(vers, tmpbuf, len);
- strlcat(vers, ", inherit.\nFS: ", len); /* hack: "show" that we support type:=inherit */
+ xstrlcat(vers, tmpbuf, len);
+ xstrlcat(vers, ", inherit.\nFS: ", len); /* hack: "show" that we support type:=inherit */
ops_showfstypes(tmpbuf, sizeof(tmpbuf));
- strlcat(vers, tmpbuf, len);
+ xstrlcat(vers, tmpbuf, len);
/* append list of networks if available */
if (wire_buf) {
- strlcat(vers, wire_buf, len);
+ xstrlcat(vers, wire_buf, len);
XFREE(wire_buf);
}
@@ -325,19 +335,18 @@ get_args(int argc, char *argv[])
perror(buf);
exit(1);
}
- yyin = fp;
- yyparse();
+ conf_in = fp;
+ conf_parse();
fclose(fp);
if (process_all_regular_maps() != 0)
exit(1);
}
- /* make sure there are some default options defined */
- if (xlog_level_init == ~0) {
- switch_option("");
- }
#ifdef DEBUG
usage += switch_option("debug");
+ /* initialize debug options */
+ if (!debug_flags)
+ debug_flags = D_CONTROL; /* CONTROL = "daemon,amq,fork" */
#endif /* DEBUG */
/* log information regarding amd.conf file */
diff --git a/contrib/amd/amd/info_exec.c b/contrib/amd/amd/info_exec.c
index 8ccab9aee579..95216c90e2e9 100644
--- a/contrib/amd/amd/info_exec.c
+++ b/contrib/amd/amd/info_exec.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997-2006 Erez Zadok
+ * Copyright (c) 1997-2014 Erez Zadok
* Copyright (c) 1990 Jan-Simon Pendry
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
* Copyright (c) 1990 The Regents of the University of California.
@@ -16,11 +16,7 @@
* 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgment:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -52,8 +48,8 @@
#endif /* HAVE_CONFIG_H */
#include <am_defs.h>
#include <amd.h>
+#include <sun_map.h>
-#define MAX_LINE_LEN 1500
/* forward declarations */
int exec_init(mnt_map *m, char *map, time_t *tp);
@@ -74,13 +70,13 @@ fgets_timed(char *s, int size, int rdfd, int secs)
if (!s || size < 0 || rdfd < 0)
return 0;
- s[0] = 0;
+ s[0] = '\0';
if (size == 0)
return s;
start = clocktime(NULL);
while (s[i] != '\n' && i < size-1) {
- s[i+1] = 0; /* places the requisite trailing '\0' */
+ s[i+1] = '\0'; /* places the requisite trailing '\0' */
/* ready for reading */
rval = read(rdfd, (void *)(s+i), 1);
@@ -114,7 +110,7 @@ fgets_timed(char *s, int size, int rdfd, int secs)
FD_ZERO(&fds);
FD_SET(rdfd, &fds);
- rval = select(rdfd+1, &fds, 0, 0, &timeo);
+ rval = select(rdfd+1, &fds, NULL, NULL, &timeo);
if (rval < 0) {
/* error selecting */
plog(XLOG_WARNING, "fgets_timed select error: %m");
@@ -165,9 +161,9 @@ read_line(char *buf, int size, int fd)
* Try to locate a value in a query answer
*/
static int
-exec_parse_qanswer(int fd, char *map, char *key, char **pval, time_t *tp)
+exec_parse_qanswer(mnt_map *m, int fd, char *map, char *key, char **pval, time_t *tp)
{
- char qanswer[MAX_LINE_LEN], *dc = 0;
+ char qanswer[INFO_MAX_LINE_LEN], *dc = NULL;
int chuck = 0;
int line_no = 0;
@@ -197,7 +193,7 @@ exec_parse_qanswer(int fd, char *map, char *key, char **pval, time_t *tp)
/*
* Find beginning of value (query answer)
*/
- for (cp = qanswer; *cp && !isascii((int)*cp) && !isspace((int)*cp); cp++)
+ for (cp = qanswer; *cp && !isascii((unsigned char)*cp) && !isspace((unsigned char)*cp); cp++)
;;
/* Ignore blank lines */
@@ -207,7 +203,10 @@ exec_parse_qanswer(int fd, char *map, char *key, char **pval, time_t *tp)
/*
* Return a copy of the data
*/
- dc = strdup(cp);
+ if (m->cfm && (m->cfm->cfm_flags & CFM_SUN_MAP_SYNTAX))
+ dc = sun_entry2amd(key, cp);
+ else
+ dc = xstrdup(cp);
*pval = dc;
dlog("%s returns %s", key, dc);
@@ -324,7 +323,7 @@ exec_map_open(char *emap, char *key)
close(pdes[1]);
/* anti-zombie insurance */
- while (waitpid(p1,0,0) < 0)
+ while (waitpid(p1, 0, 0) < 0)
if (errno != EINTR)
exit(errno);
@@ -416,7 +415,7 @@ exec_search(mnt_map *m, char *map, char *key, char **pval, time_t *tp)
if (tp)
*tp = clocktime(NULL);
- return exec_parse_qanswer(mapfd, map, key, pval, tp);
+ return exec_parse_qanswer(m, mapfd, map, key, pval, tp);
}
return errno;
diff --git a/contrib/amd/amd/info_file.c b/contrib/amd/amd/info_file.c
index 3777a2aebe94..738c7bfa5776 100644
--- a/contrib/amd/amd/info_file.c
+++ b/contrib/amd/amd/info_file.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997-2006 Erez Zadok
+ * Copyright (c) 1997-2014 Erez Zadok
* Copyright (c) 1990 Jan-Simon Pendry
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
* Copyright (c) 1990 The Regents of the University of California.
@@ -16,11 +16,7 @@
* 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgment:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -50,8 +46,8 @@
#endif /* HAVE_CONFIG_H */
#include <am_defs.h>
#include <amd.h>
+#include <sun_map.h>
-#define MAX_LINE_LEN 1500
/* forward declarations */
int file_init_or_mtime(mnt_map *m, char *map, time_t *tp);
@@ -59,8 +55,8 @@ int file_reload(mnt_map *m, char *map, void (*fn) (mnt_map *, char *, char *));
int file_search(mnt_map *m, char *map, char *key, char **pval, time_t *tp);
-static int
-read_line(char *buf, int size, FILE *fp)
+int
+file_read_line(char *buf, int size, FILE *fp)
{
int done = 0;
@@ -79,7 +75,7 @@ read_line(char *buf, int size, FILE *fp)
* Skip leading white space on next line
*/
while ((ch = getc(fp)) != EOF &&
- isascii(ch) && isspace(ch)) ;
+ isascii((unsigned char)ch) && isspace((unsigned char)ch)) ;
(void) ungetc(ch, fp);
} else {
return done;
@@ -95,18 +91,18 @@ read_line(char *buf, int size, FILE *fp)
* Try to locate a key in a file
*/
static int
-file_search_or_reload(FILE *fp,
+file_search_or_reload(mnt_map *m,
+ FILE *fp,
char *map,
char *key,
char **val,
- mnt_map *m,
void (*fn) (mnt_map *m, char *, char *))
{
- char key_val[MAX_LINE_LEN];
+ char key_val[INFO_MAX_LINE_LEN];
int chuck = 0;
int line_no = 0;
- while (read_line(key_val, sizeof(key_val), fp)) {
+ while (file_read_line(key_val, sizeof(key_val), fp)) {
char *kp;
char *cp;
char *hash;
@@ -133,7 +129,7 @@ file_search_or_reload(FILE *fp,
/*
* Find start of key
*/
- for (kp = key_val; *kp && isascii(*kp) && isspace((int)*kp); kp++) ;
+ for (kp = key_val; *kp && isascii((unsigned char)*kp) && isspace((unsigned char)*kp); kp++) ;
/*
* Ignore blank lines
@@ -144,7 +140,7 @@ file_search_or_reload(FILE *fp,
/*
* Find end of key
*/
- for (cp = kp; *cp && (!isascii(*cp) || !isspace((int)*cp)); cp++) ;
+ for (cp = kp; *cp && (!isascii((unsigned char)*cp) || !isspace((unsigned char)*cp)); cp++) ;
/*
* Check whether key matches
@@ -153,15 +149,20 @@ file_search_or_reload(FILE *fp,
*cp++ = '\0';
if (fn || (*key == *kp && STREQ(key, kp))) {
- while (*cp && isascii(*cp) && isspace((int)*cp))
+ while (*cp && isascii((unsigned char)*cp) && isspace((unsigned char)*cp))
cp++;
if (*cp) {
/*
* Return a copy of the data
*/
- char *dc = strdup(cp);
+ char *dc;
+ /* if m->cfm == NULL, not using amd.conf file */
+ if (m->cfm && (m->cfm->cfm_flags & CFM_SUN_MAP_SYNTAX))
+ dc = sun_entry2amd(kp, cp);
+ else
+ dc = xstrdup(cp);
if (fn) {
- (*fn) (m, strdup(kp), dc);
+ (*fn) (m, xstrdup(kp), dc);
} else {
*val = dc;
dlog("%s returns %s", key, dc);
@@ -221,10 +222,10 @@ file_init_or_mtime(mnt_map *m, char *map, time_t *tp)
int
file_reload(mnt_map *m, char *map, void (*fn) (mnt_map *, char *, char *))
{
- FILE *mapf = file_open(map, (time_t *) 0);
+ FILE *mapf = file_open(map, (time_t *) NULL);
if (mapf) {
- int error = file_search_or_reload(mapf, map, 0, 0, m, fn);
+ int error = file_search_or_reload(m, mapf, map, NULL, NULL, fn);
(void) fclose(mapf);
return error;
}
@@ -244,7 +245,7 @@ file_search(mnt_map *m, char *map, char *key, char **pval, time_t *tp)
*tp = t;
error = -1;
} else {
- error = file_search_or_reload(mapf, map, key, pval, 0, 0);
+ error = file_search_or_reload(m, mapf, map, key, pval, NULL);
}
(void) fclose(mapf);
return error;
diff --git a/contrib/amd/amd/info_hesiod.c b/contrib/amd/amd/info_hesiod.c
index e345c9961508..0293f435a262 100644
--- a/contrib/amd/amd/info_hesiod.c
+++ b/contrib/amd/amd/info_hesiod.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997-2006 Erez Zadok
+ * Copyright (c) 1997-2014 Erez Zadok
* Copyright (c) 1989 Jan-Simon Pendry
* Copyright (c) 1989 Imperial College of Science, Technology & Medicine
* Copyright (c) 1989 The Regents of the University of California.
@@ -16,11 +16,7 @@
* 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgment:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -50,6 +46,7 @@
#endif /* HAVE_CONFIG_H */
#include <am_defs.h>
#include <amd.h>
+#include <sun_map.h>
#define HES_PREFIX "hesiod."
#define HES_PREFLEN 7
@@ -127,7 +124,11 @@ hesiod_search(mnt_map *m, char *map, char *key, char **pval, time_t *tp)
* it (and free subsequent replies)
*/
if (rvec && *rvec) {
- *pval = *rvec;
+ if (m->cfm && (m->cfm->cfm_flags & CFM_SUN_MAP_SYNTAX)) {
+ *pval = sun_entry2amd(key, *rvec);
+ XFREE(*rvec);
+ } else
+ *pval = *rvec;
while (*++rvec)
XFREE(*rvec);
return 0;
diff --git a/contrib/amd/amd/info_ldap.c b/contrib/amd/amd/info_ldap.c
index 36ce1c8693d3..cfed6fd773d7 100644
--- a/contrib/amd/amd/info_ldap.c
+++ b/contrib/amd/amd/info_ldap.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997-2006 Erez Zadok
+ * Copyright (c) 1997-2014 Erez Zadok
* Copyright (c) 1989 Jan-Simon Pendry
* Copyright (c) 1989 Imperial College of Science, Technology & Medicine
* Copyright (c) 1989 The Regents of the University of California.
@@ -16,11 +16,7 @@
* 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgment:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -66,6 +62,7 @@
#endif /* HAVE_CONFIG_H */
#include <am_defs.h>
#include <amd.h>
+#include <sun_map.h>
/*
@@ -118,12 +115,17 @@ struct he_ent {
struct he_ent *next;
};
+static ALD *ldap_connection;
+
/*
* FORWARD DECLARATIONS:
*/
static int amu_ldap_rebind(ALD *a);
static int get_ldap_timestamp(ALD *a, char *map, time_t *ts);
+int amu_ldap_init(mnt_map *m, char *map, time_t *tsu);
+int amu_ldap_search(mnt_map *m, char *map, char *key, char **pval, time_t *ts);
+int amu_ldap_mtime(mnt_map *m, char *map, time_t *ts);
/*
* FUNCTIONS:
@@ -144,30 +146,33 @@ string2he(char *s_orig)
{
char *c, *p;
char *s;
- HE_ENT *new, *old = NULL;
+ HE_ENT *first = NULL, *cur = NULL;
- if (NULL == s_orig || NULL == (s = strdup(s_orig)))
+ if (NULL == s_orig)
return NULL;
- for (p = s; p; p = strchr(p, ',')) {
- if (old != NULL) {
- new = ALLOC(HE_ENT);
- old->next = new;
- old = new;
- } else {
- old = ALLOC(HE_ENT);
- old->next = NULL;
- }
+ s = xstrdup(s_orig);
+ for (p = strtok(s, ","); p; p = strtok(NULL, ",")) {
+ if (cur != NULL) {
+ cur->next = ALLOC(HE_ENT);
+ cur = cur->next;
+ } else
+ first = cur = ALLOC(HE_ENT);
+
+ cur->next = NULL;
c = strchr(p, ':');
if (c) { /* Host and port */
*c++ = '\0';
- old->host = strdup(p);
- old->port = atoi(c);
- } else
- old->host = strdup(p);
-
+ cur->host = xstrdup(p);
+ cur->port = atoi(c);
+ } else {
+ cur->host = xstrdup(p);
+ cur->port = LDAP_PORT;
+ }
+ plog(XLOG_USER, "Adding ldap server %s:%d",
+ cur->host, cur->port);
}
XFREE(s);
- return (old);
+ return first;
}
@@ -248,10 +253,18 @@ amu_ldap_init(mnt_map *m, char *map, time_t *ts)
if (!gopt.map_type || !STREQ(gopt.map_type, AMD_LDAP_TYPE)) {
dlog("amu_ldap_init called with map_type <%s>\n",
(gopt.map_type ? gopt.map_type : "null"));
+ return ENOENT;
} else {
dlog("Map %s is ldap\n", map);
}
+#ifndef LDAP_CONNECTION_PER_MAP
+ if (ldap_connection != NULL) {
+ m->map_data = (void *) ldap_connection;
+ return 0;
+ }
+#endif
+
aldh = ALLOC(ALD);
creds = ALLOC(CR);
aldh->ldap = NULL;
@@ -274,11 +287,14 @@ amu_ldap_init(mnt_map *m, char *map, time_t *ts)
ald_free(aldh);
return (ENOENT);
}
- m->map_data = (void *) aldh;
dlog("Bound to %s:%d\n", aldh->hostent->host, aldh->hostent->port);
- if (get_ldap_timestamp(aldh, map, ts))
+ if (get_ldap_timestamp(aldh, map, ts)) {
+ ald_free(aldh);
return (ENOENT);
+ }
dlog("Got timestamp for map %s: %ld\n", map, (u_long) *ts);
+ ldap_connection = aldh;
+ m->map_data = (void *) ldap_connection;
return (0);
}
@@ -312,7 +328,7 @@ amu_ldap_rebind(ALD *a)
for (h = a->hostent; h != NULL; h = h->next) {
if ((ld = ldap_open(h->host, h->port)) == NULL) {
plog(XLOG_WARNING, "Unable to ldap_open to %s:%d\n", h->host, h->port);
- break;
+ continue;
}
#if LDAP_VERSION_MAX > LDAP_VERSION2
/* handle LDAPv3 and heigher, if available and amd.conf-igured */
@@ -321,16 +337,16 @@ amu_ldap_rebind(ALD *a)
dlog("amu_ldap_rebind: LDAP protocol version set to %ld\n",
gopt.ldap_proto_version);
} else {
- plog(XLOG_WARNING, "Unable to set ldap protocol version to %ld\n",
- gopt.ldap_proto_version);
- break;
+ plog(XLOG_WARNING, "Unable to set ldap protocol version to %ld for "
+ "%s:%d\n", gopt.ldap_proto_version, h->host, h->port);
+ continue;
}
}
#endif /* LDAP_VERSION_MAX > LDAP_VERSION2 */
if (ldap_bind_s(ld, c->who, c->pw, c->method) != LDAP_SUCCESS) {
plog(XLOG_WARNING, "Unable to ldap_bind to %s:%d as %s\n",
h->host, h->port, c->who);
- break;
+ continue;
}
if (gopt.ldap_cache_seconds > 0) {
#if defined(HAVE_LDAP_ENABLE_CACHE) && defined(HAVE_EXTERN_LDAP_ENABLE_CACHE)
@@ -541,7 +557,10 @@ amu_ldap_search(mnt_map *m, char *map, char *key, char **pval, time_t *ts)
}
dlog("Map %s, %s => %s\n", map, key, vals[0]);
if (vals[0]) {
- *pval = strdup(vals[0]);
+ if (m->cfm && (m->cfm->cfm_flags & CFM_SUN_MAP_SYNTAX))
+ *pval = sun_entry2amd(key, vals[0]);
+ else
+ *pval = xstrdup(vals[0]);
err = 0;
} else {
plog(XLOG_USER, "Empty value for %s in map %s\n", key, map);
diff --git a/contrib/amd/amd/info_ndbm.c b/contrib/amd/amd/info_ndbm.c
index 8a52ba9e201d..5f2f52b5330e 100644
--- a/contrib/amd/amd/info_ndbm.c
+++ b/contrib/amd/amd/info_ndbm.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997-2006 Erez Zadok
+ * Copyright (c) 1997-2014 Erez Zadok
* Copyright (c) 1989 Jan-Simon Pendry
* Copyright (c) 1989 Imperial College of Science, Technology & Medicine
* Copyright (c) 1989 The Regents of the University of California.
@@ -16,11 +16,7 @@
* 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgment:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -50,6 +46,7 @@
#endif /* HAVE_CONFIG_H */
#include <am_defs.h>
#include <amd.h>
+#include <sun_map.h>
/* forward declarations */
int ndbm_init(mnt_map *m, char *map, time_t *tp);
@@ -58,7 +55,7 @@ int ndbm_search(mnt_map *m, char *map, char *key, char **pval, time_t *tp);
static int
-search_ndbm(DBM *db, char *key, char **val)
+search_ndbm(mnt_map *m, DBM *db, char *key, char **val)
{
datum k, v;
@@ -66,7 +63,10 @@ search_ndbm(DBM *db, char *key, char **val)
k.dsize = strlen(key) + 1;
v = dbm_fetch(db, k);
if (v.dptr) {
- *val = strdup(v.dptr);
+ if (m->cfm && (m->cfm->cfm_flags & CFM_SUN_MAP_SYNTAX))
+ *val = sun_entry2amd(key, v.dptr);
+ else
+ *val = xstrdup(v.dptr);
return 0;
}
return ENOENT;
@@ -95,7 +95,7 @@ ndbm_search(mnt_map *m, char *map, char *key, char **pval, time_t *tp)
*tp = stb.st_mtime;
error = -1;
} else {
- error = search_ndbm(db, key, pval);
+ error = search_ndbm(m, db, key, pval);
}
(void) dbm_close(db);
return error;
diff --git a/contrib/amd/amd/info_nis.c b/contrib/amd/amd/info_nis.c
index bcb87d5d02aa..83dc4b7a84fc 100644
--- a/contrib/amd/amd/info_nis.c
+++ b/contrib/amd/amd/info_nis.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997-2006 Erez Zadok
+ * Copyright (c) 1997-2014 Erez Zadok
* Copyright (c) 1989 Jan-Simon Pendry
* Copyright (c) 1989 Imperial College of Science, Technology & Medicine
* Copyright (c) 1989 The Regents of the University of California.
@@ -16,11 +16,7 @@
* 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgment:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -50,6 +46,7 @@
#endif /* HAVE_CONFIG_H */
#include <am_defs.h>
#include <amd.h>
+#include <sun_map.h>
/*
@@ -109,7 +106,7 @@ determine_nis_domain(void)
plog(XLOG_WARNING, "NIS domain name is not set. NIS ignored.");
return ENOENT;
}
- gopt.nis_domain = strdup(default_domain);
+ gopt.nis_domain = xstrdup(default_domain);
return 0;
}
@@ -167,6 +164,7 @@ nis_reload(mnt_map *m, char *map, void (*fn) (mnt_map *, char *, char *))
cbinfo.data = (voidp) &data;
cbinfo.foreach = (ypall_callback_fxn_t) callback;
+ plog(XLOG_INFO, "NIS map %s reloading using yp_all", map);
/*
* If you are using NIS and your yp_all function is "broken", you have to
* get it fixed. The bug in yp_all() is that it does not close a TCP
@@ -247,7 +245,7 @@ nis_isup(mnt_map *m, char *map)
* Try to locate a key using NIS.
*/
int
-nis_search(mnt_map *m, char *map, char *key, char **val, time_t *tp)
+nis_search(mnt_map *m, char *map, char *key, char **pval, time_t *tp)
{
int outlen;
int res;
@@ -301,7 +299,15 @@ nis_search(mnt_map *m, char *map, char *key, char **val, time_t *tp)
/*
* Lookup key
*/
- res = yp_match(gopt.nis_domain, map, key, strlen(key), val, &outlen);
+ res = yp_match(gopt.nis_domain, map, key, strlen(key), pval, &outlen);
+ if (m->cfm && (m->cfm->cfm_flags & CFM_SUN_MAP_SYNTAX) && res == 0) {
+ char *oldval = *pval;
+ *pval = sun_entry2amd(key, oldval);
+ /* We always need to free the output of the yp_match call. */
+ XFREE(oldval);
+ if (*pval == NULL)
+ return -1; /* sun2amd parser error */
+ }
/*
* Do something interesting with the return code
diff --git a/contrib/amd/amd/info_nisplus.c b/contrib/amd/amd/info_nisplus.c
index d392b48fed6a..79df83614700 100644
--- a/contrib/amd/amd/info_nisplus.c
+++ b/contrib/amd/amd/info_nisplus.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997-2006 Erez Zadok
+ * Copyright (c) 1997-2014 Erez Zadok
* Copyright (c) 1989 Jan-Simon Pendry
* Copyright (c) 1989 Imperial College of Science, Technology & Medicine
* Copyright (c) 1989 The Regents of the University of California.
@@ -16,11 +16,7 @@
* 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgment:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -50,6 +46,7 @@
#endif /* HAVE_CONFIG_H */
#include <am_defs.h>
#include <amd.h>
+#include <sun_map.h>
#define NISPLUS_KEY "key="
#define NISPLUS_ORGDIR ".org_dir"
@@ -221,7 +218,12 @@ nisplus_search(mnt_map *m, char *map, char *key, char **val, time_t *tp)
if (value != NULL)
data.value = strnsave(ENTRY_VAL(value, 1), ENTRY_LEN(value, 1));
}
- *val = data.value;
+
+ if (m->cfm && (m->cfm->cfm_flags & CFM_SUN_MAP_SYNTAX)) {
+ *val = sun_entry2amd(key, data.value);
+ XFREE(data.value); /* strnsave malloc'ed it above */
+ } else
+ *val = data.value;
if (*val) {
error = 0;
diff --git a/contrib/amd/amd/info_passwd.c b/contrib/amd/amd/info_passwd.c
index c8bf388b1d65..3c4486693c60 100644
--- a/contrib/amd/amd/info_passwd.c
+++ b/contrib/amd/amd/info_passwd.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997-2006 Erez Zadok
+ * Copyright (c) 1997-2014 Erez Zadok
* Copyright (c) 1990 Jan-Simon Pendry
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
* Copyright (c) 1990 The Regents of the University of California.
@@ -16,11 +16,7 @@
* 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgment:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -94,11 +90,11 @@ passwd_init(mnt_map *m, char *map, time_t *tp)
int
passwd_search(mnt_map *m, char *map, char *key, char **pval, time_t *tp)
{
- char *dir = 0;
+ char *dir = NULL;
struct passwd *pw;
if (STREQ(key, "/defaults")) {
- *pval = strdup("type:=nfs");
+ *pval = xstrdup("type:=nfs");
return 0;
}
pw = getpwnam(key);
@@ -123,7 +119,7 @@ passwd_search(mnt_map *m, char *map, char *key, char **pval, time_t *tp)
char *p, *q;
char val[MAXPATHLEN];
char rhost[MAXHOSTNAMELEN];
- dir = strdup(pw->pw_dir);
+ dir = xstrdup(pw->pw_dir);
/*
* Find user name. If no / then Invalid...
@@ -180,13 +176,12 @@ passwd_search(mnt_map *m, char *map, char *key, char **pval, time_t *tp)
dlog("passwd_search: map=%s key=%s -> %s", map, key, val);
if (q)
*q = '.';
- *pval = strdup(val);
+ *pval = xstrdup(val);
return 0;
}
enoent:
- if (dir)
- XFREE(dir);
+ XFREE(dir);
return ENOENT;
}
diff --git a/contrib/amd/amd/info_sun.c b/contrib/amd/amd/info_sun.c
new file mode 100644
index 000000000000..3f56965ff747
--- /dev/null
+++ b/contrib/amd/amd/info_sun.c
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 1997-2014 Erez Zadok
+ * Copyright (c) 1990 Jan-Simon Pendry
+ * Copyright (c) 1990 Imperial College of Science, Technology & Medicine
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Jan-Simon Pendry at Imperial College, London.
+ *
+ * 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 the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
+ *
+ *
+ * File: am-utils/amd/info_sun.c
+ *
+ */
+
+/*
+ * Get info from Sun automount-style /etc/auto_master, possibly following
+ * into multiple info services (via /etc/nsswitch.conf).
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif /* HAVE_CONFIG_H */
+#include <am_defs.h>
+#include <amd.h>
+#include <sun_map.h>
+
+
+/* XXX: just a placeholder. fill in */
diff --git a/contrib/amd/amd/info_union.c b/contrib/amd/amd/info_union.c
index 8f0631c64ac9..df480317bddf 100644
--- a/contrib/amd/amd/info_union.c
+++ b/contrib/amd/amd/info_union.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997-2006 Erez Zadok
+ * Copyright (c) 1997-2014 Erez Zadok
* Copyright (c) 1990 Jan-Simon Pendry
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
* Copyright (c) 1990 The Regents of the University of California.
@@ -16,11 +16,7 @@
* 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgment:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -77,7 +73,7 @@ union_init(mnt_map *m, char *map, time_t *tp)
int
union_search(mnt_map *m, char *map, char *key, char **pval, time_t *tp)
{
- char *mapd = strdup(map + UNION_PREFLEN);
+ char *mapd = xstrdup(map + UNION_PREFLEN);
char **v = strsplit(mapd, ':', '\"');
char **p;
size_t l;
@@ -95,14 +91,15 @@ union_search(mnt_map *m, char *map, char *key, char **pval, time_t *tp)
int
union_reload(mnt_map *m, char *map, void (*fn) (mnt_map *, char *, char *))
{
- char *mapd = strdup(map + UNION_PREFLEN);
+ static const char fseq[] = "fs:=";
+ char *mapd = xstrdup(map + UNION_PREFLEN);
char **v = strsplit(mapd, ':', '\"');
char **dir;
/*
* Add fake /defaults entry
*/
- (*fn) (m, strdup("/defaults"), strdup("type:=link;opts:=nounmount;sublink:=${key}"));
+ (*fn) (m, xstrdup("/defaults"), xstrdup("type:=link;opts:=nounmount;sublink:=${key}"));
for (dir = v; *dir; dir++) {
size_t l;
@@ -113,7 +110,7 @@ union_reload(mnt_map *m, char *map, void (*fn) (mnt_map *, char *, char *))
plog(XLOG_USER, "Cannot read directory %s: %m", *dir);
continue;
}
- l = strlen(*dir) + 5;
+ l = strlen(*dir) + sizeof(fseq);
dlog("Reading directory %s...", *dir);
while ((dp = readdir(dirp))) {
@@ -125,8 +122,8 @@ union_reload(mnt_map *m, char *map, void (*fn) (mnt_map *, char *, char *))
dlog("... gives %s", dp->d_name);
val = xmalloc(l);
- xsnprintf(val, l + 5, "fs:=%s", *dir);
- (*fn) (m, strdup(dp->d_name), val);
+ xsnprintf(val, l, "%s%s", fseq, *dir);
+ (*fn) (m, xstrdup(dp->d_name), val);
}
closedir(dirp);
}
@@ -135,11 +132,11 @@ union_reload(mnt_map *m, char *map, void (*fn) (mnt_map *, char *, char *))
* Add wildcard entry
*/
{
- size_t l = strlen(*(dir-1)) + 5;
+ size_t l = strlen(*(dir-1)) + sizeof(fseq);
char *val = xmalloc(l);
- xsnprintf(val, l, "fs:=%s", *(dir-1));
- (*fn) (m, strdup("*"), val);
+ xsnprintf(val, l, "%s%s", fseq, *(dir-1));
+ (*fn) (m, xstrdup("*"), val);
}
XFREE(mapd);
XFREE(v);
diff --git a/contrib/amd/amd/map.c b/contrib/amd/amd/map.c
index 8696dfd6984d..0d404cfdbd66 100644
--- a/contrib/amd/amd/map.c
+++ b/contrib/amd/amd/map.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997-2006 Erez Zadok
+ * Copyright (c) 1997-2014 Erez Zadok
* Copyright (c) 1990 Jan-Simon Pendry
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
* Copyright (c) 1990 The Regents of the University of California.
@@ -16,11 +16,7 @@
* 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgment:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -69,7 +65,7 @@ static u_int am_gen = 2; /* Initial generation number */
static int timeout_mp_id; /* Id from last call to timeout */
static am_node *root_node; /* The root of the mount tree */
-static am_node **exported_ap = (am_node **) 0;
+static am_node **exported_ap = (am_node **) NULL;
static int exported_ap_size = 0;
static int first_free_map = 0; /* First available free slot */
static int last_used_map = -1; /* Last unavailable used slot */
@@ -190,7 +186,7 @@ am_node *
get_ap_child(am_node *mp, char *fname)
{
am_node *new_mp;
- mntfs *mf = mp->am_mnt;
+ mntfs *mf = mp->am_al->al_mnt;
/*
* Allocate a new map
@@ -280,7 +276,7 @@ exported_ap_free(am_node *mp)
/*
* Zero the slot pointer to avoid double free's
*/
- exported_ap[mp->am_mapno] = 0;
+ exported_ap[mp->am_mapno] = NULL;
/*
* Update the free and last_used indices
@@ -325,7 +321,7 @@ insert_am(am_node *mp, am_node *p_mp)
mp->am_osib->am_ysib = mp;
p_mp->am_child = mp;
#ifdef HAVE_FS_AUTOFS
- if (p_mp->am_mnt->mf_flags & MFF_IS_AUTOFS)
+ if (p_mp->am_al->al_mnt->mf_flags & MFF_IS_AUTOFS)
mp->am_flags |= AMF_AUTOFS;
#endif /* HAVE_FS_AUTOFS */
}
@@ -408,13 +404,14 @@ init_map(am_node *mp, char *dir)
* mp->am_mapno is initialized by exported_ap_alloc
* other fields don't need to be set to zero.
*/
- mp->am_mnt = new_mntfs();
- mp->am_mfarray = 0;
- mp->am_name = strdup(dir);
- mp->am_path = strdup(dir);
+
+ mp->am_al = new_loc();
+ mp->am_alarray = NULL;
+ mp->am_name = xstrdup(dir);
+ mp->am_path = xstrdup(dir);
mp->am_gen = new_gen();
#ifdef HAVE_FS_AUTOFS
- mp->am_autofs_fh = 0;
+ mp->am_autofs_fh = NULL;
#endif /* HAVE_FS_AUTOFS */
mp->am_timeo = gopt.am_timeo;
@@ -430,6 +427,30 @@ init_map(am_node *mp, char *dir)
mp->am_stats.s_mtime = mp->am_fattr.na_atime.nt_seconds;
mp->am_dev = -1;
mp->am_rdev = -1;
+ mp->am_fd[0] = -1;
+ mp->am_fd[1] = -1;
+}
+
+
+void
+notify_child(am_node *mp, au_etype au_etype, int au_errno, int au_signal)
+{
+ amq_sync_umnt rv;
+ int err;
+
+ if (mp->am_fd[1] >= 0) { /* we have a child process */
+ rv.au_etype = au_etype;
+ rv.au_signal = au_signal;
+ rv.au_errno = au_errno;
+
+ err = write(mp->am_fd[1], &rv, sizeof(rv));
+ /* XXX: do something else on err? */
+ if (err < sizeof(rv))
+ plog(XLOG_INFO, "notify_child: write returned %d instead of %d.",
+ err, (int) sizeof(rv));
+ close(mp->am_fd[1]);
+ mp->am_fd[1] = -1;
+ }
}
@@ -442,25 +463,24 @@ free_map(am_node *mp)
{
remove_am(mp);
- if (mp->am_link)
- XFREE(mp->am_link);
- if (mp->am_name)
- XFREE(mp->am_name);
- if (mp->am_path)
- XFREE(mp->am_path);
- if (mp->am_pref)
- XFREE(mp->am_pref);
- if (mp->am_transp)
- XFREE(mp->am_transp);
-
- if (mp->am_mnt)
- free_mntfs(mp->am_mnt);
-
- if (mp->am_mfarray) {
- mntfs **temp_mf;
- for (temp_mf = mp->am_mfarray; *temp_mf; temp_mf++)
- free_mntfs(*temp_mf);
- XFREE(mp->am_mfarray);
+ if (mp->am_fd[1] != -1)
+ plog(XLOG_FATAL, "free_map: called prior to notifying the child for %s.",
+ mp->am_path);
+
+ XFREE(mp->am_link);
+ XFREE(mp->am_name);
+ XFREE(mp->am_path);
+ XFREE(mp->am_pref);
+ XFREE(mp->am_transp);
+
+ if (mp->am_al)
+ free_loc(mp->am_al);
+
+ if (mp->am_alarray) {
+ am_loc **temp_al;
+ for (temp_al = mp->am_alarray; *temp_al; temp_al++)
+ free_loc(*temp_al);
+ XFREE(mp->am_alarray);
}
#ifdef HAVE_FS_AUTOFS
@@ -480,8 +500,8 @@ find_ap_recursive(char *dir, am_node *mp)
if (STREQ(mp->am_path, dir))
return mp;
- if ((mp->am_mnt->mf_flags & MFF_MOUNTED) &&
- STREQ(mp->am_mnt->mf_mount, dir))
+ if ((mp->am_al->al_mnt->mf_flags & MFF_MOUNTED) &&
+ STREQ(mp->am_al->al_mnt->mf_mount, dir))
return mp;
mp2 = find_ap_recursive(dir, mp->am_osib);
@@ -518,37 +538,20 @@ find_ap(char *dir)
/*
- * Find the mount node corresponding
- * to the mntfs structure.
- */
-am_node *
-find_mf(mntfs *mf)
-{
- int i;
-
- for (i = last_used_map; i >= 0; --i) {
- am_node *mp = exported_ap[i];
- if (mp && mp->am_mnt == mf)
- return mp;
- }
-
- return 0;
-}
-
-
-/*
* Get the filehandle for a particular named directory.
* This is used during the bootstrap to tell the kernel
* the filehandles of the initial automount points.
*/
-am_nfs_fh *
-get_root_nfs_fh(char *dir)
+am_nfs_handle_t *
+get_root_nfs_fh(char *dir, am_nfs_handle_t *nfh)
{
- static am_nfs_fh nfh;
am_node *mp = get_root_ap(dir);
if (mp) {
- mp_to_fh(mp, &nfh);
- return &nfh;
+ if (nfs_dispatcher == nfs_program_2)
+ mp_to_fh(mp, &nfh->v2);
+ else
+ mp_to_fh3(mp, &nfh->v3);
+ return nfh;
}
/*
@@ -584,7 +587,8 @@ map_flush_srvr(fserver *fs)
for (i = last_used_map; i >= 0; --i) {
am_node *mp = exported_ap[i];
- if (mp && mp->am_mnt && mp->am_mnt->mf_server == fs) {
+
+ if (mp && mp->am_al->al_mnt && mp->am_al->al_mnt->mf_server == fs) {
plog(XLOG_INFO, "Flushed %s; dependent on %s", mp->am_path, fs->fs_host);
mp->am_ttl = clocktime(NULL);
done = 1;
@@ -608,7 +612,7 @@ mount_auto_node(char *dir, opaque_t arg)
am_node *mp = (am_node *) arg;
am_node *new_mp;
- new_mp = mp->am_mnt->mf_ops->lookup_child(mp, dir, &error, VLOOK_CREATE);
+ new_mp = mp->am_al->al_mnt->mf_ops->lookup_child(mp, dir, &error, VLOOK_CREATE);
if (new_mp && error < 0) {
/*
* We can't allow the fileid of the root node to change.
@@ -616,7 +620,7 @@ mount_auto_node(char *dir, opaque_t arg)
*/
new_mp->am_gen = new_mp->am_fattr.na_fileid = 1;
- new_mp = mp->am_mnt->mf_ops->mount_child(new_mp, &error);
+ (void) mp->am_al->al_mnt->mf_ops->mount_child(new_mp, &error);
}
if (error > 0) {
@@ -647,7 +651,7 @@ mount_exported(void)
void
make_root_node(void)
{
- mntfs *root_mnt;
+ mntfs *root_mf;
char *rootmap = ROOT_MAP;
root_node = exported_ap_alloc();
@@ -659,24 +663,24 @@ make_root_node(void)
/*
* Allocate a new mounted filesystem
*/
- root_mnt = find_mntfs(&amfs_root_ops, (am_opts *) 0, "", rootmap, "", "", "");
+ root_mf = find_mntfs(&amfs_root_ops, (am_opts *) NULL, "", rootmap, "", "", "");
/*
* Replace the initial null reference
*/
- free_mntfs(root_node->am_mnt);
- root_node->am_mnt = root_mnt;
+ free_mntfs(root_node->am_al->al_mnt);
+ root_node->am_al->al_mnt = root_mf;
/*
* Initialize the root
*/
- if (root_mnt->mf_ops->fs_init)
- (*root_mnt->mf_ops->fs_init) (root_mnt);
+ if (root_mf->mf_ops->fs_init)
+ (*root_mf->mf_ops->fs_init) (root_mf);
/*
* Mount the root
*/
- root_mnt->mf_error = root_mnt->mf_ops->mount_fs(root_node, root_mnt);
+ root_mf->mf_error = root_mf->mf_ops->mount_fs(root_node, root_mf);
}
@@ -687,68 +691,81 @@ make_root_node(void)
void
umount_exported(void)
{
- int i;
+ int i, work_done;
- for (i = last_used_map; i >= 0; --i) {
- am_node *mp = exported_ap[i];
- mntfs *mf;
+ do {
+ work_done = 0;
- if (!mp)
- continue;
+ for (i = last_used_map; i >= 0; --i) {
+ am_node *mp = exported_ap[i];
+ mntfs *mf;
- mf = mp->am_mnt;
- if (mf->mf_flags & MFF_UNMOUNTING) {
- /*
- * If this node is being unmounted then just ignore it. However,
- * this could prevent amd from finishing if the unmount gets blocked
- * since the am_node will never be free'd. am_unmounted needs
- * telling about this possibility. - XXX
- */
- continue;
- }
+ if (!mp)
+ continue;
- if (!(mf->mf_fsflags & FS_DIRECTORY))
/*
- * When shutting down this had better
- * look like a directory, otherwise it
- * can't be unmounted!
+ * Wait for children to be removed first
*/
- mk_fattr(&mp->am_fattr, NFDIR);
+ if (mp->am_child)
+ continue;
- if ((--immediate_abort < 0 &&
- !(mp->am_flags & AMF_ROOT) && mp->am_parent) ||
- (mf->mf_flags & MFF_RESTART)) {
+ mf = mp->am_al->al_mnt;
+ if (mf->mf_flags & MFF_UNMOUNTING) {
+ /*
+ * If this node is being unmounted then just ignore it. However,
+ * this could prevent amd from finishing if the unmount gets blocked
+ * since the am_node will never be free'd. am_unmounted needs
+ * telling about this possibility. - XXX
+ */
+ continue;
+ }
+
+ if (!(mf->mf_fsflags & FS_DIRECTORY))
+ /*
+ * When shutting down this had better
+ * look like a directory, otherwise it
+ * can't be unmounted!
+ */
+ mk_fattr(&mp->am_fattr, NFDIR);
+
+ if ((--immediate_abort < 0 &&
+ !(mp->am_flags & AMF_ROOT) && mp->am_parent) ||
+ (mf->mf_flags & MFF_RESTART)) {
+
+ work_done++;
- /*
- * Just throw this node away without bothering to unmount it. If
- * the server is not known to be up then don't discard the mounted
- * on directory or Amd might hang...
- */
- if (mf->mf_server &&
- (mf->mf_server->fs_flags & (FSF_DOWN | FSF_VALID)) != FSF_VALID)
- mf->mf_flags &= ~MFF_MKMNT;
- if (gopt.flags & CFM_UNMOUNT_ON_EXIT || mp->am_flags & AMF_AUTOFS) {
- plog(XLOG_INFO, "on-exit attempt to unmount %s", mf->mf_mount);
/*
- * use unmount_mp, not unmount_node, so that unmounts be
- * backgrounded as needed.
+ * Just throw this node away without bothering to unmount it. If
+ * the server is not known to be up then don't discard the mounted
+ * on directory or Amd might hang...
*/
- unmount_mp((opaque_t) mp);
+ if (mf->mf_server &&
+ (mf->mf_server->fs_flags & (FSF_DOWN | FSF_VALID)) != FSF_VALID)
+ mf->mf_flags &= ~MFF_MKMNT;
+ if (gopt.flags & CFM_UNMOUNT_ON_EXIT || mp->am_flags & AMF_AUTOFS) {
+ plog(XLOG_INFO, "on-exit attempt to unmount %s", mf->mf_mount);
+ /*
+ * use unmount_mp, not unmount_node, so that unmounts be
+ * backgrounded as needed.
+ */
+ unmount_mp((opaque_t) mp);
+ } else {
+ am_unmounted(mp);
+ }
+ if (!(mf->mf_flags & (MFF_UNMOUNTING|MFF_MOUNTED)))
+ exported_ap[i] = NULL;
} else {
- am_unmounted(mp);
+ /*
+ * Any other node gets forcibly timed out.
+ */
+ mp->am_flags &= ~AMF_NOTIMEOUT;
+ mp->am_al->al_mnt->mf_flags &= ~MFF_RSTKEEP;
+ mp->am_ttl = 0;
+ mp->am_timeo = 1;
+ mp->am_timeo_w = 0;
}
- exported_ap[i] = 0;
- } else {
- /*
- * Any other node gets forcibly timed out.
- */
- mp->am_flags &= ~AMF_NOTIMEOUT;
- mp->am_mnt->mf_flags &= ~MFF_RSTKEEP;
- mp->am_ttl = 0;
- mp->am_timeo = 1;
- mp->am_timeo_w = 0;
}
- }
+ } while (work_done);
}
@@ -762,7 +779,7 @@ int
mount_node(opaque_t arg)
{
am_node *mp = (am_node *) arg;
- mntfs *mf = mp->am_mnt;
+ mntfs *mf = mp->am_al->al_mnt;
int error = 0;
#ifdef HAVE_FS_AUTOFS
@@ -784,7 +801,7 @@ static int
unmount_node(opaque_t arg)
{
am_node *mp = (am_node *) arg;
- mntfs *mf = mp->am_mnt;
+ mntfs *mf = mp->am_al->al_mnt;
int error = 0;
if (mf->mf_flags & MFF_ERROR) {
@@ -805,7 +822,7 @@ unmount_node(opaque_t arg)
}
/* do this again, it might have changed */
- mf = mp->am_mnt;
+ mf = mp->am_al->al_mnt;
if (error) {
errno = error; /* XXX */
dlog("%s: unmount: %m", mf->mf_mount);
@@ -819,7 +836,7 @@ static void
free_map_if_success(int rc, int term, opaque_t arg)
{
am_node *mp = (am_node *) arg;
- mntfs *mf = mp->am_mnt;
+ mntfs *mf = mp->am_al->al_mnt;
wchan_t wchan = get_mntfs_wchan(mf);
/*
@@ -836,6 +853,7 @@ free_map_if_success(int rc, int term, opaque_t arg)
reschedule_timeout_mp();
}
if (term) {
+ notify_child(mp, AMQ_UMNT_SIGNAL, 0, term);
plog(XLOG_ERROR, "unmount for %s got signal %d", mp->am_path, term);
#if defined(DEBUG) && defined(SIGTRAP)
/*
@@ -852,18 +870,24 @@ free_map_if_success(int rc, int term, opaque_t arg)
#endif /* HAVE_FS_AUTOFS */
amd_stats.d_uerr++;
} else if (rc) {
+ notify_child(mp, AMQ_UMNT_FAILED, rc, 0);
if (mf->mf_ops == &amfs_program_ops || rc == EBUSY)
plog(XLOG_STATS, "\"%s\" on %s still active", mp->am_path, mf->mf_mount);
else
plog(XLOG_ERROR, "%s: unmount: %s", mp->am_path, strerror(rc));
#ifdef HAVE_FS_AUTOFS
- if (mf->mf_flags & MFF_IS_AUTOFS)
- autofs_get_mp(mp);
- if (mp->am_flags & AMF_AUTOFS)
- autofs_umount_failed(mp);
+ if (rc != ENOENT) {
+ if (mf->mf_flags & MFF_IS_AUTOFS)
+ autofs_get_mp(mp);
+ if (mp->am_flags & AMF_AUTOFS)
+ autofs_umount_failed(mp);
+ }
#endif /* HAVE_FS_AUTOFS */
amd_stats.d_uerr++;
} else {
+ /*
+ * am_unmounted() will call notify_child() appropriately.
+ */
am_unmounted(mp);
}
@@ -878,11 +902,11 @@ int
unmount_mp(am_node *mp)
{
int was_backgrounded = 0;
- mntfs *mf = mp->am_mnt;
+ mntfs *mf = mp->am_al->al_mnt;
#ifdef notdef
plog(XLOG_INFO, "\"%s\" on %s timed out (flags 0x%x)",
- mp->am_path, mp->am_mnt->mf_mount, (int) mf->mf_flags);
+ mp->am_path, mf->mf_mount, (int) mf->mf_flags);
#endif /* notdef */
#ifndef MNT2_NFS_OPT_SYMTTL
@@ -914,10 +938,11 @@ unmount_mp(am_node *mp)
plog(XLOG_STATS, "file server %s is down - timeout of \"%s\" ignored", mf->mf_server->fs_host, mp->am_path);
mf->mf_flags |= MFF_LOGDOWN;
}
+ notify_child(mp, AMQ_UMNT_SERVER, 0, 0);
return 0;
}
- dlog("\"%s\" on %s timed out", mp->am_path, mp->am_mnt->mf_mount);
+ dlog("\"%s\" on %s timed out", mp->am_path, mf->mf_mount);
mf->mf_flags |= MFF_UNMOUNTING;
#ifdef HAVE_FS_AUTOFS
@@ -926,7 +951,8 @@ unmount_mp(am_node *mp)
#endif /* HAVE_FS_AUTOFS */
if ((mf->mf_fsflags & FS_UBACKGROUND) &&
- (mf->mf_flags & MFF_MOUNTED)) {
+ (mf->mf_flags & MFF_MOUNTED) &&
+ !(mf->mf_flags & MFF_ON_AUTOFS)) {
dlog("Trying unmount in background");
run_task(unmount_node, (opaque_t) mp,
free_map_if_success, (opaque_t) mp);
@@ -964,7 +990,7 @@ timeout_mp(opaque_t v) /* argument not used?! */
/*
* Pick up mounted filesystem
*/
- mf = mp->am_mnt;
+ mf = mp->am_al->al_mnt;
if (!mf)
continue;
@@ -1056,7 +1082,7 @@ timeout_mp(opaque_t v) /* argument not used?! */
t = now + 1;
dlog("Next mount timeout in %lds", (long) (t - now));
- timeout_mp_id = timeout(t - now, timeout_mp, 0);
+ timeout_mp_id = timeout(t - now, timeout_mp, NULL);
}
@@ -1068,5 +1094,5 @@ reschedule_timeout_mp(void)
{
if (timeout_mp_id)
untimeout(timeout_mp_id);
- timeout_mp_id = timeout(0, timeout_mp, 0);
+ timeout_mp_id = timeout(0, timeout_mp, NULL);
}
diff --git a/contrib/amd/amd/mapc.c b/contrib/amd/amd/mapc.c
index d7efdbcfd217..cd4b9b956a05 100644
--- a/contrib/amd/amd/mapc.c
+++ b/contrib/amd/amd/mapc.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997-2006 Erez Zadok
+ * Copyright (c) 1997-2014 Erez Zadok
* Copyright (c) 1989 Jan-Simon Pendry
* Copyright (c) 1989 Imperial College of Science, Technology & Medicine
* Copyright (c) 1989 The Regents of the University of California.
@@ -16,11 +16,7 @@
* 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgment:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -96,7 +92,7 @@ static struct opt_tab mapc_opt[] =
{"regexp", MAPC_RE},
#endif /* HAVE_REGEXEC */
{"sync", MAPC_SYNC},
- {0, 0}
+ {NULL, 0}
};
/*
@@ -137,6 +133,7 @@ static const char *get_full_path(const char *map, const char *path, const char *
static int mapc_meta_search(mnt_map *, char *, char **, int);
static void mapc_sync(mnt_map *);
static void mapc_clear(mnt_map *);
+static void mapc_clear_kvhash(kv **);
/* ROOT MAP */
static int root_init(mnt_map *, char *, time_t *);
@@ -198,12 +195,6 @@ extern int ndbm_search(mnt_map *, char *, char *, char **, time_t *);
extern int ndbm_mtime(mnt_map *, char *, time_t *);
#endif /* HAVE_MAP_NDBM */
-/* EXECUTABLE MAPS */
-#ifdef HAVE_MAP_EXEC
-extern int exec_init(mnt_map *, char *, time_t *);
-extern int exec_search(mnt_map *, char *, char *, char **, time_t *);
-#endif /* HAVE_MAP_EXEC */
-
/* FILE MAPS */
#ifdef HAVE_MAP_FILE
extern int file_init_or_mtime(mnt_map *, char *, time_t *);
@@ -211,6 +202,16 @@ extern int file_reload(mnt_map *, char *, add_fn *);
extern int file_search(mnt_map *, char *, char *, char **, time_t *);
#endif /* HAVE_MAP_FILE */
+/* EXECUTABLE MAPS */
+#ifdef HAVE_MAP_EXEC
+extern int exec_init(mnt_map *, char *, time_t *);
+extern int exec_search(mnt_map *, char *, char *, char **, time_t *);
+#endif /* HAVE_MAP_EXEC */
+
+/* Sun-syntax MAPS */
+#ifdef HAVE_MAP_SUN
+/* XXX: fill in */
+#endif /* HAVE_MAP_SUN */
/* note that the choice of MAPC_{INC,ALL} will affect browsable_dirs */
static map_type maptypes[] =
@@ -323,6 +324,20 @@ static map_type maptypes[] =
MAPC_INC
},
#endif /* HAVE_MAP_EXEC */
+#ifdef notyet /* probe function needs to be there or SEGV */
+#ifdef HAVE_MAP_SUN
+ {
+ /* XXX: fill in */
+ "sun",
+ NULL,
+ NULL,
+ NULL, /* isup function */
+ NULL,
+ NULL,
+ 0
+ },
+#endif /* HAVE_MAP_SUN */
+#endif
{
"error",
error_init,
@@ -412,6 +427,44 @@ mapc_add_kv(mnt_map *m, char *key, char *val)
dlog("add_kv: %s -> %s", key, val);
+ if (val != NULL && strchr(val, '\n') != NULL) {
+ /*
+ * If the entry value contains multiple lines we need to break
+ * them up and add them recursively. This is a workaround to
+ * support Sun style multi-mounts. Amd converts Sun style
+ * mulit-mounts to type:=auto. The problem is that Sun packs all
+ * the entries on one line. When Amd does the conversion it puts
+ * each type:=auto entry on the same line separated by '\n'.
+ */
+ char *entry, *tok;
+
+ /*
+ * The first line should contain the first entry. The key for
+ * this entry is the key passed into this function.
+ */
+ if ((tok = strtok(val, "\n")) != NULL) {
+ mapc_add_kv(m, key, xstrdup(tok));
+ }
+
+ /*
+ * For the rest of the entries we need to tokenize them by '\n'
+ * and separate the keys from there entries.
+ */
+ while ((tok = strtok(NULL, "\n")) != NULL) {
+ key = tok;
+ /* find the entry */
+ for (entry = key; *entry && !isspace((unsigned char)*entry); entry++);
+ if (*entry) {
+ *entry++ = '\0';
+ }
+
+ mapc_add_kv(m, xstrdup(key), xstrdup(entry));
+ }
+
+ XFREE(val);
+ return;
+ }
+
#ifdef HAVE_REGEXEC
if (MAPC_ISRE(m)) {
char pattern[MAXPATHLEN];
@@ -431,7 +484,8 @@ mapc_add_kv(mnt_map *m, char *key, char *val)
plog(XLOG_USER, "error compiling RE \"%s\": %s", pattern, errstr);
return;
}
- }
+ } else
+ memset(&re, 0, sizeof(re));
#endif /* HAVE_REGEXEC */
h = &m->kvhash[hash];
@@ -443,6 +497,7 @@ mapc_add_kv(mnt_map *m, char *key, char *val)
n->val = val;
n->next = *h;
*h = n;
+ m->nentries++;
}
@@ -506,7 +561,7 @@ mapc_find_wildcard(mnt_map *m)
int rc = search_map(m, wildcard, &m->wildcard);
if (rc != 0)
- m->wildcard = 0;
+ m->wildcard = NULL;
}
@@ -520,7 +575,7 @@ static int
mapc_reload_map(mnt_map *m)
{
int error, ret = 0;
- kv *maphash[NKVHASH], *tmphash[NKVHASH];
+ kv *maphash[NKVHASH];
time_t t;
error = (*m->mtime) (m, m->map_name, &t);
@@ -546,6 +601,7 @@ mapc_reload_map(mnt_map *m)
memset((voidp) m->kvhash, 0, sizeof(m->kvhash));
dlog("calling map reload on %s", m->map_name);
+ m->nentries = 0;
error = (*m->reload) (m, m->map_name, mapc_add_kv);
if (error) {
if (m->reloads == 0)
@@ -561,19 +617,19 @@ mapc_reload_map(mnt_map *m)
else
plog(XLOG_INFO, "reload #%d of map %s succeeded",
m->reloads, m->map_name);
- memcpy((voidp) tmphash, (voidp) m->kvhash, sizeof(m->kvhash));
- memcpy((voidp) m->kvhash, (voidp) maphash, sizeof(m->kvhash));
- mapc_clear(m);
- memcpy((voidp) m->kvhash, (voidp) tmphash, sizeof(m->kvhash));
+ mapc_clear_kvhash(maphash);
+ if (m->wildcard) {
+ XFREE(m->wildcard);
+ m->wildcard = NULL;
+ }
m->modify = t;
ret = 1;
}
- m->wildcard = 0;
dlog("calling mapc_search for wildcard");
error = mapc_search(m, wildcard, &m->wildcard);
if (error)
- m->wildcard = 0;
+ m->wildcard = NULL;
return ret;
}
@@ -582,12 +638,12 @@ mapc_reload_map(mnt_map *m)
* Create a new map
*/
static mnt_map *
-mapc_create(char *map, char *opt, const char *type)
+mapc_create(char *map, char *opt, const char *type, const char *mntpt)
{
mnt_map *m = ALLOC(struct mnt_map);
map_type *mt;
time_t modify = 0;
- int alloc = 0;
+ u_int alloc = 0;
cmdoption(opt, mapc_opt, &alloc);
@@ -632,6 +688,7 @@ mapc_create(char *map, char *opt, const char *type)
/* assert: mt in maptypes */
m->flags = alloc & ~MAPC_CACHE_MASK;
+ m->nentries = 0;
alloc &= MAPC_CACHE_MASK;
if (alloc == MAPC_DFLT)
@@ -678,12 +735,12 @@ mapc_create(char *map, char *opt, const char *type)
m->search = alloc >= MAPC_ALL ? error_search : mt->search;
m->mtime = mt->mtime;
memset((voidp) m->kvhash, 0, sizeof(m->kvhash));
- m->map_name = strdup(map);
+ m->map_name = xstrdup(map);
m->refc = 1;
- m->wildcard = 0;
+ m->wildcard = NULL;
m->reloads = 0;
- /* Unfortunately with current code structure, this cannot be initialized here */
- m->cfm = NULL;
+ /* initialize per-map information (flags, etc.) */
+ m->cfm = find_cf_map(mntpt);
/*
* synchronize cache with reality
@@ -695,10 +752,10 @@ mapc_create(char *map, char *opt, const char *type)
/*
- * Free the cached data in a map
+ * Free the cached data in a map hash
*/
static void
-mapc_clear(mnt_map *m)
+mapc_clear_kvhash(kv **kvhash)
{
int i;
@@ -707,16 +764,25 @@ mapc_clear(mnt_map *m)
* along free'ing the data.
*/
for (i = 0; i < NKVHASH; i++) {
- kv *k = m->kvhash[i];
+ kv *k = kvhash[i];
while (k) {
kv *n = k->next;
XFREE(k->key);
- if (k->val)
- XFREE(k->val);
+ XFREE(k->val);
XFREE(k);
k = n;
}
}
+}
+
+
+/*
+ * Free the cached data in a map
+ */
+static void
+mapc_clear(mnt_map *m)
+{
+ mapc_clear_kvhash(m->kvhash);
/*
* Zero the hash slots
@@ -726,10 +792,10 @@ mapc_clear(mnt_map *m)
/*
* Free the wildcard if it exists
*/
- if (m->wildcard) {
- XFREE(m->wildcard);
- m->wildcard = 0;
- }
+ XFREE(m->wildcard);
+ m->wildcard = NULL;
+
+ m->nentries = 0;
}
@@ -737,7 +803,7 @@ mapc_clear(mnt_map *m)
* Find a map, or create one if it does not exist
*/
mnt_map *
-mapc_find(char *map, char *opt, const char *maptype)
+mapc_find(char *map, char *opt, const char *maptype, const char *mntpt)
{
mnt_map *m;
@@ -751,7 +817,7 @@ mapc_find(char *map, char *opt, const char *maptype)
ITER(m, mnt_map, &map_list_head)
if (STREQ(m->map_name, map))
return mapc_dup(m);
- m = mapc_create(map, opt, maptype);
+ m = mapc_create(map, opt, maptype, mntpt);
ins_que(&m->hdr, &map_list_head);
return m;
@@ -788,7 +854,7 @@ static int
mapc_meta_search(mnt_map *m, char *key, char **pval, int recurse)
{
int error = 0;
- kv *k = 0;
+ kv *k = NULL;
/*
* Firewall
@@ -839,7 +905,7 @@ mapc_meta_search(mnt_map *m, char *key, char **pval, int recurse)
int retval;
/* XXX: this code was recently ported, and must be tested -Erez */
- retval = regexec(&k->re, key, 0, 0, 0);
+ retval = regexec(&k->re, key, 0, NULL, 0);
if (retval == 0) { /* succeeded */
break;
} else { /* failed to match, log error */
@@ -863,7 +929,7 @@ mapc_meta_search(mnt_map *m, char *key, char **pval, int recurse)
*/
if (k) {
if (k->val)
- *pval = strdup(k->val);
+ *pval = xstrdup(k->val);
else
error = ENOENT;
} else if (m->alloc >= MAPC_ALL) {
@@ -880,7 +946,7 @@ mapc_meta_search(mnt_map *m, char *key, char **pval, int recurse)
*/
error = search_map(m, key, pval);
if (!error && m->alloc == MAPC_INC)
- mapc_add_kv(m, strdup(key), strdup(*pval));
+ mapc_add_kv(m, xstrdup(key), xstrdup(*pval));
}
/*
@@ -911,11 +977,11 @@ mapc_meta_search(mnt_map *m, char *key, char **pval, int recurse)
dlog("mapc recurses on %s", wildname);
error = mapc_meta_search(m, wildname, pval, MREC_PART);
if (error)
- *subp = 0;
+ *subp = '\0';
}
if (error > 0 && m->wildcard) {
- *pval = strdup(m->wildcard);
+ *pval = xstrdup(m->wildcard);
error = 0;
}
}
@@ -1031,7 +1097,7 @@ root_newmap(const char *dir, const char *opts, const char *map, const cf_map_t *
* First make sure we have a root map to talk about...
*/
if (!root_map)
- root_map = mapc_find(ROOT_MAP, "mapdefault", NULL);
+ root_map = mapc_find(ROOT_MAP, "mapdefault", NULL, NULL);
/*
* Then add the entry...
@@ -1071,7 +1137,7 @@ root_newmap(const char *dir, const char *opts, const char *map, const cf_map_t *
else
xstrlcpy(str, opts, sizeof(str));
}
- mapc_repl_kv(root_map, strdup((char *)dir), strdup(str));
+ mapc_repl_kv(root_map, xstrdup(dir), xstrdup(str));
}
diff --git a/contrib/amd/amd/mntfs.c b/contrib/amd/amd/mntfs.c
index 6021838425c0..a26ff8f553f6 100644
--- a/contrib/amd/amd/mntfs.c
+++ b/contrib/amd/amd/mntfs.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997-2006 Erez Zadok
+ * Copyright (c) 1997-2014 Erez Zadok
* Copyright (c) 1990 Jan-Simon Pendry
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
* Copyright (c) 1990 The Regents of the University of California.
@@ -16,11 +16,7 @@
* 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgment:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -52,6 +48,16 @@ qelem mfhead = {&mfhead, &mfhead};
int mntfs_allocated;
+am_loc *
+dup_loc(am_loc *loc)
+{
+ loc->al_refc++;
+ if (loc->al_mnt) {
+ dup_mntfs(loc->al_mnt);
+ }
+ return loc;
+}
+
mntfs *
dup_mntfs(mntfs *mf)
{
@@ -71,24 +77,27 @@ init_mntfs(mntfs *mf, am_ops *ops, am_opts *mo, char *mp, char *info, char *auto
{
mf->mf_ops = ops;
mf->mf_fsflags = ops->nfs_fs_flags;
- mf->mf_fo = mo;
- mf->mf_mount = strdup(mp);
- mf->mf_info = strdup(info);
- mf->mf_auto = strdup(auto_opts);
- mf->mf_mopts = strdup(mopts);
- mf->mf_remopts = strdup(remopts);
+ mf->mf_fo = 0;
+ if (mo)
+ mf->mf_fo = copy_opts(mo);
+
+ mf->mf_mount = xstrdup(mp);
+ mf->mf_info = xstrdup(info);
+ mf->mf_auto = xstrdup(auto_opts);
+ mf->mf_mopts = xstrdup(mopts);
+ mf->mf_remopts = xstrdup(remopts);
mf->mf_loopdev = NULL;
mf->mf_refc = 1;
mf->mf_flags = 0;
mf->mf_error = -1;
mf->mf_cid = 0;
- mf->mf_private = 0;
- mf->mf_prfree = 0;
+ mf->mf_private = NULL;
+ mf->mf_prfree = NULL;
if (ops->ffserver)
mf->mf_server = (*ops->ffserver) (mf);
else
- mf->mf_server = 0;
+ mf->mf_server = NULL;
}
@@ -138,7 +147,7 @@ locate_mntfs(am_ops *ops, am_opts *mo, char *mp, char *info, char *auto_opts, ch
}
dlog("mf->mf_flags = %#x", mf->mf_flags);
- mf->mf_fo = mo;
+
if ((mf->mf_flags & MFF_RESTART) && amd_state < Finishing) {
/*
* Restart a previously mounted filesystem.
@@ -171,7 +180,7 @@ locate_mntfs(am_ops *ops, am_opts *mo, char *mp, char *info, char *auto_opts, ch
if (mf->mf_private && mf->mf_prfree) {
mf->mf_prfree(mf->mf_private);
- mf->mf_private = 0;
+ mf->mf_private = NULL;
}
fs = ops->ffserver ? (*ops->ffserver) (mf) : (fserver *) NULL;
@@ -202,26 +211,35 @@ find_mntfs(am_ops *ops, am_opts *mo, char *mp, char *info, char *auto_opts, char
mntfs *
new_mntfs(void)
{
- return alloc_mntfs(&amfs_error_ops, (am_opts *) 0, "//nil//", ".", "", "", "");
+ return alloc_mntfs(&amfs_error_ops, (am_opts *) NULL, "//nil//", ".", "", "", "");
+}
+
+am_loc *
+new_loc(void)
+{
+ am_loc *loc = CALLOC(struct am_loc);
+ loc->al_fo = 0;
+ loc->al_mnt = new_mntfs();
+ loc->al_refc = 1;
+ return loc;
}
static void
uninit_mntfs(mntfs *mf)
{
- if (mf->mf_auto)
- XFREE(mf->mf_auto);
- if (mf->mf_mopts)
- XFREE(mf->mf_mopts);
- if (mf->mf_remopts)
- XFREE(mf->mf_remopts);
- if (mf->mf_info)
- XFREE(mf->mf_info);
+ if (mf->mf_fo) {
+ free_opts(mf->mf_fo);
+ XFREE(mf->mf_fo);
+ }
+ XFREE(mf->mf_auto);
+ XFREE(mf->mf_mopts);
+ XFREE(mf->mf_remopts);
+ XFREE(mf->mf_info);
if (mf->mf_private && mf->mf_prfree)
(*mf->mf_prfree) (mf->mf_private);
- if (mf->mf_mount)
- XFREE(mf->mf_mount);
+ XFREE(mf->mf_mount);
/*
* Clean up the file server
@@ -255,6 +273,16 @@ discard_mntfs(voidp v)
--mntfs_allocated;
}
+static void
+discard_loc(voidp v)
+{
+ am_loc *loc = v;
+ if (loc->al_fo) {
+ free_opts(loc->al_fo);
+ XFREE(loc->al_fo);
+ }
+ XFREE(loc);
+}
void
flush_mntfs(void)
@@ -270,6 +298,23 @@ flush_mntfs(void)
}
}
+void
+free_loc(opaque_t arg)
+{
+ am_loc *loc = (am_loc *) arg;
+ dlog("free_loc %p", loc);
+
+ if (loc->al_refc <= 0) {
+ plog(XLOG_ERROR, "IGNORING free_loc for 0x%p", loc);
+ return;
+ }
+
+ if (loc->al_mnt)
+ free_mntfs(loc->al_mnt);
+ if (--loc->al_refc == 0) {
+ discard_loc(loc);
+ }
+}
void
free_mntfs(opaque_t arg)
@@ -356,7 +401,6 @@ realloc_mntfs(mntfs *mf, am_ops *ops, am_opts *mo, char *mp, char *info, char *a
if (mf->mf_ops != &amfs_error_ops &&
(mf->mf_flags & MFF_MOUNTED) &&
!FSRV_ISDOWN(mf->mf_server)) {
- mf->mf_fo = mo;
return mf;
}
diff --git a/contrib/amd/amd/nfs_prot_svc.c b/contrib/amd/amd/nfs_prot_svc.c
index 0dd6992cf9e7..cbde17274aea 100644
--- a/contrib/amd/amd/nfs_prot_svc.c
+++ b/contrib/amd/amd/nfs_prot_svc.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997-2006 Erez Zadok
+ * Copyright (c) 1997-2014 Erez Zadok
* Copyright (c) 1989 Jan-Simon Pendry
* Copyright (c) 1989 Imperial College of Science, Technology & Medicine
* Copyright (c) 1989 The Regents of the University of California.
@@ -16,11 +16,7 @@
* 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgment:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -69,6 +65,7 @@ extern nfsstatfsres *nfsproc_statfs_2_svc(am_nfs_fh *, struct svc_req *);
/* global variables */
SVCXPRT *current_transp;
+dispatcher_t nfs_dispatcher = nfs_program_2;
/* typedefs */
typedef char *(*nfssvcproc_t)(voidp, struct svc_req *);
@@ -299,3 +296,193 @@ nfs_program_2(struct svc_req *rqstp, SVCXPRT *transp)
going_down(1);
}
}
+
+void
+nfs_program_3(struct svc_req *rqstp, register SVCXPRT *transp)
+{
+ union {
+ am_GETATTR3args am_nfs3_getattr_3_arg;
+ am_SETATTR3args am_nfs3_setattr_3_arg;
+ am_LOOKUP3args am_nfs3_lookup_3_arg;
+ am_ACCESS3args am_nfs3_access_3_arg;
+ am_READLINK3args am_nfs3_readlink_3_arg;
+ am_READ3args am_nfs3_read_3_arg;
+ am_WRITE3args am_nfs3_write_3_arg;
+ am_CREATE3args am_nfs3_create_3_arg;
+ am_MKDIR3args am_nfs3_mkdir_3_arg;
+ am_SYMLINK3args am_nfs3_symlink_3_arg;
+ am_MKNOD3args am_nfs3_mknod_3_arg;
+ am_REMOVE3args am_nfs3_remove_3_arg;
+ am_RMDIR3args am_nfs3_rmdir_3_arg;
+ am_RENAME3args am_nfs3_rename_3_arg;
+ am_LINK3args am_nfs3_link_3_arg;
+ am_READDIR3args am_nfs3_readdir_3_arg;
+ am_READDIRPLUS3args am_nfs3_readdirplus_3_arg;
+ am_FSSTAT3args am_nfs3_fsstat_3_arg;
+ am_FSINFO3args am_nfs3_fsinfo_3_arg;
+ am_PATHCONF3args am_nfs3_pathconf_3_arg;
+ am_COMMIT3args am_nfs3_commit_3_arg;
+ } argument;
+ char *result;
+ xdrproc_t _xdr_argument, _xdr_result;
+ nfssvcproc_t local;
+
+ switch (rqstp->rq_proc) {
+ case AM_NFS3_NULL:
+ _xdr_argument = (xdrproc_t) xdr_void;
+ _xdr_result = (xdrproc_t) xdr_void;
+ local = (nfssvcproc_t) am_nfs3_null_3_svc;
+ break;
+
+ case AM_NFS3_GETATTR:
+ _xdr_argument = (xdrproc_t) xdr_am_GETATTR3args;
+ _xdr_result = (xdrproc_t) xdr_am_GETATTR3res;
+ local = (nfssvcproc_t) (char *(*)(char *, struct svc_req *)) am_nfs3_getattr_3_svc;
+ break;
+
+ case AM_NFS3_SETATTR:
+ _xdr_argument = (xdrproc_t) xdr_am_SETATTR3args;
+ _xdr_result = (xdrproc_t) xdr_am_SETATTR3res;
+ local = (nfssvcproc_t) (char *(*)(char *, struct svc_req *)) am_nfs3_setattr_3_svc;
+ break;
+
+ case AM_NFS3_LOOKUP:
+ _xdr_argument = (xdrproc_t) xdr_am_LOOKUP3args;
+ _xdr_result = (xdrproc_t) xdr_am_LOOKUP3res;
+ local = (nfssvcproc_t) (char *(*)(char *, struct svc_req *)) am_nfs3_lookup_3_svc;
+ break;
+
+ case AM_NFS3_ACCESS:
+ _xdr_argument = (xdrproc_t) xdr_am_ACCESS3args;
+ _xdr_result = (xdrproc_t) xdr_am_ACCESS3res;
+ local = (nfssvcproc_t) (char *(*)(char *, struct svc_req *)) am_nfs3_access_3_svc;
+ break;
+
+ case AM_NFS3_READLINK:
+ _xdr_argument = (xdrproc_t) xdr_am_READLINK3args;
+ _xdr_result = (xdrproc_t) xdr_am_READLINK3res;
+ local = (nfssvcproc_t) (char *(*)(char *, struct svc_req *)) am_nfs3_readlink_3_svc;
+ break;
+
+ case AM_NFS3_READ:
+ _xdr_argument = (xdrproc_t) xdr_am_READ3args;
+ _xdr_result = (xdrproc_t) xdr_am_READ3res;
+ local = (nfssvcproc_t) (char *(*)(char *, struct svc_req *)) am_nfs3_read_3_svc;
+ break;
+
+ case AM_NFS3_WRITE:
+ _xdr_argument = (xdrproc_t) xdr_am_WRITE3args;
+ _xdr_result = (xdrproc_t) xdr_am_WRITE3res;
+ local = (nfssvcproc_t) (char *(*)(char *, struct svc_req *)) am_nfs3_write_3_svc;
+ break;
+
+ case AM_NFS3_CREATE:
+ _xdr_argument = (xdrproc_t) xdr_am_CREATE3args;
+ _xdr_result = (xdrproc_t) xdr_am_CREATE3res;
+ local = (nfssvcproc_t) (char *(*)(char *, struct svc_req *)) am_nfs3_create_3_svc;
+ break;
+
+ case AM_NFS3_MKDIR:
+ _xdr_argument = (xdrproc_t) xdr_am_MKDIR3args;
+ _xdr_result = (xdrproc_t) xdr_am_MKDIR3res;
+ local = (nfssvcproc_t) (char *(*)(char *, struct svc_req *)) am_nfs3_mkdir_3_svc;
+ break;
+
+ case AM_NFS3_SYMLINK:
+ _xdr_argument = (xdrproc_t) xdr_am_SYMLINK3args;
+ _xdr_result = (xdrproc_t) xdr_am_SYMLINK3res;
+ local = (nfssvcproc_t) (char *(*)(char *, struct svc_req *)) am_nfs3_symlink_3_svc;
+ break;
+
+ case AM_NFS3_MKNOD:
+ _xdr_argument = (xdrproc_t) xdr_am_MKNOD3args;
+ _xdr_result = (xdrproc_t) xdr_am_MKNOD3res;
+ local = (nfssvcproc_t) (char *(*)(char *, struct svc_req *)) am_nfs3_mknod_3_svc;
+ break;
+
+ case AM_NFS3_REMOVE:
+ _xdr_argument = (xdrproc_t) xdr_am_REMOVE3args;
+ _xdr_result = (xdrproc_t) xdr_am_REMOVE3res;
+ local = (nfssvcproc_t) (char *(*)(char *, struct svc_req *)) am_nfs3_remove_3_svc;
+ break;
+
+ case AM_NFS3_RMDIR:
+ _xdr_argument = (xdrproc_t) xdr_am_RMDIR3args;
+ _xdr_result = (xdrproc_t) xdr_am_RMDIR3res;
+ local = (nfssvcproc_t) (char *(*)(char *, struct svc_req *)) am_nfs3_rmdir_3_svc;
+ break;
+
+ case AM_NFS3_RENAME:
+ _xdr_argument = (xdrproc_t) xdr_am_RENAME3args;
+ _xdr_result = (xdrproc_t) xdr_am_RENAME3res;
+ local = (nfssvcproc_t) (char *(*)(char *, struct svc_req *)) am_nfs3_rename_3_svc;
+ break;
+
+ case AM_NFS3_LINK:
+ _xdr_argument = (xdrproc_t) xdr_am_LINK3args;
+ _xdr_result = (xdrproc_t) xdr_am_LINK3res;
+ local = (nfssvcproc_t) (char *(*)(char *, struct svc_req *)) am_nfs3_link_3_svc;
+ break;
+
+ case AM_NFS3_READDIR:
+ _xdr_argument = (xdrproc_t) xdr_am_READDIR3args;
+ _xdr_result = (xdrproc_t) xdr_am_READDIR3res;
+ local = (nfssvcproc_t) (char *(*)(char *, struct svc_req *)) am_nfs3_readdir_3_svc;
+ break;
+
+ case AM_NFS3_READDIRPLUS:
+ _xdr_argument = (xdrproc_t) xdr_am_READDIRPLUS3args;
+ _xdr_result = (xdrproc_t) xdr_am_READDIRPLUS3res;
+ local = (nfssvcproc_t) (char *(*)(char *, struct svc_req *)) am_nfs3_readdirplus_3_svc;
+ break;
+
+ case AM_NFS3_FSSTAT:
+ _xdr_argument = (xdrproc_t) xdr_am_FSSTAT3args;
+ _xdr_result = (xdrproc_t) xdr_am_FSSTAT3res;
+ local = (nfssvcproc_t) (char *(*)(char *, struct svc_req *)) am_nfs3_fsstat_3_svc;
+ break;
+
+ case AM_NFS3_FSINFO:
+ _xdr_argument = (xdrproc_t) xdr_am_FSINFO3args;
+ _xdr_result = (xdrproc_t) xdr_am_FSINFO3res;
+ local = (nfssvcproc_t) (char *(*)(char *, struct svc_req *)) am_nfs3_fsinfo_3_svc;
+ break;
+
+ case AM_NFS3_PATHCONF:
+ _xdr_argument = (xdrproc_t) xdr_am_PATHCONF3args;
+ _xdr_result = (xdrproc_t) xdr_am_PATHCONF3res;
+ local = (nfssvcproc_t) (char *(*)(char *, struct svc_req *)) am_nfs3_pathconf_3_svc;
+ break;
+
+ case AM_NFS3_COMMIT:
+ _xdr_argument = (xdrproc_t) xdr_am_COMMIT3args;
+ _xdr_result = (xdrproc_t) xdr_am_COMMIT3res;
+ local = (nfssvcproc_t) (char *(*)(char *, struct svc_req *)) am_nfs3_commit_3_svc;
+ break;
+
+ default:
+ svcerr_noproc (transp);
+ return;
+ }
+
+ memset ((char *)&argument, 0, sizeof (argument));
+
+ if (!svc_getargs(transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ plog(XLOG_ERROR,
+ "NFS xdr decode failed for %d %d %d",
+ (int) rqstp->rq_prog, (int) rqstp->rq_vers, (int) rqstp->rq_proc);
+ svcerr_decode(transp);
+ return;
+ }
+
+ result = (*local) (&argument, rqstp);
+ if (result != NULL && !svc_sendreply(transp, (xdrproc_t) _xdr_result, result)) {
+ svcerr_systemerr (transp);
+ }
+
+ if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ plog(XLOG_FATAL, "unable to free rpc arguments in nfs_program_3");
+ going_down(1);
+ }
+ return;
+}
diff --git a/contrib/amd/amd/nfs_start.c b/contrib/amd/amd/nfs_start.c
index f6aba94e2b6d..b6c544ddf178 100644
--- a/contrib/amd/amd/nfs_start.c
+++ b/contrib/amd/amd/nfs_start.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997-2006 Erez Zadok
+ * Copyright (c) 1997-2014 Erez Zadok
* Copyright (c) 1990 Jan-Simon Pendry
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
* Copyright (c) 1990 The Regents of the University of California.
@@ -16,11 +16,7 @@
* 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgment:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -65,12 +61,11 @@ u_short nfs_port = 0;
static void
checkup(void)
{
-
static int max_fd = 0;
- static char *max_mem = 0;
-
+ static char *max_mem = NULL;
int next_fd = dup(0);
caddr_t next_mem = sbrk(0);
+
close(next_fd);
if (max_fd < next_fd) {
@@ -135,8 +130,8 @@ do_select(int smask, int fds, fd_set *fdp, struct timeval *tvp)
/*
* Wait for input
*/
- nsel = select(fds, fdp, (fd_set *) 0, (fd_set *) 0,
- tvp->tv_sec ? tvp : (struct timeval *) 0);
+ nsel = select(fds, fdp, (fd_set *) NULL, (fd_set *) NULL,
+ tvp->tv_sec ? tvp : (struct timeval *) NULL);
}
#ifdef HAVE_SIGACTION
@@ -171,7 +166,7 @@ rpc_pending_now(void)
FD_SET(fwd_sock, &readfds);
tvv.tv_sec = tvv.tv_usec = 0;
- nsel = select(FD_SETSIZE, &readfds, (fd_set *) 0, (fd_set *) 0, &tvv);
+ nsel = select(FD_SETSIZE, &readfds, (fd_set *) NULL, (fd_set *) NULL, &tvv);
if (nsel < 1)
return (0);
if (FD_ISSET(fwd_sock, &readfds))
@@ -365,15 +360,16 @@ mount_automounter(int ppid)
* already created the service during restart_automounter_nodes().
*/
if (nfs_port == 0) {
- ret = create_nfs_service(&soNFS, &nfs_port, &nfsxprt, nfs_program_2);
+ ret = create_nfs_service(&soNFS, &nfs_port, &nfsxprt, nfs_dispatcher,
+ get_nfs_dispatcher_version(nfs_dispatcher));
if (ret != 0)
return ret;
}
xsnprintf(pid_fsname, sizeof(pid_fsname), "%s:(pid%ld,port%u)",
am_get_hostname(), (long) am_mypid, nfs_port);
- /* security: if user sets -D amq, don't even create listening socket */
- if (!amuDebug(D_AMQ)) {
+ /* security: if user sets -D noamq, don't even create listening socket */
+ if (amuDebug(D_AMQ)) {
ret = create_amq_service(&udp_soAMQ,
&udp_amqp,
&udp_amqncp,
@@ -416,25 +412,33 @@ mount_automounter(int ppid)
return 0;
}
- if (!amuDebug(D_AMQ)) {
+ if (amuDebug(D_AMQ)) {
/*
* Complete registration of amq (first TCP service then UDP)
*/
- unregister_amq();
-
- ret = amu_svc_register(tcp_amqp, get_amd_program_number(), AMQ_VERSION,
- amq_program_1, IPPROTO_TCP, tcp_amqncp);
- if (ret != 1) {
- plog(XLOG_FATAL, "unable to register (AMQ_PROGRAM=%d, AMQ_VERSION, tcp)", get_amd_program_number());
+ int tcp_ok = 0, udp_ok = 0;
+
+ unregister_amq(); /* unregister leftover Amd, if any, just in case */
+
+ tcp_ok = amu_svc_register(tcp_amqp, get_amd_program_number(), AMQ_VERSION,
+ amq_program_1, IPPROTO_TCP, tcp_amqncp);
+ if (!tcp_ok)
+ plog(XLOG_FATAL,
+ "unable to register (AMQ_PROGRAM=%lu, AMQ_VERSION, tcp)",
+ get_amd_program_number());
+
+ udp_ok = amu_svc_register(udp_amqp, get_amd_program_number(), AMQ_VERSION,
+ amq_program_1, IPPROTO_UDP, udp_amqncp);
+ if (!udp_ok)
+ plog(XLOG_FATAL,
+ "unable to register (AMQ_PROGRAM=%lu, AMQ_VERSION, udp)",
+ get_amd_program_number());
+
+ /* return error only if both failed */
+ if (!tcp_ok && !udp_ok) {
+ amd_state = Done;
return 3;
}
-
- ret = amu_svc_register(udp_amqp, get_amd_program_number(), AMQ_VERSION,
- amq_program_1, IPPROTO_UDP, udp_amqncp);
- if (ret != 1) {
- plog(XLOG_FATAL, "unable to register (AMQ_PROGRAM=%d, AMQ_VERSION, udp)", get_amd_program_number());
- return 4;
- }
}
/*
diff --git a/contrib/amd/amd/nfs_subr.c b/contrib/amd/amd/nfs_subr.c
index 80d3ca8e311c..734c69827a35 100644
--- a/contrib/amd/amd/nfs_subr.c
+++ b/contrib/amd/amd/nfs_subr.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997-2006 Erez Zadok
+ * Copyright (c) 1997-2014 Erez Zadok
* Copyright (c) 1990 Jan-Simon Pendry
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
* Copyright (c) 1990 The Regents of the University of California.
@@ -16,11 +16,7 @@
* 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgment:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -78,6 +74,17 @@ struct am_fh {
} u;
};
+struct am_fh3 {
+ u_int fhh_gen; /* generation number */
+ union {
+ struct {
+ int fhh_type; /* old or new am_fh */
+ pid_t fhh_pid; /* process id */
+ int fhh_id; /* map id */
+ } s;
+ char fhh_path[AM_FHSIZE3-sizeof(u_int)]; /* path to am_node */
+ } u;
+};
/* forward declarations */
/* converting am-filehandles to mount-points */
@@ -96,10 +103,10 @@ do_readlink(am_node *mp, int *error_return)
* otherwise if a link exists use that,
* otherwise use the mount point.
*/
- if (mp->am_mnt->mf_ops->readlink) {
+ if (mp->am_al->al_mnt->mf_ops->readlink) {
int retry = 0;
- mp = (*mp->am_mnt->mf_ops->readlink) (mp, &retry);
- if (mp == 0) {
+ mp = (*mp->am_al->al_mnt->mf_ops->readlink) (mp, &retry);
+ if (mp == NULL) {
*error_return = retry;
return 0;
}
@@ -109,7 +116,7 @@ do_readlink(am_node *mp, int *error_return)
if (mp->am_link) {
ln = mp->am_link;
} else {
- ln = mp->am_mnt->mf_mount;
+ ln = mp->am_al->al_mnt->mf_mount;
}
return ln;
@@ -130,14 +137,14 @@ nfsproc_getattr_2_svc(am_nfs_fh *argp, struct svc_req *rqstp)
{
static nfsattrstat res;
am_node *mp;
- int retry;
+ int retry = 0;
time_t now = clocktime(NULL);
if (amuDebug(D_TRACE))
plog(XLOG_DEBUG, "getattr:");
mp = fh_to_mp3(argp, &retry, VLOOK_CREATE);
- if (mp == 0) {
+ if (mp == NULL) {
if (amuDebug(D_TRACE))
plog(XLOG_DEBUG, "\tretry=%d", retry);
@@ -209,7 +216,7 @@ nfsproc_lookup_2_svc(nfsdiropargs *argp, struct svc_req *rqstp)
xsnprintf(opt_gid, sizeof(gid_str), "%d", (int) gid);
mp = fh_to_mp3(&argp->da_fhandle, &retry, VLOOK_CREATE);
- if (mp == 0) {
+ if (mp == NULL) {
if (retry < 0) {
amd_stats.d_drops++;
return 0;
@@ -220,9 +227,9 @@ nfsproc_lookup_2_svc(nfsdiropargs *argp, struct svc_req *rqstp)
am_node *ap;
if (amuDebug(D_TRACE))
plog(XLOG_DEBUG, "\tlookup(%s, %s)", mp->am_path, argp->da_name);
- ap = mp->am_mnt->mf_ops->lookup_child(mp, argp->da_name, &error, VLOOK_CREATE);
+ ap = mp->am_al->al_mnt->mf_ops->lookup_child(mp, argp->da_name, &error, VLOOK_CREATE);
if (ap && error < 0)
- ap = mp->am_mnt->mf_ops->mount_child(ap, &error);
+ ap = mp->am_al->al_mnt->mf_ops->mount_child(ap, &error);
if (ap == 0) {
if (error < 0) {
amd_stats.d_drops++;
@@ -285,7 +292,7 @@ nfs_quick_reply(am_node *mp, int error)
* Free up transp. It's only used for one reply.
*/
XFREE(mp->am_transp);
- dlog("Quick reply sent for %s", mp->am_mnt->mf_mount);
+ dlog("Quick reply sent for %s", mp->am_al->al_mnt->mf_mount);
}
}
@@ -301,7 +308,7 @@ nfsproc_readlink_2_svc(am_nfs_fh *argp, struct svc_req *rqstp)
plog(XLOG_DEBUG, "readlink:");
mp = fh_to_mp3(argp, &retry, VLOOK_CREATE);
- if (mp == 0) {
+ if (mp == NULL) {
readlink_retry:
if (retry < 0) {
amd_stats.d_drops++;
@@ -379,7 +386,7 @@ unlink_or_rmdir(nfsdiropargs *argp, struct svc_req *rqstp, int unlinkp)
int retry;
am_node *mp = fh_to_mp3(&argp->da_fhandle, &retry, VLOOK_DELETE);
- if (mp == 0) {
+ if (mp == NULL) {
if (retry < 0) {
amd_stats.d_drops++;
return 0;
@@ -396,8 +403,8 @@ unlink_or_rmdir(nfsdiropargs *argp, struct svc_req *rqstp, int unlinkp)
if (amuDebug(D_TRACE))
plog(XLOG_DEBUG, "\tremove(%s, %s)", mp->am_path, argp->da_name);
- mp = mp->am_mnt->mf_ops->lookup_child(mp, argp->da_name, &retry, VLOOK_DELETE);
- if (mp == 0) {
+ mp = mp->am_al->al_mnt->mf_ops->lookup_child(mp, argp->da_name, &retry, VLOOK_DELETE);
+ if (mp == NULL) {
/*
* Ignore retries...
*/
@@ -510,7 +517,7 @@ nfsproc_readdir_2_svc(nfsreaddirargs *argp, struct svc_req *rqstp)
plog(XLOG_DEBUG, "readdir:");
mp = fh_to_mp3(&argp->rda_fhandle, &retry, VLOOK_CREATE);
- if (mp == 0) {
+ if (mp == NULL) {
if (retry < 0) {
amd_stats.d_drops++;
return 0;
@@ -519,7 +526,7 @@ nfsproc_readdir_2_svc(nfsreaddirargs *argp, struct svc_req *rqstp)
} else {
if (amuDebug(D_TRACE))
plog(XLOG_DEBUG, "\treaddir(%s)", mp->am_path);
- res.rdr_status = nfs_error((*mp->am_mnt->mf_ops->readdir)
+ res.rdr_status = nfs_error((*mp->am_al->al_mnt->mf_ops->readdir)
(mp, argp->rda_cookie,
&res.rdr_u.rdr_reply_u, e_res, argp->rda_count));
mp->am_stats.s_readdir++;
@@ -541,7 +548,7 @@ nfsproc_statfs_2_svc(am_nfs_fh *argp, struct svc_req *rqstp)
plog(XLOG_DEBUG, "statfs:");
mp = fh_to_mp3(argp, &retry, VLOOK_CREATE);
- if (mp == 0) {
+ if (mp == NULL) {
if (retry < 0) {
amd_stats.d_drops++;
return 0;
@@ -562,8 +569,8 @@ nfsproc_statfs_2_svc(am_nfs_fh *argp, struct svc_req *rqstp)
/* check if map is browsable and show_statfs_entries=yes */
if ((gopt.flags & CFM_SHOW_STATFS_ENTRIES) &&
- mp->am_mnt && mp->am_mnt->mf_mopts) {
- mnt.mnt_opts = mp->am_mnt->mf_mopts;
+ mp->am_al->al_mnt && mp->am_al->al_mnt->mf_mopts) {
+ mnt.mnt_opts = mp->am_al->al_mnt->mf_mopts;
if (amu_hasmntopt(&mnt, "browsable")) {
count_map_entries(mp,
&fp->sfrok_blocks,
@@ -599,7 +606,7 @@ count_map_entries(const am_node *mp, u_int *out_blocks, u_int *out_bfree, u_int
blocks = bfree = bavail = 0;
if (!mp)
goto out;
- mf = mp->am_mnt;
+ mf = mp->am_al->al_mnt;
if (!mf)
goto out;
mmp = (mnt_map *) mf->mf_private;
@@ -625,58 +632,18 @@ out:
*out_bavail = bavail;
}
-
-/*
- * Convert from file handle to automount node.
- */
static am_node *
-fh_to_mp3(am_nfs_fh *fhp, int *rp, int vop)
+validate_ap(am_node *node, int *rp, u_int fhh_gen)
{
- struct am_fh *fp = (struct am_fh *) fhp;
- am_node *ap = 0;
-
- if (fp->u.s.fhh_type != 0) {
- /* New filehandle type */
- int len = sizeof(*fhp) - sizeof(fp->fhh_gen);
- char *path = xmalloc(len+1);
- /*
- * Because fhp is treated as a filehandle we use memcpy
- * instead of xstrlcpy.
- */
- memcpy(path, (char *) fp->u.fhh_path, len);
- path[len] = '\0';
- /* dlog("fh_to_mp3: new filehandle: %s", path); */
-
- ap = path_to_exported_ap(path);
- XFREE(path);
- } else {
- /* dlog("fh_to_mp3: old filehandle: %d", fp->u.s.fhh_id); */
- /*
- * Check process id matches
- * If it doesn't then it is probably
- * from an old kernel-cached filehandle
- * which is now out of date.
- */
- if (fp->u.s.fhh_pid != get_server_pid()) {
- dlog("fh_to_mp3: wrong pid %ld != my pid %ld",
- (long) fp->u.s.fhh_pid, get_server_pid());
- goto drop;
- }
-
- /*
- * Get hold of the supposed mount node
- */
- ap = get_exported_ap(fp->u.s.fhh_id);
- }
-
+ am_node *ap = node;
/*
* Check the generation number in the node
* matches the one from the kernel. If not
* then the old node has been timed out and
* a new one allocated.
*/
- if (ap != NULL && ap->am_gen != fp->fhh_gen)
- ap = 0;
+ if (node != NULL && node->am_gen != fhh_gen)
+ ap = NULL;
/*
* If it doesn't exists then drop the request
@@ -690,12 +657,12 @@ fh_to_mp3(am_nfs_fh *fhp, int *rp, int vop)
* for it. This implements the replicated filesystem
* retries.
*/
- if (ap->am_mnt && FSRV_ISDOWN(ap->am_mnt->mf_server) && ap->am_parent) {
+ if (ap->am_al->al_mnt && FSRV_ISDOWN(ap->am_al->al_mnt->mf_server) && ap->am_parent) {
int error;
am_node *orig_ap = ap;
- dlog("fh_to_mp3: %s (%s) is hung: lookup alternative file server",
- orig_ap->am_path, orig_ap->am_mnt->mf_info);
+ dlog("%s: %s (%s) is hung: lookup alternative file server", __func__,
+ orig_ap->am_path, orig_ap->am_al->al_mnt->mf_info);
/*
* Update modify time of parent node.
@@ -712,11 +679,11 @@ fh_to_mp3(am_nfs_fh *fhp, int *rp, int vop)
* to the caller.
*/
if (vop == VLOOK_CREATE) {
- ap = orig_ap->am_parent->am_mnt->mf_ops->lookup_child(orig_ap->am_parent, orig_ap->am_name, &error, vop);
+ ap = orig_ap->am_parent->am_al->al_mnt->mf_ops->lookup_child(orig_ap->am_parent, orig_ap->am_name, &error, vop);
if (ap && error < 0)
- ap = orig_ap->am_parent->am_mnt->mf_ops->mount_child(ap, &error);
+ ap = orig_ap->am_parent->am_al->al_mnt->mf_ops->mount_child(ap, &error);
} else {
- ap = 0;
+ ap = NULL;
error = ESTALE;
}
if (ap == 0) {
@@ -735,13 +702,13 @@ fh_to_mp3(am_nfs_fh *fhp, int *rp, int vop)
new_ttl(orig_ap);
}
-#endif
+#endif /* 0 */
/*
* Disallow references to objects being unmounted, unless
* they are automount points.
*/
- if (ap->am_mnt && (ap->am_mnt->mf_flags & MFF_UNMOUNTING) &&
+ if (ap->am_al->al_mnt && (ap->am_al->al_mnt->mf_flags & MFF_UNMOUNTING) &&
!(ap->am_flags & AMF_ROOT)) {
if (amd_state == Finishing)
*rp = ENOENT;
@@ -752,7 +719,7 @@ fh_to_mp3(am_nfs_fh *fhp, int *rp, int vop)
new_ttl(ap);
drop:
- if (!ap || !ap->am_mnt) {
+ if (!ap || !ap->am_al->al_mnt) {
/*
* If we are shutting down then it is likely
* that this node has disappeared because of
@@ -764,14 +731,60 @@ drop:
*/
if (amd_state == Finishing)
*rp = ENOENT;
- else
+ else {
*rp = ESTALE;
- amd_stats.d_stale++;
+ amd_stats.d_stale++;
+ }
}
return ap;
}
+/*
+ * Convert from file handle to automount node.
+ */
+static am_node *
+fh_to_mp3(am_nfs_fh *fhp, int *rp, int vop)
+{
+ struct am_fh *fp = (struct am_fh *) fhp;
+ am_node *ap = NULL;
+
+ if (fp->u.s.fhh_type != 0) {
+ /* New filehandle type */
+ int len = sizeof(*fhp) - sizeof(fp->fhh_gen);
+ char *path = xmalloc(len+1);
+ /*
+ * Because fhp is treated as a filehandle we use memcpy
+ * instead of xstrlcpy.
+ */
+ memcpy(path, (char *) fp->u.fhh_path, len);
+ path[len] = '\0';
+ dlog("%s: new filehandle: %s", __func__, path);
+
+ ap = path_to_exported_ap(path);
+ XFREE(path);
+ } else {
+ dlog("%s: old filehandle: %d", __func__, fp->u.s.fhh_id);
+ /*
+ * Check process id matches
+ * If it doesn't then it is probably
+ * from an old kernel-cached filehandle
+ * which is now out of date.
+ */
+ if (fp->u.s.fhh_pid != get_server_pid()) {
+ dlog("%s: wrong pid %ld != my pid %ld", __func__,
+ (long) fp->u.s.fhh_pid, get_server_pid());
+ goto done;
+ }
+
+ /*
+ * Get hold of the supposed mount node
+ */
+ ap = get_exported_ap(fp->u.s.fhh_id);
+ }
+done:
+ return validate_ap(ap, rp, fp->fhh_gen);
+}
static am_node *
fh_to_mp(am_nfs_fh *fhp)
@@ -781,6 +794,56 @@ fh_to_mp(am_nfs_fh *fhp)
return fh_to_mp3(fhp, &dummy, VLOOK_CREATE);
}
+static am_node *
+fh3_to_mp3(am_nfs_fh3 *fhp, int *rp, int vop)
+{
+ struct am_fh3 *fp = (struct am_fh3 *) fhp->am_fh3_data;
+ am_node *ap = NULL;
+
+ if (fp->u.s.fhh_type != 0) {
+ /* New filehandle type */
+ int len = sizeof(*fp) - sizeof(fp->fhh_gen);
+ char *path = xmalloc(len+1);
+ /*
+ * Because fhp is treated as a filehandle we use memcpy
+ * instead of xstrlcpy.
+ */
+ memcpy(path, (char *) fp->u.fhh_path, len);
+ path[len] = '\0';
+ dlog("%s: new filehandle: %s", __func__, path);
+
+ ap = path_to_exported_ap(path);
+ XFREE(path);
+ } else {
+ dlog("%s: old filehandle: %d", __func__, fp->u.s.fhh_id);
+ /*
+ * Check process id matches
+ * If it doesn't then it is probably
+ * from an old kernel-cached filehandle
+ * which is now out of date.
+ */
+ if (fp->u.s.fhh_pid != get_server_pid()) {
+ dlog("%s: wrong pid %ld != my pid %ld", __func__,
+ (long) fp->u.s.fhh_pid, get_server_pid());
+ goto done;
+ }
+
+ /*
+ * Get hold of the supposed mount node
+ */
+ ap = get_exported_ap(fp->u.s.fhh_id);
+ }
+done:
+ return validate_ap(ap, rp, fp->fhh_gen);
+}
+
+static am_node *
+fh3_to_mp(am_nfs_fh3 *fhp)
+{
+ int dummy;
+
+ return fh3_to_mp3(fhp, &dummy, VLOOK_CREATE);
+}
/*
* Convert from automount node to file handle.
@@ -826,3 +889,975 @@ mp_to_fh(am_node *mp, am_nfs_fh *fhp)
/* dlog("mp_to_fh: old filehandle: %d", fp->u.s.fhh_id); */
}
}
+void
+mp_to_fh3(am_node *mp, am_nfs_fh3 *fhp)
+{
+ u_int pathlen;
+ struct am_fh3 *fp = (struct am_fh3 *) fhp->am_fh3_data;
+
+ memset((char *) fhp, 0, sizeof(am_nfs_fh3));
+ fhp->am_fh3_length = AM_FHSIZE3;
+
+ /* Store the generation number */
+ fp->fhh_gen = mp->am_gen;
+
+ pathlen = strlen(mp->am_path);
+ if (pathlen <= sizeof(*fp) - sizeof(fp->fhh_gen)) {
+ /* dlog("mp_to_fh: new filehandle: %s", mp->am_path); */
+
+ /*
+ * Because fhp is treated as a filehandle we use memcpy instead of
+ * xstrlcpy.
+ */
+ memcpy(fp->u.fhh_path, mp->am_path, pathlen); /* making a filehandle */
+ } else {
+ /*
+ * Take the process id
+ */
+ fp->u.s.fhh_pid = get_server_pid();
+
+ /*
+ * ... the map number
+ */
+ fp->u.s.fhh_id = mp->am_mapno;
+
+ /*
+ * ... and the generation number (previously stored)
+ * to make a "unique" triple that will never
+ * be reallocated except across reboots (which doesn't matter)
+ * or if we are unlucky enough to be given the same
+ * pid as a previous amd (very unlikely).
+ */
+ /* dlog("mp_to_fh: old filehandle: %d", fp->u.s.fhh_id); */
+ }
+}
+
+#ifdef HAVE_FS_NFS3
+static am_ftype3 ftype_to_ftype3(nfsftype ftype)
+{
+ if (ftype == NFFIFO)
+ return AM_NF3FIFO;
+ else
+ return ftype;
+}
+
+static void nfstime_to_am_nfstime3(nfstime *time, am_nfstime3 *time3)
+{
+ time3->seconds = time->seconds;
+ time3->nseconds = time->useconds * 1000;
+}
+
+static void rdev_to_am_specdata3(u_int rdev, am_specdata3 *rdev3)
+{
+ /* No device node here */
+ rdev3->specdata1 = (u_int) -1;
+ rdev3->specdata2 = (u_int) -1;
+}
+
+static void fattr_to_fattr3(nfsfattr *fattr, am_fattr3 *fattr3)
+{
+ fattr3->type = ftype_to_ftype3(fattr->na_type);
+ fattr3->mode = (am_mode3) fattr->na_mode;
+ fattr3->nlink = fattr->na_nlink;
+ fattr3->uid = (am_uid3) fattr->na_uid;
+ fattr3->gid = (am_uid3) fattr->na_gid;
+ fattr3->size = (am_size3) fattr->na_size;
+ fattr3->used = (am_size3) fattr->na_size;
+ rdev_to_am_specdata3(fattr->na_rdev, &fattr3->rdev);
+ fattr3->fsid = (uint64) fattr->na_fsid;
+ fattr3->fileid = (uint64) fattr->na_fileid;
+ nfstime_to_am_nfstime3(&fattr->na_atime, &fattr3->atime);
+ nfstime_to_am_nfstime3(&fattr->na_mtime, &fattr3->mtime);
+ nfstime_to_am_nfstime3(&fattr->na_ctime, &fattr3->ctime);
+}
+
+static void fattr_to_wcc_attr(nfsfattr *fattr, am_wcc_attr *wcc_attr)
+{
+ wcc_attr->size = (am_size3) fattr->na_size;
+ nfstime_to_am_nfstime3(&fattr->na_mtime, &wcc_attr->mtime);
+ nfstime_to_am_nfstime3(&fattr->na_ctime, &wcc_attr->ctime);
+}
+
+static am_nfsstat3 return_estale_or_rofs(am_nfs_fh3 *fh,
+ am_pre_op_attr *pre_op,
+ am_post_op_attr *post_op)
+{
+ am_node *mp;
+
+ mp = fh3_to_mp(fh);
+ if (!mp) {
+ pre_op->attributes_follow = 0;
+ post_op->attributes_follow = 0;
+ return nfs_error(ESTALE);
+ } else {
+ am_fattr3 *fattr3 = &post_op->am_post_op_attr_u.attributes;
+ am_wcc_attr *wcc_attr = &pre_op->am_pre_op_attr_u.attributes;
+ nfsfattr *fattr = &mp->am_fattr;
+ pre_op->attributes_follow = 1;
+ fattr_to_wcc_attr(fattr, wcc_attr);
+ post_op->attributes_follow = 1;
+ fattr_to_fattr3(fattr, fattr3);
+ return nfs_error(EROFS);
+ }
+}
+
+static am_nfsstat3 unlink3_or_rmdir3(am_diropargs3 *argp,
+ am_wcc_data *wcc_data, int unlinkp)
+{
+ static am_nfsstat3 res;
+ am_nfs_fh3 *dir = &argp->dir;
+ am_filename3 name = argp->name;
+ am_pre_op_attr *pre_op_dir = &wcc_data->before;
+ am_post_op_attr *post_op_dir = &wcc_data->after;
+ nfsfattr *fattr;
+ am_wcc_attr *wcc_attr;
+ am_node *mp, *ap;
+ int retry;
+
+ post_op_dir->attributes_follow = 0;
+
+ mp = fh3_to_mp3(dir, &retry, VLOOK_DELETE);
+ if (!mp) {
+ pre_op_dir->attributes_follow = 0;
+ if (retry < 0) {
+ amd_stats.d_drops++;
+ return 0;
+ }
+ res = nfs_error(retry);
+ goto out;
+ }
+
+ pre_op_dir->attributes_follow = 1;
+ fattr = &mp->am_fattr;
+ wcc_attr = &pre_op_dir->am_pre_op_attr_u.attributes;
+ fattr_to_wcc_attr(fattr, wcc_attr);
+
+ if (mp->am_fattr.na_type != NFDIR) {
+ res = nfs_error(ENOTDIR);
+ goto out;
+ }
+
+ if (amuDebug(D_TRACE))
+ plog(XLOG_DEBUG, "\tremove(%s, %s)", mp->am_path, name);
+
+ ap = mp->am_al->al_mnt->mf_ops->lookup_child(mp, name, &retry, VLOOK_DELETE);
+ if (!ap) {
+ /*
+ * Ignore retries...
+ */
+ if (retry < 0)
+ retry = 0;
+ /*
+ * Usual NFS workaround...
+ */
+ else if (retry == ENOENT)
+ retry = 0;
+ res = nfs_error(retry);
+ } else {
+ forcibly_timeout_mp(mp);
+ res = AM_NFS3_OK;
+ }
+
+out:
+ return res;
+}
+
+voidp
+am_nfs3_null_3_svc(voidp argp, struct svc_req *rqstp)
+{
+ static char * result;
+
+ return (voidp) &result;
+}
+
+am_GETATTR3res *
+am_nfs3_getattr_3_svc(am_GETATTR3args *argp, struct svc_req *rqstp)
+{
+ static am_GETATTR3res result;
+ am_nfs_fh3 *fh = (am_nfs_fh3 *) &argp->object;
+ am_fattr3 *fattr3;
+ nfsfattr *fattr;
+ am_node *mp;
+ int retry = 0;
+ time_t now = clocktime(NULL);
+
+ if (amuDebug(D_TRACE))
+ plog(XLOG_DEBUG, "getattr_3:");
+
+ mp = fh3_to_mp3(fh, &retry, VLOOK_CREATE);
+ if (!mp) {
+ if (amuDebug(D_TRACE))
+ plog(XLOG_DEBUG, "\tretry=%d", retry);
+
+ if (retry < 0) {
+ amd_stats.d_drops++;
+ return 0;
+ }
+ result.status = nfs_error(retry);
+ return &result;
+ }
+
+ fattr = &mp->am_fattr;
+ fattr3 = (am_fattr3 *) &result.res_u.ok.obj_attributes;
+ fattr_to_fattr3(fattr, fattr3);
+
+ result.status = AM_NFS3_OK;
+
+ if (amuDebug(D_TRACE))
+ plog(XLOG_DEBUG, "\tstat(%s), size = %lu, mtime=%d.%d",
+ mp->am_path,
+ (u_long) fattr3->size,
+ (u_int) fattr3->mtime.seconds,
+ (u_int) fattr3->mtime.nseconds);
+
+ /* Delay unmount of what was looked up */
+ if (mp->am_timeo_w < 4 * gopt.am_timeo_w)
+ mp->am_timeo_w += gopt.am_timeo_w;
+ mp->am_ttl = now + mp->am_timeo_w;
+
+ mp->am_stats.s_getattr++;
+
+ return &result;
+}
+
+am_SETATTR3res *
+am_nfs3_setattr_3_svc(am_SETATTR3args *argp, struct svc_req *rqstp)
+{
+ static am_SETATTR3res result;
+ am_nfs_fh3 *fh = (am_nfs_fh3 *) &argp->object;
+ am_pre_op_attr *pre_op_obj = &result.res_u.fail.obj_wcc.before;
+ am_post_op_attr *post_op_obj = &result.res_u.fail.obj_wcc.after;
+
+ if (amuDebug(D_TRACE))
+ plog(XLOG_DEBUG, "setattr_3:");
+
+ result.status = return_estale_or_rofs(fh, pre_op_obj, post_op_obj);
+
+ return &result;
+}
+
+am_LOOKUP3res *
+am_nfs3_lookup_3_svc(am_LOOKUP3args *argp, struct svc_req *rqstp)
+{
+ static am_LOOKUP3res result;
+ am_nfs_fh3 *dir = &argp->what.dir;
+ am_post_op_attr *post_op_dir;
+ am_post_op_attr *post_op_obj;
+ am_node *mp;
+ int retry;
+ uid_t uid;
+ gid_t gid;
+
+ if (amuDebug(D_TRACE))
+ plog(XLOG_DEBUG, "lookup_3:");
+
+ /* finally, find the effective uid/gid from RPC request */
+ if (getcreds(rqstp, &uid, &gid, nfsxprt) < 0)
+ plog(XLOG_ERROR, "cannot get uid/gid from RPC credentials");
+ xsnprintf(opt_uid, sizeof(uid_str), "%d", (int) uid);
+ xsnprintf(opt_gid, sizeof(gid_str), "%d", (int) gid);
+
+ mp = fh3_to_mp3(dir, &retry, VLOOK_CREATE);
+ if (!mp) {
+ post_op_dir = &result.res_u.fail.dir_attributes;
+ post_op_dir->attributes_follow = 0;
+ if (retry < 0) {
+ amd_stats.d_drops++;
+ return 0;
+ }
+ result.status = nfs_error(retry);
+ } else {
+ post_op_dir = &result.res_u.ok.dir_attributes;
+ post_op_obj = &result.res_u.ok.obj_attributes;
+ am_filename3 name;
+ am_fattr3 *fattr3;
+ nfsfattr *fattr;
+ am_node *ap;
+ int error;
+
+ /* dir attributes */
+ post_op_dir->attributes_follow = 1;
+ fattr = &mp->am_fattr;
+ fattr3 = &post_op_dir->am_post_op_attr_u.attributes;
+ fattr_to_fattr3(fattr, fattr3);
+
+ post_op_obj->attributes_follow = 0;
+
+ name = argp->what.name;
+
+ if (amuDebug(D_TRACE))
+ plog(XLOG_DEBUG, "\tlookup_3(%s, %s)", mp->am_path, name);
+
+ ap = mp->am_al->al_mnt->mf_ops->lookup_child(mp, name, &error, VLOOK_CREATE);
+ if (ap && error < 0)
+ ap = mp->am_al->al_mnt->mf_ops->mount_child(ap, &error);
+ if (ap == 0) {
+ if (error < 0) {
+ amd_stats.d_drops++;
+ return 0;
+ }
+ result.status = nfs_error(error);
+ } else {
+ /*
+ * XXX: EXPERIMENTAL! Delay unmount of what was looked up. This
+ * should reduce the chance for race condition between unmounting an
+ * entry synchronously, and re-mounting it asynchronously.
+ */
+ if (ap->am_ttl < mp->am_ttl)
+ ap->am_ttl = mp->am_ttl;
+
+ mp_to_fh3(ap, &result.res_u.ok.object);
+
+ /* mount attributes */
+ post_op_obj->attributes_follow = 1;
+ fattr = &ap->am_fattr;
+ fattr3 = &post_op_obj->am_post_op_attr_u.attributes;
+ fattr_to_fattr3(fattr, fattr3);
+
+ result.status = AM_NFS3_OK;
+ }
+ mp->am_stats.s_lookup++;
+ }
+ return &result;
+}
+
+am_ACCESS3res *
+am_nfs3_access_3_svc(am_ACCESS3args *argp, struct svc_req *rqstp)
+{
+ static am_ACCESS3res result;
+
+ am_nfs_fh3 *obj = &argp->object;
+ u_int accessbits = argp->access;
+ u_int accessmask = AM_ACCESS3_LOOKUP|AM_ACCESS3_READ;
+ am_post_op_attr *post_op_obj;
+ am_node *mp;
+
+ if (amuDebug(D_TRACE))
+ plog(XLOG_DEBUG, "access_3:");
+
+ mp = fh3_to_mp(obj);
+ if (!mp) {
+ post_op_obj = &result.res_u.fail.obj_attributes;
+ post_op_obj->attributes_follow = 0;
+ result.status = nfs_error(ENOENT);
+ if (amuDebug(D_TRACE))
+ plog(XLOG_DEBUG, "access_3: ENOENT");
+ } else {
+ nfsfattr *fattr = &mp->am_fattr;
+ am_fattr3 *fattr3;
+ post_op_obj = &result.res_u.ok.obj_attributes;
+ fattr3 = &post_op_obj->am_post_op_attr_u.attributes;
+ post_op_obj->attributes_follow = 1;
+ fattr_to_fattr3(fattr, fattr3);
+
+ result.res_u.ok.access = accessbits & accessmask;
+ if (amuDebug(D_TRACE))
+ plog(XLOG_DEBUG, "access_3: b=%x m=%x", accessbits, accessmask);
+
+ result.status = AM_NFS3_OK;
+ }
+
+ return &result;
+}
+
+am_READLINK3res *
+am_nfs3_readlink_3_svc(am_READLINK3args *argp, struct svc_req *rqstp)
+{
+ static am_READLINK3res result;
+
+ am_nfs_fh3 *symlink = (am_nfs_fh3 *) &argp->symlink;
+ am_post_op_attr *post_op_sym;
+ am_node *mp;
+ int retry = 0;
+
+ if (amuDebug(D_TRACE))
+ plog(XLOG_DEBUG, "readlink_3:");
+
+ mp = fh3_to_mp3(symlink, &retry, VLOOK_CREATE);
+ if (!mp) {
+ readlink_retry:
+ if (retry < 0) {
+ amd_stats.d_drops++;
+ return 0;
+ }
+ post_op_sym = &result.res_u.fail.symlink_attributes;
+ post_op_sym->attributes_follow = 0;
+ result.status = nfs_error(retry);
+ } else {
+ nfsfattr *fattr;
+ am_fattr3 *fattr3;
+ char *ln;
+
+ ln = do_readlink(mp, &retry);
+ if (!ln)
+ goto readlink_retry;
+
+ if (amuDebug(D_TRACE) && ln)
+ plog(XLOG_DEBUG, "\treadlink_3(%s) = %s", mp->am_path, ln);
+
+ result.res_u.ok.data = ln;
+
+ post_op_sym = &result.res_u.ok.symlink_attributes;
+ post_op_sym->attributes_follow = 1;
+ fattr = &mp->am_fattr;
+ fattr3 = &post_op_sym->am_post_op_attr_u.attributes;
+ fattr_to_fattr3(fattr, fattr3);
+
+ mp->am_stats.s_readlink++;
+ result.status = AM_NFS3_OK;
+ }
+
+ return &result;
+}
+
+am_READ3res *
+am_nfs3_read_3_svc(am_READ3args *argp, struct svc_req *rqstp)
+{
+ static am_READ3res result;
+
+ am_nfs_fh3 *file = (am_nfs_fh3 *) &argp->file;
+ am_post_op_attr *post_op_file;
+ am_node *mp;
+
+ if (amuDebug(D_TRACE))
+ plog(XLOG_DEBUG, "read_3:");
+
+ post_op_file = &result.res_u.fail.file_attributes;
+ result.status = nfs_error(EACCES);
+
+ mp = fh3_to_mp(file);
+ if (!mp)
+ post_op_file->attributes_follow = 0;
+ else {
+ nfsfattr *fattr = &mp->am_fattr;
+ am_fattr3 *fattr3 = &post_op_file->am_post_op_attr_u.attributes;
+ post_op_file->attributes_follow = 1;
+ fattr_to_fattr3(fattr, fattr3);
+ }
+
+ return &result;
+}
+
+am_WRITE3res *
+am_nfs3_write_3_svc(am_WRITE3args *argp, struct svc_req *rqstp)
+{
+ static am_WRITE3res result;
+
+ am_nfs_fh3 *file = (am_nfs_fh3 *) &argp->file;
+ am_pre_op_attr *pre_op_file = &result.res_u.fail.file_wcc.before;
+ am_post_op_attr *post_op_file = &result.res_u.fail.file_wcc.after;
+
+ if (amuDebug(D_TRACE))
+ plog(XLOG_DEBUG, "write_3:");
+
+ result.status = return_estale_or_rofs(file, pre_op_file, post_op_file);
+
+ return &result;
+}
+
+am_CREATE3res *
+am_nfs3_create_3_svc(am_CREATE3args *argp, struct svc_req *rqstp)
+{
+ static am_CREATE3res result;
+
+ am_nfs_fh3 *dir = (am_nfs_fh3 *) &argp->where.dir;
+ am_pre_op_attr *pre_op_dir = &result.res_u.fail.dir_wcc.before;
+ am_post_op_attr *post_op_dir = &result.res_u.fail.dir_wcc.after;
+
+ if (amuDebug(D_TRACE))
+ plog(XLOG_DEBUG, "create_3:");
+
+ result.status = return_estale_or_rofs(dir, pre_op_dir, post_op_dir);
+
+ return &result;
+}
+
+am_MKDIR3res *
+am_nfs3_mkdir_3_svc(am_MKDIR3args *argp, struct svc_req *rqstp)
+{
+ static am_MKDIR3res result;
+
+ am_nfs_fh3 *dir = (am_nfs_fh3 *) &argp->where.dir;
+ am_pre_op_attr *pre_op_dir = &result.res_u.fail.dir_wcc.before;
+ am_post_op_attr *post_op_dir = &result.res_u.fail.dir_wcc.after;
+
+ if (amuDebug(D_TRACE))
+ plog(XLOG_DEBUG, "mkdir_3:");
+
+ result.status = return_estale_or_rofs(dir, pre_op_dir, post_op_dir);
+
+ return &result;
+}
+
+am_SYMLINK3res *
+am_nfs3_symlink_3_svc(am_SYMLINK3args *argp, struct svc_req *rqstp)
+{
+ static am_SYMLINK3res result;
+
+ am_nfs_fh3 *dir = (am_nfs_fh3 *) &argp->where.dir;
+ am_pre_op_attr *pre_op_dir = &result.res_u.fail.dir_wcc.before;
+ am_post_op_attr *post_op_dir = &result.res_u.fail.dir_wcc.after;
+
+ if (amuDebug(D_TRACE))
+ plog(XLOG_DEBUG, "symlink_3:");
+
+ result.status = return_estale_or_rofs(dir, pre_op_dir, post_op_dir);
+
+ return &result;
+}
+
+am_MKNOD3res *
+am_nfs3_mknod_3_svc(am_MKNOD3args *argp, struct svc_req *rqstp)
+{
+ static am_MKNOD3res result;
+
+ am_nfs_fh3 *dir = (am_nfs_fh3 *) &argp->where.dir;
+ am_pre_op_attr *pre_op_dir = &result.res_u.fail.dir_wcc.before;
+ am_post_op_attr *post_op_dir = &result.res_u.fail.dir_wcc.after;
+
+ if (amuDebug(D_TRACE))
+ plog(XLOG_DEBUG, "mknod_3:");
+
+ result.status = return_estale_or_rofs(dir, pre_op_dir, post_op_dir);
+ return &result;
+}
+
+am_REMOVE3res *
+am_nfs3_remove_3_svc(am_REMOVE3args *argp, struct svc_req *rqstp)
+{
+ static am_REMOVE3res result;
+
+ am_diropargs3 *obj = &argp->object;
+ am_wcc_data dir_wcc;
+
+ if (amuDebug(D_TRACE))
+ plog(XLOG_DEBUG, "remove_3:");
+
+ result.status = unlink3_or_rmdir3(obj, &dir_wcc, TRUE);
+
+ result.res_u.ok.dir_wcc = dir_wcc;
+
+ return &result;
+}
+
+am_RMDIR3res *
+am_nfs3_rmdir_3_svc(am_RMDIR3args *argp, struct svc_req *rqstp)
+{
+ static am_RMDIR3res result;
+
+ am_diropargs3 *obj = &argp->object;
+ am_wcc_data dir_wcc;
+
+ if (amuDebug(D_TRACE))
+ plog(XLOG_DEBUG, "rmdir_3:");
+
+ result.status = unlink3_or_rmdir3(obj, &dir_wcc, TRUE);
+
+ result.res_u.ok.dir_wcc = dir_wcc;
+
+ return &result;
+}
+
+am_RENAME3res *
+am_nfs3_rename_3_svc(am_RENAME3args *argp, struct svc_req *rqstp)
+{
+ static am_RENAME3res result;
+
+ am_nfs_fh3 *fromdir = (am_nfs_fh3 *) &argp->from.dir;
+ am_nfs_fh3 *todir = (am_nfs_fh3 *) &argp->to.dir;
+ am_filename3 name = argp->to.name;
+ am_node *to_mp, *from_mp;
+
+ if (amuDebug(D_TRACE))
+ plog(XLOG_DEBUG, "rename_3:");
+
+ if (!(from_mp = fh3_to_mp(fromdir)) || !(to_mp = fh3_to_mp(todir)))
+ result.status = nfs_error(ESTALE);
+ /*
+ * If the kernel is doing clever things with referenced files
+ * then let it pretend...
+ */
+ else {
+ am_wcc_attr *wcc_attr;
+ am_fattr3 *fattr3;
+ am_wcc_data *to_wcc_data, *from_wcc_data;
+ am_pre_op_attr *pre_op_to, *pre_op_from;
+ am_post_op_attr *post_op_to, *post_op_from;
+ nfsfattr *fattr;
+
+ to_wcc_data = &result.res_u.ok.todir_wcc;
+
+ pre_op_to = &to_wcc_data->before;
+ post_op_to = &to_wcc_data->after;
+
+ pre_op_to->attributes_follow = 1;
+ fattr = &to_mp->am_fattr;
+ wcc_attr = &pre_op_to->am_pre_op_attr_u.attributes;
+ fattr_to_wcc_attr(fattr, wcc_attr);
+ post_op_to->attributes_follow = 1;
+ fattr3 = &post_op_to->am_post_op_attr_u.attributes;
+ fattr_to_fattr3(fattr, fattr3);
+
+ from_wcc_data = &result.res_u.ok.fromdir_wcc;
+
+ pre_op_from = &from_wcc_data->before;
+ post_op_from = &from_wcc_data->after;
+
+ pre_op_from->attributes_follow = 1;
+ fattr = &from_mp->am_fattr;
+ wcc_attr = &pre_op_from->am_pre_op_attr_u.attributes;
+ fattr_to_wcc_attr(fattr, wcc_attr);
+ post_op_from->attributes_follow = 1;
+ fattr3 = &post_op_from->am_post_op_attr_u.attributes;
+ fattr_to_fattr3(fattr, fattr3);
+
+ if (NSTREQ(name, ".nfs", 4))
+ result.status = AM_NFS3_OK;
+ /*
+ * otherwise a failure
+ */
+ else
+ result.status = nfs_error(EROFS);
+ }
+
+ return &result;
+}
+
+am_LINK3res *
+am_nfs3_link_3_svc(am_LINK3args *argp, struct svc_req *rqstp)
+{
+ static am_LINK3res result;
+
+ am_nfs_fh3 *file = (am_nfs_fh3 *) &argp->file;
+ am_nfs_fh3 *dir = (am_nfs_fh3 *) &argp->link.dir;
+ am_post_op_attr *post_op_file;
+ am_pre_op_attr *pre_op_dir;
+ am_post_op_attr *post_op_dir;
+ am_node *mp_file, *mp_dir;
+
+ if (amuDebug(D_TRACE))
+ plog(XLOG_DEBUG, "link_3:");
+
+ post_op_file = &result.res_u.fail.file_attributes;
+ post_op_file->attributes_follow = 0;
+
+ mp_file = fh3_to_mp(file);
+ if (mp_file) {
+ nfsfattr *fattr = &mp_file->am_fattr;
+ am_fattr3 *fattr3 = &post_op_file->am_post_op_attr_u.attributes;
+ fattr_to_fattr3(fattr, fattr3);
+ }
+
+ pre_op_dir = &result.res_u.fail.linkdir_wcc.before;
+ pre_op_dir->attributes_follow = 0;
+ post_op_dir = &result.res_u.fail.linkdir_wcc.after;
+ post_op_dir->attributes_follow = 0;
+
+ mp_dir = fh3_to_mp(dir);
+ if (mp_dir) {
+ nfsfattr *fattr = &mp_dir->am_fattr;
+ am_fattr3 *fattr3 = &post_op_dir->am_post_op_attr_u.attributes;
+ am_wcc_attr *wcc_attr = &pre_op_dir->am_pre_op_attr_u.attributes;
+
+ pre_op_dir->attributes_follow = 1;
+ fattr_to_wcc_attr(fattr, wcc_attr);
+ post_op_dir->attributes_follow = 1;
+ fattr_to_fattr3(fattr, fattr3);
+ }
+
+ if (!mp_file || !mp_dir)
+ result.status = nfs_error(ESTALE);
+ else
+ result.status = nfs_error(EROFS);
+
+ return &result;
+}
+
+am_READDIR3res *
+am_nfs3_readdir_3_svc(am_READDIR3args *argp, struct svc_req *rqstp)
+{
+ static am_READDIR3res result;
+ static am_entry3 entries[MAX_READDIR_ENTRIES];
+ am_nfs_fh3 *dir = (am_nfs_fh3 *) &argp->dir;
+ am_cookie3 cookie = argp->cookie;
+ am_cookieverf3 cookieverf;
+ am_count3 count = argp->count;
+ am_post_op_attr *post_op_dir;
+ am_node *mp;
+ int retry;
+
+ if (amuDebug(D_TRACE))
+ plog(XLOG_DEBUG, "readdir_3:");
+
+ memcpy(&cookieverf, &argp->cookieverf, sizeof(am_cookieverf3));
+
+ mp = fh3_to_mp3(dir, &retry, VLOOK_CREATE);
+ if (mp == NULL) {
+ if (retry < 0) {
+ amd_stats.d_drops++;
+ return 0;
+ }
+ post_op_dir = &result.res_u.fail.dir_attributes;
+ post_op_dir->attributes_follow = 0;
+ result.status = nfs_error(retry);
+ } else {
+ am_dirlist3 *list = &result.res_u.ok.reply;
+ am_nfsstat3 status;
+
+ if (amuDebug(D_TRACE))
+ plog(XLOG_DEBUG, "\treaddir_3(%s)", mp->am_path);
+
+ status = mp->am_al->al_mnt->mf_ops->readdir(mp,
+ (voidp)&cookie, list, entries, count);
+ if (status == 0) {
+ post_op_dir = &result.res_u.ok.dir_attributes;
+ nfsfattr *fattr;
+ am_fattr3 *fattr3;
+
+ fattr = &mp->am_fattr;
+ fattr3 = &post_op_dir->am_post_op_attr_u.attributes;
+ post_op_dir->attributes_follow = 1;
+ fattr_to_fattr3(fattr, fattr3);
+ result.status = AM_NFS3_OK;
+ } else {
+ post_op_dir = &result.res_u.fail.dir_attributes;
+ post_op_dir->attributes_follow = 0;
+ result.status = nfs_error(status);
+ }
+
+ mp->am_stats.s_readdir++;
+ }
+
+ return &result;
+}
+
+am_READDIRPLUS3res *
+am_nfs3_readdirplus_3_svc(am_READDIRPLUS3args *argp, struct svc_req *rqstp)
+{
+ static am_READDIRPLUS3res result;
+ am_nfs_fh3 *dir = (am_nfs_fh3 *) &argp->dir;
+ am_post_op_attr *post_op_dir;
+ nfsfattr *fattr;
+ am_fattr3 *fattr3;
+ am_node *mp;
+ int retry;
+
+ mp = fh3_to_mp3(dir, &retry, VLOOK_CREATE);
+ if (mp == NULL) {
+ if (retry < 0) {
+ amd_stats.d_drops++;
+ return 0;
+ }
+ post_op_dir = &result.res_u.fail.dir_attributes;
+ post_op_dir->attributes_follow = 0;
+ result.status = nfs_error(retry);
+ } else {
+ post_op_dir = &result.res_u.ok.dir_attributes;
+ fattr = &mp->am_fattr;
+ fattr3 = &post_op_dir->am_post_op_attr_u.attributes;
+ post_op_dir->attributes_follow = 1;
+ fattr_to_fattr3(fattr, fattr3);
+ result.status = AM_NFS3ERR_NOTSUPP;
+ }
+
+ return &result;
+}
+
+am_FSSTAT3res *
+am_nfs3_fsstat_3_svc(am_FSSTAT3args *argp, struct svc_req *rqstp)
+{
+ static am_FSSTAT3res result;
+
+ am_nfs_fh3 *fsroot = (am_nfs_fh3 *) &argp->fsroot;
+ am_post_op_attr *post_op_fsroot;
+ am_node *mp;
+ int retry;
+
+ if (amuDebug(D_TRACE))
+ plog(XLOG_DEBUG, "fsstat_3:");
+
+ mp = fh3_to_mp3(fsroot, &retry, VLOOK_CREATE);
+ if (!mp) {
+ if (retry < 0) {
+ amd_stats.d_drops++;
+ return 0;
+ }
+ post_op_fsroot = &result.res_u.fail.obj_attributes;
+ post_op_fsroot->attributes_follow = 0;
+ result.status = nfs_error(retry);
+ } else {
+ am_FSSTAT3resok *ok = &result.res_u.ok;
+ u_int blocks, bfree, bavail;
+ nfsfattr *fattr;
+ am_fattr3 *fattr3;
+ mntent_t mnt;
+
+ if (amuDebug(D_TRACE))
+ plog(XLOG_DEBUG, "\tfsstat_3(%s)", mp->am_path);
+
+ fattr = &mp->am_fattr;
+ post_op_fsroot = &ok->obj_attributes;
+ post_op_fsroot->attributes_follow = 1;
+ fattr3 = &post_op_fsroot->am_post_op_attr_u.attributes;
+ fattr_to_fattr3(fattr, fattr3);
+
+ /*
+ * just return faked up file system information
+ */
+ ok->tbytes = 1024;
+ ok->invarsec = 0;
+
+ /* check if map is browsable and show_statfs_entries=yes */
+ if ((gopt.flags & CFM_SHOW_STATFS_ENTRIES) &&
+ mp->am_al->al_mnt && mp->am_al->al_mnt->mf_mopts) {
+ mnt.mnt_opts = mp->am_al->al_mnt->mf_mopts;
+ if (amu_hasmntopt(&mnt, "browsable")) {
+ count_map_entries(mp, &blocks, &bfree, &bavail);
+ }
+ ok->fbytes = bfree;
+ ok->abytes = bavail;
+ ok->ffiles = bfree;
+ ok->afiles = bavail;
+ ok->tfiles = blocks;
+ } else {
+ ok->fbytes = 0;
+ ok->abytes = 0;
+ ok->ffiles = 0;
+ ok->afiles = 0;
+ ok->tfiles = 0; /* set to 1 if you don't want empty automounts */
+ }
+
+ result.status = AM_NFS3_OK;
+ mp->am_stats.s_statfs++;
+ }
+
+ return &result;
+}
+
+#define FSF3_HOMOGENEOUS 0x0008
+
+am_FSINFO3res *
+am_nfs3_fsinfo_3_svc(am_FSINFO3args *argp, struct svc_req *rqstp)
+{
+ static am_FSINFO3res result;
+
+ am_nfs_fh3 *fsroot = (am_nfs_fh3 *) &argp->fsroot;
+ am_post_op_attr *post_op_fsroot;
+ am_node *mp;
+ int retry;
+
+ if (amuDebug(D_TRACE))
+ plog(XLOG_DEBUG, "fsinfo_3:");
+
+ mp = fh3_to_mp3(fsroot, &retry, VLOOK_CREATE);
+ if (!mp) {
+ if (retry < 0) {
+ amd_stats.d_drops++;
+ return 0;
+ }
+ post_op_fsroot = &result.res_u.fail.obj_attributes;
+ post_op_fsroot->attributes_follow = 0;
+ result.status = nfs_error(retry);
+ } else {
+ am_FSINFO3resok *ok = &result.res_u.ok;
+ nfsfattr *fattr;
+ am_fattr3 *fattr3;
+
+ if (amuDebug(D_TRACE))
+ plog(XLOG_DEBUG, "\tfsinfo_3(%s)", mp->am_path);
+
+ fattr = &mp->am_fattr;
+ post_op_fsroot = &ok->obj_attributes;
+ post_op_fsroot->attributes_follow = 1;
+ fattr3 = &post_op_fsroot->am_post_op_attr_u.attributes;
+ fattr_to_fattr3(fattr, fattr3);
+
+ /*
+ * just return faked up file system information
+ */
+ ok->rtmax = 0;
+ ok->rtpref = 0;
+ ok->rtmult = 0;
+ ok->wtmax = 0;
+ ok->wtpref = 0;
+ ok->wtmult = 0;
+ ok->dtpref = 1024;
+ ok->maxfilesize = 0;
+ ok->time_delta.seconds = 1;
+ ok->time_delta.nseconds = 0;
+ ok->properties = FSF3_HOMOGENEOUS;
+
+ result.status = AM_NFS3_OK;
+ mp->am_stats.s_fsinfo++;
+ }
+
+ return &result;
+}
+
+am_PATHCONF3res *
+am_nfs3_pathconf_3_svc(am_PATHCONF3args *argp, struct svc_req *rqstp)
+{
+ static am_PATHCONF3res result;
+
+ am_nfs_fh3 *obj = (am_nfs_fh3 *) &argp->object;
+ am_post_op_attr *post_op_obj;
+ am_node *mp;
+ int retry;
+
+ if (amuDebug(D_TRACE))
+ plog(XLOG_DEBUG, "pathconf_3:");
+
+ mp = fh3_to_mp3(obj, &retry, VLOOK_CREATE);
+ if (!mp) {
+ if (retry < 0) {
+ amd_stats.d_drops++;
+ return 0;
+ }
+ post_op_obj = &result.res_u.fail.obj_attributes;
+ post_op_obj->attributes_follow = 0;
+ result.status = nfs_error(retry);
+ } else {
+ am_PATHCONF3resok *ok = &result.res_u.ok;
+ nfsfattr *fattr;
+ am_fattr3 *fattr3;
+
+ if (amuDebug(D_TRACE))
+ plog(XLOG_DEBUG, "\tpathconf_3(%s)", mp->am_path);
+
+ fattr = &mp->am_fattr;
+ post_op_obj = &ok->obj_attributes;
+ post_op_obj->attributes_follow = 1;
+ fattr3 = &post_op_obj->am_post_op_attr_u.attributes;
+ fattr_to_fattr3(fattr, fattr3);
+
+ ok->linkmax = 0;
+ ok->name_max = NAME_MAX;
+ ok->no_trunc = 1;
+ ok->chown_restricted = 1;
+ ok->case_insensitive = 0;
+ ok->case_preserving = 1;
+
+ result.status = AM_NFS3_OK;
+ mp->am_stats.s_pathconf++;
+ }
+
+ return &result;
+}
+
+am_COMMIT3res *
+am_nfs3_commit_3_svc(am_COMMIT3args *argp, struct svc_req *rqstp)
+{
+ static am_COMMIT3res result;
+
+ am_nfs_fh3 *file = (am_nfs_fh3 *) &argp->file;
+ am_pre_op_attr *pre_op_file = &result.res_u.fail.file_wcc.before;
+ am_post_op_attr *post_op_file = &result.res_u.fail.file_wcc.after;
+
+ if (amuDebug(D_TRACE))
+ plog(XLOG_DEBUG, "commit_3:");
+
+ result.status = return_estale_or_rofs(file, pre_op_file, post_op_file);
+
+ return &result;
+}
+#endif /* HAVE_FS_NFS3 */
diff --git a/contrib/amd/amd/ops_TEMPLATE.c b/contrib/amd/amd/ops_TEMPLATE.c
index 3f7421984412..b873c8ece271 100644
--- a/contrib/amd/amd/ops_TEMPLATE.c
+++ b/contrib/amd/amd/ops_TEMPLATE.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997-2006 Erez Zadok
+ * Copyright (c) 1997-2014 Erez Zadok
* Copyright (c) 1990 Jan-Simon Pendry
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
* Copyright (c) 1990 The Regents of the University of California.
@@ -16,11 +16,7 @@
* 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgment:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -64,7 +60,7 @@ static int foofs_init(mntfs *mf);
static int foofs_mount(am_node *mp, mntfs *mf);
static int foofs_umount(am_node *mp, mntfs *mf);
static am_node *foofs_lookuppn(am_node *mp, char *fname, int *error_return, int op);
-static int foofs_readdir(am_node *mp, nfscookie cookie, nfsdirlist *dp, nfsentry *ep, u_int count);
+static int foofs_readdir(am_node *mp, void cookie, voidp dp, voidp ep, u_int count);
static am_node *foofs_readlink(am_node *mp, int *error_return);
static void foofs_mounted(am_node *am, mntfs *mf);
static void foofs_umounted(am_node *mp, mntfs *mf);
@@ -220,7 +216,7 @@ foofs_lookuppn(am_node *mp, char *fname, int *error_return, int op)
* If OK, fills in ep with chain of directory entries.
*/
static int
-foofs_readdir(am_node *mp, nfscookie cookie, nfsdirlist *dp, nfsentry *ep, u_int count)
+foofs_readdir(am_node *mp, void cookie, voidp dp, voidp ep, u_int count)
{
int error = 0;
diff --git a/contrib/amd/amd/ops_cachefs.c b/contrib/amd/amd/ops_cachefs.c
index d3e303bc2bf9..26a333527457 100644
--- a/contrib/amd/amd/ops_cachefs.c
+++ b/contrib/amd/amd/ops_cachefs.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997-2006 Erez Zadok
+ * Copyright (c) 1997-2014 Erez Zadok
* Copyright (c) 1990 Jan-Simon Pendry
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
* Copyright (c) 1990 The Regents of the University of California.
@@ -16,11 +16,7 @@
* 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgment:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -99,7 +95,7 @@ cachefs_match(am_opts *fo)
dlog("CACHEFS: using cache directory \"%s\"", fo->opt_cachedir);
/* determine magic cookie to put in mtab */
- return strdup(fo->opt_cachedir);
+ return xstrdup(fo->opt_cachedir);
}
@@ -114,7 +110,7 @@ cachefs_init(mntfs *mf)
* Save cache directory name
*/
if (!mf->mf_private) {
- mf->mf_private = (voidp) strdup(mf->mf_fo->opt_cachedir);
+ mf->mf_private = (voidp) xstrdup(mf->mf_fo->opt_cachedir);
mf->mf_prfree = (void (*)(voidp)) free;
}
diff --git a/contrib/amd/amd/ops_cdfs.c b/contrib/amd/amd/ops_cdfs.c
index 40355ac5c078..6ceb76408b03 100644
--- a/contrib/amd/amd/ops_cdfs.c
+++ b/contrib/amd/amd/ops_cdfs.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997-2006 Erez Zadok
+ * Copyright (c) 1997-2014 Erez Zadok
* Copyright (c) 1990 Jan-Simon Pendry
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
* Copyright (c) 1990 The Regents of the University of California.
@@ -16,11 +16,7 @@
* 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgment:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -97,7 +93,7 @@ cdfs_match(am_opts *fo)
/*
* Determine magic cookie to put in mtab
*/
- return strdup(fo->opt_dev);
+ return xstrdup(fo->opt_dev);
}
@@ -148,6 +144,7 @@ mount_cdfs(char *mntdir, char *fs_name, char *opts, int on_autofs)
if (amu_hasmntopt(&mnt, MNTTAB_OPT_RRIP))
cdfs_flags |= MNT2_CDFS_OPT_RRIP;
#endif /* defined(MNT2_CDFS_OPT_RRIP) && defined(MNTTAB_OPT_RRIP) */
+
#if defined(MNT2_CDFS_OPT_NORRIP) && defined(MNTTAB_OPT_NORRIP)
if (amu_hasmntopt(&mnt, MNTTAB_OPT_NORRIP))
cdfs_flags |= MNT2_CDFS_OPT_NORRIP;
@@ -157,11 +154,27 @@ mount_cdfs(char *mntdir, char *fs_name, char *opts, int on_autofs)
if (amu_hasmntopt(&mnt, MNTTAB_OPT_GENS))
cdfs_flags |= MNT2_CDFS_OPT_GENS;
#endif /* defined(MNT2_CDFS_OPT_GENS) && defined(MNTTAB_OPT_GENS) */
+
#if defined(MNT2_CDFS_OPT_EXTATT) && defined(MNTTAB_OPT_EXTATT)
if (amu_hasmntopt(&mnt, MNTTAB_OPT_EXTATT))
cdfs_flags |= MNT2_CDFS_OPT_EXTATT;
#endif /* defined(MNT2_CDFS_OPT_EXTATT) && defined(MNTTAB_OPT_EXTATT) */
+#if defined(MNT2_CDFS_OPT_NOCASETRANS) && defined(MNTTAB_OPT_NOCASETRANS)
+ if (amu_hasmntopt(&mnt, MNTTAB_OPT_NOCASETRANS))
+ cdfs_flags |= MNT2_CDFS_OPT_NOCASETRANS;
+#endif /* defined(MNT2_CDFS_OPT_NOCASETRANS) && defined(MNTTAB_OPT_NOCASETRANS) */
+
+#if defined(MNT2_CDFS_OPT_NOJOLIET) && defined(MNTTAB_OPT_NOJOLIET)
+ if (amu_hasmntopt(&mnt, MNTTAB_OPT_NOJOLIET))
+ cdfs_flags |= MNT2_CDFS_OPT_NOJOLIET;
+#endif /* defined(MNT2_CDFS_OPT_NOJOLIET) && defined(MNTTAB_OPT_NOJOLIET) */
+
+#if defined(MNT2_CDFS_OPT_RRCASEINS) && defined(MNTTAB_OPT_RRCASEINS)
+ if (amu_hasmntopt(&mnt, MNTTAB_OPT_RRCASEINS))
+ cdfs_flags |= MNT2_CDFS_OPT_RRCASEINS;
+#endif /* defined(MNT2_CDFS_OPT_RRCASEINS) && defined(MNTTAB_OPT_RRCASEINS) */
+
genflags = compute_mount_flags(&mnt);
#ifdef HAVE_FS_AUTOFS
if (on_autofs)
diff --git a/contrib/amd/amd/ops_efs.c b/contrib/amd/amd/ops_efs.c
index 047fe1e4690c..58bf8f0b76cb 100644
--- a/contrib/amd/amd/ops_efs.c
+++ b/contrib/amd/amd/ops_efs.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997-2006 Erez Zadok
+ * Copyright (c) 1997-2014 Erez Zadok
* Copyright (c) 1990 Jan-Simon Pendry
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
* Copyright (c) 1990 The Regents of the University of California.
@@ -16,11 +16,7 @@
* 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgment:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -98,7 +94,7 @@ efs_match(am_opts *fo)
/*
* Determine magic cookie to put in mtab
*/
- return strdup(fo->opt_dev);
+ return xstrdup(fo->opt_dev);
}
@@ -137,6 +133,9 @@ mount_efs(char *mntdir, char *fs_name, char *opts, int on_autofs)
#ifdef HAVE_EFS_ARGS_T_FSPEC
efs_args.fspec = fs_name;
#endif /* HAVE_EFS_ARGS_T_FSPEC */
+#if defined(HAVE_EFS_ARGS_T_VERSION) && defined(EFS_MNT_VERSION)
+ efs_args.version = EFS_MNT_VERSION;
+#endif /* HAVE_EFS_ARGS_T_VERSION && EFS_MNT_VERSION */
/*
* Call generic mount routine
diff --git a/contrib/amd/amd/ops_ext.c b/contrib/amd/amd/ops_ext.c
new file mode 100644
index 000000000000..106ab31f3748
--- /dev/null
+++ b/contrib/amd/amd/ops_ext.c
@@ -0,0 +1,223 @@
+/*
+ * Copyright (c) 1997-2014 Erez Zadok
+ * Copyright (c) 1990 Jan-Simon Pendry
+ * Copyright (c) 1990 Imperial College of Science, Technology & Medicine
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Jan-Simon Pendry at Imperial College, London.
+ *
+ * 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 the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
+ *
+ *
+ * File: am-utils/amd/ops_ext.c
+ *
+ */
+
+/*
+ * Irix UN*X file system: EXT (Extended File System)
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif /* HAVE_CONFIG_H */
+#include <am_defs.h>
+#include <amd.h>
+
+/* forward declarations */
+static char *ext_match(am_opts *fo);
+static int ext2_mount(am_node *am, mntfs *mf);
+static int ext3_mount(am_node *am, mntfs *mf);
+static int ext4_mount(am_node *am, mntfs *mf);
+static int ext_umount(am_node *am, mntfs *mf);
+
+/*
+ * Ops structure
+ */
+am_ops ext2_ops =
+{
+ "ext2",
+ ext_match,
+ 0, /* ext_init */
+ ext2_mount,
+ ext_umount,
+ amfs_error_lookup_child,
+ amfs_error_mount_child,
+ amfs_error_readdir,
+ 0, /* ext_readlink */
+ 0, /* ext_mounted */
+ 0, /* ext_umounted */
+ amfs_generic_find_srvr,
+ 0, /* ext_get_wchan */
+ FS_MKMNT | FS_NOTIMEOUT | FS_UBACKGROUND | FS_AMQINFO, /* nfs_fs_flags */
+#ifdef HAVE_FS_AUTOFS
+ AUTOFS_EXT_FS_FLAGS,
+#endif /* HAVE_FS_AUTOFS */
+};
+
+am_ops ext3_ops =
+{
+ "ext3",
+ ext_match,
+ 0, /* ext_init */
+ ext3_mount,
+ ext_umount,
+ amfs_error_lookup_child,
+ amfs_error_mount_child,
+ amfs_error_readdir,
+ 0, /* ext_readlink */
+ 0, /* ext_mounted */
+ 0, /* ext_umounted */
+ amfs_generic_find_srvr,
+ 0, /* ext_get_wchan */
+ FS_MKMNT | FS_NOTIMEOUT | FS_UBACKGROUND | FS_AMQINFO, /* nfs_fs_flags */
+#ifdef HAVE_FS_AUTOFS
+ AUTOFS_EXT_FS_FLAGS,
+#endif /* HAVE_FS_AUTOFS */
+};
+
+am_ops ext4_ops =
+{
+ "ext4",
+ ext_match,
+ 0, /* ext_init */
+ ext4_mount,
+ ext_umount,
+ amfs_error_lookup_child,
+ amfs_error_mount_child,
+ amfs_error_readdir,
+ 0, /* ext_readlink */
+ 0, /* ext_mounted */
+ 0, /* ext_umounted */
+ amfs_generic_find_srvr,
+ 0, /* ext_get_wchan */
+ FS_MKMNT | FS_NOTIMEOUT | FS_UBACKGROUND | FS_AMQINFO, /* nfs_fs_flags */
+#ifdef HAVE_FS_AUTOFS
+ AUTOFS_EXT_FS_FLAGS,
+#endif /* HAVE_FS_AUTOFS */
+};
+
+/*
+ * EXT needs local filesystem and device.
+ */
+static char *
+ext_match(am_opts *fo)
+{
+
+ if (!fo->opt_dev) {
+ plog(XLOG_USER, "ext: no device specified");
+ return 0;
+ }
+
+ dlog("EXT: mounting device \"%s\" on \"%s\"", fo->opt_dev, fo->opt_fs);
+
+ /*
+ * Determine magic cookie to put in mtab
+ */
+ return xstrdup(fo->opt_dev);
+}
+
+
+static int
+mount_ext(char *mntdir, char *fs_name, char *opts, int on_autofs, char *
+ mount_type, const char *mnttab_type)
+{
+ ext_args_t ext_args;
+ mntent_t mnt;
+ int flags;
+
+ /*
+ * Figure out the name of the file system type.
+ */
+ MTYPE_TYPE type = mount_type;
+
+ memset((voidp) &ext_args, 0, sizeof(ext_args)); /* Paranoid */
+
+ /*
+ * Fill in the mount structure
+ */
+ memset((voidp) &mnt, 0, sizeof(mnt));
+ mnt.mnt_dir = mntdir;
+ mnt.mnt_fsname = fs_name;
+ mnt.mnt_type = mnttab_type;
+ mnt.mnt_opts = opts;
+
+ flags = compute_mount_flags(&mnt);
+#ifdef HAVE_FS_AUTOFS
+ if (on_autofs)
+ flags |= autofs_compute_mount_flags(&mnt);
+#endif /* HAVE_FS_AUTOFS */
+
+ /*
+ * Call generic mount routine
+ */
+ return mount_fs(&mnt, flags, (caddr_t) &ext_args, 0, type, 0, NULL, mnttab_file_name, on_autofs);
+}
+
+
+static int
+ext_mount(am_node *am, mntfs *mf, char *mount_type,
+ const char *mnttab_type)
+{
+ int on_autofs = mf->mf_flags & MFF_ON_AUTOFS;
+ int error;
+
+ error = mount_ext(mf->mf_mount, mf->mf_info, mf->mf_mopts, on_autofs,
+ mount_type, mnttab_type);
+ if (error) {
+ errno = error;
+ plog(XLOG_ERROR, "mount_ext: %m");
+ return error;
+ }
+
+ return 0;
+}
+
+static int
+ext2_mount(am_node *am, mntfs *mf)
+{
+ return ext_mount(am, mf, MOUNT_TYPE_EXT2, MNTTAB_TYPE_EXT2);
+}
+
+static int
+ext3_mount(am_node *am, mntfs *mf)
+{
+ return ext_mount(am, mf, MOUNT_TYPE_EXT3, MNTTAB_TYPE_EXT3);
+}
+
+static int
+ext4_mount(am_node *am, mntfs *mf)
+{
+ return ext_mount(am, mf, MOUNT_TYPE_EXT4, MNTTAB_TYPE_EXT4);
+}
+
+static int
+ext_umount(am_node *am, mntfs *mf)
+{
+ int unmount_flags = (mf->mf_flags & MFF_ON_AUTOFS) ? AMU_UMOUNT_AUTOFS : 0;
+
+ return UMOUNT_FS(mf->mf_mount, mnttab_file_name, unmount_flags);
+}
diff --git a/contrib/amd/amd/ops_lofs.c b/contrib/amd/amd/ops_lofs.c
index 26fdc9f9b626..b04f64399c18 100644
--- a/contrib/amd/amd/ops_lofs.c
+++ b/contrib/amd/amd/ops_lofs.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997-2006 Erez Zadok
+ * Copyright (c) 1997-2014 Erez Zadok
* Copyright (c) 1990 Jan-Simon Pendry
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
* Copyright (c) 1990 The Regents of the University of California.
@@ -16,11 +16,7 @@
* 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgment:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -97,7 +93,7 @@ lofs_match(am_opts *fo)
/*
* Determine magic cookie to put in mtab
*/
- return strdup(fo->opt_rfs);
+ return xstrdup(fo->opt_rfs);
}
diff --git a/contrib/amd/amd/ops_lustre.c b/contrib/amd/amd/ops_lustre.c
new file mode 100644
index 000000000000..1b321ce4e8c4
--- /dev/null
+++ b/contrib/amd/amd/ops_lustre.c
@@ -0,0 +1,203 @@
+/*
+ * Copyright (c) 2011 Christos Zoulas
+ * 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 REGENTS 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 REGENTS 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.
+ *
+ *
+ * File: am-utils/amd/ops_lustre.c
+ *
+ */
+
+/*
+ * Lustre file system
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif /* HAVE_CONFIG_H */
+#ifdef HAVE_FS_LUSTRE
+#include <am_defs.h>
+#include <amd.h>
+
+/* forward declarations */
+static char *lustre_match(am_opts *fo);
+static int lustre_mount(am_node *am, mntfs *mf);
+static int lustre_umount(am_node *am, mntfs *mf);
+
+/*
+ * Ops structure
+ */
+am_ops lustre_ops =
+{
+ "lustre",
+ lustre_match,
+ 0, /* lustre_init */
+ lustre_mount,
+ lustre_umount,
+ amfs_error_lookup_child,
+ amfs_error_mount_child,
+ amfs_error_readdir,
+ 0, /* lustre_readlink */
+ 0, /* lustre_mounted */
+ 0, /* lustre_umounted */
+ amfs_generic_find_srvr,
+ 0, /* lustre_get_wchan */
+ FS_MKMNT | FS_UBACKGROUND | FS_AMQINFO, /* nfs_fs_flags */
+#ifdef HAVE_FS_AUTOFS
+ AUTOFS_LUSTRE_FS_FLAGS,
+#endif /* HAVE_FS_AUTOFS */
+};
+
+
+/*
+ * Lustre needs remote filesystem and host.
+ */
+static char *
+lustre_match(am_opts *fo)
+{
+ char *xmtab, *cp;
+ size_t l;
+ char *rhost, *ptr, *remhost;
+ struct in_addr addr;
+
+ if (fo->opt_fs && !fo->opt_rfs)
+ fo->opt_rfs = fo->opt_fs;
+ if (!fo->opt_rfs) {
+ plog(XLOG_USER, "lustre: no remote filesystem specified");
+ return NULL;
+ }
+ if (!fo->opt_rhost) {
+ plog(XLOG_USER, "lustre: no remote host specified");
+ return NULL;
+ }
+
+ /*
+ * Determine magic cookie to put in mtab
+ */
+ rhost = xstrdup(fo->opt_rhost);
+ remhost = NULL;
+ for (ptr = strtok(rhost, ":"); ptr; ptr = strtok(NULL, ":")) {
+ char *at = strchr(ptr, '@');
+ if (at == NULL) {
+ plog(XLOG_USER, "lustre: missing protocol in host `%s'", ptr);
+ XFREE(rhost);
+ return NULL;
+ }
+ *at = '\0';
+ /*
+ * Convert symbolic addresses to numbers that the kernel likes
+ */
+ if (inet_aton(ptr, &addr) == 0) {
+ struct hostent *hp;
+ if ((hp = gethostbyname(ptr)) == NULL) {
+ plog(XLOG_USER, "lustre: unknown host `%s'", ptr);
+ XFREE(rhost);
+ return NULL;
+ }
+ if (hp->h_length != sizeof(addr.s_addr)) {
+ plog(XLOG_USER, "lustre: bad address length %zu != %d for %s",
+ sizeof(addr), hp->h_length, ptr);
+ XFREE(rhost);
+ return NULL;
+ }
+ memcpy(&addr.s_addr, hp->h_addr, sizeof(addr));
+ }
+ *at = '@';
+
+ cp = remhost;
+ if (remhost)
+ remhost = strvcat(cp, ":", inet_ntoa(addr), at, NULL);
+ else
+ remhost = strvcat(inet_ntoa(addr), at, NULL);
+ XFREE(cp);
+ }
+ if (remhost == NULL) {
+ plog(XLOG_USER, "lustre: empty host");
+ XFREE(rhost);
+ return NULL;
+ }
+
+ XFREE(rhost);
+ XFREE(fo->opt_rhost);
+ fo->opt_rhost = remhost;
+
+ l = strlen(fo->opt_rhost) + strlen(fo->opt_rfs) + 2;
+ xmtab = xmalloc(l);
+ xsnprintf(xmtab, l, "%s:%s", fo->opt_rhost, fo->opt_rfs);
+ dlog("lustre: mounting remote server \"%s\", remote fs \"%s\" on \"%s\"",
+ fo->opt_rhost, fo->opt_rfs, fo->opt_fs);
+
+
+ return xmtab;
+}
+
+static int
+lustre_mount(am_node *am, mntfs *mf)
+{
+ mntent_t mnt;
+ int genflags, error;
+ int on_autofs = mf->mf_flags & MFF_ON_AUTOFS;
+
+ /*
+ * Figure out the name of the file system type.
+ */
+ MTYPE_TYPE type = MOUNT_TYPE_LUSTRE;
+
+ /*
+ * Fill in the mount structure
+ */
+ memset(&mnt, 0, sizeof(mnt));
+ mnt.mnt_dir = mf->mf_mount;
+ mnt.mnt_fsname = mf->mf_info;
+ mnt.mnt_type = MNTTAB_TYPE_LUSTRE;
+ mnt.mnt_opts = mf->mf_mopts;
+
+ genflags = compute_mount_flags(&mnt);
+#ifdef HAVE_FS_AUTOFS
+ if (on_autofs)
+ genflags |= autofs_compute_mount_flags(&mnt);
+#endif /* HAVE_FS_AUTOFS */
+
+ /*
+ * Call generic mount routine
+ */
+ error = mount_fs(&mnt, genflags, NULL, 0, type, 0,
+ NULL, mnttab_file_name, on_autofs);
+ if (error) {
+ errno = error;
+ plog(XLOG_ERROR, "mount_lustre: %m");
+ return error;
+ }
+
+ return 0;
+}
+
+
+static int
+lustre_umount(am_node *am, mntfs *mf)
+{
+ int unmount_flags = (mf->mf_flags & MFF_ON_AUTOFS) ? AMU_UMOUNT_AUTOFS : 0;
+
+ return UMOUNT_FS(mf->mf_mount, mnttab_file_name, unmount_flags);
+}
+#endif
diff --git a/contrib/amd/amd/ops_mfs.c b/contrib/amd/amd/ops_mfs.c
index ccaa49c569cd..822a2659317b 100644
--- a/contrib/amd/amd/ops_mfs.c
+++ b/contrib/amd/amd/ops_mfs.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997-2006 Erez Zadok
+ * Copyright (c) 1997-2014 Erez Zadok
* Copyright (c) 1990 Jan-Simon Pendry
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
* Copyright (c) 1990 The Regents of the University of California.
@@ -16,11 +16,7 @@
* 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgment:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
diff --git a/contrib/amd/amd/ops_nfs.c b/contrib/amd/amd/ops_nfs.c
index a6a85858d484..2dbfa5b5e2ee 100644
--- a/contrib/amd/amd/ops_nfs.c
+++ b/contrib/amd/amd/ops_nfs.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997-2006 Erez Zadok
+ * Copyright (c) 1997-2014 Erez Zadok
* Copyright (c) 1990 Jan-Simon Pendry
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
* Copyright (c) 1990 The Regents of the University of California.
@@ -16,11 +16,7 @@
* 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgment:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -113,6 +109,13 @@ static int call_mountd(fh_cache *fp, u_long proc, fwd_fun f, wchan_t wchan);
static int webnfs_lookup(fh_cache *fp, fwd_fun f, wchan_t wchan);
static int fh_id = 0;
+/*
+ * clamp the filehandle version to 3, so that we can fail back to nfsv3
+ * since nfsv4 does not have file handles
+ */
+#define SET_FH_VERSION(fs) \
+ (fs)->fs_version > NFS_VERSION3 ? NFS_VERSION3 : (fs)->fs_version;
+
/* globals */
AUTH *nfs_auth;
qelem fh_head = {&fh_head, &fh_head};
@@ -145,7 +148,7 @@ am_ops nfs_ops =
static fh_cache *
find_nfs_fhandle_cache(opaque_t arg, int done)
{
- fh_cache *fp, *fp2 = 0;
+ fh_cache *fp, *fp2 = NULL;
int id = (long) arg; /* for 64-bit archs */
ITER(fp, fh_cache, &fh_head) {
@@ -201,6 +204,10 @@ got_nfs_fh_mount(voidp pkt, int len, struct sockaddr_in *sa, struct sockaddr_in
memmove(fp->fh_nfs_handle.v3.am_fh3_data,
res3.mountres3_u.mountinfo.fhandle.fhandle3_val,
fp->fh_nfs_handle.v3.am_fh3_length);
+
+ XFREE(res3.mountres3_u.mountinfo.fhandle.fhandle3_val);
+ if (res3.mountres3_u.mountinfo.auth_flavors.auth_flavors_val)
+ XFREE(res3.mountres3_u.mountinfo.auth_flavors.auth_flavors_val);
} else {
#endif /* HAVE_FS_NFS3 */
memset(&res, 0, sizeof(res));
@@ -326,8 +333,7 @@ discard_fh(opaque_t arg)
dlog("Discarding filehandle for %s:%s", fp->fh_fs->fs_host, fp->fh_path);
free_srvr(fp->fh_fs);
}
- if (fp->fh_path)
- XFREE(fp->fh_path);
+ XFREE(fp->fh_path);
XFREE(fp);
}
@@ -338,7 +344,7 @@ discard_fh(opaque_t arg)
static int
prime_nfs_fhandle_cache(char *path, fserver *fs, am_nfs_handle_t *fhbuf, mntfs *mf)
{
- fh_cache *fp, *fp_save = 0;
+ fh_cache *fp, *fp_save = NULL;
int error;
int reuse_id = FALSE;
@@ -466,11 +472,11 @@ prime_nfs_fhandle_cache(char *path, fserver *fs, am_nfs_handle_t *fhbuf, mntfs *
fp->fh_sin = *fs->fs_ip;
if (!(mf->mf_flags & MFF_WEBNFS))
fp->fh_sin.sin_port = 0;
- fp->fh_nfs_version = fs->fs_version;
+ fp->fh_nfs_version = SET_FH_VERSION(fs);
}
fp->fh_fs = dup_srvr(fs);
- fp->fh_path = strdup(path);
+ fp->fh_path = xstrdup(path);
if (mf->mf_flags & MFF_WEBNFS)
error = webnfs_lookup(fp, got_nfs_fh_webnfs, get_mntfs_wchan(mf));
@@ -544,7 +550,9 @@ call_mountd(fh_cache *fp, u_long proc, fwd_fun fun, wchan_t wchan)
if (error)
return error;
fp->fh_sin.sin_port = mountd_port;
- }
+ dlog("%s: New %d mountd port", __func__, fp->fh_sin.sin_port);
+ } else
+ dlog("%s: Already had %d mountd port", __func__, fp->fh_sin.sin_port);
/* find the right version of the mount protocol */
#ifdef HAVE_FS_NFS3
@@ -605,7 +613,7 @@ webnfs_lookup(fh_cache *fp, fwd_fun fun, wchan_t wchan)
nfsdiropargs args;
#ifdef HAVE_FS_NFS3
am_LOOKUP3args args3;
-#endif
+#endif /* HAVE_FS_NFS3 */
char *wnfs_path;
size_t l;
@@ -724,6 +732,17 @@ nfs_init(mntfs *mf)
am_nfs_handle_t fhs;
char *colon;
+#ifdef NO_FALLBACK
+ /*
+ * We don't need file handles for NFS version 4, but we can fall back to
+ * version 3, so we allocate anyway
+ */
+#ifdef HAVE_FS_NFS4
+ if (mf->mf_server->fs_version == NFS_VERSION4)
+ return 0;
+#endif /* HAVE_FS_NFS4 */
+#endif /* NO_FALLBACK */
+
if (mf->mf_private) {
if (mf->mf_flags & MFF_NFS_SCALEDOWN) {
fserver *fs;
@@ -732,6 +751,9 @@ nfs_init(mntfs *mf)
mf->mf_ops->umounted(mf);
mf->mf_prfree(mf->mf_private);
+ mf->mf_private = NULL;
+ mf->mf_prfree = NULL;
+
fs = mf->mf_ops->ffserver(mf);
free_srvr(mf->mf_server);
mf->mf_server = fs;
@@ -769,7 +791,11 @@ mount_nfs_fh(am_nfs_handle_t *fhp, char *mntdir, char *fs_name, mntfs *mf)
int retry;
int proto = AMU_TYPE_NONE;
mntent_t mnt;
+ void *argsp;
nfs_args_t nfs_args;
+#ifdef HAVE_FS_NFS4
+ nfs4_args_t nfs4_args;
+#endif /* HAVE_FS_NFS4 */
/*
* Extract HOST name to give to kernel.
@@ -829,10 +855,7 @@ mount_nfs_fh(am_nfs_handle_t *fhp, char *mntdir, char *fs_name, mntfs *mf)
/*
* Set mount types accordingly
*/
-#ifndef HAVE_FS_NFS3
- type = MOUNT_TYPE_NFS;
- mnt.mnt_type = MNTTAB_TYPE_NFS;
-#else /* HAVE_FS_NFS3 */
+#ifdef HAVE_FS_NFS3
if (nfs_version == NFS_VERSION3) {
type = MOUNT_TYPE_NFS3;
/*
@@ -843,16 +866,25 @@ mount_nfs_fh(am_nfs_handle_t *fhp, char *mntdir, char *fs_name, mntfs *mf)
* So on those systems, set it to "nfs".
* Note: MNTTAB_OPT_VERS is always set for NFS3 (see am_compat.h).
*/
+ argsp = &nfs_args;
# if defined(MNTTAB_OPT_VERS) && defined(MOUNT_TABLE_ON_FILE)
mnt.mnt_type = MNTTAB_TYPE_NFS;
# else /* defined(MNTTAB_OPT_VERS) && defined(MOUNT_TABLE_ON_FILE) */
mnt.mnt_type = MNTTAB_TYPE_NFS3;
# endif /* defined(MNTTAB_OPT_VERS) && defined(MOUNT_TABLE_ON_FILE) */
- } else {
+# ifdef HAVE_FS_NFS4
+ } else if (nfs_version == NFS_VERSION4) {
+ argsp = &nfs4_args;
+ type = MOUNT_TYPE_NFS4;
+ mnt.mnt_type = MNTTAB_TYPE_NFS4;
+# endif /* HAVE_FS_NFS4 */
+ } else
+#endif /* HAVE_FS_NFS3 */
+ {
+ argsp = &nfs_args;
type = MOUNT_TYPE_NFS;
mnt.mnt_type = MNTTAB_TYPE_NFS;
}
-#endif /* HAVE_FS_NFS3 */
plog(XLOG_INFO, "mount_nfs_fh: NFS version %d", (int) nfs_version);
plog(XLOG_INFO, "mount_nfs_fh: using NFS transport %s", nfs_proto);
@@ -866,32 +898,44 @@ mount_nfs_fh(am_nfs_handle_t *fhp, char *mntdir, char *fs_name, mntfs *mf)
genflags |= autofs_compute_mount_flags(&mnt);
#endif /* HAVE_FS_AUTOFS */
- /* setup the many fields and flags within nfs_args */
- compute_nfs_args(&nfs_args,
- &mnt,
- genflags,
- NULL, /* struct netconfig *nfsncp */
- fs->fs_ip,
- nfs_version,
- nfs_proto,
- fhp,
- host,
- fs_name);
+ /* setup the many fields and flags within nfs_args */
+ compute_nfs_args(argsp,
+ &mnt,
+ genflags,
+ NULL, /* struct netconfig *nfsncp */
+ fs->fs_ip,
+ nfs_version,
+ nfs_proto,
+ fhp,
+ host,
+ fs_name);
/* finally call the mounting function */
if (amuDebug(D_TRACE)) {
- print_nfs_args(&nfs_args, nfs_version);
+ print_nfs_args(argsp, nfs_version);
plog(XLOG_DEBUG, "Generic mount flags 0x%x used for NFS mount", genflags);
}
- error = mount_fs(&mnt, genflags, (caddr_t) &nfs_args, retry, type,
- nfs_version, nfs_proto, mnttab_file_name, on_autofs);
- XFREE(xopts);
+ error = mount_fs(&mnt, genflags, argsp, retry, type,
+ nfs_version, nfs_proto, mnttab_file_name, on_autofs);
+ XFREE(mnt.mnt_opts);
+ discard_nfs_args(argsp, nfs_version);
-#ifdef HAVE_TRANSPORT_TYPE_TLI
- free_knetconfig(nfs_args.knconf);
- if (nfs_args.addr)
- XFREE(nfs_args.addr); /* allocated in compute_nfs_args() */
-#endif /* HAVE_TRANSPORT_TYPE_TLI */
+#ifdef HAVE_FS_NFS4
+# ifndef NO_FALLBACK
+ /*
+ * If we are using a v4 file handle, we try a v3 if we get back:
+ * ENOENT: NFS v4 has a different export list than v3
+ * EPERM: Kernels <= 2.6.18 return that, instead of ENOENT
+ */
+ if ((error == ENOENT || error == EPERM) && nfs_version == NFS_VERSION4) {
+ plog(XLOG_DEBUG, "Could not find NFS 4 mount, trying again with NFS 3");
+ fs->fs_version = NFS_VERSION3;
+ error = mount_nfs_fh(fhp, mntdir, fs_name, mf);
+ if (error)
+ fs->fs_version = NFS_VERSION4;
+ }
+# endif /* NO_FALLBACK */
+#endif /* HAVE_FS_NFS4 */
return error;
}
@@ -903,11 +947,16 @@ nfs_mount(am_node *am, mntfs *mf)
int error = 0;
mntent_t mnt;
- if (!mf->mf_private) {
+ if (!mf->mf_private && mf->mf_server->fs_version != 4) {
plog(XLOG_ERROR, "Missing filehandle for %s", mf->mf_info);
return EINVAL;
}
+ if (mf->mf_mopts == NULL) {
+ plog(XLOG_ERROR, "Missing mount options for %s", mf->mf_info);
+ return EINVAL;
+ }
+
mnt.mnt_opts = mf->mf_mopts;
if (amu_hasmntopt(&mnt, "softlookup") ||
(amu_hasmntopt(&mnt, "soft") && !amu_hasmntopt(&mnt, "nosoftlookup")))
@@ -932,6 +981,7 @@ nfs_umount(am_node *am, mntfs *mf)
{
int unmount_flags, new_unmount_flags, error;
+ dlog("attempting nfs umount");
unmount_flags = (mf->mf_flags & MFF_ON_AUTOFS) ? AMU_UMOUNT_AUTOFS : 0;
error = UMOUNT_FS(mf->mf_mount, mnttab_file_name, unmount_flags);
@@ -1031,12 +1081,12 @@ nfs_umounted(mntfs *mf)
f.fh_path = path;
f.fh_sin = *fs->fs_ip;
f.fh_sin.sin_port = (u_short) 0;
- f.fh_nfs_version = fs->fs_version;
+ f.fh_nfs_version = SET_FH_VERSION(fs);
f.fh_fs = fs;
f.fh_id = 0;
f.fh_error = 0;
- prime_nfs_fhandle_cache(colon + 1, mf->mf_server, (am_nfs_handle_t *) 0, mf);
- call_mountd(&f, MOUNTPROC_UMNT, (fwd_fun *) 0, (wchan_t) 0);
+ prime_nfs_fhandle_cache(colon + 1, mf->mf_server, (am_nfs_handle_t *) NULL, mf);
+ call_mountd(&f, MOUNTPROC_UMNT, (fwd_fun *) NULL, (wchan_t) NULL);
*colon = ':';
}
}
diff --git a/contrib/amd/amd/ops_nfs3.c b/contrib/amd/amd/ops_nfs3.c
index db3c7f9d265d..e07811b808e2 100644
--- a/contrib/amd/amd/ops_nfs3.c
+++ b/contrib/amd/amd/ops_nfs3.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997-2006 Erez Zadok
+ * Copyright (c) 1997-2014 Erez Zadok
* Copyright (c) 1990 Jan-Simon Pendry
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
* Copyright (c) 1990 The Regents of the University of California.
@@ -16,11 +16,7 @@
* 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgment:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
diff --git a/contrib/amd/amd/ops_nfs4.c b/contrib/amd/amd/ops_nfs4.c
new file mode 100644
index 000000000000..3798590837f3
--- /dev/null
+++ b/contrib/amd/amd/ops_nfs4.c
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 1997-2014 Erez Zadok
+ * Copyright (c) 1990 Jan-Simon Pendry
+ * Copyright (c) 1990 Imperial College of Science, Technology & Medicine
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Jan-Simon Pendry at Imperial College, London.
+ *
+ * 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
<