rs changes (also use driver configurations in the image ramdisk)

This commit is contained in:
Philip Homburg
2006-10-31 13:35:04 +00:00
parent 9ac537eb7c
commit 0c1d433f60
11 changed files with 197 additions and 30 deletions

View File

@@ -83,7 +83,6 @@ PUBLIC int main(void)
switch(call_nr) {
case RS_UP: result = do_up(&m, FALSE, 0); break;
case RS_UP_COPY: result = do_up(&m, TRUE, 0); break;
case RS_RUN: result = do_up(&m, FALSE, RS_EXITING); break;
case RS_START: result = do_start(&m); break;
case RS_DOWN: result = do_down(&m); break;
case RS_REFRESH: result = do_refresh(&m); break;
@@ -139,7 +138,6 @@ PRIVATE void init_server(void)
for (s=0; s< NR_BOOT_PROCS; s++) {
ip = &image[s];
if (ip->proc_nr >= 0) {
nr_in_use ++;
rproc[s].r_flags = RS_IN_USE;
rproc[s].r_proc_nr_e = ip->endpoint;
rproc[s].r_pid = getnpid(ip->proc_nr);

View File

@@ -20,8 +20,6 @@
/* Allocate variables. */
struct rproc rproc[NR_SYS_PROCS]; /* system process table */
struct rproc *rproc_ptr[NR_PROCS]; /* mapping for fast access */
int nr_in_use; /* number of services */
extern int errno; /* error status */
/* Prototypes for internal functions that do the hard work. */
FORWARD _PROTOTYPE( int start_service, (struct rproc *rp, int flags,
@@ -61,13 +59,11 @@ int flags; /* extra flags, if any */
endpoint_t ep; /* new endpoint no. */
/* See if there is a free entry in the table with system processes. */
if (nr_in_use >= NR_SYS_PROCS) return(EAGAIN);
for (slot_nr = 0; slot_nr < NR_SYS_PROCS; slot_nr++) {
rp = &rproc[slot_nr]; /* get pointer to slot */
if (! rp->r_flags & RS_IN_USE) /* check if available */
break;
}
nr_in_use ++; /* update administration */
/* Obtain command name and parameters. This is a space-separated string
* that looks like "/sbin/service arg1 arg2 ...". Arguments are optional.
@@ -166,13 +162,11 @@ message *m_ptr; /* request message pointer */
if (s != OK) return(s);
/* See if there is a free entry in the table with system processes. */
if (nr_in_use >= NR_SYS_PROCS) return(EAGAIN);
for (slot_nr = 0; slot_nr < NR_SYS_PROCS; slot_nr++) {
rp = &rproc[slot_nr]; /* get pointer to slot */
if (! rp->r_flags & RS_IN_USE) /* check if available */
break;
}
nr_in_use ++; /* update administration */
/* Obtain command name and parameters. This is a space-separated string
* that looks like "/sbin/service arg1 arg2 ...". Arguments are optional.
@@ -977,8 +971,8 @@ struct priv *privp;
src_bit, call_nr;
unsigned long mask;
/* Clear the privilege structure */
memset(privp, '\0', sizeof(*privp));
/* Clear s_k_call_mask */
memset(privp->s_k_call_mask, '\0', sizeof(privp->s_k_call_mask));
src_bits_per_word= 8*sizeof(rp->r_call_mask[0]);
dst_bits_per_word= 8*sizeof(privp->s_k_call_mask[0]);
@@ -1017,6 +1011,12 @@ int endpoint;
int i, r;
struct rs_pci rs_pci;
if (strcmp(rp->r_label, "pci") == 0)
{
printf("init_pci: not when starting 'pci'\n");
return;
}
len= strlen(rp->r_label);
if (len+1 > sizeof(rs_pci.rsp_label))
{

View File

@@ -60,7 +60,6 @@ extern struct rproc {
/* Mapping for fast access to the system process table. */
extern struct rproc *rproc_ptr[NR_PROCS];
extern int nr_in_use;
/* Flag values. */
#define RS_IN_USE 0x001 /* set when process slot is in use */

View File

@@ -33,14 +33,15 @@ PRIVATE char *known_requests[] = {
"rescue",
"shutdown",
"upcopy", /* fill for RS_UP_COPY */
"run",
"catch for illegal requests"
};
#define ILLEGAL_REQUEST sizeof(known_requests)/sizeof(char *)
/* Global error number set for failed system calls. */
#define OK 0
extern int errno;
#define RUN_CMD "run"
#define RUN_SCRIPT "/etc/rs.single" /* Default script for 'run' */
/* Define names for arguments provided to this utility. The first few
* arguments are required and have a known index. Thereafter, some optional
@@ -75,6 +76,7 @@ extern int errno;
* are stored globally in the following variables:
*/
PRIVATE int req_type;
PRIVATE int do_run= 0; /* 'run' command instead of 'up' */
PRIVATE char *req_label;
PRIVATE char *req_path;
PRIVATE char *req_args;
@@ -150,22 +152,38 @@ PRIVATE int parse_arguments(int argc, char **argv)
exit(EINVAL);
}
/* Verify request type. */
for (req_type=0; req_type< ILLEGAL_REQUEST; req_type++) {
if (strcmp(known_requests[req_type],argv[optind+ARG_REQUEST])==0) break;
if (strcmp(argv[optind+ARG_REQUEST], RUN_CMD) == 0)
{
req_nr= RS_UP;
do_run= TRUE;
}
if (req_type == ILLEGAL_REQUEST) {
print_usage(argv[ARG_NAME], "illegal request type");
exit(ENOSYS);
else
{
/* Verify request type. */
for (req_type=0; req_type< ILLEGAL_REQUEST; req_type++) {
if (strcmp(known_requests[req_type],argv[optind+ARG_REQUEST])==0)
break;
}
if (req_type == ILLEGAL_REQUEST) {
print_usage(argv[ARG_NAME], "illegal request type");
exit(ENOSYS);
}
req_nr = RS_RQ_BASE + req_type;
}
req_nr = RS_RQ_BASE + req_type;
if (req_nr == RS_UP || req_nr == RS_RUN) {
if (req_nr == RS_UP) {
rs_start.rss_flags= 0;
if (c_flag)
rs_start.rss_flags |= RF_COPY;
if (do_run)
{
/* Set default recovery script for RUN */
req_script = RUN_SCRIPT;
req_nr = RS_START;
}
if (req_nr == RS_UP && c_flag)
req_nr= RS_UP_COPY;
@@ -640,6 +658,8 @@ struct
int call_nr;
} system_tab[]=
{
{ "PRIVCTL", SYS_PRIVCTL },
{ "TRACE", SYS_TRACE },
{ "KILL", SYS_KILL },
{ "UMAP", SYS_UMAP },
{ "VIRCOPY", SYS_VIRCOPY },
@@ -652,7 +672,9 @@ struct
{ "GETINFO", SYS_GETINFO },
{ "SAFECOPYFROM", SYS_SAFECOPYFROM },
{ "SAFECOPYTO", SYS_SAFECOPYTO },
{ "VSAFECOPY", SYS_VSAFECOPY },
{ "SETGRANT", SYS_SETGRANT },
{ "READBIOS", SYS_READBIOS },
{ NULL, 0 }
};
@@ -865,7 +887,6 @@ PUBLIC int main(int argc, char **argv)
switch(request) {
case RS_UP:
case RS_UP_COPY:
case RS_RUN:
/* Build space-separated command string to be passed to RS server. */
strcpy(command, req_path);
command[strlen(req_path)] = ' ';