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..
That's because of the (void **) cast. The char * and void ** are
not compatible pointers and copiler should print a warning about
incompatible type. On the other hand void ** and char ** are
incompatible pointers too.
As one wise man said: "C is a Spartan language" ...
--
Cyril Hrubis
[email protected]
------------------------------------------------------------------------------
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