_min1 < _min2 ? _min1 : _min2; })
struct envdev_s {
- char devname[16]; /* Device name */
+ const char *devname; /* Device name */
ulong devoff; /* Device offset */
ulong env_size; /* environment size */
ulong erase_size; /* device erase size */
return -1;
}
#else
- strcpy (DEVNAME (0), DEVICE1_NAME);
+ DEVNAME (0) = DEVICE1_NAME;
DEVOFFSET (0) = DEVICE1_OFFSET;
ENVSIZE (0) = ENV1_SIZE;
/* Default values are: erase-size=env-size */
#endif
#ifdef HAVE_REDUND
- strcpy (DEVNAME (1), DEVICE2_NAME);
+ DEVNAME (1) = DEVICE2_NAME;
DEVOFFSET (1) = DEVICE2_OFFSET;
ENVSIZE (1) = ENV2_SIZE;
/* Default values are: erase-size=env-size */
int i = 0;
int rc;
char dump[128];
+ char *devname;
fp = fopen (fname, "r");
if (fp == NULL)
if (dump[0] == '#')
continue;
- rc = sscanf (dump, "%s %lx %lx %lx %lx",
- DEVNAME (i),
+ rc = sscanf (dump, "%ms %lx %lx %lx %lx",
+ &devname,
&DEVOFFSET (i),
&ENVSIZE (i),
&DEVESIZE (i),
if (rc < 3)
continue;
+ DEVNAME(i) = devname;
+
if (rc < 4)
/* Assume the erase size is the same as the env-size */
DEVESIZE(i) = ENVSIZE(i);