From nobody Thu Dec 09 01:27:58 2021 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 EDEB918CEF99; Thu, 9 Dec 2021 01:27:59 +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 4J8by72ZTJz3Gn8; Thu, 9 Dec 2021 01:27:59 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 DF5F11DDAE; Thu, 9 Dec 2021 01:27:58 +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 1B91Rw1Y046036; Thu, 9 Dec 2021 01:27:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1B91RwYq046035; Thu, 9 Dec 2021 01:27:58 GMT (envelope-from git) Date: Thu, 9 Dec 2021 01:27:58 GMT Message-Id: <202112090127.1B91RwYq046035@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: b49b6e0f95c8 - main - swapon(8): adapt to the new swapoff(2) interface 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/main X-Git-Reftype: branch X-Git-Commit: b49b6e0f95c89f8dcb5898424c360b46019254b4 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1639013279; 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=bpvO8GYWFggSPFn17T7dDWUNLVjXXpcVWheYNiLUP9I=; b=c763cjHlDzAuJOr9OeFKXoZMrvTTeiTTzCxWEGTlfKZcC3sSrvsPNgzWrfFoJotFZ+M5Uw njYLMGwMBcLT5fTNopDvulumvLv8PzaCD2msFtbOde1yO1+0SSCH0m0Qmw39r0iD6qFUD4 K95dIrrulSU9oTdoN+lHVR/V4CQH97U1CC3pb/j/Iwi6auwP9GZPOuSQSrZlvhZ76t5etM Nu5HYw4a5ChLIRxzyoW+rsqxv9TUHoDTjzfMU6xGUwEnF5ovF/BIRbdq8LWZXPNbgdjNgi RdVmTR1AZ2ZhuLwImZuV4g3MYn8m/0Nn8WGxBqOeiH2sYjp8Ieo69+N+J97tbw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1639013279; a=rsa-sha256; cv=none; b=u+3k+xs9nKH2Wn8jF+7DMVWDGkyeCkK4WoCZW9bf2ETgNkPAcU2p4BR9jkJGzrcasIpCpx lX6fY1uxUGttTpDZvW/lZyWnOosjEIOvMqhqCA88fqpTbDWApOHg2ZzmMqozvaOvBl6zXA 9+5+2rhvbpxazczuCDquSFvo4TGi+fQ+fj9ViP3daQEIIgOGddGACZo1jfAntGHbju8DGp G6IicEdKCBDMUmarZIi1+u9l9/Lp2GbkwTuPn3vnKEgQRTg0rMIeEnwwZDZm+64rPryyhn PTpZvv8NqPa6+wJgxu0s0S+pdmfMWRCO5Bb/N/OQTHcqLcPvDYQZgt7NzTgpnA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=b49b6e0f95c89f8dcb5898424c360b46019254b4 commit b49b6e0f95c89f8dcb5898424c360b46019254b4 Author: Konstantin Belousov AuthorDate: 2021-12-08 21:05:49 +0000 Commit: Konstantin Belousov CommitDate: 2021-12-09 00:48:59 +0000 swapon(8): adapt to the new swapoff(2) interface also fix test sys/audit/administrative.c. Reviewed by: brooks Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D33343 --- sbin/swapon/swapon.c | 10 ++-------- tests/sys/audit/administrative.c | 2 +- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/sbin/swapon/swapon.c b/sbin/swapon/swapon.c index d644d99e7913..4daa6e8b17ee 100644 --- a/sbin/swapon/swapon.c +++ b/sbin/swapon/swapon.c @@ -789,18 +789,12 @@ swapon_trim(const char *name) static const char * swap_on_off_sfile(const char *name, int doingall) { - struct swapoff_new_args sa; int error; if (which_prog == SWAPON) error = Eflag ? swapon_trim(name) : swapon(name); - else { /* SWAPOFF */ - bzero(&sa, sizeof(sa)); - sa.name = name; - if (fflag) - sa.flags |= SWAPOFF_FORCE; - error = swapoff((const char *)&sa); - } + else /* SWAPOFF */ + error = swapoff(name, fflag ? SWAPOFF_FORCE : 0); if (error == -1) { switch (errno) { diff --git a/tests/sys/audit/administrative.c b/tests/sys/audit/administrative.c index d75f6147cdf4..159e7c14e031 100644 --- a/tests/sys/audit/administrative.c +++ b/tests/sys/audit/administrative.c @@ -1605,7 +1605,7 @@ ATF_TC_BODY(swapoff_failure, tc) FILE *pipefd = setup(fds, auclass); /* Failure reason: Block device required */ - ATF_REQUIRE_EQ(-1, swapoff(path)); + ATF_REQUIRE_EQ(-1, swapoff(path, 0)); check_audit(fds, adregex, pipefd); }