| In Chromium OS, sysroot is mounted read-only, but iscsid keeps the idbm |
| database in /etc/iscsi, so scanning and adding nodes and targets fails. This |
| patch allows to change the root of the idbm database during compile time with |
| a -DISCSI_IDBM_ROOT preprocessor directive. |
| |
| Fix by Victor Dodon <printesoi@chromium.org> |
| --- a/usr/idbm.c |
| +++ b/usr/idbm.c |
| @@ -2468,9 +2468,9 @@ free_info: |
| int idbm_init(idbm_get_config_file_fn *fn) |
| { |
| /* make sure root db dir is there */ |
| - if (access(ISCSI_CONFIG_ROOT, F_OK) != 0) { |
| - if (mkdir(ISCSI_CONFIG_ROOT, 0660) != 0) { |
| - log_error("Could not make %s %d\n", ISCSI_CONFIG_ROOT, |
| + if (access(ISCSI_IDBM_ROOT, F_OK) != 0) { |
| + if (mkdir(ISCSI_IDBM_ROOT, 0660) != 0) { |
| + log_error("Could not make %s %d\n", ISCSI_IDBM_ROOT, |
| errno); |
| return errno; |
| } |
| --- a/usr/idbm.h |
| +++ b/usr/idbm.h |
| @@ -28,12 +28,16 @@ |
| #include "config.h" |
| #include "list.h" |
| |
| -#define NODE_CONFIG_DIR ISCSI_CONFIG_ROOT"nodes" |
| -#define SLP_CONFIG_DIR ISCSI_CONFIG_ROOT"slp" |
| -#define ISNS_CONFIG_DIR ISCSI_CONFIG_ROOT"isns" |
| -#define STATIC_CONFIG_DIR ISCSI_CONFIG_ROOT"static" |
| -#define FW_CONFIG_DIR ISCSI_CONFIG_ROOT"fw" |
| -#define ST_CONFIG_DIR ISCSI_CONFIG_ROOT"send_targets" |
| +#ifndef ISCSI_IDBM_ROOT |
| +# define ISCSI_IDBM_ROOT ISCSI_CONFIG_ROOT |
| +#endif |
| + |
| +#define NODE_CONFIG_DIR ISCSI_IDBM_ROOT"nodes" |
| +#define SLP_CONFIG_DIR ISCSI_IDBM_ROOT"slp" |
| +#define ISNS_CONFIG_DIR ISCSI_IDBM_ROOT"isns" |
| +#define STATIC_CONFIG_DIR ISCSI_IDBM_ROOT"static" |
| +#define FW_CONFIG_DIR ISCSI_IDBM_ROOT"fw" |
| +#define ST_CONFIG_DIR ISCSI_IDBM_ROOT"send_targets" |
| #define ST_CONFIG_NAME "st_config" |
| #define ISNS_CONFIG_NAME "isns_config" |
| |