This commit is contained in:
2024-12-14 10:43:33 +03:00
parent 7f8090bb1f
commit bbf76e4925
1292 changed files with 2823 additions and 500876 deletions

View File

@@ -1,382 +0,0 @@
# By YZBruh
# Copyright 2024 Partition Manager
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#####
# sub-make for building e2fsprogs (built-in mke2fs)
#####
# Include required files
include ../../build/config/env.mk
ifeq ($(INC_OLDENV),true)
include ../../build/config/oldenv.mk
endif
# Some variables, flags etc.
E := @ echo
INCLUDE := $(realpath ../../include/e2fsprogs)
E2FSPROGS_DEFAULT_CFLAGS = \
-std=c17 \
-Wall \
-Werror \
-Wno-pointer-arith \
-Wno-sign-compare \
-Wno-type-limits \
-Wno-typedef-redefinition \
-Wno-unused-parameter \
-Wno-unused-command-line-argument \
-Wno-nullability-completeness \
-Wno-macro-redefined \
-fPIC \
-pthread \
-include $(INCLUDE)/../PartitionManager/Alternatives.h
INCLUDE_DIRS := \
$(INCLUDE)/misc \
$(INCLUDE)/blkid \
$(INCLUDE)/e2p \
$(INCLUDE)/et \
$(INCLUDE)/ext2fs \
$(INCLUDE)/ss \
$(INCLUDE)/support \
$(INCLUDE)/uuid \
$(INCLUDE)/e2fsck \
$(INCLUDE)
INC_DIRS := $(foreach dir,$(INCLUDE_DIRS),$(shell echo -I$(dir)))
CFLAGS := $(E2FSPROGS_DEFAULT_CFLAGS) $(INC_DIRS)
ARFLAGS := rcs
OUT := $(realpath ../../out/e2fsprogs)
MKE2FS := $(CURDIR)/mke2fs
LIB := $(CURDIR)/lib
LIBEXT2FS := $(LIB)/ext2fs
LIBEXT2_UUID := $(LIB)/uuid
LIBEXT2_E2P := $(LIB)/e2p
LIBEXT2_QUOTA := $(LIB)/support
LIBEXT2_MISC := $(LIB)/misc
LIBEXT2_COM_ERR := $(LIB)/et
LIBEXT2_BLKID := $(LIB)/blkid
# Source list of mke2fs
MKE2FS_SRCS := \
$(MKE2FS)/default_profile.c \
$(MKE2FS)/mk_hugefiles.c \
$(MKE2FS)/mke2fs.c \
$(MKE2FS)/util.c
# Source list of libext2fs
LIBEXT2FS_SRCS := \
$(LIBEXT2FS)/alloc.c \
$(LIBEXT2FS)/alloc_sb.c \
$(LIBEXT2FS)/alloc_stats.c \
$(LIBEXT2FS)/alloc_tables.c \
$(LIBEXT2FS)/atexit.c \
$(LIBEXT2FS)/badblocks.c \
$(LIBEXT2FS)/bb_inode.c \
$(LIBEXT2FS)/bitmaps.c \
$(LIBEXT2FS)/bitops.c \
$(LIBEXT2FS)/blkmap64_ba.c \
$(LIBEXT2FS)/blkmap64_rb.c \
$(LIBEXT2FS)/blknum.c \
$(LIBEXT2FS)/block.c \
$(LIBEXT2FS)/bmap.c \
$(LIBEXT2FS)/check_desc.c \
$(LIBEXT2FS)/crc16.c \
$(LIBEXT2FS)/crc32c.c \
$(LIBEXT2FS)/csum.c \
$(LIBEXT2FS)/closefs.c \
$(LIBEXT2FS)/dblist.c \
$(LIBEXT2FS)/dblist_dir.c \
$(LIBEXT2FS)/digest_encode.c \
$(LIBEXT2FS)/dirblock.c \
$(LIBEXT2FS)/dirhash.c \
$(LIBEXT2FS)/dir_iterate.c \
$(LIBEXT2FS)/dupfs.c \
$(LIBEXT2FS)/expanddir.c \
$(LIBEXT2FS)/ext2_err.c \
$(LIBEXT2FS)/ext_attr.c \
$(LIBEXT2FS)/extent.c \
$(LIBEXT2FS)/fallocate.c \
$(LIBEXT2FS)/fileio.c \
$(LIBEXT2FS)/finddev.c \
$(LIBEXT2FS)/flushb.c \
$(LIBEXT2FS)/freefs.c \
$(LIBEXT2FS)/gen_bitmap.c \
$(LIBEXT2FS)/gen_bitmap64.c \
$(LIBEXT2FS)/get_num_dirs.c \
$(LIBEXT2FS)/get_pathname.c \
$(LIBEXT2FS)/getsize.c \
$(LIBEXT2FS)/getsectsize.c \
$(LIBEXT2FS)/hashmap.c \
$(LIBEXT2FS)/i_block.c \
$(LIBEXT2FS)/icount.c \
$(LIBEXT2FS)/imager.c \
$(LIBEXT2FS)/ind_block.c \
$(LIBEXT2FS)/initialize.c \
$(LIBEXT2FS)/inline.c \
$(LIBEXT2FS)/inline_data.c \
$(LIBEXT2FS)/inode.c \
$(LIBEXT2FS)/io_manager.c \
$(LIBEXT2FS)/ismounted.c \
$(LIBEXT2FS)/link.c \
$(LIBEXT2FS)/llseek.c \
$(LIBEXT2FS)/lookup.c \
$(LIBEXT2FS)/mmp.c \
$(LIBEXT2FS)/mkdir.c \
$(LIBEXT2FS)/mkjournal.c \
$(LIBEXT2FS)/namei.c \
$(LIBEXT2FS)/native.c \
$(LIBEXT2FS)/newdir.c \
$(LIBEXT2FS)/nls_utf8.c \
$(LIBEXT2FS)/openfs.c \
$(LIBEXT2FS)/progress.c \
$(LIBEXT2FS)/punch.c \
$(LIBEXT2FS)/qcow2.c \
$(LIBEXT2FS)/rbtree.c \
$(LIBEXT2FS)/read_bb.c \
$(LIBEXT2FS)/read_bb_file.c \
$(LIBEXT2FS)/res_gdt.c \
$(LIBEXT2FS)/rw_bitmaps.c \
$(LIBEXT2FS)/sha256.c \
$(LIBEXT2FS)/sha512.c \
$(LIBEXT2FS)/swapfs.c \
$(LIBEXT2FS)/symlink.c \
$(LIBEXT2FS)/undo_io.c \
$(LIBEXT2FS)/unix_io.c \
$(LIBEXT2FS)/sparse_io.c \
$(LIBEXT2FS)/unlink.c \
$(LIBEXT2FS)/valid_blk.c \
$(LIBEXT2FS)/version.c \
$(LIBEXT2FS)/test_io.c
# Source list of libext2_uuid
LIBEXT2_UUID_SRCS := \
$(LIBEXT2_UUID)/clear.c \
$(LIBEXT2_UUID)/compare.c \
$(LIBEXT2_UUID)/copy.c \
$(LIBEXT2_UUID)/gen_uuid.c \
$(LIBEXT2_UUID)/isnull.c \
$(LIBEXT2_UUID)/pack.c \
$(LIBEXT2_UUID)/parse.c \
$(LIBEXT2_UUID)/unpack.c \
$(LIBEXT2_UUID)/unparse.c \
$(LIBEXT2_UUID)/uuid_time.c
# Source list of libext2_blkid
LIBEXT2_BLKID_SRCS := \
$(LIBEXT2_BLKID)/cache.c \
$(LIBEXT2_BLKID)/dev.c \
$(LIBEXT2_BLKID)/devname.c \
$(LIBEXT2_BLKID)/devno.c \
$(LIBEXT2_BLKID)/getsize.c \
$(LIBEXT2_BLKID)/llseek.c \
$(LIBEXT2_BLKID)/probe.c \
$(LIBEXT2_BLKID)/read.c \
$(LIBEXT2_BLKID)/resolve.c \
$(LIBEXT2_BLKID)/save.c \
$(LIBEXT2_BLKID)/tag.c \
$(LIBEXT2_BLKID)/version.c
# Source list of libext2_e2p
LIBEXT2_E2P_SRCS := \
$(LIBEXT2_E2P)/crypto_mode.c \
$(LIBEXT2_E2P)/encoding.c \
$(LIBEXT2_E2P)/errcode.c \
$(LIBEXT2_E2P)/feature.c \
$(LIBEXT2_E2P)/fgetflags.c \
$(LIBEXT2_E2P)/fgetproject.c \
$(LIBEXT2_E2P)/fgetversion.c \
$(LIBEXT2_E2P)/fsetflags.c \
$(LIBEXT2_E2P)/fsetproject.c \
$(LIBEXT2_E2P)/fsetversion.c \
$(LIBEXT2_E2P)/getflags.c \
$(LIBEXT2_E2P)/getversion.c \
$(LIBEXT2_E2P)/hashstr.c \
$(LIBEXT2_E2P)/iod.c \
$(LIBEXT2_E2P)/ljs.c \
$(LIBEXT2_E2P)/ls.c \
$(LIBEXT2_E2P)/mntopts.c \
$(LIBEXT2_E2P)/ostype.c \
$(LIBEXT2_E2P)/parse_num.c \
$(LIBEXT2_E2P)/pe.c \
$(LIBEXT2_E2P)/percent.c \
$(LIBEXT2_E2P)/pf.c \
$(LIBEXT2_E2P)/ps.c \
$(LIBEXT2_E2P)/setflags.c \
$(LIBEXT2_E2P)/setversion.c \
$(LIBEXT2_E2P)/uuid.c
# Source list of libext2_quota
LIBEXT2_QUOTA_SRCS := \
$(LIBEXT2_QUOTA)/devname.c \
$(LIBEXT2_QUOTA)/dict.c \
$(LIBEXT2_QUOTA)/mkquota.c \
$(LIBEXT2_QUOTA)/parse_qtype.c \
$(LIBEXT2_QUOTA)/plausible.c \
$(LIBEXT2_QUOTA)/prof_err.c \
$(LIBEXT2_QUOTA)/profile.c \
$(LIBEXT2_QUOTA)/profile_helpers.c \
$(LIBEXT2_QUOTA)/quotaio.c \
$(LIBEXT2_QUOTA)/quotaio_tree.c \
$(LIBEXT2_QUOTA)/quotaio_v2.c
# Source od libext2_misc
LIBEXT2_MISC_SRCS := $(LIBEXT2_MISC)/create_inode.c
# Source list of libext2_com_err
LIBEXT2_COM_ERR_SRCS := \
$(LIBEXT2_COM_ERR)/com_err.c \
$(LIBEXT2_COM_ERR)/com_right.c \
$(LIBEXT2_COM_ERR)/error_message.c \
$(LIBEXT2_COM_ERR)/et_name.c \
$(LIBEXT2_COM_ERR)/init_et.c
# Object lists
MKE2FS_OBJS := $(MKE2FS_SRCS:.c=.o)
LIBEXT2FS_OBJS := $(LIBEXT2FS_SRCS:.c=.o)
LIBEXT2_UUID_OBJS := $(LIBEXT2_UUID_SRCS:.c=.o)
LIBEXT2_BLKID_OBJS := $(LIBEXT2_BLKID_SRCS:.c=.o)
LIBEXT2_E2P_OBJS := $(LIBEXT2_E2P_SRCS:.c=.o)
LIBEXT2_QUOTA_OBJS := $(LIBEXT2_QUOTA_SRCS:.c=.o)
LIBEXT2_MISC_OBJS := $(LIBEXT2_MISC_SRCS:.c=.o)
LIBEXT2_COM_ERR_OBJS := $(LIBEXT2_COM_ERR_SRCS:.c=.o)
# Compiler flags (CFLAGS)
LIBEXT2FS_CFLAGS := -Wno-unused-but-set-variable
LIBEXT2_E2P_CFLAGS := -Wno-error=attributes
LIBEXT2_MISC_CFLAGS := -Wno-error=format-extra-args
LIBEXT2_BLKID_CFLAGS := \
-Wno-error=attributes \
-Wno-error=pointer-sign \
-Wno-unused-but-set-variable \
-fno-strict-aliasing
# Full object list
OBJS_ALL := \
$(MKE2FS_OBJS) \
$(LIBEXT2FS_OBJS) \
$(LIBEXT2_BLKID_OBJS) \
$(LIBEXT2_UUID_OBJS) \
$(LIBEXT2_E2P_OBJS) \
$(LIBEXT2_QUOTA_OBJS) \
$(LIBEXT2_MISC_OBJS) \
$(LIBEXT2_COM_ERR_OBJS)
# Progress list
PROGRESS_LIST := \
$(LIBEXT2_BLKID_OBJS) \
libext2_blkid_ar \
$(LIBEXT2_UUID_OBJS) \
libext2_uuid_ar \
$(LIBEXT2_E2P_OBJS) \
libext2_e2p_ar \
$(LIBEXT2FS_OBJS) \
libext2fs_ar \
$(LIBEXT2_QUOTA_OBJS) \
libext2_quota_ar \
$(LIBEXT2_MISC_OBJS) \
libext2_misc_ar \
$(LIBEXT2_COM_ERR_OBJS) \
libext2_com_err_ar \
$(MKE2FS_OBJS) \
mke2fs_dummy_ld
.PHONY: all
all: $(PROGRESS_LIST)
# Cleaner
.PHONY: clean
clean:
@ rm -rf $(OBJS_ALL)
#######################################
# 'MAKE' TARGETS FOR BUILDING OBJECTS #
#######################################
$(MKE2FS)/%.o: $(MKE2FS)/%.c
$(E) " CC e2fsprogs/`basename $(MKE2FS)`/`basename $@`"
@ $(CC) -c $(CFLAGS) $(MKE2FS_CFLAGS) "$<" -o "$@" || exit 1
$(LIBEXT2FS)/%.o: $(LIBEXT2FS)/%.c
$(E) " CC e2fsprogs/lib/`basename $(LIBEXT2FS)`/`basename $@`"
@ $(CC) -c $(CFLAGS) $(LIBEXT2FS_CFLAGS) "$<" -o "$@" || exit 1
$(LIBEXT2_BLKID)/%.o: $(LIBEXT2_BLKID)/%.c
$(E) " CC e2fsprogs/lib/`basename $(LIBEXT2_BLKID)`/`basename $@`"
@ $(CC) -c $(CFLAGS) $(LIBEXT2_BLKID_CFLAGS) "$<" -o "$@" || exit 1
$(LIBEXT2_E2P)/%.o: $(LIBEXT2_E2P)/%.c
$(E) " CC e2fsprogs/lib/`basename $(LIBEXT2_E2P)`/`basename $@`"
@ $(CC) -c $(CFLAGS) "$<" -o "$@" || exit 1
$(LIBEXT2_UUID)/%.o: $(LIBEXT2_UUID)/%.c
$(E) " CC e2fsprogs/lib/`basename $(LIBEXT2_UUID)`/`basename $@`"
@ $(CC) -c $(CFLAGS) "$<" -o "$@" || exit 1
$(LIBEXT2_QUOTA)/%.o: $(LIBEXT2_QUOTA)/%.c
$(E) " CC e2fsprogs/lib/`basename $(LIBEXT2_QUOTA)`/`basename $@`"
@ $(CC) -c $(CFLAGS) "$<" -o "$@" || exit 1
$(LIBEXT2_MISC)/%.o: $(LIBEXT2_MISC)/%.c
$(E) " CC e2fsprogs/lib/`basename $(LIBEXT2_MISC)`/`basename $@`"
@ $(CC) -c $(CFLAGS) $(LIBEXT2_MISC_CFLAGS) "$<" -o "$@" || exit 1
$(LIBEXT2_COM_ERR)/%.o: $(LIBEXT2_COM_ERR)/%.c
$(E) " CC e2fsprogs/lib/`basename $(LIBEXT2_COM_ERR)`/`basename $@`"
@ $(CC) -c $(CFLAGS) "$<" -o "$@" || exit 1
#############################################
# 'MAKE' TARGETS FOR GENERATING STATIC LIBS #
#############################################
libext2fs_ar: $(LIBEXT2FS_OBJS)
$(E) " AR out/e2fsprogs/libext2fs.a"
@ $(AR) $(ARFLAGS) $(OUT)/libext2fs.a $^ || exit 1
$(E) " ----------- libext2_quota -----------"
libext2_blkid_ar: $(LIBEXT2_BLKID_OBJS)
$(E) " AR out/e2fsprogs/libext2_blkid.a"
@ $(AR) $(ARFLAGS) $(OUT)/libext2_blkid.a $^ || exit 1
$(E) " ----------- libext2_uuid ---------"
libext2_e2p_ar: $(LIBEXT2_E2P_OBJS)
$(E) " AR out/e2fsprogs/libext2_e2p.a"
@ $(AR) $(ARFLAGS) $(OUT)/libext2_e2p.a $^ || exit 1
$(E) " ----------- libext2fs -----------"
libext2_uuid_ar: $(LIBEXT2_UUID_OBJS)
$(E) " AR out/e2fsprogs/libext2_uuid.a"
@ $(AR) $(ARFLAGS) $(OUT)/libext2_uuid.a $^ || exit 1
$(E) " ----------- libext2_e2p -----------"
libext2_quota_ar: $(LIBEXT2_QUOTA_OBJS)
$(E) " AR out/e2fsprogs/libext2_quota.a"
@ $(AR) $(ARFLAGS) $(OUT)/libext2_quota.a $^ || exit 1
$(E) " ----------- libext2_misc -----------"
libext2_misc_ar: $(LIBEXT2_MISC_OBJS)
$(E) " AR out/e2fsprogs/libext2_misc.a"
@ $(AR) $(ARFLAGS) $(OUT)/libext2_misc.a $^ || exit 1
$(E) " ----------- libext2_com_err -----------"
libext2_com_err_ar: $(LIBEXT2_COM_ERR_OBJS)
$(E) " AR out/e2fsprogs/libext2_com_err.a"
@ $(AR) $(ARFLAGS) $(OUT)/libext2_com_err.a $^ || exit 1
$(E) " ----------- mke2fs -----------"
#############################################
# DUMMY 'MAKE' TARGET FOR DISPLAYING MKE2FS #
#############################################
mke2fs_dummy_ld:
$(E) " DMY mke2fs"

View File

@@ -17,9 +17,7 @@
#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__OpenBSD__)
#define _XOPEN_SOURCE 600
#ifndef _DARWIN_C_SOURCE
#define _DARWIN_C_SOURCE
#endif
#define _FILE_OFFSET_BITS 64
#ifndef _LARGEFILE_SOURCE
#define _LARGEFILE_SOURCE

View File

@@ -76,7 +76,7 @@ extern int optind;
extern int isatty(int);
extern FILE *fpopen(const char *cmd, const char *mode);
const char * ProgramName = "mke2fs";
const char * program_name = "mke2fs";
static const char * device_name /* = NULL */;
/* Command line options */
@@ -140,7 +140,7 @@ static void usage(void)
"\t[-t fs-type] [-T usage-type ] [-U UUID] [-e errors_behavior]"
"[-z undo_file]\n"
"\t[-jnqvDFSV] device [blocks-count]\n"),
ProgramName);
program_name);
exit(1);
}
@@ -1061,7 +1061,7 @@ static void parse_extended_opts(struct ext2_super_block *param,
"Failed to parse quota type at %s", errtok);
free(errtok);
} else
com_err(ProgramName, ret,
com_err(program_name, ret,
"while parsing quota type");
r_usage++;
badopt = token;
@@ -1320,9 +1320,9 @@ static char **parse_fs_type(const char *fs_type,
ext_type = fs_type;
else if (is_hurd)
ext_type = "ext2";
else if (!strcmp(ProgramName, "mke3fs"))
else if (!strcmp(program_name, "mke3fs"))
ext_type = "ext3";
else if (!strcmp(ProgramName, "mke4fs"))
else if (!strcmp(program_name, "mke4fs"))
ext_type = "ext4";
else if (progname) {
ext_type = strrchr(progname, '/');
@@ -1643,11 +1643,11 @@ profile_error:
fs_param.s_rev_level = 0;
if (argc && *argv) {
ProgramName = get_progname(*argv);
program_name = get_progname(*argv);
/* If called as mkfs.ext3, create a journal inode */
if (!strcmp(ProgramName, "mkfs.ext3") ||
!strcmp(ProgramName, "mke3fs"))
if (!strcmp(program_name, "mkfs.ext3") ||
!strcmp(program_name, "mke3fs"))
journal_size = -1;
}
@@ -1659,7 +1659,7 @@ profile_error:
b = (blocksize > 0) ? blocksize : -blocksize;
if (b < EXT2_MIN_BLOCK_SIZE ||
b > EXT2_MAX_BLOCK_SIZE) {
com_err(ProgramName, 0,
com_err(program_name, 0,
_("invalid block size - %s"), optarg);
exit(1);
}
@@ -1679,7 +1679,7 @@ profile_error:
cluster_size = parse_num_blocks2(optarg, -1);
if (cluster_size <= EXT2_MIN_CLUSTER_SIZE ||
cluster_size > EXT2_MAX_CLUSTER_SIZE) {
com_err(ProgramName, 0,
com_err(program_name, 0,
_("invalid cluster size - %s"),
optarg);
exit(1);
@@ -1692,7 +1692,7 @@ profile_error:
direct_io = 1;
break;
case 'R':
com_err(ProgramName, 0, "%s",
com_err(program_name, 0, "%s",
_("'-R' is deprecated, use '-E' instead"));
/* fallthrough */
case 'E':
@@ -1706,7 +1706,7 @@ profile_error:
else if (strcmp(optarg, "panic") == 0)
errors_behavior = EXT2_ERRORS_PANIC;
else {
com_err(ProgramName, 0,
com_err(program_name, 0,
_("bad error behavior - %s"),
optarg);
usage();
@@ -1718,12 +1718,12 @@ profile_error:
case 'g':
fs_param.s_blocks_per_group = strtoul(optarg, &tmp, 0);
if (*tmp) {
com_err(ProgramName, 0, "%s",
com_err(program_name, 0, "%s",
_("Illegal number for blocks per group"));
exit(1);
}
if ((fs_param.s_blocks_per_group % 8) != 0) {
com_err(ProgramName, 0, "%s",
com_err(program_name, 0, "%s",
_("blocks per group must be multiple of 8"));
exit(1);
}
@@ -1731,18 +1731,18 @@ profile_error:
case 'G':
flex_bg_size = strtoul(optarg, &tmp, 0);
if (*tmp) {
com_err(ProgramName, 0, "%s",
com_err(program_name, 0, "%s",
_("Illegal number for flex_bg size"));
exit(1);
}
if (flex_bg_size < 1 ||
(flex_bg_size & (flex_bg_size-1)) != 0) {
com_err(ProgramName, 0, "%s",
com_err(program_name, 0, "%s",
_("flex_bg size must be a power of 2"));
exit(1);
}
if (flex_bg_size > MAX_32_NUM) {
com_err(ProgramName, 0,
com_err(program_name, 0,
_("flex_bg size (%lu) must be less than"
" or equal to 2^31"), flex_bg_size);
exit(1);
@@ -1752,7 +1752,7 @@ profile_error:
inode_ratio = parse_num_blocks(optarg, -1);
if (inode_ratio < EXT2_MIN_BLOCK_SIZE ||
inode_ratio > EXT2_MAX_BLOCK_SIZE * 1024) {
com_err(ProgramName, 0,
com_err(program_name, 0,
_("invalid inode ratio %s (min %d/max %d)"),
optarg, EXT2_MIN_BLOCK_SIZE,
EXT2_MAX_BLOCK_SIZE * 1024);
@@ -1762,7 +1762,7 @@ profile_error:
case 'I':
inode_size = strtoul(optarg, &tmp, 0);
if (*tmp) {
com_err(ProgramName, 0,
com_err(program_name, 0,
_("invalid inode size - %s"), optarg);
exit(1);
}
@@ -1788,7 +1788,7 @@ profile_error:
bad_blocks_filename = realloc(bad_blocks_filename,
strlen(optarg) + 1);
if (!bad_blocks_filename) {
com_err(ProgramName, ENOMEM, "%s",
com_err(program_name, ENOMEM, "%s",
_("in malloc for bad_blocks_filename"));
exit(1);
}
@@ -1806,7 +1806,7 @@ profile_error:
reserved_ratio = strtod(optarg, &tmp);
if ( *tmp || reserved_ratio > 50 ||
reserved_ratio < 0) {
com_err(ProgramName, 0,
com_err(program_name, 0,
_("invalid reserved blocks percent - %s"),
optarg);
exit(1);
@@ -1821,7 +1821,7 @@ profile_error:
case 'N':
num_inodes = strtoul(optarg, &tmp, 0);
if (*tmp) {
com_err(ProgramName, 0,
com_err(program_name, 0,
_("bad num inodes - %s"), optarg);
exit(1);
}
@@ -1834,7 +1834,7 @@ profile_error:
fs_features_size + 1 + strlen(optarg),
&fs_features);
if (retval) {
com_err(ProgramName, retval,
com_err(program_name, retval,
_("while allocating fs_feature string"));
exit(1);
}
@@ -1851,12 +1851,12 @@ profile_error:
case 'r':
r_opt = strtoul(optarg, &tmp, 0);
if (*tmp) {
com_err(ProgramName, 0,
com_err(program_name, 0,
_("bad revision level - %s"), optarg);
exit(1);
}
if (r_opt > EXT2_MAX_SUPP_REV) {
com_err(ProgramName, EXT2_ET_REV_TOO_HIGH,
com_err(program_name, EXT2_ET_REV_TOO_HIGH,
_("while trying to create revision %d"), r_opt);
exit(1);
}
@@ -1870,7 +1870,7 @@ profile_error:
break;
case 't':
if (fs_type) {
com_err(ProgramName, 0, "%s",
com_err(program_name, 0, "%s",
_("The -t option may only be used once"));
exit(1);
}
@@ -1878,7 +1878,7 @@ profile_error:
break;
case 'T':
if (usage_types) {
com_err(ProgramName, 0, "%s",
com_err(program_name, 0, "%s",
_("The -T option may only be used once"));
exit(1);
}
@@ -1933,13 +1933,13 @@ profile_error:
EXT2_FLAG_JOURNAL_DEV_OK, 0,
0, io_ptr, &jfs);
if (retval) {
com_err(ProgramName, retval,
com_err(program_name, retval,
_("while trying to open journal device %s\n"),
journal_device);
exit(1);
}
if ((blocksize < 0) && (jfs->blocksize < (unsigned) (-blocksize))) {
com_err(ProgramName, 0,
com_err(program_name, 0,
_("Journal dev blocksize (%d) smaller than "
"minimum blocksize %d\n"), jfs->blocksize,
-blocksize);
@@ -1956,7 +1956,7 @@ profile_error:
fs_blocks_count = parse_num_blocks2(argv[optind++],
fs_param.s_log_block_size);
if (!fs_blocks_count) {
com_err(ProgramName, 0,
com_err(program_name, 0,
_("invalid blocks '%s' on device '%s'"),
argv[optind - 1], device_name);
exit(1);
@@ -2008,20 +2008,20 @@ profile_error:
}
}
if (retval && (retval != EXT2_ET_UNIMPLEMENTED)) {
com_err(ProgramName, retval, "%s",
com_err(program_name, retval, "%s",
_("while trying to determine filesystem size"));
exit(1);
}
if (!fs_blocks_count) {
if (retval == EXT2_ET_UNIMPLEMENTED) {
com_err(ProgramName, 0, "%s",
com_err(program_name, 0, "%s",
_("Couldn't determine device size; you "
"must specify\nthe size of the "
"filesystem\n"));
exit(1);
} else {
if (dev_size == 0) {
com_err(ProgramName, 0, "%s",
com_err(program_name, 0, "%s",
_("Device size reported to be zero. "
"Invalid partition specified, or\n\t"
"partition table wasn't reread "
@@ -2038,7 +2038,7 @@ profile_error:
EXT2_BLOCK_SIZE(&fs_param))-1));
}
} else if (!force && is_device && (fs_blocks_count > dev_size)) {
com_err(ProgramName, 0, "%s",
com_err(program_name, 0, "%s",
_("Filesystem larger than apparent device size."));
proceed_question(proceed_delay);
}
@@ -2136,13 +2136,13 @@ profile_error:
/* Get the hardware sector sizes, if available */
retval = ext2fs_get_device_sectsize(device_name, &lsector_size);
if (retval) {
com_err(ProgramName, retval, "%s",
com_err(program_name, retval, "%s",
_("while trying to determine hardware sector size"));
exit(1);
}
retval = ext2fs_get_device_phys_sectsize(device_name, &psector_size);
if (retval) {
com_err(ProgramName, retval, "%s",
com_err(program_name, retval, "%s",
_("while trying to determine physical sector size"));
exit(1);
}
@@ -2174,7 +2174,7 @@ profile_error:
fs_blocks_count /= (blocksize / 1024);
} else {
if (blocksize < lsector_size) { /* Impossible */
com_err(ProgramName, EINVAL, "%s",
com_err(program_name, EINVAL, "%s",
_("while setting blocksize; too small "
"for device\n"));
exit(1);
@@ -2207,7 +2207,7 @@ profile_error:
fprintf(stderr, _("%s: Size of device (0x%llx blocks) %s "
"too big to be expressed\n\t"
"in 32 bits using a blocksize of %d.\n"),
ProgramName, (unsigned long long) fs_blocks_count,
program_name, (unsigned long long) fs_blocks_count,
device_name, EXT2_BLOCK_SIZE(&fs_param));
exit(1);
}
@@ -2221,7 +2221,7 @@ profile_error:
fprintf(stderr, _("%s: Size of device (0x%llx blocks) %s "
"too big to create\n\t"
"a filesystem using a blocksize of %d.\n"),
ProgramName, (unsigned long long) fs_blocks_count,
program_name, (unsigned long long) fs_blocks_count,
device_name, EXT2_BLOCK_SIZE(&fs_param));
exit(1);
}
@@ -2277,7 +2277,7 @@ profile_error:
reserved_ratio = get_double_from_profile(
fs_types, "reserved_ratio", 5.0);
if (reserved_ratio > 50 || reserved_ratio < 0) {
com_err(ProgramName, 0,
com_err(program_name, 0,
_("invalid reserved blocks percent - %lf"),
reserved_ratio);
exit(1);
@@ -2314,13 +2314,13 @@ profile_error:
int_log2(cluster_size >> EXT2_MIN_CLUSTER_LOG_SIZE);
if (fs_param.s_log_cluster_size &&
fs_param.s_log_cluster_size < fs_param.s_log_block_size) {
com_err(ProgramName, 0, "%s",
com_err(program_name, 0, "%s",
_("The cluster size may not be "
"smaller than the block size.\n"));
exit(1);
}
} else if (cluster_size) {
com_err(ProgramName, 0, "%s",
com_err(program_name, 0, "%s",
_("specifying a cluster size requires the "
"bigalloc feature"));
exit(1);
@@ -2384,7 +2384,7 @@ profile_error:
/* This check should happen beyond the last assignment to blocksize */
if (blocksize > sys_page_size) {
if (!force) {
com_err(ProgramName, 0,
com_err(program_name, 0,
_("%d-byte blocks too big for system (max %d)"),
blocksize, sys_page_size);
proceed_question(proceed_delay);
@@ -2442,7 +2442,7 @@ profile_error:
int encoding = e2p_str2encoding(en);
if (encoding < 0) {
com_err(ProgramName, 0,
com_err(program_name, 0,
_("Unknown filename encoding from profile: %s"),
en);
exit(1);
@@ -2453,7 +2453,7 @@ profile_error:
if (ef) {
if (e2p_str2encoding_flags(encoding, ef,
&fs_param.s_encoding_flags) < 0) {
com_err(ProgramName, 0,
com_err(program_name, 0,
_("Unknown encoding flags from profile: %s"), ef);
exit(1);
}
@@ -2493,7 +2493,7 @@ profile_error:
if (ext2fs_has_feature_project(&fs_param)) {
quotatype_bits |= QUOTA_PRJ_BIT;
if (inode_size == EXT2_GOOD_OLD_INODE_SIZE) {
com_err(ProgramName, 0,
com_err(program_name, 0,
_("%d byte inodes are too small for "
"project quota"),
inode_size);
@@ -2515,7 +2515,7 @@ profile_error:
/* Can't support bigalloc feature without extents feature */
if (ext2fs_has_feature_bigalloc(&fs_param) &&
!ext2fs_has_feature_extents(&fs_param)) {
com_err(ProgramName, 0, "%s",
com_err(program_name, 0, "%s",
_("Can't support bigalloc feature without "
"extents feature"));
exit(1);
@@ -2543,7 +2543,7 @@ profile_error:
*/
if (ext2fs_has_feature_resize_inode(&fs_param) &&
!ext2fs_has_feature_sparse_super(&fs_param)) {
com_err(ProgramName, 0, "%s",
com_err(program_name, 0, "%s",
_("reserved online resize blocks not supported "
"on non-sparse filesystem"));
exit(1);
@@ -2552,7 +2552,7 @@ profile_error:
if (fs_param.s_blocks_per_group) {
if (fs_param.s_blocks_per_group < 256 ||
fs_param.s_blocks_per_group > 8 * (unsigned) blocksize) {
com_err(ProgramName, 0, "%s",
com_err(program_name, 0, "%s",
_("blocks per group count out of range"));
exit(1);
}
@@ -2574,7 +2574,7 @@ profile_error:
"flex_bg_size", 16);
if (flex_bg_size) {
if (!ext2fs_has_feature_flex_bg(&fs_param)) {
com_err(ProgramName, 0, "%s",
com_err(program_name, 0, "%s",
_("Flex_bg feature not enabled, so "
"flex_bg size may not be specified"));
exit(1);
@@ -2586,7 +2586,7 @@ profile_error:
if (inode_size < EXT2_GOOD_OLD_INODE_SIZE ||
inode_size > EXT2_BLOCK_SIZE(&fs_param) ||
inode_size & (inode_size - 1)) {
com_err(ProgramName, 0,
com_err(program_name, 0,
_("invalid inode size %d (min %d/max %d)"),
inode_size, EXT2_GOOD_OLD_INODE_SIZE,
blocksize);
@@ -2601,7 +2601,7 @@ profile_error:
*/
if (ext2fs_has_feature_inline_data(&fs_param) &&
fs_param.s_inode_size == EXT2_GOOD_OLD_INODE_SIZE) {
com_err(ProgramName, 0,
com_err(program_name, 0,
_("%d byte inodes are too small for inline data; "
"specify larger size"),
fs_param.s_inode_size);
@@ -2627,7 +2627,7 @@ _("128-byte inodes cannot handle dates beyond 2038 and are deprecated\n"));
if (ext2fs_has_feature_64bit(&fs_param))
num_inodes = MAX_32_NUM;
else {
com_err(ProgramName, 0,
com_err(program_name, 0,
_("too many inodes (%llu), raise "
"inode ratio?"),
(unsigned long long) n);
@@ -2635,7 +2635,7 @@ _("128-byte inodes cannot handle dates beyond 2038 and are deprecated\n"));
}
}
} else if (num_inodes > MAX_32_NUM) {
com_err(ProgramName, 0,
com_err(program_name, 0,
_("too many inodes (%llu), specify < 2^32 inodes"),
(unsigned long long) num_inodes);
exit(1);
@@ -2650,7 +2650,7 @@ _("128-byte inodes cannot handle dates beyond 2038 and are deprecated\n"));
(inode_size ? inode_size : EXT2_GOOD_OLD_INODE_SIZE)) >=
((ext2fs_blocks_count(&fs_param)) *
EXT2_BLOCK_SIZE(&fs_param))) {
com_err(ProgramName, 0, _("inode_size (%u) * inodes_count "
com_err(program_name, 0, _("inode_size (%u) * inodes_count "
"(%u) too big for a\n\t"
"filesystem with %llu blocks, "
"specify higher inode_ratio (-i)\n\t"
@@ -2795,7 +2795,7 @@ static int mke2fs_setup_tdb(const char *name, io_manager *io_ptr)
if ((unlink(tdb_file) < 0) && (errno != ENOENT)) {
retval = errno;
com_err(ProgramName, retval,
com_err(program_name, retval,
_("while trying to delete %s"), tdb_file);
goto errout;
}
@@ -2821,7 +2821,7 @@ errout:
free(tdb_dir);
free(tdb_file);
err:
com_err(ProgramName, retval, "%s",
com_err(program_name, retval, "%s",
_("while trying to setup undo file\n"));
return retval;
}
@@ -2921,14 +2921,14 @@ static int create_quota_inodes(ext2_filsys fs)
retval = quota_init_context(&qctx, fs, quotatype_bits);
if (retval) {
com_err(ProgramName, retval,
com_err(program_name, retval,
_("while initializing quota context"));
exit(1);
}
quota_compute_usage(qctx);
retval = quota_write_inode(qctx, quotatype_bits);
if (retval) {
com_err(ProgramName, retval,
com_err(program_name, retval,
_("while writing quota inodes"));
exit(1);
}
@@ -2953,7 +2953,7 @@ static errcode_t set_error_behavior(ext2_filsys fs)
else if (strcmp(arg, "panic") == 0)
errors = EXT2_ERRORS_PANIC;
else {
com_err(ProgramName, 0,
com_err(program_name, 0,
_("bad error behavior in profile - %s"),
arg);
free(arg);
@@ -3033,7 +3033,7 @@ int mke2fs_main (int argc, char *argv[])
char *android_sparse_params = malloc(strlen(device_name) + 48);
if (!android_sparse_params) {
com_err(ProgramName, ENOMEM, "%s",
com_err(program_name, ENOMEM, "%s",
_("in malloc for android_sparse_params"));
exit(1);
}
@@ -3202,7 +3202,7 @@ int mke2fs_main (int argc, char *argv[])
* Override the creator OS, if applicable
*/
if (creator_os && !set_os(fs->super, creator_os)) {
com_err (ProgramName, 0, _("unknown os - %s"), creator_os);
com_err (program_name, 0, _("unknown os - %s"), creator_os);
exit(1);
}
@@ -3272,7 +3272,7 @@ int mke2fs_main (int argc, char *argv[])
else
retval = ext2fs_allocate_tables(fs);
if (retval) {
com_err(ProgramName, retval, "%s",
com_err(program_name, retval, "%s",
_("while trying to allocate filesystem tables"));
exit(1);
}
@@ -3298,7 +3298,7 @@ int mke2fs_main (int argc, char *argv[])
retval = ext2fs_convert_subcluster_bitmap(fs, &fs->block_map);
if (retval) {
com_err(ProgramName, retval, "%s",
com_err(program_name, retval, "%s",
_("\n\twhile converting subcluster bitmap"));
exit(1);
}
@@ -3307,7 +3307,7 @@ int mke2fs_main (int argc, char *argv[])
ext2fs_blocks_count(fs->super) - 1,
&overhead);
if (retval) {
com_err(ProgramName, retval, "%s",
com_err(program_name, retval, "%s",
_("while calculating overhead"));
exit(1);
}
@@ -3367,7 +3367,7 @@ int mke2fs_main (int argc, char *argv[])
&ret_blk, NULL);
if (retval) {
com_err(ProgramName, retval,
com_err(program_name, retval,
_("while zeroing block %llu at end of filesystem"),
(unsigned long long) ret_blk);
}
@@ -3399,7 +3399,7 @@ int mke2fs_main (int argc, char *argv[])
EXT2_FLAG_JOURNAL_DEV_OK, 0,
fs->blocksize, default_io_manager, &jfs);
if (retval) {
com_err(ProgramName, retval,
com_err(program_name, retval,
_("while trying to open journal device %s\n"),
journal_device);
exit(1);
@@ -3411,7 +3411,7 @@ int mke2fs_main (int argc, char *argv[])
}
retval = ext2fs_add_journal_device(fs, jfs);
if(retval) {
com_err (ProgramName, retval,
com_err (program_name, retval,
_("\n\twhile trying to add journal to device %s"),
journal_device);
exit(1);
@@ -3442,7 +3442,7 @@ int mke2fs_main (int argc, char *argv[])
journal_location,
journal_flags);
if (retval) {
com_err(ProgramName, retval, "%s",
com_err(program_name, retval, "%s",
_("\n\twhile trying to create journal"));
exit(1);
}
@@ -3476,7 +3476,7 @@ no_journal:
retval = mk_hugefiles(fs, device_name);
if (retval)
com_err(ProgramName, retval, "while creating huge files");
com_err(program_name, retval, "while creating huge files");
/* Copy files from the specified directory */
if (src_root_dir) {
if (!quiet)
@@ -3485,7 +3485,7 @@ no_journal:
retval = populate_fs(fs, EXT2_ROOT_INO, src_root_dir,
EXT2_ROOT_INO);
if (retval) {
com_err(ProgramName, retval, "%s",
com_err(program_name, retval, "%s",
_("while populating file system"));
exit(1);
} else if (!quiet)
@@ -3499,7 +3499,7 @@ no_journal:
max_mnt_count = fs->super->s_max_mnt_count;
retval = ext2fs_close_free(&fs);
if (retval) {
com_err(ProgramName, retval, "%s",
com_err(program_name, retval, "%s",
_("while writing out and closing file system"));
retval = 1;
} else if (!quiet) {