Global variables and inline functions are moved from minix.h to
minix_programs.h which is included in mkfs.minix and fsck.minix.
The minix.h will have only struct definitions etc generic
contents which is reasonable to share with utilities and
libraries.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
In the minix.h two definitions where renamed, so that the single
definition is reusable in fsck.minix, mkfs.minix and libblkid.
BLOCK_SIZE_BITS -> MINIX_BLOCK_SIZE_BITS
BLOCK_SIZE -> MINIX_BLOCK_SIZE
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
For v3 minix superblocks the state flag (s_state) has been removed, so drop it
from the structure in accordance with the kernel's representation.
Reported-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
We can now create minix v3 filesystems. Support for this fs was added a few
years ago in the Linux kernel. One of the most important benefits is the
ability to handle file names up to 60 characters long. With this change we
also introduce the -3 option which naturally indicates which version to create.
Version 1 is still left as the default one for backwards compatibility reasons.
[kzak@redhat.com: - fix gcc warnings:
mkfs.minix.c: In function ‘super_set_state_ptr’:
mkfs.minix.c:174:1: warning: no return statement in function returning non-void [-Wreturn-type]
mkfs.minix.c: In function ‘write_tables’:
mkfs.minix.c:182:7: warning: unused variable ‘state’ [-Wunused-variable]
mkfs.minix.c: At top level:
mkfs.minix.c:111:27: warning: ‘blksz’ defined but not used [-Wunused-variable]
]
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
Produce a warning if the device is misaligned.
[kzak@redhat.com: - use it for block devices only]
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
Like the original minix mkfs, add the -1 and -2 argument options to specify the
version of the filesystem to create.
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Because of the dependence of fs_version, some superblock attributes will vary,
so simplify the logic of assigning values to maxsize and the amount of zones
related to each filesystem, thus making setup_tables() more readable.
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Get rid of this function and use errx(3) instead. This patch also
introduces a mkfs.h header and defines general purpose mkfs related
exit codes.
[kzak@redhat.com: - fix "warning: too many arguments for format" errors]
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
This patch provides some minor code fixes: add/remove some macros and close the device after usage.
Also modifies usage() and changes main()'s indentation to 8-characters.
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
This bug has been introduced by commit
95356e8b74.
The fsck.minix code assumes that isset() macro returns boolean,
unfortunately the generic implementation from libc returns integer.
This patch also add a fallback for the bitmap macros to include/bitops.h.
Reported-by: "Andries E. Brouwer" <Andries.Brouwer@cwi.nl>
Signed-off-by: Karel Zak <kzak@redhat.com>
This patch renames bitops.h to minix_bitops.h to avoid possible
collisions with global include/bitops.h file.
Signed-off-by: Karel Zak <kzak@redhat.com>
blkdev_get_size returns size in bytes, so BLOCKS has to be
calculated accordingly.
Use stat value for size if device is not a block device.
Signed-off-by: Matthias Koenig <mkoenig@suse.de>
no longer use deprecated alias.
helps compiling util-linux-ng against klibc.
add pathnames.h include, where _PATH_MOUNTED is defined.
Signed-off-by: maximilian attems <max@stro.at>
Minix filesystem until version 2 has a fixed blocksize of 1024 bytes.
If you try to create a filsystem on a device with a physical sectorsize
larger than 1024 bytes, this resulting minix fs cannot be mounted,
because the physical sectorsize must be smaller than the filesystem
blocksize.
This patch adds a check for this and will refuse to create a filesystem
if the sectorsize is bigger than the blocksize.
Signed-off-by: Matthias Koenig <mkoenig@suse.de>