zipl/src: make blsdir variable global instead of local

It is used by the next patch.
Specifically, ->filter() and ->sort() callbacks of the scandir(3)
accept only short names of directory entries to be filtered/sorted,
while we need to know absolute names to perform filtering/sorting.

Signed-off-by: Eduard Shishkin <edward6@linux.ibm.com>
Reviewed-by: Stefan Haberland <sth@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Eduard Shishkin
2022-03-28 20:51:37 +02:00
committed by Jan Höppner
parent e9bf141264
commit ebc3384b9f
3 changed files with 7 additions and 5 deletions

View File

@@ -116,12 +116,14 @@ struct scan_token {
} content;
};
extern const char *blsdir;
/* Determines which keyword may be present in which section */
extern enum scan_key_state scan_key_table[SCAN_SECTION_NUM][SCAN_KEYWORD_NUM];
int scan_file(const char* filename, struct scan_token** array);
int scan_bls(const char* blsdir, struct scan_token** token, int scan_size);
int scan_bls(struct scan_token **token, int scan_size);
void scan_free(struct scan_token* array);
char* scan_keyword_name(enum scan_keyword_id id);
int scan_check_defaultboot(struct scan_token* scan);

View File

@@ -30,6 +30,8 @@
#include "zipl.h"
#include "envblk.h"
const char *blsdir;
/* Command line options */
static struct option options[] = {
{ "config", required_argument, NULL, 'c'},
@@ -1732,7 +1734,6 @@ get_job_from_config_file(struct command_line* cmdline, struct job_data* job)
struct scan_token* scan;
struct scan_token* new_scan;
const char *filename = NULL;
char *blsdir;
char* source;
int i, rc, scan_size;
@@ -1772,7 +1773,7 @@ get_job_from_config_file(struct command_line* cmdline, struct job_data* job)
} else {
blsdir = ZIPL_DEFAULT_BLSDIR;
}
rc = scan_bls(blsdir, &scan, scan_size);
rc = scan_bls(&scan, scan_size);
if (rc) {
error_text("BLS parsing '%s'", blsdir);
return rc;

View File

@@ -40,7 +40,6 @@
#include "misc.h"
#include "scan.h"
/* Determines which keyword may be present in which section */
enum scan_key_state scan_key_table[SCAN_SECTION_NUM][SCAN_KEYWORD_NUM] = {
/* defa dump dump imag para parm ramd segm targ prom time defa tape mv
@@ -1318,7 +1317,7 @@ static char *scan_get_default_target(struct scan_token *scan)
#define BLS_TOKEN_MAX 5 /* section heading, image, ramdisk, parameter, target */
int scan_bls(const char *blsdir, struct scan_token **token, int scan_size)
int scan_bls(struct scan_token **token, int scan_size)
{
int size, remaining = 0, n, current, rc = -1, count = 0;
struct scan_token *array = *token;