This change is necessary for instrumentation-aided state transfer.
Change-Id: I24be938009f02e302a15083f9a7a11824975e42b
return EINVAL;
/* For pipes, free the inode data buffer. */
- if (rip->i_data != NULL)
+ if (rip->i_data != NULL) {
free(rip->i_data);
+ rip->i_data = NULL;
+ }
/* Return the inode to the free list. */
rip->i_free = TRUE;
enum policy supported;
};
-static struct {
+typedef struct {
struct rproc proc[NR_SYS_PROCS];
struct rprocpub pub[NR_SYS_PROCS];
-} rproc;
+} ixfer_rproc_t;
+static ixfer_rproc_t rproc;
static struct policies policies[NR_SYS_PROCS];
static int quiet = 0;
+typedef struct buf *noxfer_buf_ptr_t; /* annotation for temporary buf ptrs */
+
void lmfs_setquiet(int q) { quiet = q; }
static int fs_bufs_heuristic(int minbufs, fsblkcnt_t btotal,
* However, the caller must also not rely on all or even any of the blocks to
* be present in the cache afterwards--failures are (deliberately!) ignored.
*/
- static struct buf *bufq[LMFS_MAX_PREFETCH]; /* static because of size only */
+ static noxfer_buf_ptr_t bufq[LMFS_MAX_PREFETCH]; /* static for size only */
struct buf *bp;
unsigned int count;
int r;
/* Flush all dirty blocks for one device. */
register struct buf *bp;
- static struct buf **dirty;
+ static noxfer_buf_ptr_t *dirty;
static unsigned int dirtylistsize = 0;
unsigned int ndirty;
#ifndef _VTREEFS_INODE_H
#define _VTREEFS_INODE_H
+/*
+ * Callback data can be a pointer or a (cast) integer value. For now, we
+ * instruct the state transfer framework that it should translate only
+ * recognized pointers.
+ */
+typedef cbdata_t cixfer_cbdata_t;
+
/*
* The inodes that are active, form a fully connected tree. Each node except
* the root node has a parent and a tail queue of children, where each child
unsigned int i_count; /* reference count */
index_t i_index; /* index number in parent / NO_INDEX */
int i_indexed; /* number of indexed entries */
- cbdata_t i_cbdata; /* callback data */
+ cixfer_cbdata_t i_cbdata; /* callback data */
unsigned short i_flags; /* I_DELETED or 0 */
/* Tree structure */
/* Needs to be included here, for 'ps' etc */
#include "const.h"
+typedef struct sigaction ixfer_sigaction;
+
EXTERN struct mproc {
char mp_exitstatus; /* storage for status when process exits */
char mp_sigstatus; /* storage for signal # for killed procs */
sigset_t mp_sigpending; /* pending signals to be handled */
sigset_t mp_ksigpending; /* bitmap for pending signals from the kernel */
sigset_t mp_sigtrace; /* signals to hand to tracer first */
- struct sigaction mp_sigact[_NSIG]; /* as in sigaction(2) */
+ ixfer_sigaction mp_sigact[_NSIG]; /* as in sigaction(2) */
#ifdef __ACK__
char mp_padding[60]; /* align structure with new libc */
#endif
{ NULL }
};
+extern struct minix_kerninfo *_minix_kerninfo;
+
int srv_execve(int proc_e, char *exec, size_t exec_len, char **argv,
char **envp)
{
memset(&execi, 0, sizeof(execi));
- execi.stack_high = kinfo.user_sp;
+ execi.stack_high = _minix_kerninfo->kinfo->user_sp;
execi.stack_size = DEFAULT_STACK_LIMIT;
execi.proc_e = proc_e;
execi.hdr = exec;
EXTERN struct machine machine; /* machine info */
-EXTERN struct kinfo kinfo; /* kernel information */
-
#endif /* RS_GLO_H */
if (OK != (s=sys_getmachine(&machine)))
panic("couldn't get machine info: %d", s);
- if (OK != (s=sys_getkinfo(&kinfo)))
- panic("couldn't get kernel kinfo: %d", s);
-
/* Main loop - get work and do it, forever. */
while (TRUE) {
/* Perform sensitive background operations when RS is idle. */
#define lock_exec() lock_proc(fproc_addr(VM_PROC_NR))
#define unlock_exec() unlock_proc(fproc_addr(VM_PROC_NR))
+extern struct minix_kerninfo *_minix_kerninfo;
+
/*===========================================================================*
* get_read_vp *
*===========================================================================*/
/* passed from exec() libc code */
execi.userflags = 0;
- execi.args.stack_high = kinfo.user_sp;
+ execi.args.stack_high = _minix_kerninfo->kinfo->user_sp;
execi.args.stack_size = DEFAULT_STACK_LIMIT;
fp->text_size = 0;
/* Data initialized elsewhere. */
extern int (* const call_vec[])(void);
-EXTERN struct kinfo kinfo; /* kernel information */
-
#endif
printf("Started VFS: %d worker thread(s)\n", NR_WTHREADS);
- if (OK != (sys_getkinfo(&kinfo)))
- panic("couldn't get kernel kinfo");
-
/* This is the main loop that gets work, processes it, and sends replies. */
while (TRUE) {
yield_all(); /* let other threads run */
+#ifndef _VM_GLO_H
+#define _VM_GLO_H
#include <minix/sys_config.h>
#include <minix/type.h>
long enable_filemap;
-EXTERN kinfo_t kernel_boot_info;
+typedef kinfo_t ixfer_kinfo_t;
+EXTERN ixfer_kinfo_t kernel_boot_info;
#if SANITYCHECKS
EXTERN int nocheck;
/* total number of memory pages */
EXTERN int total_pages;
EXTERN int num_vm_instances;
+
+#endif /* !_VM_GLO_H */
static struct vmproc *init_proc(endpoint_t ep_nr)
{
- static struct boot_image *ip;
+ struct boot_image *ip;
for (ip = &kernel_boot_info.boot_procs[0];
ip < &kernel_boot_info.boot_procs[NR_BOOT_PROCS]; ip++) {
{
int s, i;
static struct memory mem_chunks[NR_MEMS];
- static struct boot_image *ip;
+ struct boot_image *ip;
extern void __minix_init(void);
multiboot_module_t *mod;
vir_bytes kern_dyn, kern_static;
if (sbuf){ /* handle case where sbuf == NULL */
*sbuf = '\0';
}
+#if defined(_MINIX_MAGIC)
+ sbuf = ebuf = NULL; /* leave no dangling pointers */
+#endif
return scount;
#else /* __minix is not defined */
*sbuf = '\0';