Change the format command to always take the mount point as an argument.
Requires I5a63fd61a7e74d386d0803946d06bcf2fa8a857e Change-Id: Ica5fb73d6f2ffb981b74d1896538988dbc4d9b24
This commit is contained in:
parent
155cd3c155
commit
516e4e2372
1 changed files with 4 additions and 13 deletions
|
@ -200,27 +200,20 @@ done:
|
||||||
// if fs_size == 0, then make_ext4fs uses the entire partition.
|
// if fs_size == 0, then make_ext4fs uses the entire partition.
|
||||||
// if fs_size > 0, that is the size to use
|
// if fs_size > 0, that is the size to use
|
||||||
// if fs_size < 0, then reserve that many bytes at the end of the partition
|
// if fs_size < 0, then reserve that many bytes at the end of the partition
|
||||||
// mount_point is used with SELinux as the location of the mount point, absent otherwise
|
|
||||||
Value* FormatFn(const char* name, State* state, int argc, Expr* argv[]) {
|
Value* FormatFn(const char* name, State* state, int argc, Expr* argv[]) {
|
||||||
char* result = NULL;
|
char* result = NULL;
|
||||||
if (argc != 4 && argc != 5) {
|
if (argc != 5) {
|
||||||
return ErrorAbort(state, "%s() expects 4 or 5 args, got %d", name, argc);
|
return ErrorAbort(state, "%s() expects 5 args, got %d", name, argc);
|
||||||
}
|
}
|
||||||
char* fs_type;
|
char* fs_type;
|
||||||
char* partition_type;
|
char* partition_type;
|
||||||
char* location;
|
char* location;
|
||||||
char* fs_size;
|
char* fs_size;
|
||||||
char* mount_point = NULL;
|
char* mount_point;
|
||||||
|
|
||||||
#ifdef HAVE_SELINUX
|
|
||||||
if (ReadArgs(state, argv, 5, &fs_type, &partition_type, &location, &fs_size, &mount_point) < 0) {
|
if (ReadArgs(state, argv, 5, &fs_type, &partition_type, &location, &fs_size, &mount_point) < 0) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
if (ReadArgs(state, argv, 4, &fs_type, &partition_type, &location, &fs_size) < 0) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (strlen(fs_type) == 0) {
|
if (strlen(fs_type) == 0) {
|
||||||
ErrorAbort(state, "fs_type argument to %s() can't be empty", name);
|
ErrorAbort(state, "fs_type argument to %s() can't be empty", name);
|
||||||
|
@ -236,12 +229,10 @@ Value* FormatFn(const char* name, State* state, int argc, Expr* argv[]) {
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_SELINUX
|
if (strlen(mount_point) == 0) {
|
||||||
if (!mount_point || strlen(mount_point) == 0) {
|
|
||||||
ErrorAbort(state, "mount_point argument to %s() can't be empty", name);
|
ErrorAbort(state, "mount_point argument to %s() can't be empty", name);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
if (strcmp(partition_type, "MTD") == 0) {
|
if (strcmp(partition_type, "MTD") == 0) {
|
||||||
mtd_scan_partitions();
|
mtd_scan_partitions();
|
||||||
|
|
Loading…
Reference in a new issue