sync with OpenBSD -current
This commit is contained in:
parent
77cffac7ea
commit
46994dfb53
76 changed files with 1061 additions and 927 deletions
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: vmm_machdep.c,v 1.13 2024/01/06 13:17:20 dv Exp $ */
|
||||
/* $OpenBSD: vmm_machdep.c,v 1.14 2024/01/10 04:13:59 dv Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org>
|
||||
*
|
||||
|
@ -3989,6 +3989,13 @@ vcpu_run_vmx(struct vcpu *vcpu, struct vm_run_params *vrp)
|
|||
if (vcpu->vc_exit.vei.vei_dir == VEI_DIR_IN)
|
||||
vcpu->vc_gueststate.vg_rax =
|
||||
vcpu->vc_exit.vei.vei_data;
|
||||
vcpu->vc_gueststate.vg_rip =
|
||||
vcpu->vc_exit.vrs.vrs_gprs[VCPU_REGS_RIP];
|
||||
if (vmwrite(VMCS_GUEST_IA32_RIP,
|
||||
vcpu->vc_gueststate.vg_rip)) {
|
||||
printf("%s: failed to update rip\n", __func__);
|
||||
return (EINVAL);
|
||||
}
|
||||
break;
|
||||
case VMX_EXIT_EPT_VIOLATION:
|
||||
ret = vcpu_writeregs_vmx(vcpu, VM_RWREGS_GPRS, 0,
|
||||
|
@ -4525,7 +4532,6 @@ svm_handle_exit(struct vcpu *vcpu)
|
|||
case SVM_VMEXIT_IOIO:
|
||||
if (svm_handle_inout(vcpu) == 0)
|
||||
ret = EAGAIN;
|
||||
update_rip = 1;
|
||||
break;
|
||||
case SVM_VMEXIT_HLT:
|
||||
ret = svm_handle_hlt(vcpu);
|
||||
|
@ -4610,7 +4616,6 @@ vmx_handle_exit(struct vcpu *vcpu)
|
|||
case VMX_EXIT_IO:
|
||||
if (vmx_handle_inout(vcpu) == 0)
|
||||
ret = EAGAIN;
|
||||
update_rip = 1;
|
||||
break;
|
||||
case VMX_EXIT_EXTINT:
|
||||
vmx_handle_intr(vcpu);
|
||||
|
@ -5159,12 +5164,6 @@ svm_handle_inout(struct vcpu *vcpu)
|
|||
struct vmcb *vmcb = (struct vmcb *)vcpu->vc_control_va;
|
||||
|
||||
insn_length = vmcb->v_exitinfo2 - vmcb->v_rip;
|
||||
if (insn_length != 1 && insn_length != 2) {
|
||||
DPRINTF("%s: IN/OUT instruction with length %lld not "
|
||||
"supported\n", __func__, insn_length);
|
||||
return (EINVAL);
|
||||
}
|
||||
|
||||
exit_qual = vmcb->v_exitinfo1;
|
||||
|
||||
/* Bit 0 - direction */
|
||||
|
@ -5190,11 +5189,11 @@ svm_handle_inout(struct vcpu *vcpu)
|
|||
/* Data */
|
||||
vcpu->vc_exit.vei.vei_data = vmcb->v_rax;
|
||||
|
||||
vcpu->vc_exit.vei.vei_insn_len = (uint8_t)insn_length;
|
||||
|
||||
TRACEPOINT(vmm, inout, vcpu, vcpu->vc_exit.vei.vei_port,
|
||||
vcpu->vc_exit.vei.vei_dir, vcpu->vc_exit.vei.vei_data);
|
||||
|
||||
vcpu->vc_gueststate.vg_rip += insn_length;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
@ -5220,12 +5219,6 @@ vmx_handle_inout(struct vcpu *vcpu)
|
|||
return (EINVAL);
|
||||
}
|
||||
|
||||
if (insn_length != 1 && insn_length != 2) {
|
||||
DPRINTF("%s: IN/OUT instruction with length %lld not "
|
||||
"supported\n", __func__, insn_length);
|
||||
return (EINVAL);
|
||||
}
|
||||
|
||||
if (vmx_get_exit_qualification(&exit_qual)) {
|
||||
printf("%s: can't get exit qual\n", __func__);
|
||||
return (EINVAL);
|
||||
|
@ -5249,11 +5242,11 @@ vmx_handle_inout(struct vcpu *vcpu)
|
|||
/* Data */
|
||||
vcpu->vc_exit.vei.vei_data = (uint32_t)vcpu->vc_gueststate.vg_rax;
|
||||
|
||||
vcpu->vc_exit.vei.vei_insn_len = (uint8_t)insn_length;
|
||||
|
||||
TRACEPOINT(vmm, inout, vcpu, vcpu->vc_exit.vei.vei_port,
|
||||
vcpu->vc_exit.vei.vei_dir, vcpu->vc_exit.vei.vei_data);
|
||||
|
||||
vcpu->vc_gueststate.vg_rip += insn_length;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
@ -6416,6 +6409,9 @@ vcpu_run_svm(struct vcpu *vcpu, struct vm_run_params *vrp)
|
|||
vcpu->vc_exit.vei.vei_data;
|
||||
vmcb->v_rax = vcpu->vc_gueststate.vg_rax;
|
||||
}
|
||||
vcpu->vc_gueststate.vg_rip =
|
||||
vcpu->vc_exit.vrs.vrs_gprs[VCPU_REGS_RIP];
|
||||
vmcb->v_rip = vcpu->vc_gueststate.vg_rip;
|
||||
break;
|
||||
case SVM_VMEXIT_NPF:
|
||||
ret = vcpu_writeregs_svm(vcpu, VM_RWREGS_GPRS,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: vmmvar.h,v 1.96 2024/01/06 13:17:20 dv Exp $ */
|
||||
/* $OpenBSD: vmmvar.h,v 1.97 2024/01/10 04:13:59 dv Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org>
|
||||
*
|
||||
|
@ -338,6 +338,7 @@ struct vm_exit_inout {
|
|||
uint8_t vei_encoding; /* operand encoding */
|
||||
uint16_t vei_port; /* port */
|
||||
uint32_t vei_data; /* data */
|
||||
uint8_t vei_insn_len; /* Count of instruction bytes */
|
||||
};
|
||||
/*
|
||||
* vm_exit_eptviolation : describes an EPT VIOLATION exit
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: acpi.c,v 1.425 2023/07/08 08:01:10 tobhe Exp $ */
|
||||
/* $OpenBSD: acpi.c,v 1.426 2024/01/08 19:52:29 kettenis Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
|
||||
* Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org>
|
||||
|
@ -1104,16 +1104,16 @@ acpi_attach_common(struct acpi_softc *sc, paddr_t base)
|
|||
printf(" !DSDT");
|
||||
|
||||
p_dsdt = entry->q_table;
|
||||
acpi_parse_aml(sc, p_dsdt->aml, p_dsdt->hdr_length -
|
||||
sizeof(p_dsdt->hdr));
|
||||
acpi_parse_aml(sc, NULL, p_dsdt->aml,
|
||||
p_dsdt->hdr_length - sizeof(p_dsdt->hdr));
|
||||
|
||||
/* Load SSDT's */
|
||||
SIMPLEQ_FOREACH(entry, &sc->sc_tables, q_next) {
|
||||
if (memcmp(entry->q_table, SSDT_SIG,
|
||||
sizeof(SSDT_SIG) - 1) == 0) {
|
||||
p_dsdt = entry->q_table;
|
||||
acpi_parse_aml(sc, p_dsdt->aml, p_dsdt->hdr_length -
|
||||
sizeof(p_dsdt->hdr));
|
||||
acpi_parse_aml(sc, NULL, p_dsdt->aml,
|
||||
p_dsdt->hdr_length - sizeof(p_dsdt->hdr));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: dsdt.c,v 1.264 2021/12/09 20:21:35 patrick Exp $ */
|
||||
/* $OpenBSD: dsdt.c,v 1.265 2024/01/08 19:52:29 kettenis Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org>
|
||||
*
|
||||
|
@ -634,8 +634,9 @@ __aml_search(struct aml_node *root, uint8_t *nameseg, int create)
|
|||
|
||||
SIMPLEQ_INIT(&node->son);
|
||||
SIMPLEQ_INSERT_TAIL(&root->son, node, sib);
|
||||
return node;
|
||||
}
|
||||
return node;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Get absolute pathname of AML node */
|
||||
|
@ -3742,8 +3743,6 @@ aml_loadtable(struct acpi_softc *sc, const char *signature,
|
|||
struct acpi_dsdt *p_dsdt;
|
||||
struct acpi_q *entry;
|
||||
|
||||
if (strlen(rootpath) > 0)
|
||||
aml_die("LoadTable: RootPathString unsupported");
|
||||
if (strlen(parameterpath) > 0)
|
||||
aml_die("LoadTable: ParameterPathString unsupported");
|
||||
|
||||
|
@ -3755,8 +3754,8 @@ aml_loadtable(struct acpi_softc *sc, const char *signature,
|
|||
strncmp(hdr->oemtableid, oemtableid,
|
||||
sizeof(hdr->oemtableid)) == 0) {
|
||||
p_dsdt = entry->q_table;
|
||||
acpi_parse_aml(sc, p_dsdt->aml, p_dsdt->hdr_length -
|
||||
sizeof(p_dsdt->hdr));
|
||||
acpi_parse_aml(sc, rootpath, p_dsdt->aml,
|
||||
p_dsdt->hdr_length - sizeof(p_dsdt->hdr));
|
||||
return aml_allocvalue(AML_OBJTYPE_DDBHANDLE, 0, 0);
|
||||
}
|
||||
}
|
||||
|
@ -4520,11 +4519,19 @@ parse_error:
|
|||
}
|
||||
|
||||
int
|
||||
acpi_parse_aml(struct acpi_softc *sc, uint8_t *start, uint32_t length)
|
||||
acpi_parse_aml(struct acpi_softc *sc, const char *rootpath,
|
||||
uint8_t *start, uint32_t length)
|
||||
{
|
||||
struct aml_node *root = &aml_root;
|
||||
struct aml_scope *scope;
|
||||
struct aml_value res;
|
||||
|
||||
if (rootpath) {
|
||||
root = aml_searchname(&aml_root, rootpath);
|
||||
if (root == NULL)
|
||||
aml_die("Invalid RootPathName %s\n", rootpath);
|
||||
}
|
||||
|
||||
aml_root.start = start;
|
||||
memset(&res, 0, sizeof(res));
|
||||
res.type = AML_OBJTYPE_SCOPE;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: dsdt.h,v 1.80 2023/04/02 11:32:48 jsg Exp $ */
|
||||
/* $OpenBSD: dsdt.h,v 1.81 2024/01/08 19:52:29 kettenis Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2005 Marco Peereboom <marco@openbsd.org>
|
||||
*
|
||||
|
@ -56,8 +56,8 @@ void aml_walktree(struct aml_node *);
|
|||
|
||||
void aml_find_node(struct aml_node *, const char *,
|
||||
int (*)(struct aml_node *, void *), void *);
|
||||
int acpi_parse_aml(struct acpi_softc *, u_int8_t *,
|
||||
uint32_t);
|
||||
int acpi_parse_aml(struct acpi_softc *, const char *,
|
||||
u_int8_t *, uint32_t);
|
||||
void aml_register_notify(struct aml_node *, const char *,
|
||||
int (*)(struct aml_node *, int, void *), void *,
|
||||
int);
|
||||
|
|
|
@ -783,7 +783,9 @@ void *__devm_drm_dev_alloc(struct device *parent,
|
|||
{
|
||||
void *container;
|
||||
struct drm_device *drm;
|
||||
#ifdef notyet
|
||||
int ret;
|
||||
#endif
|
||||
|
||||
container = kzalloc(size, GFP_KERNEL);
|
||||
if (!container)
|
||||
|
|
|
@ -82,6 +82,4 @@ struct device_node *__matching_node(struct device_node *,
|
|||
#define for_each_matching_node(a, b) \
|
||||
for (a = __matching_node(NULL, b); a; a = __matching_node(a, b))
|
||||
|
||||
static const void *of_device_get_match_data(const struct device *);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -29,19 +29,19 @@ extern struct bus_type platform_bus_type;
|
|||
void __iomem *
|
||||
devm_platform_ioremap_resource_byname(struct platform_device *, const char *);
|
||||
|
||||
inline void
|
||||
static inline void
|
||||
platform_set_drvdata(struct platform_device *pdev, void *data)
|
||||
{
|
||||
dev_set_drvdata(&pdev->dev, data);
|
||||
}
|
||||
|
||||
inline void *
|
||||
static inline void *
|
||||
platform_get_drvdata(struct platform_device *pdev)
|
||||
{
|
||||
return dev_get_drvdata(&pdev->dev);
|
||||
}
|
||||
|
||||
inline int
|
||||
static inline int
|
||||
platform_driver_register(struct platform_driver *platform_drv)
|
||||
{
|
||||
return 0;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: if_bnxt.c,v 1.40 2024/01/04 07:08:47 jmatthew Exp $ */
|
||||
/* $OpenBSD: if_bnxt.c,v 1.43 2024/01/10 05:06:00 jmatthew Exp $ */
|
||||
/*-
|
||||
* Broadcom NetXtreme-C/E network driver.
|
||||
*
|
||||
|
@ -742,6 +742,8 @@ bnxt_free_slots(struct bnxt_softc *sc, struct bnxt_slot *slots, int allocated,
|
|||
while (i-- > 0) {
|
||||
bs = &slots[i];
|
||||
bus_dmamap_destroy(sc->sc_dmat, bs->bs_map);
|
||||
if (bs->bs_m != NULL)
|
||||
m_freem(bs->bs_m);
|
||||
}
|
||||
free(slots, M_DEVBUF, total * sizeof(*bs));
|
||||
}
|
||||
|
@ -1001,8 +1003,6 @@ bnxt_queue_down(struct bnxt_softc *sc, struct bnxt_queue *bq)
|
|||
struct bnxt_rx_queue *rx = &bq->q_rx;
|
||||
struct bnxt_tx_queue *tx = &bq->q_tx;
|
||||
|
||||
/* empty rx ring first i guess */
|
||||
|
||||
bnxt_free_slots(sc, tx->tx_slots, tx->tx_ring.ring_size,
|
||||
tx->tx_ring.ring_size);
|
||||
tx->tx_slots = NULL;
|
||||
|
@ -1073,7 +1073,7 @@ bnxt_up(struct bnxt_softc *sc)
|
|||
if (bnxt_hwrm_vnic_ctx_alloc(sc, &sc->sc_vnic.rss_id) != 0) {
|
||||
printf("%s: failed to allocate vnic rss context\n",
|
||||
DEVNAME(sc));
|
||||
goto down_queues;
|
||||
goto down_all_queues;
|
||||
}
|
||||
|
||||
sc->sc_vnic.id = (uint16_t)HWRM_NA_SIGNATURE;
|
||||
|
@ -1139,8 +1139,11 @@ dealloc_vnic:
|
|||
bnxt_hwrm_vnic_free(sc, &sc->sc_vnic);
|
||||
dealloc_vnic_ctx:
|
||||
bnxt_hwrm_vnic_ctx_free(sc, &sc->sc_vnic.rss_id);
|
||||
|
||||
down_all_queues:
|
||||
i = sc->sc_nqueues;
|
||||
down_queues:
|
||||
for (i = 0; i < sc->sc_nqueues; i++)
|
||||
while (i-- > 0)
|
||||
bnxt_queue_down(sc, &sc->sc_queues[i]);
|
||||
|
||||
bnxt_dmamem_free(sc, sc->sc_rx_cfg);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: if_ixl.c,v 1.94 2023/12/30 17:52:27 bluhm Exp $ */
|
||||
/* $OpenBSD: if_ixl.c,v 1.95 2024/01/07 21:01:45 bluhm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2013-2015, Intel Corporation
|
||||
|
@ -1881,6 +1881,7 @@ ixl_attach(struct device *parent, struct device *self, void *aux)
|
|||
goto free_hmc;
|
||||
}
|
||||
|
||||
mtx_init(&sc->sc_link_state_mtx, IPL_NET);
|
||||
if (ixl_get_link_status(sc) != 0) {
|
||||
/* error printed by ixl_get_link_status */
|
||||
goto free_hmc;
|
||||
|
@ -1987,7 +1988,6 @@ ixl_attach(struct device *parent, struct device *self, void *aux)
|
|||
if_attach_queues(ifp, nqueues);
|
||||
if_attach_iqueues(ifp, nqueues);
|
||||
|
||||
mtx_init(&sc->sc_link_state_mtx, IPL_NET);
|
||||
task_set(&sc->sc_link_state_task, ixl_link_state_update, sc);
|
||||
ixl_wr(sc, I40E_PFINT_ICR0_ENA,
|
||||
I40E_PFINT_ICR0_ENA_LINK_STAT_CHANGE_MASK |
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#! /bin/sh -
|
||||
# $OpenBSD: makesyscalls.sh,v 1.21 2023/12/21 19:34:07 miod Exp $
|
||||
# $OpenBSD: makesyscalls.sh,v 1.22 2024/01/07 20:52:44 miod Exp $
|
||||
# $NetBSD: makesyscalls.sh,v 1.26 1998/01/09 06:17:51 thorpej Exp $
|
||||
#
|
||||
# Copyright (c) 1994,1996 Christopher G. Demetriou
|
||||
|
@ -326,6 +326,11 @@ function parseline() {
|
|||
parserr($f, "argument definition")
|
||||
} else
|
||||
varargc = argc;
|
||||
if (argc > 6) {
|
||||
printf "%s: line %d: too many syscall arguments (%d > 6)\n", \
|
||||
infile, NR, argc
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
function putent(nodefs, compatwrap) {
|
||||
# output syscall declaration for switch table.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: in_pcb.c,v 1.283 2024/01/01 22:16:51 bluhm Exp $ */
|
||||
/* $OpenBSD: in_pcb.c,v 1.284 2024/01/09 19:57:00 bluhm Exp $ */
|
||||
/* $NetBSD: in_pcb.c,v 1.25 1996/02/13 23:41:53 christos Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -133,7 +133,7 @@ uint64_t in_pcblhash(struct inpcbtable *, u_int, u_short);
|
|||
|
||||
struct inpcb *in_pcblookup_lock(struct inpcbtable *, struct in_addr, u_int,
|
||||
struct in_addr, u_int, u_int, int);
|
||||
int in_pcbaddrisavail_lock(struct inpcb *, struct sockaddr_in *, int,
|
||||
int in_pcbaddrisavail_lock(const struct inpcb *, struct sockaddr_in *, int,
|
||||
struct proc *, int);
|
||||
int in_pcbpickport(u_int16_t *, const void *, int, const struct inpcb *,
|
||||
struct proc *);
|
||||
|
@ -365,8 +365,8 @@ in_pcbbind(struct inpcb *inp, struct mbuf *nam, struct proc *p)
|
|||
}
|
||||
|
||||
int
|
||||
in_pcbaddrisavail_lock(struct inpcb *inp, struct sockaddr_in *sin, int wild,
|
||||
struct proc *p, int lock)
|
||||
in_pcbaddrisavail_lock(const struct inpcb *inp, struct sockaddr_in *sin,
|
||||
int wild, struct proc *p, int lock)
|
||||
{
|
||||
struct socket *so = inp->inp_socket;
|
||||
struct inpcbtable *table = inp->inp_table;
|
||||
|
@ -436,8 +436,8 @@ in_pcbaddrisavail_lock(struct inpcb *inp, struct sockaddr_in *sin, int wild,
|
|||
}
|
||||
|
||||
int
|
||||
in_pcbaddrisavail(struct inpcb *inp, struct sockaddr_in *sin, int wild,
|
||||
struct proc *p)
|
||||
in_pcbaddrisavail(const struct inpcb *inp, struct sockaddr_in *sin,
|
||||
int wild, struct proc *p)
|
||||
{
|
||||
return in_pcbaddrisavail_lock(inp, sin, wild, p, IN_PCBLOCK_GRAB);
|
||||
}
|
||||
|
@ -962,7 +962,7 @@ in_pcbselsrc(struct in_addr *insrc, struct sockaddr_in *sin,
|
|||
{
|
||||
struct ip_moptions *mopts = inp->inp_moptions;
|
||||
struct route *ro = &inp->inp_route;
|
||||
struct in_addr *laddr = &inp->inp_laddr;
|
||||
const struct in_addr *laddr = &inp->inp_laddr;
|
||||
u_int rtableid = inp->inp_rtableid;
|
||||
struct sockaddr *ip4_source = NULL;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: in_pcb.h,v 1.147 2024/01/03 11:07:04 bluhm Exp $ */
|
||||
/* $OpenBSD: in_pcb.h,v 1.148 2024/01/09 19:57:00 bluhm Exp $ */
|
||||
/* $NetBSD: in_pcb.h,v 1.14 1996/02/13 23:42:00 christos Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -315,7 +315,7 @@ void in_losing(struct inpcb *);
|
|||
int in_pcballoc(struct socket *, struct inpcbtable *, int);
|
||||
int in_pcbbind_locked(struct inpcb *, struct mbuf *, struct proc *);
|
||||
int in_pcbbind(struct inpcb *, struct mbuf *, struct proc *);
|
||||
int in_pcbaddrisavail(struct inpcb *, struct sockaddr_in *, int,
|
||||
int in_pcbaddrisavail(const struct inpcb *, struct sockaddr_in *, int,
|
||||
struct proc *);
|
||||
int in_pcbconnect(struct inpcb *, struct mbuf *);
|
||||
void in_pcbdetach(struct inpcb *);
|
||||
|
@ -338,9 +338,9 @@ struct inpcb *
|
|||
struct inpcb *
|
||||
in6_pcblookup_listen(struct inpcbtable *, struct in6_addr *, u_int,
|
||||
struct mbuf *, u_int);
|
||||
int in6_pcbaddrisavail_lock(struct inpcb *, struct sockaddr_in6 *, int,
|
||||
struct proc *, int);
|
||||
int in6_pcbaddrisavail(struct inpcb *, struct sockaddr_in6 *, int,
|
||||
int in6_pcbaddrisavail_lock(const struct inpcb *, struct sockaddr_in6 *,
|
||||
int, struct proc *, int);
|
||||
int in6_pcbaddrisavail(const struct inpcb *, struct sockaddr_in6 *, int,
|
||||
struct proc *);
|
||||
int in6_pcbconnect(struct inpcb *, struct mbuf *);
|
||||
void in6_setsockaddr(struct inpcb *, struct mbuf *);
|
||||
|
@ -370,7 +370,7 @@ struct rtentry *
|
|||
void in6_pcbnotify(struct inpcbtable *, struct sockaddr_in6 *,
|
||||
u_int, const struct sockaddr_in6 *, u_int, u_int, int, void *,
|
||||
void (*)(struct inpcb *, int));
|
||||
int in6_selecthlim(struct inpcb *);
|
||||
int in6_selecthlim(const struct inpcb *);
|
||||
int in_pcbset_rtableid(struct inpcb *, u_int);
|
||||
void in_pcbset_laddr(struct inpcb *, const struct sockaddr *, u_int);
|
||||
void in_pcbunset_faddr(struct inpcb *);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: in6_pcb.c,v 1.131 2023/12/07 16:08:30 bluhm Exp $ */
|
||||
/* $OpenBSD: in6_pcb.c,v 1.132 2024/01/09 19:57:01 bluhm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
|
||||
|
@ -150,8 +150,8 @@ in6_pcbhash(struct inpcbtable *table, u_int rdomain,
|
|||
}
|
||||
|
||||
int
|
||||
in6_pcbaddrisavail_lock(struct inpcb *inp, struct sockaddr_in6 *sin6, int wild,
|
||||
struct proc *p, int lock)
|
||||
in6_pcbaddrisavail_lock(const struct inpcb *inp, struct sockaddr_in6 *sin6,
|
||||
int wild, struct proc *p, int lock)
|
||||
{
|
||||
struct socket *so = inp->inp_socket;
|
||||
struct inpcbtable *table = inp->inp_table;
|
||||
|
@ -240,8 +240,8 @@ in6_pcbaddrisavail_lock(struct inpcb *inp, struct sockaddr_in6 *sin6, int wild,
|
|||
}
|
||||
|
||||
int
|
||||
in6_pcbaddrisavail(struct inpcb *inp, struct sockaddr_in6 *sin6, int wild,
|
||||
struct proc *p)
|
||||
in6_pcbaddrisavail(const struct inpcb *inp, struct sockaddr_in6 *sin6,
|
||||
int wild, struct proc *p)
|
||||
{
|
||||
return in6_pcbaddrisavail_lock(inp, sin6, wild, p, IN_PCBLOCK_GRAB);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: in6_src.c,v 1.90 2023/12/15 00:24:56 bluhm Exp $ */
|
||||
/* $OpenBSD: in6_src.c,v 1.91 2024/01/09 19:57:01 bluhm Exp $ */
|
||||
/* $KAME: in6_src.c,v 1.36 2001/02/06 04:08:17 itojun Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -422,7 +422,7 @@ in6_selectif(struct sockaddr_in6 *dstsock, struct ip6_pktopts *opts,
|
|||
}
|
||||
|
||||
int
|
||||
in6_selecthlim(struct inpcb *inp)
|
||||
in6_selecthlim(const struct inpcb *inp)
|
||||
{
|
||||
if (inp && inp->inp_hops >= 0)
|
||||
return (inp->inp_hops);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: ext2fs_dir.h,v 1.11 2014/07/11 07:59:04 pelikan Exp $ */
|
||||
/* $OpenBSD: ext2fs_dir.h,v 1.12 2024/01/09 03:16:00 guenther Exp $ */
|
||||
/* $NetBSD: ext2fs_dir.h,v 1.4 2000/01/28 16:00:23 bouyer Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -61,9 +61,9 @@
|
|||
* with null bytes. All names are guaranteed null terminated.
|
||||
* The maximum length of a name in a directory is EXT2FS_MAXNAMLEN.
|
||||
*
|
||||
* The macro EXT2FS_DIRSIZ(fmt, dp) gives the amount of space required to
|
||||
* The macro EXT2FS_DIRSIZ(dp) gives the amount of space required to
|
||||
* represent a directory entry. Free space in a directory is represented by
|
||||
* entries which have dp->e2d_reclen > DIRSIZ(fmt, dp). All d2fs_bsize bytes
|
||||
* entries which have dp->e2d_reclen > DIRSIZ(dp). All d2fs_bsize bytes
|
||||
* in a directory block are claimed by the directory entries. This
|
||||
* usually results in the last entry in a directory having a large
|
||||
* dp->e2d_reclen. When entries are deleted from a directory, the
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: ffs_inode.c,v 1.81 2021/12/12 09:14:59 visa Exp $ */
|
||||
/* $OpenBSD: ffs_inode.c,v 1.82 2024/01/09 03:15:59 guenther Exp $ */
|
||||
/* $NetBSD: ffs_inode.c,v 1.10 1996/05/11 18:27:19 mycroft Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -152,9 +152,7 @@ ffs_truncate(struct inode *oip, off_t length, int flags, struct ucred *cred)
|
|||
return (0);
|
||||
|
||||
if (ovp->v_type == VLNK &&
|
||||
(DIP(oip, size) < oip->i_ump->um_maxsymlinklen ||
|
||||
(oip->i_ump->um_maxsymlinklen == 0 &&
|
||||
oip->i_din1->di_blocks == 0))) {
|
||||
DIP(oip, size) < oip->i_ump->um_maxsymlinklen) {
|
||||
#ifdef DIAGNOSTIC
|
||||
if (length != 0)
|
||||
panic("ffs_truncate: partial truncate of symlink");
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: ffs_vfsops.c,v 1.195 2023/07/05 15:13:28 beck Exp $ */
|
||||
/* $OpenBSD: ffs_vfsops.c,v 1.196 2024/01/09 03:16:00 guenther Exp $ */
|
||||
/* $NetBSD: ffs_vfsops.c,v 1.19 1996/02/09 22:22:26 christos Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -675,8 +675,8 @@ ffs_validate(struct fs *fsp)
|
|||
return (0); /* Invalid number of fragments */
|
||||
|
||||
if (fsp->fs_inodefmt == FS_42INODEFMT)
|
||||
fsp->fs_maxsymlinklen = 0;
|
||||
else if (fsp->fs_maxsymlinklen < 0)
|
||||
return (0); /* Obsolete format, support broken in 2014 */
|
||||
if (fsp->fs_maxsymlinklen <= 0)
|
||||
return (0); /* Invalid max size of short symlink */
|
||||
|
||||
return (1); /* Super block is okay */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: ffs_vnops.c,v 1.100 2022/06/26 05:20:43 visa Exp $ */
|
||||
/* $OpenBSD: ffs_vnops.c,v 1.101 2024/01/09 03:16:00 guenther Exp $ */
|
||||
/* $NetBSD: ffs_vnops.c,v 1.7 1996/05/11 18:27:24 mycroft Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -202,8 +202,7 @@ ffs_read(void *v)
|
|||
panic("ffs_read: mode");
|
||||
|
||||
if (vp->v_type == VLNK) {
|
||||
if (DIP(ip, size) < ip->i_ump->um_maxsymlinklen ||
|
||||
(ip->i_ump->um_maxsymlinklen == 0 && DIP(ip, blocks) == 0))
|
||||
if (DIP(ip, size) < ip->i_ump->um_maxsymlinklen)
|
||||
panic("ffs_read: short symlink");
|
||||
} else if (vp->v_type != VREG && vp->v_type != VDIR)
|
||||
panic("ffs_read: type %d", vp->v_type);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: dir.h,v 1.12 2019/05/04 15:38:12 deraadt Exp $ */
|
||||
/* $OpenBSD: dir.h,v 1.13 2024/01/09 03:15:59 guenther Exp $ */
|
||||
/* $NetBSD: dir.h,v 1.8 1996/03/09 19:42:41 scottr Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -61,9 +61,9 @@
|
|||
* with null bytes. All names are guaranteed null terminated.
|
||||
* The maximum length of a name in a directory is MAXNAMLEN.
|
||||
*
|
||||
* The macro DIRSIZ(fmt, dp) gives the amount of space required to represent
|
||||
* The macro DIRSIZ(dp) gives the amount of space required to represent
|
||||
* a directory entry. Free space in a directory is represented by
|
||||
* entries which have dp->d_reclen > DIRSIZ(fmt, dp). All DIRBLKSIZ bytes
|
||||
* entries which have dp->d_reclen > DIRSIZ(dp). All DIRBLKSIZ bytes
|
||||
* in a directory block are claimed by the directory entries. This
|
||||
* usually results in the last entry in a directory having a large
|
||||
* dp->d_reclen. When entries are deleted from a directory, the
|
||||
|
@ -112,17 +112,8 @@ struct direct {
|
|||
#define DIRECTSIZ(namlen) \
|
||||
((offsetof(struct direct, d_name) + \
|
||||
((namlen)+1)*sizeof(((struct direct *)0)->d_name[0]) + 3) & ~3)
|
||||
#if (BYTE_ORDER == LITTLE_ENDIAN)
|
||||
#define DIRSIZ(oldfmt, dp) \
|
||||
((oldfmt) ? \
|
||||
((sizeof(struct direct) - (MAXNAMLEN+1)) + (((dp)->d_type+1 + 3) &~ 3)) : \
|
||||
((sizeof(struct direct) - (MAXNAMLEN+1)) + (((dp)->d_namlen+1 + 3) &~ 3)))
|
||||
#else
|
||||
#define DIRSIZ(oldfmt, dp) \
|
||||
#define DIRSIZ(dp) \
|
||||
((sizeof(struct direct) - (MAXNAMLEN+1)) + (((dp)->d_namlen+1 + 3) &~ 3))
|
||||
#endif
|
||||
#define OLDDIRFMT 1
|
||||
#define NEWDIRFMT 0
|
||||
|
||||
/*
|
||||
* Template for manipulating directories. Should use struct direct's,
|
||||
|
@ -140,18 +131,4 @@ struct dirtemplate {
|
|||
u_int8_t dotdot_namlen;
|
||||
char dotdot_name[4]; /* ditto */
|
||||
};
|
||||
|
||||
/*
|
||||
* This is the old format of directories, sanz type element.
|
||||
*/
|
||||
struct odirtemplate {
|
||||
u_int32_t dot_ino;
|
||||
int16_t dot_reclen;
|
||||
u_int16_t dot_namlen;
|
||||
char dot_name[4]; /* must be multiple of 4 */
|
||||
u_int32_t dotdot_ino;
|
||||
int16_t dotdot_reclen;
|
||||
u_int16_t dotdot_namlen;
|
||||
char dotdot_name[4]; /* ditto */
|
||||
};
|
||||
#endif /* !_DIR_H_ */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: ufs_dirhash.c,v 1.42 2019/03/15 05:42:38 kevlo Exp $ */
|
||||
/* $OpenBSD: ufs_dirhash.c,v 1.43 2024/01/09 03:15:59 guenther Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2001, 2002 Ian Dowse. All rights reserved.
|
||||
*
|
||||
|
@ -50,7 +50,6 @@
|
|||
|
||||
#define WRAPINCR(val, limit) (((val) + 1 == (limit)) ? 0 : ((val) + 1))
|
||||
#define WRAPDECR(val, limit) (((val) == 0) ? ((limit) - 1) : ((val) - 1))
|
||||
#define OFSFMT(ip) ((ip)->i_ump->um_maxsymlinklen == 0)
|
||||
#define BLKFREE2IDX(n) ((n) > DH_NFSTATS ? DH_NFSTATS : (n))
|
||||
|
||||
int ufs_mindirhashsize;
|
||||
|
@ -112,7 +111,7 @@ ufsdirhash_build(struct inode *ip)
|
|||
|
||||
/* Check if we can/should use dirhash. */
|
||||
if (ip->i_dirhash == NULL) {
|
||||
if (DIP(ip, size) < ufs_mindirhashsize || OFSFMT(ip))
|
||||
if (DIP(ip, size) < ufs_mindirhashsize)
|
||||
return (-1);
|
||||
} else {
|
||||
/* Hash exists, but sysctls could have changed. */
|
||||
|
@ -224,7 +223,7 @@ ufsdirhash_build(struct inode *ip)
|
|||
slot = WRAPINCR(slot, dh->dh_hlen);
|
||||
dh->dh_hused++;
|
||||
DH_ENTRY(dh, slot) = pos;
|
||||
ufsdirhash_adjfree(dh, pos, -DIRSIZ(0, ep));
|
||||
ufsdirhash_adjfree(dh, pos, -DIRSIZ(ep));
|
||||
}
|
||||
pos += ep->d_reclen;
|
||||
}
|
||||
|
@ -430,7 +429,7 @@ restart:
|
|||
/* Check for sequential access, and update offset. */
|
||||
if (dh->dh_seqopt == 0 && dh->dh_seqoff == offset)
|
||||
dh->dh_seqopt = 1;
|
||||
dh->dh_seqoff = offset + DIRSIZ(0, dp);
|
||||
dh->dh_seqoff = offset + DIRSIZ(dp);
|
||||
|
||||
*bpp = bp;
|
||||
*offp = offset;
|
||||
|
@ -519,7 +518,7 @@ ufsdirhash_findfree(struct inode *ip, int slotneeded, int *slotsize)
|
|||
brelse(bp);
|
||||
return (-1);
|
||||
}
|
||||
if (dp->d_ino == 0 || dp->d_reclen > DIRSIZ(0, dp))
|
||||
if (dp->d_ino == 0 || dp->d_reclen > DIRSIZ(dp))
|
||||
break;
|
||||
i += dp->d_reclen;
|
||||
dp = (struct direct *)((char *)dp + dp->d_reclen);
|
||||
|
@ -535,7 +534,7 @@ ufsdirhash_findfree(struct inode *ip, int slotneeded, int *slotsize)
|
|||
while (i < DIRBLKSIZ && freebytes < slotneeded) {
|
||||
freebytes += dp->d_reclen;
|
||||
if (dp->d_ino != 0)
|
||||
freebytes -= DIRSIZ(0, dp);
|
||||
freebytes -= DIRSIZ(dp);
|
||||
if (dp->d_reclen == 0) {
|
||||
brelse(bp);
|
||||
return (-1);
|
||||
|
@ -627,7 +626,7 @@ ufsdirhash_add(struct inode *ip, struct direct *dirp, doff_t offset)
|
|||
DH_ENTRY(dh, slot) = offset;
|
||||
|
||||
/* Update the per-block summary info. */
|
||||
ufsdirhash_adjfree(dh, offset, -DIRSIZ(0, dirp));
|
||||
ufsdirhash_adjfree(dh, offset, -DIRSIZ(dirp));
|
||||
DIRHASH_UNLOCK(dh);
|
||||
}
|
||||
|
||||
|
@ -660,7 +659,7 @@ ufsdirhash_remove(struct inode *ip, struct direct *dirp, doff_t offset)
|
|||
ufsdirhash_delslot(dh, slot);
|
||||
|
||||
/* Update the per-block summary info. */
|
||||
ufsdirhash_adjfree(dh, offset, DIRSIZ(0, dirp));
|
||||
ufsdirhash_adjfree(dh, offset, DIRSIZ(dirp));
|
||||
DIRHASH_UNLOCK(dh);
|
||||
}
|
||||
|
||||
|
@ -835,7 +834,7 @@ ufsdirhash_checkblock(struct inode *ip, char *buf, doff_t offset)
|
|||
/* Check that the entry exists (will panic if it doesn't). */
|
||||
ufsdirhash_findslot(dh, dp->d_name, dp->d_namlen, offset + i);
|
||||
|
||||
nfree += dp->d_reclen - DIRSIZ(0, dp);
|
||||
nfree += dp->d_reclen - DIRSIZ(dp);
|
||||
}
|
||||
if (i != DIRBLKSIZ)
|
||||
panic("ufsdirhash_checkblock: bad dir end");
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: ufs_lookup.c,v 1.59 2022/01/11 03:13:59 jsg Exp $ */
|
||||
/* $OpenBSD: ufs_lookup.c,v 1.60 2024/01/09 03:15:59 guenther Exp $ */
|
||||
/* $NetBSD: ufs_lookup.c,v 1.7 1996/02/09 22:36:06 christos Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -64,8 +64,6 @@ int dirchk = 1;
|
|||
int dirchk = 0;
|
||||
#endif
|
||||
|
||||
#define OFSFMT(ip) ((ip)->i_ump->um_maxsymlinklen == 0)
|
||||
|
||||
/*
|
||||
* Convert a component of a pathname into a pointer to a locked inode.
|
||||
* This is a very central and rather complicated routine.
|
||||
|
@ -299,7 +297,7 @@ searchloop:
|
|||
int size = ep->d_reclen;
|
||||
|
||||
if (ep->d_ino != 0)
|
||||
size -= DIRSIZ(OFSFMT(dp), ep);
|
||||
size -= DIRSIZ(ep);
|
||||
if (size > 0) {
|
||||
if (size >= slotneeded) {
|
||||
slotstatus = FOUND;
|
||||
|
@ -322,14 +320,7 @@ searchloop:
|
|||
* Check for a name match.
|
||||
*/
|
||||
if (ep->d_ino) {
|
||||
# if (BYTE_ORDER == LITTLE_ENDIAN)
|
||||
if (OFSFMT(dp))
|
||||
namlen = ep->d_type;
|
||||
else
|
||||
namlen = ep->d_namlen;
|
||||
# else
|
||||
namlen = ep->d_namlen;
|
||||
# endif
|
||||
namlen = ep->d_namlen;
|
||||
if (namlen == cnp->cn_namelen &&
|
||||
!memcmp(cnp->cn_nameptr, ep->d_name, namlen)) {
|
||||
#ifdef UFS_DIRHASH
|
||||
|
@ -440,9 +431,9 @@ found:
|
|||
* Check that directory length properly reflects presence
|
||||
* of this entry.
|
||||
*/
|
||||
if (dp->i_offset + DIRSIZ(OFSFMT(dp), ep) > DIP(dp, size)) {
|
||||
if (dp->i_offset + DIRSIZ(ep) > DIP(dp, size)) {
|
||||
ufs_dirbad(dp, dp->i_offset, "i_ffs_size too small");
|
||||
DIP_ASSIGN(dp, size, dp->i_offset + DIRSIZ(OFSFMT(dp), ep));
|
||||
DIP_ASSIGN(dp, size, dp->i_offset + DIRSIZ(ep));
|
||||
dp->i_flag |= IN_CHANGE | IN_UPDATE;
|
||||
}
|
||||
brelse(bp);
|
||||
|
@ -626,17 +617,10 @@ ufs_dirbadentry(struct vnode *vdp, struct direct *ep, int entryoffsetinblock)
|
|||
|
||||
dp = VTOI(vdp);
|
||||
|
||||
# if (BYTE_ORDER == LITTLE_ENDIAN)
|
||||
if (OFSFMT(dp))
|
||||
namlen = ep->d_type;
|
||||
else
|
||||
namlen = ep->d_namlen;
|
||||
# else
|
||||
namlen = ep->d_namlen;
|
||||
# endif
|
||||
namlen = ep->d_namlen;
|
||||
if ((ep->d_reclen & 0x3) != 0 ||
|
||||
ep->d_reclen > DIRBLKSIZ - (entryoffsetinblock & (DIRBLKSIZ - 1)) ||
|
||||
ep->d_reclen < DIRSIZ(OFSFMT(dp), ep) || namlen > MAXNAMLEN) {
|
||||
ep->d_reclen < DIRSIZ(ep) || namlen > MAXNAMLEN) {
|
||||
/*return (1); */
|
||||
printf("First bad\n");
|
||||
goto bad;
|
||||
|
@ -674,15 +658,7 @@ ufs_makedirentry(struct inode *ip, struct componentname *cnp,
|
|||
memset(newdirp->d_name + (cnp->cn_namelen & ~(DIR_ROUNDUP-1)),
|
||||
0, DIR_ROUNDUP);
|
||||
memcpy(newdirp->d_name, cnp->cn_nameptr, cnp->cn_namelen);
|
||||
if (OFSFMT(ip)) {
|
||||
newdirp->d_type = 0;
|
||||
# if (BYTE_ORDER == LITTLE_ENDIAN)
|
||||
{ u_char tmp = newdirp->d_namlen;
|
||||
newdirp->d_namlen = newdirp->d_type;
|
||||
newdirp->d_type = tmp; }
|
||||
# endif
|
||||
} else
|
||||
newdirp->d_type = IFTODT(DIP(ip, mode));
|
||||
newdirp->d_type = IFTODT(DIP(ip, mode));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -712,7 +688,7 @@ ufs_direnter(struct vnode *dvp, struct vnode *tvp, struct direct *dirp,
|
|||
cr = cnp->cn_cred;
|
||||
p = cnp->cn_proc;
|
||||
dp = VTOI(dvp);
|
||||
newentrysize = DIRSIZ(OFSFMT(dp), dirp);
|
||||
newentrysize = DIRSIZ(dirp);
|
||||
|
||||
if (dp->i_count == 0) {
|
||||
/*
|
||||
|
@ -827,7 +803,7 @@ ufs_direnter(struct vnode *dvp, struct vnode *tvp, struct direct *dirp,
|
|||
* dp->i_offset + dp->i_count would yield the space.
|
||||
*/
|
||||
ep = (struct direct *)dirbuf;
|
||||
dsize = ep->d_ino ? DIRSIZ(OFSFMT(dp), ep) : 0;
|
||||
dsize = ep->d_ino ? DIRSIZ(ep) : 0;
|
||||
spacefree = ep->d_reclen - dsize;
|
||||
for (loc = ep->d_reclen; loc < dp->i_count; ) {
|
||||
nep = (struct direct *)(dirbuf + loc);
|
||||
|
@ -852,7 +828,7 @@ ufs_direnter(struct vnode *dvp, struct vnode *tvp, struct direct *dirp,
|
|||
dsize = 0;
|
||||
continue;
|
||||
}
|
||||
dsize = DIRSIZ(OFSFMT(dp), nep);
|
||||
dsize = DIRSIZ(nep);
|
||||
spacefree += nep->d_reclen - dsize;
|
||||
#ifdef UFS_DIRHASH
|
||||
if (dp->i_dirhash != NULL)
|
||||
|
@ -1030,8 +1006,7 @@ ufs_dirrewrite(struct inode *dp, struct inode *oip, ufsino_t newinum,
|
|||
if (error)
|
||||
return (error);
|
||||
ep->d_ino = newinum;
|
||||
if (!OFSFMT(dp))
|
||||
ep->d_type = newtype;
|
||||
ep->d_type = newtype;
|
||||
oip->i_effnlink--;
|
||||
if (DOINGSOFTDEP(vdp)) {
|
||||
softdep_change_linkcnt(oip, 0);
|
||||
|
@ -1087,14 +1062,7 @@ ufs_dirempty(struct inode *ip, ufsino_t parentino, struct ucred *cred)
|
|||
if (dp->d_ino == 0)
|
||||
continue;
|
||||
/* accept only "." and ".." */
|
||||
# if (BYTE_ORDER == LITTLE_ENDIAN)
|
||||
if (OFSFMT(ip))
|
||||
namlen = dp->d_type;
|
||||
else
|
||||
namlen = dp->d_namlen;
|
||||
# else
|
||||
namlen = dp->d_namlen;
|
||||
# endif
|
||||
namlen = dp->d_namlen;
|
||||
if (namlen > 2)
|
||||
return (0);
|
||||
if (dp->d_name[0] != '.')
|
||||
|
@ -1145,14 +1113,7 @@ ufs_checkpath(struct inode *source, struct inode *target, struct ucred *cred)
|
|||
IO_NODELOCKED, cred, NULL, curproc);
|
||||
if (error != 0)
|
||||
break;
|
||||
# if (BYTE_ORDER == LITTLE_ENDIAN)
|
||||
if (OFSFMT(VTOI(vp)))
|
||||
namlen = dirbuf.dotdot_type;
|
||||
else
|
||||
namlen = dirbuf.dotdot_namlen;
|
||||
# else
|
||||
namlen = dirbuf.dotdot_namlen;
|
||||
# endif
|
||||
namlen = dirbuf.dotdot_namlen;
|
||||
if (namlen != 2 ||
|
||||
dirbuf.dotdot_name[0] != '.' ||
|
||||
dirbuf.dotdot_name[1] != '.') {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: ufs_vnops.c,v 1.158 2023/09/08 20:00:28 mvs Exp $ */
|
||||
/* $OpenBSD: ufs_vnops.c,v 1.159 2024/01/09 03:15:59 guenther Exp $ */
|
||||
/* $NetBSD: ufs_vnops.c,v 1.18 1996/05/11 18:28:04 mycroft Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -81,14 +81,10 @@ void filt_ufsdetach(struct knote *);
|
|||
/*
|
||||
* A virgin directory (no blushing please).
|
||||
*/
|
||||
static struct dirtemplate mastertemplate = {
|
||||
static const struct dirtemplate mastertemplate = {
|
||||
0, 12, DT_DIR, 1, ".",
|
||||
0, DIRBLKSIZ - 12, DT_DIR, 2, ".."
|
||||
};
|
||||
static struct odirtemplate omastertemplate = {
|
||||
0, 12, 1, ".",
|
||||
0, DIRBLKSIZ - 12, 2, ".."
|
||||
};
|
||||
|
||||
/*
|
||||
* Update the times in the inode
|
||||
|
@ -1127,7 +1123,7 @@ ufs_mkdir(void *v)
|
|||
struct vnode *tvp;
|
||||
struct buf *bp;
|
||||
struct direct newdir;
|
||||
struct dirtemplate dirtemplate, *dtp;
|
||||
struct dirtemplate dirtemplate;
|
||||
int error, dmode, blkoff;
|
||||
|
||||
#ifdef DIAGNOSTIC
|
||||
|
@ -1187,11 +1183,7 @@ ufs_mkdir(void *v)
|
|||
/*
|
||||
* Initialize directory with "." and ".." from static template.
|
||||
*/
|
||||
if (dp->i_ump->um_maxsymlinklen > 0)
|
||||
dtp = &mastertemplate;
|
||||
else
|
||||
dtp = (struct dirtemplate *)&omastertemplate;
|
||||
dirtemplate = *dtp;
|
||||
dirtemplate = mastertemplate;
|
||||
dirtemplate.dot_ino = ip->i_number;
|
||||
dirtemplate.dotdot_ino = dp->i_number;
|
||||
|
||||
|
@ -1411,9 +1403,6 @@ ufs_readdir(void *v)
|
|||
caddr_t diskbuf;
|
||||
size_t count, entries;
|
||||
int bufsize, readcnt, error;
|
||||
#if (BYTE_ORDER == LITTLE_ENDIAN)
|
||||
int ofmt = VTOI(ap->a_vp)->i_ump->um_maxsymlinklen == 0;
|
||||
#endif
|
||||
|
||||
if (uio->uio_rw != UIO_READ)
|
||||
return (EINVAL);
|
||||
|
@ -1468,16 +1457,8 @@ ufs_readdir(void *v)
|
|||
off += dp->d_reclen;
|
||||
u.dn.d_off = off;
|
||||
u.dn.d_fileno = dp->d_ino;
|
||||
#if (BYTE_ORDER == LITTLE_ENDIAN)
|
||||
if (ofmt) {
|
||||
u.dn.d_type = dp->d_namlen;
|
||||
u.dn.d_namlen = dp->d_type;
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
u.dn.d_type = dp->d_type;
|
||||
u.dn.d_namlen = dp->d_namlen;
|
||||
}
|
||||
u.dn.d_type = dp->d_type;
|
||||
u.dn.d_namlen = dp->d_namlen;
|
||||
memcpy(u.dn.d_name, dp->d_name, u.dn.d_namlen);
|
||||
memset(u.dn.d_name + u.dn.d_namlen, 0, u.dn.d_reclen
|
||||
- u.dn.d_namlen - offsetof(struct dirent, d_name));
|
||||
|
@ -1513,10 +1494,8 @@ ufs_readlink(void *v)
|
|||
u_int64_t isize;
|
||||
|
||||
isize = DIP(ip, size);
|
||||
if (isize < ip->i_ump->um_maxsymlinklen ||
|
||||
(ip->i_ump->um_maxsymlinklen == 0 && DIP(ip, blocks) == 0)) {
|
||||
if (isize < ip->i_ump->um_maxsymlinklen)
|
||||
return (uiomove((char *)SHORTLINK(ip), isize, ap->a_uio));
|
||||
}
|
||||
return (VOP_READ(vp, ap->a_uio, 0, ap->a_cred));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue