Re: [PATCH 03/19] mkfs: Sanitise the superblock feature macros

Eric Sandeen
2016-04-07T00:12:31Z

On 3/24/16 6:15 AM, jtulak@redhat.com wrote:
> @@ -1262,10 +1358,11 @@ main(
> switch (getsubopt(&p, (constpp)iopts, &value)) {
> case I_ALIGN:
> if (!value || *value == '\0')
> - value = "1";
> - iaflag = atoi(value);
> - if (iaflag < 0 || iaflag > 1)
> + reqval('i', iopts, I_ALIGN);
> + c = atoi(value);
> + if (c < 0 || c > 1)
> illegal(value, "i align");
> + sb_feat.inode_align = c ? true : false;
> break;
> case I_LOG:
> if (!value || *value == '\0')

Hm, this seems wrong, as well - per the man page:

"If the value is omitted, 1 is assumed."

but this change with the reqval() removes that, doesn't it? Why?
(it's fixed later, but there is no reason to break it mid-series...)

Before this patch:

# mkfs/mkfs.xfs -dfile,name=fsfile,size=1g -i align
meta-data=fsfile isize=512 agcount=4, agsize=65536 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=1, sparse=0
data = bsize=4096 blocks=262144, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal log bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0

After this patch:

# mkfs/mkfs.xfs -dfile,name=fsfile,size=1g -i align
-i align option requires a value
Usage: mkfs.xfs
/* blocksize */ [-b log=n|size=num]
/* metadata */ [-m crc=0|1,finobt=0|1,uuid=xxx]
/* data subvol */ [-d agcount=n,agsize=n,file,name=xxx,size=num,
(sunit=value,swidth=value|su=num,sw=num|noalign),
sectlog=n|sectsize=num
...

-Eric