From nobody Sat Mar 30 08:32:14 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4V69W267M4z5GXnq; Sat, 30 Mar 2024 08:32:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4V69W25F48z4Y7H; Sat, 30 Mar 2024 08:32:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1711787534; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ocC/odLMQ7e2ibrnXVnZIdpGUjfq07kHd7B4j/onQsM=; b=QbyU5nyxxO2YZn3jxD8MNy7QItYcua7PFZdcVYmrAJKGDQ2c5QumiWGFoUJ/qLfGzBihwY aQnSTrch7h2N/J0qUx09L5g4fZwzV8D2pud5GKfes9Wc0BzIvVcf2K/+khz2SqQlwe4S8/ kfB+MWuDcULD35+QrzYMnTNAfDpj2nGSB4t+peJnX8xTJIuh86emetNUGn+ae9FIk7d0+M +Ja+eYuBDTOAFXTJwGDoJclAvEJvRZFcVaV4OKWU3WZ9A4Wg3x9Pn6U12RzM2FIcX83qPq 1Uezcv6rSHhODHMW9PYyVUxynD5jlH3+8kYxl89C1emtFZEe7D2cPJdlAxqF+Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1711787534; a=rsa-sha256; cv=none; b=vz8Kkon9E6pUFQtFDHsdkjlts5Wv7laKBhWuF0t7025puK3rEaQc66hirBvqgWlvrQT300 XxOHerH2Z0meW0eNSEIEr4bOCGwvD7w5CnbbGsIVlFBNs0xojGTlF9I/P+PFA9s4DYhkJ+ DYpjLiXuwOxKiqW7EbXQp6h9XjeMbBlfFLXB6cLmmG7mKzgjZCjeHm1vtWJNo1ztR7Q8eu pN6MC1XKuS34R2ZHXTZeoQDcGMI99IImYEhtJgHsxDMRB3ySa6QGcQc3W4Eau0bWftLt5u pGo2/Qonnd3Iuy8P2eNYlGtpYRkvPeAwXp89ClArATOMtYUbznKhYTPdr4rA6A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1711787534; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ocC/odLMQ7e2ibrnXVnZIdpGUjfq07kHd7B4j/onQsM=; b=TXNrPqCd2duFl2mtJcLor7JXcATCX1RsamEyQESDcHbhS37vOF3E+DGEmAp9GhG2AV16oL Hg892Ld6auR+9Hqdh6FoY0wt8A2+D+gEASWU9vS6JFnm9d7M2tzkBKaMu/NbfTrDEzBrjX gcbsMazIoeYNajIvjF7p3rw3R2erxb1wSCeT1zFsNc46+QemTU3MTdz/ZxwgEKq5Zgr3m5 k34ixTXZfEU9MGxb1FvERProJ4xNm8Lo9QNX/05twLUVOLfIpcAWjD1gBOWlJ0dk3hKf/H CdE90GkIC66Vso1dQblrecaBQVI8Dfe2QRKUimtbMnUCAES1YuNBfUhY9AtLlw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4V69W24sYMzn4H; Sat, 30 Mar 2024 08:32:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 42U8WESd039710; Sat, 30 Mar 2024 08:32:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 42U8WEFv039707; Sat, 30 Mar 2024 08:32:14 GMT (envelope-from git) Date: Sat, 30 Mar 2024 08:32:14 GMT Message-Id: <202403300832.42U8WEFv039707@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: cde0347ca70b - stable/14 - cdevpriv(9): add iterator List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: cde0347ca70b1ffc49803a1fe6c38f8b83135ddc Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=cde0347ca70b1ffc49803a1fe6c38f8b83135ddc commit cde0347ca70b1ffc49803a1fe6c38f8b83135ddc Author: Konstantin Belousov AuthorDate: 2024-03-22 02:58:00 +0000 Commit: Konstantin Belousov CommitDate: 2024-03-30 08:31:13 +0000 cdevpriv(9): add iterator (cherry picked from commit d3efbe0132b24e8660df836905cda7662f85a154) --- sys/fs/devfs/devfs_vnops.c | 20 ++++++++++++++++++++ sys/sys/conf.h | 2 ++ 2 files changed, 22 insertions(+) diff --git a/sys/fs/devfs/devfs_vnops.c b/sys/fs/devfs/devfs_vnops.c index b8cf8c12d32e..cda4afc8c241 100644 --- a/sys/fs/devfs/devfs_vnops.c +++ b/sys/fs/devfs/devfs_vnops.c @@ -179,6 +179,26 @@ devfs_set_cdevpriv(void *priv, d_priv_dtor_t *priv_dtr) return (error); } +int +devfs_foreach_cdevpriv(struct cdev *dev, int (*cb)(void *data, void *arg), + void *arg) +{ + struct cdev_priv *cdp; + struct cdev_privdata *p; + int error; + + cdp = cdev2priv(dev); + error = 0; + mtx_lock(&cdevpriv_mtx); + LIST_FOREACH(p, &cdp->cdp_fdpriv, cdpd_list) { + error = cb(p->cdpd_data, arg); + if (error != 0) + break; + } + mtx_unlock(&cdevpriv_mtx); + return (error); +} + void devfs_destroy_cdevpriv(struct cdev_privdata *p) { diff --git a/sys/sys/conf.h b/sys/sys/conf.h index f2dfaad5aa1b..a1c71080732f 100644 --- a/sys/sys/conf.h +++ b/sys/sys/conf.h @@ -321,6 +321,8 @@ typedef void d_priv_dtor_t(void *data); int devfs_get_cdevpriv(void **datap); int devfs_set_cdevpriv(void *priv, d_priv_dtor_t *dtr); void devfs_clear_cdevpriv(void); +int devfs_foreach_cdevpriv(struct cdev *dev, + int (*cb)(void *data, void *arg), void *arg); ino_t devfs_alloc_cdp_inode(void); void devfs_free_cdp_inode(ino_t ino);