summaryrefslogtreecommitdiffstats
path: root/external/common
diff options
context:
space:
mode:
authorCyril Bur <cyril.bur@au1.ibm.com>2016-01-04 13:23:07 +1100
committerStewart Smith <stewart@linux.vnet.ibm.com>2016-01-15 15:04:57 +1100
commit6b53f9241cf4d044d0f0f756f4a8c9f4c55f0140 (patch)
treedb7699c82d90abd49867f462c3dd306449b46298 /external/common
parentb25529d182b53be0b760638c812c422b794546e4 (diff)
downloadtalos-skiboot-6b53f9241cf4d044d0f0f756f4a8c9f4c55f0140.tar.gz
talos-skiboot-6b53f9241cf4d044d0f0f756f4a8c9f4c55f0140.zip
libflash/blocklevel: Add keep_alive parameter
Currently the file backend will keep a file descriptor open until the structure is destroyed. This is undesirable for daemons and long running processes that only have a very occasional need to access the file. Keeping the file open requires users of blocklevel to close and reinit their structures every time, doing is isn't disastrous but can easily be managed at the interface level. This has been done at the blocklevel_device interface so as to provide minimal changes to arch_flash_init(). At the moment there isn't a need for the actually flash driver to be able to do this, this remains unimplmented there. Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'external/common')
-rw-r--r--external/common/arch_flash.h3
-rw-r--r--external/common/arch_flash_arm.c4
-rw-r--r--external/common/arch_flash_powerpc.c8
-rw-r--r--external/common/arch_flash_x86.c4
4 files changed, 10 insertions, 9 deletions
diff --git a/external/common/arch_flash.h b/external/common/arch_flash.h
index 60c4de8e..918ffa92 100644
--- a/external/common/arch_flash.h
+++ b/external/common/arch_flash.h
@@ -20,7 +20,8 @@
#include <getopt.h>
#include <libflash/blocklevel.h>
-int arch_flash_init(struct blocklevel_device **bl, const char *file);
+int arch_flash_init(struct blocklevel_device **bl, const char *file,
+ bool keep_alive);
void arch_flash_close(struct blocklevel_device *bl, const char *file);
diff --git a/external/common/arch_flash_arm.c b/external/common/arch_flash_arm.c
index 13d29465..f65bddc2 100644
--- a/external/common/arch_flash_arm.c
+++ b/external/common/arch_flash_arm.c
@@ -263,7 +263,7 @@ int arch_flash_set_wrprotect(struct blocklevel_device *bl, int set)
return set_wrprotect(set);
}
-int arch_flash_init(struct blocklevel_device **r_bl, const char *file)
+int arch_flash_init(struct blocklevel_device **r_bl, const char *file, bool keep_alive)
{
struct blocklevel_device *new_bl;
@@ -272,7 +272,7 @@ int arch_flash_init(struct blocklevel_device **r_bl, const char *file)
return -1;
if (file) {
- file_init_path(file, NULL, &new_bl);
+ file_init_path(file, NULL, keep_alive, &new_bl);
} else {
new_bl = flash_setup(arch_data.bmc);
}
diff --git a/external/common/arch_flash_powerpc.c b/external/common/arch_flash_powerpc.c
index 93eaceea..19dfec8c 100644
--- a/external/common/arch_flash_powerpc.c
+++ b/external/common/arch_flash_powerpc.c
@@ -188,7 +188,7 @@ static int get_dev_mtd(const char *fdt_flash_path, char **mtd_path)
return done ? rc : -1;
}
-static struct blocklevel_device *arch_init_blocklevel(const char *file)
+static struct blocklevel_device *arch_init_blocklevel(const char *file, bool keep_alive)
{
int rc;
struct blocklevel_device *new_bl = NULL;
@@ -200,7 +200,7 @@ static struct blocklevel_device *arch_init_blocklevel(const char *file)
return NULL;
}
- file_init_path(file ? file : real_file, NULL, &new_bl);
+ file_init_path(file ? file : real_file, NULL, keep_alive, &new_bl);
free(real_file);
return new_bl;
}
@@ -211,11 +211,11 @@ int arch_flash_set_wrprotect(struct blocklevel_device *bl, int set)
return 0;
}
-int arch_flash_init(struct blocklevel_device **r_bl, const char *file)
+int arch_flash_init(struct blocklevel_device **r_bl, const char *file, bool keep_alive)
{
struct blocklevel_device *new_bl;
- new_bl = arch_init_blocklevel(file);
+ new_bl = arch_init_blocklevel(file, keep_alive);
if (!new_bl)
return -1;
diff --git a/external/common/arch_flash_x86.c b/external/common/arch_flash_x86.c
index 29c0229e..3be05dfc 100644
--- a/external/common/arch_flash_x86.c
+++ b/external/common/arch_flash_x86.c
@@ -28,7 +28,7 @@
#include "arch_flash.h"
-int arch_flash_init(struct blocklevel_device **r_bl, const char *file)
+int arch_flash_init(struct blocklevel_device **r_bl, const char *file, bool keep_alive)
{
struct blocklevel_device *new_bl;
@@ -38,7 +38,7 @@ int arch_flash_init(struct blocklevel_device **r_bl, const char *file)
return -1;
}
- file_init_path(file, NULL, &new_bl);
+ file_init_path(file, NULL, keep_alive, &new_bl);
if (!new_bl)
return -1;
OpenPOWER on IntegriCloud