From nobody Sat Jan 08 04:29:34 2022 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 EB9A119321A5; Sat, 8 Jan 2022 04:29:35 +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 4JW6Yp67GBz3Dhc; Sat, 8 Jan 2022 04:29:34 +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 653CD18455; Sat, 8 Jan 2022 04:29:34 +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 2084TYsF022296; Sat, 8 Jan 2022 04:29:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2084TY6H022295; Sat, 8 Jan 2022 04:29:34 GMT (envelope-from git) Date: Sat, 8 Jan 2022 04:29:34 GMT Message-Id: <202201080429.2084TY6H022295@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: 65990b68a2cd - main - msdosfs: clusterfree() is used only in error handling cases 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: 65990b68a2cd89a08f0350e187df1968b16f4255 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1641616175; 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=b3cf/bBcrdgOtyBbVgwCH4HxIkgq+l0y2dsWdLRaehM=; b=B3G4JhCZ/gy4aZ3Iu7RbeoVZB/CNnP/1Vq7TKFzpaAL0hfE9NDEpERiM5BDxbDMOfgA9am gqZgqFNxPIhISOet/FcfRxExG2ELh4R5/8rfHc9bqXEXBS3niK9htLl4gqNl0oTG6ffEi6 2ch+OIeFhZUGD3v6GHShZrYKSfRXR5/1KV+iu5LBW7VgSWoDT+YxqoD88FIHnaMkMqoAFR GHRoxrM+hmzY3YXNBFJmSyLAiIshXqLdo3KOoD5Aj6ErnaET37hR1qEOcAxFFkWs5uZThw sebK1uyHxVn3eArF4TzehvdI5SoXTSSTEOKgqq0UoLI8RQBzBCnABBvZO3ZkNA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1641616175; a=rsa-sha256; cv=none; b=Zyo6HHx8cHptEzxKjeiqjwcjRMNqez3d3axpkG2z9aO8km2FGOmFFa7GTzKBc77loxI4z9 SQ0b/fDJK/lCDy5LpCAtpcSWCt6k4krta9v9Vp7df3XgmJ2TpiEZaH8dlaIpLGaoN6Wt7d M6farRfiBfhjHMSpljurhVxpp8C3+bLrPEz3PqOzMiKO2+z9J/xVKwfw+7YUr4/BANeZwZ 3m3HR5xQyd1Aj+7k7ogU4mwGu+4p0bTtf4NZQDUA0rJzPWOTTvA+mMICed6suVJn23MGGS u30Qc9s/PxT5RSJ+SWnU2rLjmLZvEJMbQ6pM5IeoUVOJqiPhWnWAyFhq364vBA== 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=65990b68a2cd89a08f0350e187df1968b16f4255 commit 65990b68a2cd89a08f0350e187df1968b16f4255 Author: Konstantin Belousov AuthorDate: 2022-01-04 14:43:02 +0000 Commit: Konstantin Belousov CommitDate: 2022-01-08 03:41:44 +0000 msdosfs: clusterfree() is used only in error handling cases Change its return type to void, because its result is ignored in both call sites. Remove oldcnp argument as well, it is NULL always. Suggested and reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D33721 --- sys/fs/msdosfs/fat.h | 2 +- sys/fs/msdosfs/msdosfs_fat.c | 13 +++++-------- sys/fs/msdosfs/msdosfs_vnops.c | 2 +- usr.sbin/makefs/msdos/msdosfs_fat.c | 13 +++++-------- usr.sbin/makefs/msdos/msdosfs_vnops.c | 2 +- 5 files changed, 13 insertions(+), 19 deletions(-) diff --git a/sys/fs/msdosfs/fat.h b/sys/fs/msdosfs/fat.h index bb0f128eaa87..b28a9bed1356 100644 --- a/sys/fs/msdosfs/fat.h +++ b/sys/fs/msdosfs/fat.h @@ -97,7 +97,7 @@ #define DE_CLEAR 1 /* Zero out the blocks allocated */ int pcbmap(struct denode *dep, u_long findcn, daddr_t *bnp, u_long *cnp, int* sp); -int clusterfree(struct msdosfsmount *pmp, u_long cn, u_long *oldcnp); +void clusterfree(struct msdosfsmount *pmp, u_long cn); int clusteralloc(struct msdosfsmount *pmp, u_long start, u_long count, u_long fillwith, u_long *retcluster, u_long *got); int fatentry(int function, struct msdosfsmount *pmp, u_long cluster, u_long *oldcontents, u_long newcontents); int freeclusterchain(struct msdosfsmount *pmp, u_long startchain); diff --git a/sys/fs/msdosfs/msdosfs_fat.c b/sys/fs/msdosfs/msdosfs_fat.c index 202feeef0102..fc1db705989b 100644 --- a/sys/fs/msdosfs/msdosfs_fat.c +++ b/sys/fs/msdosfs/msdosfs_fat.c @@ -420,15 +420,15 @@ usemap_free(struct msdosfsmount *pmp, u_long cn) return (0); } -int -clusterfree(struct msdosfsmount *pmp, u_long cluster, u_long *oldcnp) +void +clusterfree(struct msdosfsmount *pmp, u_long cluster) { int error; u_long oldcn; error = fatentry(FAT_GET_AND_SET, pmp, cluster, &oldcn, MSDOSFSFREE); - if (error) - return (error); + if (error != 0) + return; /* * If the cluster was successfully marked free, then update * the count of free clusters, and turn off the "allocated" @@ -437,9 +437,6 @@ clusterfree(struct msdosfsmount *pmp, u_long cluster, u_long *oldcnp) MSDOSFS_LOCK_MP(pmp); error = usemap_free(pmp, cluster); MSDOSFS_UNLOCK_MP(pmp); - if (error == 0 && oldcnp != NULL) - *oldcnp = oldcn; - return (error); } /* @@ -1056,7 +1053,7 @@ extendfile(struct denode *dep, u_long count, struct buf **bpp, u_long *ncp, dep->de_fc[FC_LASTFC].fc_fsrcn, 0, cn); if (error) { - clusterfree(pmp, cn, NULL); + clusterfree(pmp, cn); return (error); } frcn = dep->de_fc[FC_LASTFC].fc_frcn + 1; diff --git a/sys/fs/msdosfs/msdosfs_vnops.c b/sys/fs/msdosfs/msdosfs_vnops.c index c071d9f44d86..36da35257d2c 100644 --- a/sys/fs/msdosfs/msdosfs_vnops.c +++ b/sys/fs/msdosfs/msdosfs_vnops.c @@ -1433,7 +1433,7 @@ msdosfs_mkdir(struct vop_mkdir_args *ap) return (0); bad: - clusterfree(pmp, newcluster, NULL); + clusterfree(pmp, newcluster); bad2: return (error); } diff --git a/usr.sbin/makefs/msdos/msdosfs_fat.c b/usr.sbin/makefs/msdos/msdosfs_fat.c index b5700d8c7d1d..0081e2d2d38c 100644 --- a/usr.sbin/makefs/msdos/msdosfs_fat.c +++ b/usr.sbin/makefs/msdos/msdosfs_fat.c @@ -408,24 +408,21 @@ usemap_free(struct msdosfsmount *pmp, u_long cn) pmp->pm_inusemap[cn / N_INUSEBITS] &= ~(1U << (cn % N_INUSEBITS)); } -int -clusterfree(struct msdosfsmount *pmp, u_long cluster, u_long *oldcnp) +void +clusterfree(struct msdosfsmount *pmp, u_long cluster) { int error; u_long oldcn; error = fatentry(FAT_GET_AND_SET, pmp, cluster, &oldcn, MSDOSFSFREE); - if (error) - return (error); + if (error != 0) + return; /* * If the cluster was successfully marked free, then update * the count of free clusters, and turn off the "allocated" * bit in the "in use" cluster bit map. */ usemap_free(pmp, cluster); - if (oldcnp) - *oldcnp = oldcn; - return (0); } /* @@ -1024,7 +1021,7 @@ m_extendfile(struct denode *dep, u_long count, struct m_buf **bpp, u_long *ncp, dep->de_fc[FC_LASTFC].fc_fsrcn, 0, cn); if (error) { - clusterfree(pmp, cn, NULL); + clusterfree(pmp, cn); return (error); } frcn = dep->de_fc[FC_LASTFC].fc_frcn + 1; diff --git a/usr.sbin/makefs/msdos/msdosfs_vnops.c b/usr.sbin/makefs/msdos/msdosfs_vnops.c index 7e927b4b99c7..ed33856716f1 100644 --- a/usr.sbin/makefs/msdos/msdosfs_vnops.c +++ b/usr.sbin/makefs/msdos/msdosfs_vnops.c @@ -636,7 +636,7 @@ msdosfs_mkdire(const char *path, struct denode *pdep, fsnode *node) { return dep; bad: - clusterfree(pmp, newcluster, NULL); + clusterfree(pmp, newcluster); bad2: errno = error; return NULL;