Print this page
5255 uts shouldn't open-code ISP2

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/dcfs/dc_vnops.c
          +++ new/usr/src/uts/common/fs/dcfs/dc_vnops.c
↓ open down ↓ 940 lines elided ↑ open up ↑
 941  941  
 942  942          /*
 943  943           * Make sure it's a valid compressed file
 944  944           */
 945  945          hdr = &thdr;
 946  946          error = vn_rdwr(UIO_READ, vp, (caddr_t)hdr, sizeof (struct comphdr), 0,
 947  947              UIO_SYSSPACE, 0, 0, cred, NULL);
 948  948          if (error || hdr->ch_magic != CH_MAGIC_ZLIB ||
 949  949              hdr->ch_version != CH_VERSION || hdr->ch_algorithm != CH_ALG_ZLIB ||
 950  950              hdr->ch_fsize == 0 || hdr->ch_blksize < PAGESIZE ||
 951      -            hdr->ch_blksize > ptob(DCCACHESIZE) ||
 952      -            (hdr->ch_blksize & (hdr->ch_blksize - 1)) != 0)
      951 +            hdr->ch_blksize > ptob(DCCACHESIZE) || !ISP2(hdr->ch_blksize))
 953  952                  return (NULL);
 954  953  
 955  954          /* get underlying file size */
 956  955          if (VOP_GETATTR(vp, &vattr, 0, cred, ctp) != 0)
 957  956                  return (NULL);
 958  957  
 959  958          /*
 960  959           * Re-read entire header
 961  960           */
 962  961          hdrsize = hdr->ch_blkmap[0] + sizeof (uint64_t);
↓ open down ↓ 165 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX