On 03/16/2011 08:07 PM, Cyril Hrubis wrote:
> Hi!
>> - if (no_xfs) {
>> - diob.d_miniosz = stb.st_blksize;
>> - diob.d_maxiosz = stb.st_blksize * 256; /* good number ? */
>> - diob.d_mem = stb.st_blksize;
>> - }
>> + diob.d_miniosz = stb.st_blksize;
>> + diob.d_maxiosz = stb.st_blksize * 256; /* good number ? */
>> + diob.d_mem = stb.st_blksize;
>
> Hmm, why you are removing the if (no_xfs) here (I don't say it's wrong,
> I only want to know why)?
The compiler gave warning that diob.d_* may not initialized. I don't
know what the values diob.d_* should be if XFS exists (no_xfs == 0), but
I guess they should be the same as when XFS not available.
>
>> #ifndef NO_XFS
>> else if (ioctl(fd, XFS_IOC_DIOINFO, &diob) < 0) {
>> if (v)
>> @@ -1826,7 +1824,13 @@ dread_f(int opno, long r)
>> len = align;
>> else if (len > diob.d_maxiosz)
>> len = diob.d_maxiosz;
>> - buf = memalign(diob.d_mem, len);
>> + if (posix_memalign((void **)buf, diob.d_mem, len) != 0) {
>
> The posix_memalign() actually returns pointer to the memory via buf, so
> instead of (void **)buf, you should write &buf (and that would silence
> the warning about uninitalized buf too).
>
sorry, my mistake. I'll correct it. Btw, compiler kept silent when I
missed & sign..
Thanks,
Caspar
--
Quality Engineer (Kernel) in
Red Hat Software (Beijing) Co., R&D Branch
http://www.cn.redhat.com/
TEL: +86-10-62608150
------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list