From nobody Sun Jan 09 01:20:54 2022 X-Original-To: dev-commits-src-branches@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 734D7193C69D; Sun, 9 Jan 2022 01:20:55 +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 4JWfKf6zHwz3K4g; Sun, 9 Jan 2022 01:20:54 +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 BF136D4E; Sun, 9 Jan 2022 01:20:54 +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 2091Ks5U097771; Sun, 9 Jan 2022 01:20:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2091Ks3k097770; Sun, 9 Jan 2022 01:20:54 GMT (envelope-from git) Date: Sun, 9 Jan 2022 01:20:54 GMT Message-Id: <202201090120.2091Ks3k097770@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: 1a35d94bbbc5 - stable/13 - mountmsdosfs(): some style List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/13 X-Git-Reftype: branch X-Git-Commit: 1a35d94bbbc5197b555f7b406737bba4f3e4ef74 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1641691255; 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=X9NDQxFSDrM/+9tq2OkZBjrthcqMH9nTT82mZZGQynQ=; b=pyC7iIWbUTfNDif+6bwf63ciHq0Q+K9OR2T8dL1OyFehTeIHAeQW9zS4kk+/TIpHhm34Zs K6ugopsUuGatp0WBJKLh7CouXHTjIpQ96/cDAbf0Ok5WLw0/KwbCQi8Hu2tyq29zBMChFn LkWz9/V4HNdjMFhODVL/Jb7D8DCuZ3z/zjcnK+nQzzo0GGYL/BoOaiPAjvdIgj2ckDy/4I Vls5cu2pMAlIiRGI7PSewm4BWaQlDswVWBMS3D9B2LULY6HM10VbpG74Y6Ws08r3e29H3R 3CWPr9caxRjtWL6oNbtu9BhBkhZPu8vWoehePhrIAhm6alg+4WZVhOiqugr3wA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1641691255; a=rsa-sha256; cv=none; b=GYNAEWqvRvjlf3tz2RV9yq5lAAkAJKladq2vLHZNDncn9RIJHo2pZvmOH2qTxmtD0zztn+ SelK7yuhIfLmlHD89TJUuUmfezAXiAOPK5ipnZfUHvrmP50y8aFlgnBgylu/jll3vg0Pnv sWNgBu2PBFcrXK8abDe9ACWmJIlGpCK+J5YF0gT02e5xSmmysPv9U4XSzEILR3SdZuM0h8 1Uudy0oVxEUVfOcibZRPWYIFND/ETu6iInT2bMw7dxBX1O6U4Kdpzc8P277+obTbjNpvow S6kwPhchYX68u4E1QNto17EzRm+DUoWXcFO/GbSDMKD8HVhkDpJgpIqU4iTR1A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=1a35d94bbbc5197b555f7b406737bba4f3e4ef74 commit 1a35d94bbbc5197b555f7b406737bba4f3e4ef74 Author: Konstantin Belousov AuthorDate: 2021-12-30 19:33:41 +0000 Commit: Konstantin Belousov CommitDate: 2022-01-09 01:20:22 +0000 mountmsdosfs(): some style (cherry picked from commit 04fd468da0d0baea535da418b92df74101a9659d) --- sys/fs/msdosfs/msdosfs_vfsops.c | 55 +++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 30 deletions(-) diff --git a/sys/fs/msdosfs/msdosfs_vfsops.c b/sys/fs/msdosfs/msdosfs_vfsops.c index 0f6d41b3c77c..939badf458fb 100644 --- a/sys/fs/msdosfs/msdosfs_vfsops.c +++ b/sys/fs/msdosfs/msdosfs_vfsops.c @@ -456,14 +456,14 @@ mountmsdosfs(struct vnode *devvp, struct mount *mp) b710 = (struct byte_bpb710 *)bsp->bs710.bsBPB; #ifndef MSDOSFS_NOCHECKSIG - if (bsp->bs50.bsBootSectSig0 != BOOTSIG0 - || bsp->bs50.bsBootSectSig1 != BOOTSIG1) { + if (bsp->bs50.bsBootSectSig0 != BOOTSIG0 || + bsp->bs50.bsBootSectSig1 != BOOTSIG1) { error = EINVAL; goto error_exit; } #endif - pmp = malloc(sizeof *pmp, M_MSDOSFSMNT, M_WAITOK | M_ZERO); + pmp = malloc(sizeof(*pmp), M_MSDOSFSMNT, M_WAITOK | M_ZERO); pmp->pm_mountp = mp; pmp->pm_cp = cp; pmp->pm_bo = bo; @@ -509,7 +509,7 @@ mountmsdosfs(struct vnode *devvp, struct mount *mp) * use these anyway, so we're unaffected if they are * invalid. */ - if (!pmp->pm_BytesPerSec || !SecPerClust) { + if (pmp->pm_BytesPerSec == 0 || SecPerClust == 0) { error = EINVAL; goto error_exit; } @@ -523,8 +523,7 @@ mountmsdosfs(struct vnode *devvp, struct mount *mp) } if (pmp->pm_RootDirEnts == 0) { - if (pmp->pm_FATsecs - || getushort(b710->bpbFSVers)) { + if (pmp->pm_FATsecs != 0 || getushort(b710->bpbFSVers) != 0) { error = EINVAL; #ifdef MSDOSFS_DEBUG printf("mountmsdosfs(): bad FAT32 filesystem\n"); @@ -535,7 +534,7 @@ mountmsdosfs(struct vnode *devvp, struct mount *mp) pmp->pm_fatmult = 4; pmp->pm_fatdiv = 1; pmp->pm_FATsecs = getulong(b710->bpbBigFATsecs); - if (getushort(b710->bpbExtFlags) & FATMIRROR) + if ((getushort(b710->bpbExtFlags) & FATMIRROR) != 0) pmp->pm_curfat = getushort(b710->bpbExtFlags) & FATNUM; else pmp->pm_flags |= MSDOSFS_FATMIRROR; @@ -549,14 +548,11 @@ mountmsdosfs(struct vnode *devvp, struct mount *mp) * - number of sectors: >= 1, <= size of partition * - number of FAT sectors: >= 1 */ - if ( (SecPerClust == 0) - || (SecPerClust & (SecPerClust - 1)) - || (pmp->pm_BytesPerSec < DEV_BSIZE) - || (pmp->pm_BytesPerSec & (pmp->pm_BytesPerSec - 1)) - || (pmp->pm_HugeSectors == 0) - || (pmp->pm_FATsecs == 0) - || (SecPerClust * pmp->pm_BlkPerSec > MAXBSIZE / DEV_BSIZE) - ) { + if (SecPerClust == 0 || (SecPerClust & (SecPerClust - 1)) != 0 || + pmp->pm_BytesPerSec < DEV_BSIZE || + (pmp->pm_BytesPerSec & (pmp->pm_BytesPerSec - 1)) != 0 || + pmp->pm_HugeSectors == 0 || pmp->pm_FATsecs == 0 || + SecPerClust * pmp->pm_BlkPerSec > MAXBSIZE / DEV_BSIZE) { error = EINVAL; goto error_exit; } @@ -570,14 +566,14 @@ mountmsdosfs(struct vnode *devvp, struct mount *mp) if (FAT32(pmp)) { pmp->pm_rootdirblk = getulong(b710->bpbRootClust); - pmp->pm_firstcluster = pmp->pm_fatblk - + (pmp->pm_FATs * pmp->pm_FATsecs); + pmp->pm_firstcluster = pmp->pm_fatblk + + pmp->pm_FATs * pmp->pm_FATsecs; pmp->pm_fsinfo = getushort(b710->bpbFSInfo) * pmp->pm_BlkPerSec; } else { pmp->pm_rootdirblk = pmp->pm_fatblk + - (pmp->pm_FATs * pmp->pm_FATsecs); + pmp->pm_FATs * pmp->pm_FATsecs; pmp->pm_rootdirsize = howmany(pmp->pm_RootDirEnts * - sizeof(struct direntry), DEV_BSIZE); /* in blocks */ + sizeof(struct direntry), DEV_BSIZE); /* in blocks */ pmp->pm_firstcluster = pmp->pm_rootdirblk + pmp->pm_rootdirsize; } @@ -586,8 +582,8 @@ mountmsdosfs(struct vnode *devvp, struct mount *mp) pmp->pm_fatsize = pmp->pm_FATsecs * DEV_BSIZE; /* XXX not used? */ if (pmp->pm_fatmask == 0) { - if (pmp->pm_maxcluster - <= ((CLUST_RSRVD - CLUST_FIRST) & FAT12_MASK)) { + if (pmp->pm_maxcluster <= ((CLUST_RSRVD - CLUST_FIRST) & + FAT12_MASK)) { /* * This will usually be a floppy disk. This size makes * sure that one FAT entry will not be split across @@ -633,7 +629,7 @@ mountmsdosfs(struct vnode *devvp, struct mount *mp) * Check for valid cluster size * must be a power of 2 */ - if (pmp->pm_bpcluster ^ (1 << pmp->pm_cnshift)) { + if ((pmp->pm_bpcluster ^ (1 << pmp->pm_cnshift)) != 0) { error = EINVAL; goto error_exit; } @@ -657,9 +653,9 @@ mountmsdosfs(struct vnode *devvp, struct mount *mp) NOCRED, &bp)) != 0) goto error_exit; fp = (struct fsinfo *)bp->b_data; - if (!bcmp(fp->fsisig1, "RRaA", 4) - && !bcmp(fp->fsisig2, "rrAa", 4) - && !bcmp(fp->fsisig3, "\0\0\125\252", 4)) { + if (!bcmp(fp->fsisig1, "RRaA", 4) && + !bcmp(fp->fsisig2, "rrAa", 4) && + !bcmp(fp->fsisig3, "\0\0\125\252", 4)) { pmp->pm_nxtfree = getulong(fp->fsinxtfree); if (pmp->pm_nxtfree > pmp->pm_maxcluster) pmp->pm_nxtfree = CLUST_FIRST; @@ -683,9 +679,8 @@ mountmsdosfs(struct vnode *devvp, struct mount *mp) * Allocate memory for the bitmap of allocated clusters, and then * fill it in. */ - pmp->pm_inusemap = malloc(howmany(pmp->pm_maxcluster + 1, N_INUSEBITS) - * sizeof(*pmp->pm_inusemap), - M_MSDOSFSFAT, M_WAITOK); + pmp->pm_inusemap = malloc(howmany(pmp->pm_maxcluster + 1, + N_INUSEBITS) * sizeof(*pmp->pm_inusemap), M_MSDOSFSFAT, M_WAITOK); /* * fillinusemap() needs pm_devvp. @@ -732,14 +727,14 @@ mountmsdosfs(struct vnode *devvp, struct mount *mp) return (0); error_exit: - if (bp) + if (bp != NULL) brelse(bp); if (cp != NULL) { g_topology_lock(); g_vfs_close(cp); g_topology_unlock(); } - if (pmp) { + if (pmp != NULL) { lockdestroy(&pmp->pm_fatlock); lockdestroy(&pmp->pm_checkpath_lock); free(pmp->pm_inusemap, M_MSDOSFSFAT);