-
Notifications
You must be signed in to change notification settings - Fork 27
storage: Try opening the slot-suffixed partition #27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Some devices ship 2 copies of remote partitions (see e.g. linux-msm#22), which the current code can't cope with. Add parsing of a slot suffix (via '-S', single character) and if passed, retry opening partition (via a partlabel) with it. Signed-off-by: Konrad Dybcio <[email protected]>
0fc30d9
to
2ee01bf
Compare
@@ -26,7 +26,8 @@ ssize_t rmtfs_mem_write(struct rmtfs_mem *rmem, unsigned long phys_address, cons | |||
struct rmtfd; | |||
|
|||
int storage_init(const char *storage_root, bool read_only, bool use_partitions); | |||
struct rmtfd *storage_open(unsigned node, const char *path); | |||
#define SLOT_SUFFIX_LEN (2 + 1) /* "_a" or "_b", null-terminated */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should not be necessary.
@@ -535,6 +536,20 @@ int main(int argc, char **argv) | |||
|
|||
break; | |||
|
|||
/* Partlabel slot suffix on A/B devices */ | |||
case 'S': | |||
if (strnlen(optarg, 1 + 1) != 1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd say, let users pass the complete suffix, like '_a', '_b', '_some_user_idea', etc. There is no need to limit it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer to limit it to what Android expects.. otherwise we'll have to make up for it in all of our other software as well
return -1; | ||
} | ||
|
||
ret = snprintf(slot_suffix, SLOT_SUFFIX_LEN, "_%s", optarg); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
asnprintf
is your friend if you insist
@@ -27,6 +27,7 @@ | |||
|
|||
static struct rmtfs_mem *rmem; | |||
static sig_atomic_t sig_int_count; | |||
static char slot_suffix[SLOT_SUFFIX_LEN]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
char *
would be a better fit. Not need to be len-picky.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found it neater not to sprinkle free
/goto
s all over the program
Some devices ship 2 copies of remote partitions (see e.g. #22), which the current code can't cope with.
Add parsing of a slot suffix (via '-S', single character) and if passed, retry opening partition (via a partlabel) with it.