Skip to content

Commit 67cbf16

Browse files
committed
Remove unused mountpoint support
Signed-off-by: Jo-Philipp Wich <[email protected]>
1 parent e97166f commit 67cbf16

File tree

3 files changed

+13
-23
lines changed

3 files changed

+13
-23
lines changed

ext4_utils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ typedef int (*fs_config_func_t)(const char *path, int dir, unsigned *uid, unsign
156156
struct selabel_handle;
157157

158158
int make_ext4fs_internal(int fd, const char *directory,
159-
const char *mountpoint, fs_config_func_t fs_config_func, int gzip,
159+
fs_config_func_t fs_config_func, int gzip,
160160
int sparse, int crc, int wipe,
161161
int verbose, time_t fixed_time,
162162
FILE* block_list_file);

make_ext4fs.c

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -372,28 +372,24 @@ static char *canonicalize_rel_slashes(const char *str)
372372
}
373373

374374
int make_ext4fs_internal(int fd, const char *_directory,
375-
const char *_mountpoint, fs_config_func_t fs_config_func, int gzip,
375+
fs_config_func_t fs_config_func, int gzip,
376376
int sparse, int crc, int wipe,
377377
int verbose, time_t fixed_time,
378378
FILE* block_list_file)
379379
{
380380
u32 root_inode_num;
381381
u16 root_mode;
382-
char *mountpoint;
383382
char *directory = NULL;
384383

385384
if (setjmp(setjmp_env))
386385
return EXIT_FAILURE; /* Handle a call to longjmp() */
387386

388-
if (_mountpoint == NULL) {
389-
mountpoint = strdup("");
390-
} else {
391-
mountpoint = canonicalize_abs_slashes(_mountpoint);
387+
if (_directory == NULL) {
388+
fprintf(stderr, "Need a source directory\n");
389+
return EXIT_FAILURE;
392390
}
393391

394-
if (_directory) {
395-
directory = canonicalize_rel_slashes(_directory);
396-
}
392+
directory = canonicalize_rel_slashes(_directory);
397393

398394
if (info.len <= 0)
399395
info.len = get_file_size(fd);
@@ -477,11 +473,8 @@ int make_ext4fs_internal(int fd, const char *_directory,
477473
if (info.feat_compat & EXT4_FEATURE_COMPAT_RESIZE_INODE)
478474
ext4_create_resize_inode();
479475

480-
if (directory)
481-
root_inode_num = build_directory_structure(directory, mountpoint, 0,
482-
fs_config_func, verbose, fixed_time);
483-
else
484-
root_inode_num = build_default_directory_structure(mountpoint);
476+
root_inode_num = build_directory_structure(directory, "", 0,
477+
fs_config_func, verbose, fixed_time);
485478

486479
root_mode = S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH;
487480
inode_set_permissions(root_inode_num, root_mode, 0, 0, 0);
@@ -491,12 +484,11 @@ int make_ext4fs_internal(int fd, const char *_directory,
491484
ext4_queue_sb();
492485

493486
if (block_list_file) {
494-
size_t dirlen = directory ? strlen(directory) : 0;
487+
size_t dirlen = strlen(directory);
495488
struct block_allocation* p = get_saved_allocation_chain();
496489
while (p) {
497-
if (directory && strncmp(p->filename, directory, dirlen) == 0) {
498-
// substitute mountpoint for the leading directory in the filename, in the output file
499-
fprintf(block_list_file, "%s%s", mountpoint, p->filename + dirlen);
490+
if (strncmp(p->filename, directory, dirlen) == 0) {
491+
fprintf(block_list_file, "%s", p->filename + dirlen);
500492
} else {
501493
fprintf(block_list_file, "%s", p->filename);
502494
}
@@ -522,7 +514,6 @@ int make_ext4fs_internal(int fd, const char *_directory,
522514
sparse_file_destroy(ext4_sparse_file);
523515
ext4_sparse_file = NULL;
524516

525-
free(mountpoint);
526517
free(directory);
527518

528519
return 0;

make_ext4fs_main.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ static void usage(char *path)
3535
{
3636
fprintf(stderr, "%s [ -l <len> ] [ -j <journal size> ] [ -b <block_size> ]\n", basename(path));
3737
fprintf(stderr, " [ -g <blocks per group> ] [ -i <inodes> ] [ -I <inode size> ]\n");
38-
fprintf(stderr, " [ -L <label> ] [ -f ] [ -a <android mountpoint> ]\n");
38+
fprintf(stderr, " [ -L <label> ] [ -f ]\n");
3939
fprintf(stderr, " [ -S file_contexts ] [ -C fs_config ] [ -T timestamp ]\n");
4040
fprintf(stderr, " [ -z | -s ] [ -w ] [ -c ] [ -J ] [ -v ] [ -B <block_list_file> ]\n");
4141
fprintf(stderr, " <filename> [<directory>]\n");
@@ -46,7 +46,6 @@ int main(int argc, char **argv)
4646
int opt;
4747
const char *filename = NULL;
4848
const char *directory = NULL;
49-
char *mountpoint = NULL;
5049
fs_config_func_t fs_config_func = NULL;
5150
const char *fs_config_file = NULL;
5251
int gzip = 0;
@@ -172,7 +171,7 @@ int main(int argc, char **argv)
172171
fd = STDOUT_FILENO;
173172
}
174173

175-
exitcode = make_ext4fs_internal(fd, directory, mountpoint, fs_config_func, gzip,
174+
exitcode = make_ext4fs_internal(fd, directory, fs_config_func, gzip,
176175
sparse, crc, wipe, verbose, fixed_time, block_list_file);
177176
close(fd);
178177
if (block_list_file)

0 commit comments

Comments
 (0)