From nobody Mon Oct 24 21:42:12 2022 X-Original-To: dev-commits-src-main@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 4Mx7nx1l5vz4gqfw; Mon, 24 Oct 2022 21:42:13 +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 4Mx7nx1JwWz3FNH; Mon, 24 Oct 2022 21:42:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1666647733; 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=oSMeVZjL0DA35U0ZT5XawoXXEruSSjOI2wVUzoV2Wzs=; b=ay2UbrJvkIzHJ/o9K5mj4PF3EFVBdTh1HD58nF2CgzsMwHc+coB1Ts29FgYxD4p/VR8TQ3 9FtszYgC56phV8NajrIkzDYxbbB9vxMu2h+4fbVl/R3VXcOKlBC81ovag1pSHQdHWqBsyn /x9NAe7L1biIhUlojMocpdu0xRkdYb/dmBAzt42Z3OG9Le1Ye99HUT5eUom0KnP9etEa90 BYNeXT61pAlGZVCJWgF4qgTId9Mu4LgUkDTzcxtb4+AsSmHTYK5jYmzDRSYUJIcZ9H1Aeb aftAR7Xkie1TyQ9S1+CqfvpctX0rrLsPDdwC0oE3lzagGuGU8k7yjwueSNCbpw== 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 4Mx7nx0QH4zMsd; Mon, 24 Oct 2022 21:42:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 29OLgCoj050561; Mon, 24 Oct 2022 21:42:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 29OLgC14050560; Mon, 24 Oct 2022 21:42:12 GMT (envelope-from git) Date: Mon, 24 Oct 2022 21:42:12 GMT Message-Id: <202210242142.29OLgC14050560@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: b5a81075903b - main - LinuxKPI: seq_file add "private" versions. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b5a81075903b3d97265151960b731210c0e80244 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1666647733; 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=oSMeVZjL0DA35U0ZT5XawoXXEruSSjOI2wVUzoV2Wzs=; b=HVm+L4KDYfCgBv1JXEV1rqHDQYGgZEHgmJUTk/squt1wDWKMX6RdsIY8C187vNIFjLgUEI FUD7e6y+cXLRS5tZbKv0rujFTCBZySr9OuBnXZR0dzoL98dICGwYEq+IMYDbgG5qSrhgHp MjiveJ2rA3RHt4T6qCVE3SxzzIXE/aq6xtKKwMRdah4MvHv9lJcwwKTS8zif8Ajb9xx47i upqnJpG5IRcPlY4rs29M5v4IT1BIofBPL6ZGvRUDcxLE+yg15gxJuQpnjLlkTWH6UmZvfH JAA27nQWITTfckDpDdf7JeVbpnYur93bWqYL4YL7smY2/7LSWuHRtpW4PmuLfA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1666647733; a=rsa-sha256; cv=none; b=PbnIsQvkUONTInMnBzS+CesfJyueLHlKprbqLMUtxWzZFNmpx6s73Zwac87l+y365F0/Uz lbPPnmw+vMkTpFGV1308jUp0LzAFR6pdU7RfpGjQafenFifsE+ivT6FKLpqa8d/Q0ugGS/ TDb6kcn3gl+UKnCe8brGgdZFNv1axLk48S8neZsfeIgaXD0lYDdenEiMKmoxpK8a2m/BEN LKYKp9GSl+TKoM+F5W8qyL8EuW048sJ+Q2CSPD8zvvGnbtHhi86fcAlBOw6qBOW7Oqojle 8DYHAa0d+DoE28rUpNmUjawkb0HmZNpwNNw3AvWoRYnHIZC3DYCHRTesDdPIvw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=b5a81075903b3d97265151960b731210c0e80244 commit b5a81075903b3d97265151960b731210c0e80244 Author: Bjoern A. Zeeb AuthorDate: 2022-10-22 18:07:37 +0000 Commit: Bjoern A. Zeeb CommitDate: 2022-10-24 21:39:48 +0000 LinuxKPI: seq_file add "private" versions. Add __seq_open_private() and seq_release_private() needed by iwlwifi debugfs support. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D37089 --- .../linuxkpi/common/include/linux/seq_file.h | 3 ++ sys/compat/linuxkpi/common/src/linux_seq_file.c | 33 ++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/seq_file.h b/sys/compat/linuxkpi/common/include/linux/seq_file.h index e925c6d8c2ae..8fb93646f9a5 100644 --- a/sys/compat/linuxkpi/common/include/linux/seq_file.h +++ b/sys/compat/linuxkpi/common/include/linux/seq_file.h @@ -69,6 +69,9 @@ struct seq_operations { ssize_t seq_read(struct linux_file *, char *, size_t, off_t *); int seq_write(struct seq_file *seq, const void *data, size_t len); +void *__seq_open_private(struct linux_file *, const struct seq_operations *, int); +int seq_release_private(struct inode *, struct linux_file *); + int seq_open(struct linux_file *f, const struct seq_operations *op); int seq_release(struct inode *inode, struct linux_file *file); diff --git a/sys/compat/linuxkpi/common/src/linux_seq_file.c b/sys/compat/linuxkpi/common/src/linux_seq_file.c index 054917e2fc24..c358e4ae7dc1 100644 --- a/sys/compat/linuxkpi/common/src/linux_seq_file.c +++ b/sys/compat/linuxkpi/common/src/linux_seq_file.c @@ -130,6 +130,29 @@ seq_open(struct linux_file *f, const struct seq_operations *op) return (0); } +void * +__seq_open_private(struct linux_file *f, const struct seq_operations *op, int size) +{ + struct seq_file *seq_file; + void *private; + int error; + + private = malloc(size, M_LSEQ, M_NOWAIT|M_ZERO); + if (private == NULL) + return (NULL); + + error = seq_open(f, op); + if (error < 0) { + free(private, M_LSEQ); + return (NULL); + } + + seq_file = (struct seq_file *)f->private_data; + seq_file->private = private; + + return (private); +} + int single_open(struct linux_file *f, int (*show)(struct seq_file *, void *), void *d) { @@ -166,6 +189,16 @@ seq_release(struct inode *inode __unused, struct linux_file *file) return (0); } +int +seq_release_private(struct inode *inode __unused, struct linux_file *f) +{ + struct seq_file *seq; + + seq = (struct seq_file *)f->private_data; + free(seq->private, M_LSEQ); + return (seq_release(inode, f)); +} + int single_release(struct vnode *v, struct linux_file *f) {