From nobody Sun Jan 02 20:43:08 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 D20E819361D4; Sun, 2 Jan 2022 20:43:08 +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 4JRrRw3vnvz4tMP; Sun, 2 Jan 2022 20:43:08 +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 665A4187F6; Sun, 2 Jan 2022 20:43:08 +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 202Kh8VM089915; Sun, 2 Jan 2022 20:43:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 202Kh8Z9089914; Sun, 2 Jan 2022 20:43:08 GMT (envelope-from git) Date: Sun, 2 Jan 2022 20:43:08 GMT Message-Id: <202201022043.202Kh8Z9089914@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: 04fd468da0d0 - main - mountmsdosfs(): some style 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 04fd468da0d0baea535da418b92df74101a9659d Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1641156188; 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=5EXWts0D/R/ho7h3GD8xx/4Wai246dmoO/4YSa3U6CE=; b=rjiB7c2ODdVqQgr7Wpbk3EsElIT0lwG87utBdrJicrmSNodbSafeVPqRvE7jDNh22YBNyK laExQEnjHbywLe1mjahYx86SN0SIoh5rSDGiy7QTChLsmGI+YA1OVKnV4ljEmSn3YHxHDV UdifK7o7lnPwnUq7NQOIdUIKrjKo+sv/sp6ldGvwqf6uCgMkUHR9lNTssmECB545ecjsol z+wDGeH4N7mZg8XZ4pCV5FJAyfroBFxYFNvFeduMwijJWed/6UUGfFofBExvAaYf6DuVFI SQYtpYpO7jg7K89HsqIq+ulQnMCYdHioho1iTCAMMMXmK4rQ7mr9ZRU1nhB7xQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1641156188; a=rsa-sha256; cv=none; b=BkPcV6rsMjhTKoK53vkxO7yW+DqnAY+Bo4TAZPmzkOZGdQ+RhvzrEr5d3MJyPrYTKWsDWK FMRJOWzOcDLV0lxkhmkZcBbKumsD127EhaiZyTBCrqBMoQDCbZxuijjL8+ZmOglESGwDx+ +iI/G19uDSXHHZ3ma0NV0fV/AAk8Ow4fiV4XEmcFnVLHRPb1QlVuc9y+05VM00iw/PtPrC rqJnUhZN/miU9S+ZntXIJ9HNGoZ+3SMqH5IVk/t1sTxFC4ogUmaDizSfoFkPDMTdxlyrPp A9bzArxFuQWIJlJMELRYDMD3UHsWodsYYHS/QYN6Rtz/QdJr2cjBmmOx/k10Kw== 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=04fd468da0d0baea535da418b92df74101a9659d commit 04fd468da0d0baea535da418b92df74101a9659d Author: Konstantin Belousov AuthorDate: 2021-12-30 19:33:41 +0000 Commit: Konstantin Belousov CommitDate: 2022-01-02 20:25:07 +0000 mountmsdosfs(): some style Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D33721 --- 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 32cc81c52ffd..5eb6ad04eab9 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);