Commit Graph

25 Commits

Author SHA1 Message Date
Marcel Moolenaar
5d71efbecd Be more precise when including headers so that we're less likely to
depend on namespace pollution and as such become more portable. This
means including headers like <sys/types.h> or <stdlib.h>, but also
making sure we include system/host headers before local headers.

While here: define ENOATTR as ENOMSG in mtree.c. There is no ENOATTR
on Linux.

With this, makefs is ready for compilation on macOS and Linux.
2016-10-25 16:29:15 +00:00
Marcel Moolenaar
46783b12e3 Allow building makefs(8) from another Makefile (such as one in
a seperate directory hierarchy used to build tools). This boils
down to replacing the use of ${.CURDIR} with either ${SRCDIR}
or ${SRCTOP}. SRCDIR is defined as the directory in which the
Makefile lives that bmake(1) is currently reading. Use SRCTOP
when reaching outside of makefs's directory.
2016-10-25 16:21:38 +00:00
Ed Maste
881e506b36 makefs: sync NetBSD IDs with upstream for changes that we already have
May 22 21:51:39 2011 +0000 (christos):

    From Nathan Whitehorn (nwhitehorn at freebsd dot org):
    Add code to generate bootable ISOs on Powermac and CHRP systems.
    Synthesize some partition maps (APM and MBR, respectively) pointing
    to (a) the whole disk, and (b) relevant El Torito boot images that
    have been added by other code. These partition maps are a little
    bit funny looking, but they seem to work. FreeBSD has been using
    this successfully in their release generation on powerpc, as well
    as generating all non-SPARC install media. SPARC support could
    probably be added as an extension of this patch.

makefs.8 1.33

Tue Aug 23 17:09:11 2011 +0000 (christos):

    PR/45285: Martin Matuska: makefs does not properly convert ISO level 1 and 2
    filenames (buffer overflow)

    makefs does not properly verify the maximum filename length in the
    special "." case for both ISO level 1 and ISO level 2 filename
    conversion.  This creates broken images or causes a buffer overflow
    (ISO level 2).

    ISO level 1:
    If a filename contains only dots or up to 8 characters followed by
    dots the 8+3 limit check doesn't work.

    ISO level 2:
    If a filename contains a dot in the first 30 characters and a dot
    on the 30th character, the length limit check doesn't work and the
    buffer is overflowed.

    $ mkdir level1
    $ touch level1/12345............
    $ makefs -t cd9660 -o isolevel=1 test.iso level1

    $ mkdir level2
    $ touch level2/1234567890.2345678901234567.....34567890123456789012345
    $ makefs -t cd9660 -o isolevel=2 test.iso level2

cd9660.c 1.32

Sun Oct 9 21:33:43 2011 +0000 (christos):

    add support for setting the ufs label. (Nathan Whitehorn)

ffs.c 1.45
ffs.h 1.2
mkfs.c 1.22
makefs.8 1.37

Obtained from:	NetBSD
2016-07-19 18:40:54 +00:00
Ed Maste
7b03d164da makefs: Provide a -T option to set timestamps to a consistent value
This is taken from the NetBSD versions listed below and adapted to the
makefs version in FreeBSD, along with a bug fix from cem@ that will be
sent to NetBSD.

Reviewed by:	pfg
Approved by:	re (gjb)
Obtained from:	NetBSD
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D6835
2016-06-14 14:03:28 +00:00
Conrad Meyer
16f6b6f174 ffs_bswap: Copy one UFS dinode member at a time
No functional change.

Reported by:	Coverity
CIDs:		974635, 974636, 977396, 977397, 977398, 977399
Sponsored by:	EMC / Isilon Storage Division
2016-05-11 16:42:13 +00:00
Marcelo Araujo
a8945bbf62 Use MIN/MAX macros from sys/param.h.
MFC after:	2 weeks.
2016-05-02 01:47:13 +00:00
Marcelo Araujo
bb0bd931dc The malloc will return NULL if it can't allocate memory.
MFC after:	2 weeks.
2016-04-18 05:19:45 +00:00
Ed Maste
6d90cbf05d Remove clauses 3 and 4 from makefs newfs_extern.h
Obtained from:	NetBSD
2015-11-19 02:39:46 +00:00
Enji Cooper
fc062a4bd7 Sync minor whitespace / type changes in ffs_csum_swap and ffs_sb_swap with
src/sys/ufs/ffs/ffs_bswap.c@1.39

Obtained from: NetBSD
MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division
2015-11-02 10:09:09 +00:00
Sean Bruno
24484ca4bf makefs(8) leaves sblock.fs_providersize uninitialized (zero) that can be easily
checked with dumpfs(8). This may lead to other problems, f.e. geom_label kernel
module sanity checks do not like zero fs_old_size value and skips such UFS1
file system while tasting (fs_old_size derives from sblock.fs_providersize).

PR:	203704
Submitted by:	eugen@grosbein.net
Reviewed by:	marcel
2015-10-13 17:00:14 +00:00
John-Mark Gurney
646fc9ccad convert to using the _daddr_t types like newfs was...
Put the superblock in the correct possition for UFS2... There is a bug
in FFS that if we don't put it here (for UFS2), it will forcefully
relocate the superblock, and I believe cause data loss..

I have a fix for that, but w/ how many releases are broken, we won't be
able to switch to the better _FLOPPY (block 0) for this for a while..
2014-05-31 20:26:34 +00:00
Marius Strobl
2e17284732 Ensure that makefs.h is included when using ufs_bswap.h so the FFS_EI macro
is picked up when defined. Previously, ffs_subr.c was always built without
support for opposite endianess as it doesn't include makefs.h on its own.

MFC after:	3 days
2013-07-26 14:22:03 +00:00
Matthew D Fleming
b424efd5b1 Fix usr.bin/ and usr.sbin/ build with a 64-bit ino_t.
Original code by:	Gleb Kurtsou
2012-09-27 23:31:19 +00:00
Mateusz Guzik
1ec9bedabe Remove unused member of struct indir (in_exists) from UFS and EXT2 code.
Reviewed by:	mckusick
Approved by:	trasz (mentor)
MFC after:	1 week
2012-08-17 17:45:27 +00:00
Ulrich Spörlein
3df5ecac8c Spelling fixes for usr.sbin/ 2011-12-30 10:58:14 +00:00
Ed Schouten
55a1bde99c Small cleanups to panic() prototype.
- Let panic() use _Noreturn and __printflike() instead of GCC-specific
  attributes.
- Remove prototype from ffs_subr.c and let it include ffs_extern.h.
- Forward declare struct inode to make ffs_extern.h not depend on it.
2011-12-20 12:34:17 +00:00
Nathan Whitehorn
703d6e3e8d Add support to makefs(8) to add UFS labels to images.
Submitted by:	avg
MFC after:	3 days
2011-10-09 16:22:31 +00:00
Kirk McKusick
ff13f23f84 Drop the include of <ufs/ffs/ffs_extern.h> from usr.sbin/makefs/ffs/ffs_bswap.c
and usr.sbin/makefs/ffs/ffs_subr.c as they have no need of anything in that
file.  No other programs or libraries include <ufs/ffs/ffs_extern.h> (nor
should they as it is totally in-kernel interfaces). For added protection
I enclosed the entire contents of <ufs/ffs/ffs_extern.h> in ifdef _KERNEL.

Feedback from:	Bruce Evans and Tai-hwa Liang
2011-06-16 23:40:10 +00:00
Dimitry Andric
222ef43340 Use alternative, less messy solution to avoid breakage after r223020:
put the snapdata structure between #ifdef _KERNEL guards.

Suggested by:	kib
2011-06-13 16:05:41 +00:00
Dimitry Andric
e8c2d28580 Apparently makefs needs a few more system headers to compile during
buildworld.
2011-06-13 01:04:00 +00:00
Dimitry Andric
057ead2f86 Unbreak usr.sbin/makefs after r223020.
Pointy hat to:	mckusick
2011-06-12 23:09:00 +00:00
Olivier Houchard
01a0f8531a Sync with the latest version from NetBSD. It notably addds ISO9660 support.
Submitted by:	bapt
2010-11-07 16:05:04 +00:00
Jeff Roberson
113db2dddb - Merge soft-updates journaling from projects/suj/head into head. This
brings in support for an optional intent log which eliminates the need
   for background fsck on unclean shutdown.

Sponsored by:   iXsystems, Yahoo!, and Juniper.
With help from: McKusick and Peter Holm
2010-04-24 07:05:35 +00:00
Ed Schouten
a9d25ec695 Fix LLVM compiler errors related to K&R declarations with ANSI prototypes.
Submitted by:	Pawel Worach <pawel.worach@gmail.com>
2009-02-26 20:59:05 +00:00
Sam Leffler
d347a0da97 import netbsd makefs tool 2008-12-19 18:47:46 +00:00