From 0de8edfb07df25875e2743ce683b694ae52ea408 Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Wed, 15 Jan 2014 05:31:52 +0000 Subject: remove functions that were uses by other (non-linux) compat; and convert to ANSI protos while here --- sys/compat/common/compat_dir.c | 10 +++------ sys/compat/common/compat_util.c | 45 ++++++----------------------------------- sys/compat/common/compat_util.h | 16 ++------------- 3 files changed, 11 insertions(+), 60 deletions(-) (limited to 'sys/compat') diff --git a/sys/compat/common/compat_dir.c b/sys/compat/common/compat_dir.c index f41c509da82..7e8c2911a74 100644 --- a/sys/compat/common/compat_dir.c +++ b/sys/compat/common/compat_dir.c @@ -1,4 +1,4 @@ -/* $OpenBSD: compat_dir.c,v 1.7 2013/10/31 09:53:56 pirofti Exp $ */ +/* $OpenBSD: compat_dir.c,v 1.8 2014/01/15 05:31:51 deraadt Exp $ */ /* * Copyright (c) 2000 Constantine Sapuntzakis @@ -41,12 +41,8 @@ #include int -readdir_with_callback(fp, off, nbytes, appendfunc, arg) - struct file *fp; - off_t *off; - u_long nbytes; - int (*appendfunc)(void *, struct dirent *); - void *arg; +readdir_with_callback(struct file *fp, off_t *off, u_long nbytes, + int (*appendfunc)(void *, struct dirent *), void *arg) { struct dirent *bdp; caddr_t inp, buf; diff --git a/sys/compat/common/compat_util.c b/sys/compat/common/compat_util.c index 42b790225d5..ec45ce78421 100644 --- a/sys/compat/common/compat_util.c +++ b/sys/compat/common/compat_util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: compat_util.c,v 1.10 2004/08/01 06:22:28 mickey Exp $ */ +/* $OpenBSD: compat_util.c,v 1.11 2014/01/15 05:31:51 deraadt Exp $ */ /* $NetBSD: compat_util.c,v 1.4 1996/03/14 19:31:45 christos Exp $ */ /* @@ -53,13 +53,8 @@ * be in exists. */ int -emul_find(p, sgp, prefix, path, pbuf, cflag) - struct proc *p; - caddr_t *sgp; /* Pointer to stackgap memory */ - const char *prefix; - char *path; - char **pbuf; - int cflag; +emul_find(struct proc *p, caddr_t *sgp, const char *prefix, + char *path, char **pbuf, int cflag) { struct nameidata nd; struct nameidata ndroot; @@ -113,8 +108,7 @@ emul_find(p, sgp, prefix, path, pbuf, cflag) goto bad; *cp = '/'; - } - else { + } else { NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, buf, p); if ((error = namei(&nd)) != 0) @@ -177,41 +171,14 @@ bad: return error; } -/* - * Translate one set of flags to another, based on the entries in - * the given table. If 'leftover' is specified, it is filled in - * with any flags which could not be translated. - */ -unsigned long -emul_flags_translate(tab, in, leftover) - const struct emul_flags_xtab *tab; - unsigned long in; - unsigned long *leftover; -{ - unsigned long out; - - for (out = 0; tab->omask != 0; tab++) { - if ((in & tab->omask) == tab->oval) { - in &= ~tab->omask; - out |= tab->nval; - } - } - if (leftover != NULL) - *leftover = in; - return (out); -} - caddr_t -stackgap_init(e) - struct emul *e; +stackgap_init(struct emul *e) { return STACKGAPBASE; } void * -stackgap_alloc(sgp, sz) - caddr_t *sgp; - size_t sz; +stackgap_alloc(caddr_t *sgp, size_t sz) { void *n = (void *) *sgp; caddr_t nsgp; diff --git a/sys/compat/common/compat_util.h b/sys/compat/common/compat_util.h index 3494c242fc7..03df1662f2a 100644 --- a/sys/compat/common/compat_util.h +++ b/sys/compat/common/compat_util.h @@ -1,4 +1,4 @@ -/* $OpenBSD: compat_util.h,v 1.7 2002/03/14 01:26:49 millert Exp $ */ +/* $OpenBSD: compat_util.h,v 1.8 2014/01/15 05:31:51 deraadt Exp $ */ /* $NetBSD: compat_util.h,v 1.1 1995/06/24 20:16:05 christos Exp $ */ /* @@ -33,26 +33,14 @@ #ifndef _COMPAT_UTIL_H_ #define _COMPAT_UTIL_H_ -#include #include struct emul; -/* struct proc; */ caddr_t stackgap_init(struct emul *); void *stackgap_alloc(caddr_t *, size_t); -struct emul_flags_xtab { - unsigned long omask; - unsigned long oval; - unsigned long nval; -}; - -int emul_find(struct proc *, caddr_t *, const char *, char *, - char **, int); - -unsigned long emul_flags_translate(const struct emul_flags_xtab *tab, - unsigned long in, unsigned long *leftover); +int emul_find(struct proc *, caddr_t *, const char *, char *, char **, int); #define CHECK_ALT_EXIST(p, sgp, root, path) \ emul_find(p, sgp, root, path, &(path), 0) -- cgit v1.2.3