[illumos-Developer] Webrev for bug 81: remove 'is_z_a_power_of_x_le_y' from pcfs utils

Gary Mills mills at cc.umanitoba.ca
Fri Jul 15 07:05:02 PDT 2011


This is for illumos bug 81: remove 'is_z_a_power_of_x_le_y' from pcfs
utils.  It eliminates the two functions is_z_a_power_of_x_le_y() and
powerofx_le_y(), replacing them with the standard macro ISP2() plus
the locally-defined macro IN_RANGE().  My webrev is at:

    URL: http://cr.illumos.org/view/wt1na2j2/illumos81/

Most of my testing was done with a test program that exercises the
functions and macros.  I have verified that both produce the same
result.  I also did final testing under oi_148b to ensure that
mkfs_pcfs behaves the same before and after my changes.

This is the native one:

    # zfs create -V 10m rpool/vol1
    # mkfs -F pcfs -o fat=16,nofdisk,nsect=255,ntrack=63,size=20000 /dev/zvol/rdsk/rpool/vol1
    Construct a new FAT file system on /dev/zvol/rdsk/rpool/vol1: (y/n)? y
    # fstyp /dev/zvol/rdsk/rpool/vol1
    pcfs
    # mkfs -F pcfs -o fat=16,nofdisk,nsect=255,ntrack=63,spc=33,size=20000 /dev/zvol/rdsk/rpool/vol1
    Invalid Sectors/Cluster value.  Must be a power of 2 between 1 and 128.
    # mkfs -F pcfs -o fat=16,nofdisk,nsect=255,ntrack=63,spc=256,size=20000 /dev/zvol/rdsk/rpool/vol1
    Invalid Sectors/Cluster value.  Must be a power of 2 between 1 and 128.

This is the fixed one:

    # /home/mills/Downloads/code/illumos-gate/usr/src/cmd/fs.d/pcfs/mkfs/mkfs -F pcfs -o fat=16,nofdisk,nsect=255,ntrack=63,size=20000 /dev/zvol/rdsk/rpool/vol1
    Construct a new FAT file system on /dev/zvol/rdsk/rpool/vol1: (y/n)? y
    # /home/mills/Downloads/code/illumos-gate/usr/src/cmd/fs.d/pcfs/mkfs/mkfs -F pcfs -o fat=16,nofdisk,nsect=255,ntrack=63,spc=33,size=20000 /dev/zvol/rdsk/rpool/vol1
    Invalid Sectors/Cluster value.  Must be a power of 2 between 1 and 128.
    # /home/mills/Downloads/code/illumos-gate/usr/src/cmd/fs.d/pcfs/mkfs/mkfs -F pcfs -o fat=16,nofdisk,nsect=255,ntrack=63,spc=256,size=20000 /dev/zvol/rdsk/rpool/vol1
    Invalid Sectors/Cluster value.  Must be a power of 2 between 1 and 128.

-- 
-Gary Mills-        -Unix Group-        -Computer and Network Services-



More information about the Developer mailing list