Commit Graph

50 Commits

Author SHA1 Message Date
Stewart Smith 3ec70fbc45 Don't redefine __const
This would break compiling on RHEL6/CentOS6

Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-12-01 13:50:03 +11:00
Stewart Smith 5d37305e2a clib: explicitly include clib/builtin.h
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-11-30 19:36:57 +11:00
Stewart Smith e99543bb17 README: add build instructions
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-11-30 19:10:34 +11:00
Stewart Smith 2b8ac8212b clib: include system assert.h
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-11-30 19:08:59 +11:00
Stewart Smith 64357b2dae Remove references to removed clib/assert.h
Fixes: 281345fdc9
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-11-30 19:03:52 +11:00
Stewart Smith 6bd1a1fe3e fix high memory usage during any operation with '--buffer'
The --buffer command line option was passed to setvbuf(3).
Computers are fast enough and libc is good enough that
we realistically do not need this.

Hostboot's buildpnor.pl would pass --buffer 0x40000000
which resulted in a malloc(2GB), which would fail on systems
with less than 2GB of memory because sometimes
libc and the kernel are sane.

So, we keep the command line option for backwards compatibility
but completely ignore it.

In the few places where it was used to allocate a buffer to do
work in (and this was via a rather round-about way), we instead
just allocate something the size of the PNOR image.

Fixes: https://github.com/open-power/ffs/issues/7
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-11-30 18:52:23 +11:00
Stewart Smith 1ccd69266b fpart: make test run valgrind clean
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-11-30 17:22:42 +11:00
Stewart Smith 0d97f63595 Merge branch 'bugfixes' of https://github.com/stewart-ibm/ffs 2017-11-30 16:59:07 +11:00
Stewart Smith a669f2e0fe Add skeleton README
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-11-30 16:45:40 +11:00
Stewart Smith aa0ee75d8a Merge fix for TOC > 4k
https://github.com/open-power/ffs/pull/14
2017-11-30 16:37:10 +11:00
Stewart Smith dbe1e476ae Add .gitignore
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-11-30 16:09:26 +11:00
Christian Geddes d0e98fa613 Update libffs to increment part entry and TOC size info
Without this commit , the size of the Table of Contents noted by
ffs_hdr->size was getting defaulted to 4kb (1 hostboot pagesize)
There should be no limitation on the size of the toc, but this
size was not getting incremented if there were enough entries to
push the size of the toc over 4kb. This commit adds logic to
increate the ffs_hdr->size as well as the "part" ffs_entries's size
as we add entries to the ffs_hdr
2017-11-20 17:16:55 -06:00
Stewart Smith fd98239a8b fpart/libffs doesn't initialized reserved FFS header to 0
When running the fpart test suite under valgrind, you can see that it
writes unitialized data to disk (pnor) in the very first test:

./fpart/fpart --target /tmp/create.nor --size 64MiB --block 64kb \
  --partition-offset 0x7f0000 --create

This is because libffs.c doesn't properly initialize the reserved area.

Thus, it could contain any old crap sitting around in memory,
essentially making the reserved fields useless.

Somebody will need to audit *EVERY* libffs created thing in the wild
before ever using that reserved space.

==8261== Syscall param write(buf) points to uninitialised byte(s)
==8261==    at 0x4F27C20: __write_nocancel (syscall-template.S:84)
==8261==    by 0x4EAE1DE: _IO_file_write@@GLIBC_2.2.5 (fileops.c:1263)
==8261==    by 0x4EAF978: new_do_write (fileops.c:518)
==8261==    by 0x4EAF978: _IO_do_write@@GLIBC_2.2.5 (fileops.c:494)
==8261==    by 0x4EAD9DF: _IO_file_sync@@GLIBC_2.2.5 (fileops.c:874)
==8261==    by 0x4EA2FEE: fflush (iofflush.c:41)
==8261==    by 0x406D31: ffs_flush (libffs.c:635)
==8261==    by 0x408304: __ffs_fclose (libffs.c:718)
==8261==    by 0x4032D9: __cleanup_ffs (cmd_create.c:108)
==8261==    by 0x4032D9: create.5128 (cmd_create.c:108)
==8261==    by 0x4056D2: command (command.c:229)
==8261==    by 0x403400: command_create (cmd_create.c:118)
==8261==    by 0x4018F8: process_args (main.c:431)
==8261==    by 0x4018F8: main (main.c:565)
==8261==  Address 0x402201c is in a rw- anonymous segment

Fixes: https://github.com/open-power/ffs/issues/11
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-12-15 23:06:31 +11:00
Stewart Smith 31bf3f7f7c Don't use fsync(): it's not needed
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-12-15 23:06:31 +11:00
Stewart Smith ba8eeee29b use open/read/write for create_regular_file
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-12-15 23:06:26 +11:00
Stewart Smith 4c6b424892 Fix make distcheck
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-12-15 21:19:31 +11:00
Stewart Smith 87bdb36715 use trusty travis env
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-12-15 19:30:14 +11:00
Stewart Smith 041d482397 remove unused mq
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-12-15 19:18:45 +11:00
Stewart Smith 3f88fcdc89 remove AC_CHECK_HEADER_STDBOOL
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-12-15 19:05:03 +11:00
Stewart Smith 0a97161513 remove autoconf 2.69 requiremnt
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-12-15 19:03:29 +11:00
Stewart Smith 398b86566f Update travis-ci.yml for autotools
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-12-15 19:00:52 +11:00
Stewart Smith 281345fdc9 remove custom assert implementation and exception.c
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-12-15 18:59:00 +11:00
Stewart Smith 799ef76e46 Move to autotools
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-12-15 18:43:23 +11:00
Stewart Smith 58cc128607 remove unused ctz builtin defines
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-12-15 17:02:43 +11:00
Stewart Smith 971e7410f0 Remove #define parity __builtin_parity
we already used __builtin_parityll explicitly, no need to keep around this
define

Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-12-15 17:01:04 +11:00
Stewart Smith c8c64252eb remove likely/unlikely: nothing is *that* perf critical
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-12-15 16:59:35 +11:00
Stewart Smith 67c96c6d2e remove crc32 - use sha1sum in test case instead
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-12-15 16:48:06 +11:00
Stewart Smith bf46a48b09 remove more unused memory_leak_detection code
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-12-15 16:48:06 +11:00
Stewart Smith 70a008ea7f remove unused slab
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-12-15 16:48:06 +11:00
Stewart Smith 4672f12323 remove unused db.c/db.h
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-12-15 16:48:06 +11:00
Stewart Smith b22aff3ebc remove unused signal
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-12-15 16:48:06 +11:00
Stewart Smith 0e3baa21f2 remove unused heap
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-12-15 16:48:06 +11:00
Stewart Smith 5690d7ee13 remove unused array
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-12-15 16:48:06 +11:00
Stewart Smith d38494a9cb remove unused dispatch and watch
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-12-15 16:48:06 +11:00
Stewart Smith b0ca9982f0 remove unused stack.h
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-12-15 16:48:06 +11:00
Stewart Smith b6b90c6d85 remove unused vector and vector_iter
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-12-15 16:48:06 +11:00
Stewart Smith 5be6f6f3da remove unused timer.h
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-12-15 16:48:06 +11:00
Stewart Smith a28718aa94 remove unused map and map_iter
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-12-15 16:48:06 +11:00
Stewart Smith 83fc569e83 remove unused bitset
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-12-15 16:48:05 +11:00
Stewart Smith 630e879961 remove unused table and table_iter
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-12-15 16:48:05 +11:00
Stewart Smith ad0327c468 Remove unused memory_leak_detection.h
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-12-15 16:48:05 +11:00
Stewart Smith 13caae9a81 add running of fpart test to travis
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-12-15 16:46:26 +11:00
Stewart Smith 165df94dc4 add .travis.yml for travis-ci
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-12-15 16:44:44 +11:00
Patrick Williams 2e790b8409 Merge pull request #4 from anoo1/master
Support to compile in 64bit for Ubuntu Little Endian
2015-04-22 15:11:25 -05:00
Adriana Kobylak 76ce4aadee Support to compile in 64bit for Ubuntu Little Endian 2015-02-18 16:14:28 -06:00
Patrick Williams aa8354ef7e Merge pull request #2 from bradbishop/master
Use correct (Apache) license.
2015-01-16 14:51:44 -06:00
Patrick Williams 5b12a17dbe Merge pull request #3 from bradbishop/hash
Remove some unused hash function.
2015-01-16 14:50:41 -06:00
Brad Bishop 3ad5abafa3 Remove some unused hash function. 2015-01-08 08:34:21 -05:00
Brad Bishop 89d9b904af Use correct (Apache) license. 2015-01-07 20:45:40 -05:00
Brad Bishop bf46300767 Port FFS tools over from Building Block repository. 2014-07-02 22:49:29 -05:00