VFS: enable sending control messages
This commit is contained in:
parent
8ae9987dca
commit
0d63d9e125
4 changed files with 78 additions and 2 deletions
|
@ -18,6 +18,10 @@ Created: Feb 15, 1994 by Philip Homburg <philip@cs.vu.nl>
|
|||
#define PMGETPARAM _IOW('M', 5, struct sysgetenv)
|
||||
#define PMSETPARAM _IOR('M', 7, struct sysgetenv)
|
||||
|
||||
/* VFS controls */
|
||||
#define VFSSETPARAM _IOR('M', 130, struct sysgetenv)
|
||||
#define VFSGETPARAM _IOR('M', 131, struct sysgetenv)
|
||||
|
||||
struct sysgetenv {
|
||||
char *key; /* Name requested. */
|
||||
size_t keylen; /* Length of name including \0. */
|
||||
|
|
|
@ -14,6 +14,7 @@ EXTERN int nr_locks; /* number of locks currently in place */
|
|||
EXTERN int reviving; /* number of pipe processes to be revived */
|
||||
EXTERN int pending;
|
||||
EXTERN int sending;
|
||||
EXTERN int verbose;
|
||||
|
||||
EXTERN dev_t ROOT_DEV; /* device number of the root device */
|
||||
EXTERN int ROOT_FS_E; /* kernel endpoint of the root FS proc */
|
||||
|
|
|
@ -486,6 +486,7 @@ static int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *info)
|
|||
force_sync = 0;
|
||||
receive_from = ANY;
|
||||
self = NULL;
|
||||
verbose = 0;
|
||||
|
||||
/* Initialize proc endpoints to NONE */
|
||||
for (rfp = &fproc[0]; rfp < &fproc[NR_PROCS]; rfp++) {
|
||||
|
|
|
@ -595,11 +595,81 @@ int ruid;
|
|||
int do_svrctl()
|
||||
{
|
||||
int svrctl;
|
||||
vir_bytes ptr;
|
||||
|
||||
svrctl = m_in.svrctl_req;
|
||||
svrctl = job_m_in.svrctl_req;
|
||||
ptr = (vir_bytes) job_m_in.svrctl_argp;
|
||||
if (((svrctl >> 8) & 0xFF) != 'M') return(EINVAL);
|
||||
|
||||
switch (svrctl) {
|
||||
/* No control request implemented yet. */
|
||||
case VFSSETPARAM:
|
||||
case VFSGETPARAM:
|
||||
{
|
||||
struct sysgetenv sysgetenv;
|
||||
char search_key[64];
|
||||
char val[64];
|
||||
int r, s;
|
||||
|
||||
/* Copy sysgetenv structure to VFS */
|
||||
if (sys_datacopy(who_e, ptr, SELF, (vir_bytes) &sysgetenv,
|
||||
sizeof(sysgetenv)) != OK)
|
||||
return(EFAULT);
|
||||
|
||||
/* Basic sanity checking */
|
||||
if (svrctl == VFSSETPARAM) {
|
||||
if (sysgetenv.keylen <= 0 ||
|
||||
sysgetenv.keylen > (sizeof(search_key) - 1) ||
|
||||
sysgetenv.vallen <= 0 ||
|
||||
sysgetenv.vallen >= sizeof(val)) {
|
||||
return(EINVAL);
|
||||
}
|
||||
}
|
||||
|
||||
/* Copy parameter "key" */
|
||||
if ((s = sys_datacopy(who_e, (vir_bytes) sysgetenv.key,
|
||||
SELF, (vir_bytes) search_key,
|
||||
sysgetenv.keylen)) != OK)
|
||||
return(s);
|
||||
search_key[sysgetenv.keylen] = '\0'; /* Limit string */
|
||||
|
||||
/* Is it a parameter we know? */
|
||||
if (svrctl == VFSSETPARAM) {
|
||||
if (!strcmp(search_key, "verbose")) {
|
||||
int verbose_val;
|
||||
if ((s = sys_datacopy(who_e,
|
||||
(vir_bytes) sysgetenv.val, SELF,
|
||||
(vir_bytes) &val, sysgetenv.vallen)) != OK)
|
||||
return(s);
|
||||
val[sysgetenv.vallen] = '\0'; /* Limit string */
|
||||
verbose_val = atoi(val);
|
||||
if (verbose_val < 0 || verbose_val > 4) {
|
||||
return(EINVAL);
|
||||
}
|
||||
verbose = verbose_val;
|
||||
r = OK;
|
||||
} else {
|
||||
r = ESRCH;
|
||||
}
|
||||
} else { /* VFSGETPARAM */
|
||||
if (!strcmp(search_key, "print_traces")) {
|
||||
mthread_stacktraces();
|
||||
sysgetenv.val = 0;
|
||||
sysgetenv.vallen = 0;
|
||||
r = OK;
|
||||
} else {
|
||||
r = ESRCH;
|
||||
}
|
||||
|
||||
if (r == OK) {
|
||||
if ((s = sys_datacopy(SELF,
|
||||
(vir_bytes) &sysgetenv, who_e, ptr,
|
||||
sizeof(sysgetenv))) != OK)
|
||||
return(s);
|
||||
}
|
||||
}
|
||||
|
||||
return(r);
|
||||
}
|
||||
default:
|
||||
return(EINVAL);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue