return (const char *)CONFIG_ENV_EXT4_DEVICE_AND_PART;
}
-static int env_ext4_save(void)
+static int env_ext4_save_buffer(env_t *env_new)
{
- env_t env_new;
struct blk_desc *dev_desc = NULL;
struct disk_partition info;
int dev, part;
const char *ifname = env_ext4_get_intf();
const char *dev_and_part = env_ext4_get_dev_part();
- err = env_export(&env_new);
- if (err)
- return err;
-
part = blk_get_device_part_str(ifname, dev_and_part,
&dev_desc, &info, 1);
if (part < 0)
return 1;
}
- err = ext4fs_write(CONFIG_ENV_EXT4_FILE, (void *)&env_new,
+ err = ext4fs_write(CONFIG_ENV_EXT4_FILE, (void *)env_new,
sizeof(env_t), FILETYPE_REG);
ext4fs_close();
CONFIG_ENV_EXT4_FILE, ifname, dev, part);
return 1;
}
- gd->env_valid = ENV_VALID;
+ return 0;
+}
+
+static int env_ext4_save(void)
+{
+ env_t env_new;
+ int err;
+
+ err = env_export(&env_new);
+ if (err)
+ return err;
+
+ err = env_ext4_save_buffer(&env_new);
+ if (err)
+ return err;
+
+ gd->env_valid = ENV_VALID;
puts("done\n");
+
return 0;
}