-
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,7 @@ | |
|
||
static struct rmtfs_mem *rmem; | ||
static sig_atomic_t sig_int_count; | ||
static char slot_suffix[SLOT_SUFFIX_LEN]; | ||
|
||
static bool dbgprintf_enabled; | ||
static void dbgprintf(const char *fmt, ...) | ||
|
@@ -69,7 +70,7 @@ static void rmtfs_open(int sock, const struct qrtr_packet *pkt) | |
goto respond; | ||
} | ||
|
||
rmtfd = storage_open(pkt->node, req.path); | ||
rmtfd = storage_open(pkt->node, req.path, slot_suffix); | ||
if (!rmtfd) { | ||
qmi_result_error(&resp.result, QMI_RMTFS_ERR_INTERNAL); | ||
goto respond; | ||
|
@@ -504,7 +505,7 @@ int main(int argc, char **argv) | |
int option; | ||
const char *storage_root = NULL; | ||
|
||
while ((option = getopt(argc, argv, "o:Prsv")) != -1) { | ||
while ((option = getopt(argc, argv, "oS:Prsv")) != -1) { | ||
switch (option) { | ||
/* | ||
* -o sets the directory where EFS images are stored, | ||
|
@@ -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 commentThe 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 commentThe 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 |
||
fprintf(stderr, "Couldn't parse slot name (too long?)\n"); | ||
return -1; | ||
} | ||
|
||
ret = snprintf(slot_suffix, SLOT_SUFFIX_LEN, "_%s", optarg); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
if (ret != SLOT_SUFFIX_LEN - 1) | ||
return -1; | ||
|
||
dbgprintf("Using slot %s\n", slot_suffix); | ||
break; | ||
|
||
/* -v is for verbose */ | ||
case 'v': | ||
dbgprintf_enabled = 1; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. Should not be necessary. |
||
struct rmtfd *storage_open(unsigned node, const char *path, const char *slot_suffix); | ||
struct rmtfd *storage_get(unsigned node, int caller_id); | ||
void storage_close(struct rmtfd *rmtfd); | ||
int storage_get_caller_id(const struct rmtfd *rmtfd); | ||
|
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