"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "fsremap/src/arch/mem_linux.cc" between
fstransform-0.9.3-src.tar.gz and fstransform-0.9.4.tar.gz

About: fstransform is a tool to change a file-system from one format to another, for example from jfs, xfs, or reiser to ext2, ext3, or ext4, in-place and without the need for backup.

mem_linux.cc  (fstransform-0.9.3-src):mem_linux.cc  (fstransform-0.9.4)
skipping to change at line 68 skipping to change at line 68
ff_log(FC_WARN, errno, "failed to open /proc/meminfo, maybe /proc is not mounted?"); ff_log(FC_WARN, errno, "failed to open /proc/meminfo, maybe /proc is not mounted?");
return 0; return 0;
} }
char label[256], unit[8]; char label[256], unit[8];
ft_ull n_ull = 0, scale; ft_ull n_ull = 0, scale;
ft_uoff total = 0, n; ft_uoff total = 0, n;
ft_uint left = 3; ft_uint left = 3;
int err; int err;
while (left != 0) { while (left != 0) {
if ((err = fscanf(f, "%256s %"FT_ULL" %8s\n", label, & n_ull, unit)) <= 0) { if ((err = fscanf(f, "%256s %" FT_ULL " %8s\n", label, & n_ull, unit)) < = 0) {
if (ferror(f)) if (ferror(f))
ff_log(FC_WARN, errno, "error reading /proc/meminfo"); ff_log(FC_WARN, errno, "error reading /proc/meminfo");
break; break;
} }
if (err != 3) if (err != 3)
continue; continue;
label[255] = '\0'; // in case it's missing label[255] = '\0'; // in case it's missing
unit[7] = '\0'; // idem unit[7] = '\0'; // idem
skipping to change at line 100 skipping to change at line 100
default: scale = 0; break; default: scale = 0; break;
} }
/* overflow? then approximate.. */ /* overflow? then approximate.. */
if (scale >= 8*sizeof(ft_ull) || n_ull > (ft_ull)-1 >> scale) if (scale >= 8*sizeof(ft_ull) || n_ull > (ft_ull)-1 >> scale)
n_ull = (ft_ull)-1; n_ull = (ft_ull)-1;
else else
n_ull <<= scale; n_ull <<= scale;
n = (ft_uoff) n_ull; n = (ft_uoff) n_ull;
/* overflow? then approximate.. */ /* overflow? then approximate.. */
if (n < 0 || n_ull != (ft_ull) n || n > (ft_uoff)-1 - total) { if ((ft_ull) n != n_ull || n > (ft_uoff)-1 - total) {
total = (ft_uoff)-1; total = (ft_uoff)-1;
break; break;
} }
total += n; total += n;
left--; left--;
} }
if (fclose(f) != 0) if (fclose(f) != 0)
ff_log(FC_WARN, errno, "error closing /proc/meminfo"); ff_log(FC_WARN, errno, "error closing /proc/meminfo");
return total; return total;
} }
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)