optset_parse: Add support for 64bit values
This is needed to fix blocktest for dev_t = 64bit. Change-Id: I713e92aaa9a7a0755e212048817fa0f3e6dfe258
This commit is contained in:
parent
900a0b90b9
commit
2a4c46db59
|
|
@ -4,6 +4,7 @@
|
||||||
typedef enum {
|
typedef enum {
|
||||||
OPT_BOOL,
|
OPT_BOOL,
|
||||||
OPT_STRING,
|
OPT_STRING,
|
||||||
|
OPT_64INT,
|
||||||
OPT_INT
|
OPT_INT
|
||||||
} optset_type;
|
} optset_type;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@ int len;
|
||||||
*/
|
*/
|
||||||
char *dst;
|
char *dst;
|
||||||
int val;
|
int val;
|
||||||
|
int64_t val64;
|
||||||
|
|
||||||
switch (entry->os_type) {
|
switch (entry->os_type) {
|
||||||
case OPT_BOOL:
|
case OPT_BOOL:
|
||||||
|
|
@ -52,6 +53,15 @@ int len;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case OPT_64INT:
|
||||||
|
if (len > 0)
|
||||||
|
val64 = (uint64_t) strtoull(ptr, NULL, entry->os_val);
|
||||||
|
else
|
||||||
|
val64 = 0;
|
||||||
|
|
||||||
|
*((uint64_t *) entry->os_ptr) = val64;
|
||||||
|
|
||||||
|
break;
|
||||||
case OPT_INT:
|
case OPT_INT:
|
||||||
if (len > 0)
|
if (len > 0)
|
||||||
val = (int) strtoul(ptr, NULL, entry->os_val);
|
val = (int) strtoul(ptr, NULL, entry->os_val);
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ static int driver_deaths = 0; /* number of restarts that we saw */
|
||||||
/* Options supported by this driver. */
|
/* Options supported by this driver. */
|
||||||
static struct optset optset_table[] = {
|
static struct optset optset_table[] = {
|
||||||
{ "label", OPT_STRING, driver_label, sizeof(driver_label) },
|
{ "label", OPT_STRING, driver_label, sizeof(driver_label) },
|
||||||
{ "minor", OPT_INT, &driver_minor, 10 },
|
{ "minor", OPT_64INT, &driver_minor, 10 },
|
||||||
{ "rw", OPT_BOOL, &may_write, TRUE },
|
{ "rw", OPT_BOOL, &may_write, TRUE },
|
||||||
{ "ro", OPT_BOOL, &may_write, FALSE },
|
{ "ro", OPT_BOOL, &may_write, FALSE },
|
||||||
{ "sector", OPT_INT, §or_size, 10 },
|
{ "sector", OPT_INT, §or_size, 10 },
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user