Remove unused mountpoint support

Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
This commit is contained in:
Jo-Philipp Wich 2015-04-08 07:05:14 +02:00
parent e97166fc4a
commit 67cbf164c7
3 changed files with 13 additions and 23 deletions

View File

@ -156,7 +156,7 @@ typedef int (*fs_config_func_t)(const char *path, int dir, unsigned *uid, unsign
struct selabel_handle; struct selabel_handle;
int make_ext4fs_internal(int fd, const char *directory, int make_ext4fs_internal(int fd, const char *directory,
const char *mountpoint, fs_config_func_t fs_config_func, int gzip, fs_config_func_t fs_config_func, int gzip,
int sparse, int crc, int wipe, int sparse, int crc, int wipe,
int verbose, time_t fixed_time, int verbose, time_t fixed_time,
FILE* block_list_file); FILE* block_list_file);

View File

@ -372,28 +372,24 @@ static char *canonicalize_rel_slashes(const char *str)
} }
int make_ext4fs_internal(int fd, const char *_directory, int make_ext4fs_internal(int fd, const char *_directory,
const char *_mountpoint, fs_config_func_t fs_config_func, int gzip, fs_config_func_t fs_config_func, int gzip,
int sparse, int crc, int wipe, int sparse, int crc, int wipe,
int verbose, time_t fixed_time, int verbose, time_t fixed_time,
FILE* block_list_file) FILE* block_list_file)
{ {
u32 root_inode_num; u32 root_inode_num;
u16 root_mode; u16 root_mode;
char *mountpoint;
char *directory = NULL; char *directory = NULL;
if (setjmp(setjmp_env)) if (setjmp(setjmp_env))
return EXIT_FAILURE; /* Handle a call to longjmp() */ return EXIT_FAILURE; /* Handle a call to longjmp() */
if (_mountpoint == NULL) { if (_directory == NULL) {
mountpoint = strdup(""); fprintf(stderr, "Need a source directory\n");
} else { return EXIT_FAILURE;
mountpoint = canonicalize_abs_slashes(_mountpoint);
} }
if (_directory) { directory = canonicalize_rel_slashes(_directory);
directory = canonicalize_rel_slashes(_directory);
}
if (info.len <= 0) if (info.len <= 0)
info.len = get_file_size(fd); info.len = get_file_size(fd);
@ -477,11 +473,8 @@ int make_ext4fs_internal(int fd, const char *_directory,
if (info.feat_compat & EXT4_FEATURE_COMPAT_RESIZE_INODE) if (info.feat_compat & EXT4_FEATURE_COMPAT_RESIZE_INODE)
ext4_create_resize_inode(); ext4_create_resize_inode();
if (directory) root_inode_num = build_directory_structure(directory, "", 0,
root_inode_num = build_directory_structure(directory, mountpoint, 0, fs_config_func, verbose, fixed_time);
fs_config_func, verbose, fixed_time);
else
root_inode_num = build_default_directory_structure(mountpoint);
root_mode = S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH; root_mode = S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH;
inode_set_permissions(root_inode_num, root_mode, 0, 0, 0); inode_set_permissions(root_inode_num, root_mode, 0, 0, 0);
@ -491,12 +484,11 @@ int make_ext4fs_internal(int fd, const char *_directory,
ext4_queue_sb(); ext4_queue_sb();
if (block_list_file) { if (block_list_file) {
size_t dirlen = directory ? strlen(directory) : 0; size_t dirlen = strlen(directory);
struct block_allocation* p = get_saved_allocation_chain(); struct block_allocation* p = get_saved_allocation_chain();
while (p) { while (p) {
if (directory && strncmp(p->filename, directory, dirlen) == 0) { if (strncmp(p->filename, directory, dirlen) == 0) {
// substitute mountpoint for the leading directory in the filename, in the output file fprintf(block_list_file, "%s", p->filename + dirlen);
fprintf(block_list_file, "%s%s", mountpoint, p->filename + dirlen);
} else { } else {
fprintf(block_list_file, "%s", p->filename); fprintf(block_list_file, "%s", p->filename);
} }
@ -522,7 +514,6 @@ int make_ext4fs_internal(int fd, const char *_directory,
sparse_file_destroy(ext4_sparse_file); sparse_file_destroy(ext4_sparse_file);
ext4_sparse_file = NULL; ext4_sparse_file = NULL;
free(mountpoint);
free(directory); free(directory);
return 0; return 0;

View File

@ -35,7 +35,7 @@ static void usage(char *path)
{ {
fprintf(stderr, "%s [ -l <len> ] [ -j <journal size> ] [ -b <block_size> ]\n", basename(path)); fprintf(stderr, "%s [ -l <len> ] [ -j <journal size> ] [ -b <block_size> ]\n", basename(path));
fprintf(stderr, " [ -g <blocks per group> ] [ -i <inodes> ] [ -I <inode size> ]\n"); fprintf(stderr, " [ -g <blocks per group> ] [ -i <inodes> ] [ -I <inode size> ]\n");
fprintf(stderr, " [ -L <label> ] [ -f ] [ -a <android mountpoint> ]\n"); fprintf(stderr, " [ -L <label> ] [ -f ]\n");
fprintf(stderr, " [ -S file_contexts ] [ -C fs_config ] [ -T timestamp ]\n"); fprintf(stderr, " [ -S file_contexts ] [ -C fs_config ] [ -T timestamp ]\n");
fprintf(stderr, " [ -z | -s ] [ -w ] [ -c ] [ -J ] [ -v ] [ -B <block_list_file> ]\n"); fprintf(stderr, " [ -z | -s ] [ -w ] [ -c ] [ -J ] [ -v ] [ -B <block_list_file> ]\n");
fprintf(stderr, " <filename> [<directory>]\n"); fprintf(stderr, " <filename> [<directory>]\n");
@ -46,7 +46,6 @@ int main(int argc, char **argv)
int opt; int opt;
const char *filename = NULL; const char *filename = NULL;
const char *directory = NULL; const char *directory = NULL;
char *mountpoint = NULL;
fs_config_func_t fs_config_func = NULL; fs_config_func_t fs_config_func = NULL;
const char *fs_config_file = NULL; const char *fs_config_file = NULL;
int gzip = 0; int gzip = 0;
@ -172,7 +171,7 @@ int main(int argc, char **argv)
fd = STDOUT_FILENO; fd = STDOUT_FILENO;
} }
exitcode = make_ext4fs_internal(fd, directory, mountpoint, fs_config_func, gzip, exitcode = make_ext4fs_internal(fd, directory, fs_config_func, gzip,
sparse, crc, wipe, verbose, fixed_time, block_list_file); sparse, crc, wipe, verbose, fixed_time, block_list_file);
close(fd); close(fd);
if (block_list_file) if (block_list_file)