unifdef -D__NetBSD__

This commit is contained in:
pooka 2010-12-17 13:05:29 +00:00
parent 2daf152b55
commit 8fb9443f66
8 changed files with 13 additions and 299 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: iconv.h,v 1.9 2008/06/24 10:37:19 gmcgarry Exp $ */
/* $NetBSD: iconv.h,v 1.10 2010/12/17 13:05:29 pooka Exp $ */
/*
* Copyright (c) 2000-2001, Boris Popov
@ -82,49 +82,6 @@ __END_DECLS
#else /* !_KERNEL */
#ifndef __NetBSD__
#include <sys/kobj.h>
#include <sys/queue.h> /* can't avoid that */
#include <sys/sysctl.h> /* can't avoid that */
struct iconv_cspair;
struct iconv_cspairdata;
/*
* iconv converter class definition
*/
struct iconv_converter_class {
KOBJ_CLASS_FIELDS;
TAILQ_ENTRY(iconv_converter_class) cc_link;
};
struct iconv_cspair {
int cp_id; /* unique id of charset pair */
int cp_refcount; /* number of references from other pairs */
const char * cp_from;
const char * cp_to;
void * cp_data;
struct iconv_converter_class * cp_dcp;
struct iconv_cspair *cp_base;
TAILQ_ENTRY(iconv_cspair) cp_link;
};
#define KICONV_CONVERTER(name,size) \
static DEFINE_CLASS(iconv_ ## name, iconv_ ## name ## _methods, (size)); \
static moduledata_t iconv_ ## name ## _mod = { \
"iconv_"#name, iconv_converter_handler, \
(void*)&iconv_ ## name ## _class \
}; \
DECLARE_MODULE(iconv_ ## name, iconv_ ## name ## _mod, SI_SUB_DRIVERS, SI_ORDER_ANY);
#define KICONV_CES(name,size) \
static DEFINE_CLASS(iconv_ces_ ## name, iconv_ces_ ## name ## _methods, (size)); \
static moduledata_t iconv_ces_ ## name ## _mod = { \
"iconv_ces_"#name, iconv_cesmod_handler, \
(void*)&iconv_ces_ ## name ## _class \
}; \
DECLARE_MODULE(iconv_ces_ ## name, iconv_ces_ ## name ## _mod, SI_SUB_DRIVERS, SI_ORDER_ANY);
#endif /* !NetBSD */
#ifdef MALLOC_DECLARE
MALLOC_DECLARE(M_ICONV);
@ -144,11 +101,6 @@ void *iconv_convmem(void *, void *, const void *, int);
*/
int iconv_lookupcp(const char **, const char *);
#ifndef __NetBSD__
int iconv_converter_initstub(struct iconv_converter_class *);
int iconv_converter_donestub(struct iconv_converter_class *);
int iconv_converter_handler(module_t, int, void *);
#endif /* !NetBSD */
#ifdef ICONV_DEBUG
#define ICDEBUG(x) aprint_debug x

View File

@ -1,4 +1,4 @@
/* $NetBSD: smb_conn.c,v 1.26 2010/07/01 13:00:56 hannken Exp $ */
/* $NetBSD: smb_conn.c,v 1.27 2010/12/17 13:05:29 pooka Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@ -61,7 +61,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: smb_conn.c,v 1.26 2010/07/01 13:00:56 hannken Exp $");
__KERNEL_RCSID(0, "$NetBSD: smb_conn.c,v 1.27 2010/12/17 13:05:29 pooka Exp $");
/*
* Connection engine.
@ -88,9 +88,6 @@ __KERNEL_RCSID(0, "$NetBSD: smb_conn.c,v 1.26 2010/07/01 13:00:56 hannken Exp $"
static struct smb_connobj smb_vclist;
static int smb_vcnext = 1; /* next unique id for VC */
#ifndef __NetBSD__
SYSCTL_NODE(_net, OID_AUTO, smb, CTLFLAG_RW, NULL, "SMB protocol");
#endif
MALLOC_DEFINE(M_SMBCONN, "SMB conn", "SMB connection");
@ -103,12 +100,6 @@ static void smb_vc_gone(struct smb_connobj *cp, struct smb_cred *scred);
static smb_co_free_t smb_share_free;
static smb_co_gone_t smb_share_gone;
#ifndef __NetBSD__
static int smb_sysctl_treedump(SYSCTL_HANDLER_ARGS);
SYSCTL_PROC(_net_smb, OID_AUTO, treedump, CTLFLAG_RD | CTLTYPE_OPAQUE,
NULL, 0, smb_sysctl_treedump, "S,treedump", "Requester tree");
#endif
int
smb_sm_init(void)
@ -708,25 +699,6 @@ smb_vc_getpass(struct smb_vc *vcp)
return smb_emptypass;
}
#ifndef __NetBSD__
static int
smb_vc_getinfo(struct smb_vc *vcp, struct smb_vc_info *vip)
{
memset(vip, 0, sizeof(struct smb_vc_info));
vip->itype = SMB_INFO_VC;
vip->usecount = vcp->obj.co_usecount;
vip->uid = vcp->vc_uid;
vip->gid = vcp->vc_grp;
vip->mode = vcp->vc_mode;
vip->flags = vcp->obj.co_flags;
vip->sopt = vcp->vc_sopt;
vip->iodstate = vcp->vc_iod->iod_state;
memset(&vip->sopt.sv_skey, 0, sizeof(vip->sopt.sv_skey));
snprintf(vip->srvname, sizeof(vip->srvname), "%s", vcp->vc_srvname);
snprintf(vip->vcname, sizeof(vip->vcname), "%s", vcp->vc_username);
return 0;
}
#endif
u_short
smb_vc_nextmid(struct smb_vc *vcp)
@ -905,73 +877,4 @@ smb_share_getpass(struct smb_share *ssp)
return smb_emptypass;
}
#ifndef __NetBSD__
static int
smb_share_getinfo(struct smb_share *ssp, struct smb_share_info *sip)
{
memset(sip, 0, sizeof(struct smb_share_info));
sip->itype = SMB_INFO_SHARE;
sip->usecount = ssp->obj.co_usecount;
sip->tid = ssp->ss_tid;
sip->type= ssp->ss_type;
sip->uid = ssp->ss_uid;
sip->gid = ssp->ss_grp;
sip->mode= ssp->ss_mode;
sip->flags = ssp->obj.co_flags;
snprintf(sip->sname, sizeof(sip->sname), "%s", ssp->ss_name);
return 0;
}
#endif
#ifndef __NetBSD__
/*
* Dump an entire tree into sysctl call
*/
static int
smb_sysctl_treedump(SYSCTL_HANDLER_ARGS)
{
struct smb_cred scred;
struct smb_vc *vcp;
struct smb_share *ssp;
struct smb_vc_info vci;
struct smb_share_info ssi;
int error, itype;
smb_makescred(&scred, td, td->td_proc->p_cred);
error = smb_sm_lockvclist(LK_SHARED);
if (error)
return error;
SMBCO_FOREACH((struct smb_connobj*)vcp, &smb_vclist) {
error = smb_vc_lock(vcp, LK_SHARED);
if (error)
continue;
smb_vc_getinfo(vcp, &vci);
error = SYSCTL_OUT(req, &vci, sizeof(struct smb_vc_info));
if (error) {
smb_vc_unlock(vcp, 0);
break;
}
SMBCO_FOREACH((struct smb_connobj*)ssp, VCTOCP(vcp)) {
error = smb_share_lock(ssp, LK_SHARED);
if (error) {
error = 0;
continue;
}
smb_share_getinfo(ssp, &ssi);
smb_share_unlock(ssp, 0);
error = SYSCTL_OUT(req, &ssi, sizeof(struct smb_share_info));
if (error)
break;
}
smb_vc_unlock(vcp, 0);
if (error)
break;
}
if (!error) {
itype = SMB_INFO_NONE;
error = SYSCTL_OUT(req, &itype, sizeof(itype));
}
smb_sm_unlockvclist();
return error;
}
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: smb_conn.h,v 1.19 2009/03/18 15:14:32 cegger Exp $ */
/* $NetBSD: smb_conn.h,v 1.20 2010/12/17 13:05:29 pooka Exp $ */
/*
* Copyright (c) 2000-2001 Boris Popov
@ -445,12 +445,7 @@ struct smbiod {
SIMPLEQ_HEAD(, smb_rq)
iod_rqlist; /* list of outstanding requests */
int iod_muxwant;
#ifdef __NetBSD__
struct lwp * iod_l;
#else
struct proc * iod_p;
struct thread * iod_td;
#endif
struct smb_cred iod_scred;
struct smb_slock iod_evlock; /* iod_evlist */
SIMPLEQ_HEAD(,smbiod_event) iod_evlist;

View File

@ -1,4 +1,4 @@
/* $NetBSD: smb_dev.c,v 1.36 2010/12/15 12:58:13 ahoka Exp $ */
/* $NetBSD: smb_dev.c,v 1.37 2010/12/17 13:05:29 pooka Exp $ */
/*
* Copyright (c) 2000-2001 Boris Popov
@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: smb_dev.c,v 1.36 2010/12/15 12:58:13 ahoka Exp $");
__KERNEL_RCSID(0, "$NetBSD: smb_dev.c,v 1.37 2010/12/17 13:05:29 pooka Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@ -67,31 +67,10 @@ __KERNEL_RCSID(0, "$NetBSD: smb_dev.c,v 1.36 2010/12/15 12:58:13 ahoka Exp $");
#include <netsmb/smb_dev.h>
#include <netsmb/smb_rq.h>
#ifdef __NetBSD__
static struct smb_dev **smb_devtbl; /* indexed by minor */
#define SMB_GETDEV(dev) (smb_devtbl[minor(dev)])
#define NSMB_DEFNUM 4
#else /* !NetBSD */
#define SMB_GETDEV(dev) ((struct smb_dev*)(dev)->si_drv1)
static d_open_t nsmb_dev_open;
static d_close_t nsmb_dev_close;
static d_read_t nsmb_dev_read;
static d_write_t nsmb_dev_write;
static d_ioctl_t nsmb_dev_ioctl;
static d_poll_t nsmb_dev_poll;
MODULE_DEPEND(netsmb, libiconv, 1, 1, 1);
MODULE_VERSION(netsmb, NSMB_VERSION);
static int smb_version = NSMB_VERSION;
SYSCTL_DECL(_net_smb);
SYSCTL_INT(_net_smb, OID_AUTO, version, CTLFLAG_RD, &smb_version, 0, "");
#endif /* NetBSD */
static MALLOC_DEFINE(M_NSMBDEV, "NETSMBDEV", "NET/SMB device");
@ -100,7 +79,6 @@ static MALLOC_DEFINE(M_NSMBDEV, "NETSMBDEV", "NET/SMB device");
int smb_dev_queue(struct smb_dev *ndp, struct smb_rq *rqp, int prio);
*/
#ifdef __NetBSD__
dev_type_open(nsmb_dev_open);
dev_type_close(nsmb_dev_close);
dev_type_ioctl(nsmb_dev_ioctl);
@ -109,40 +87,7 @@ const struct cdevsw nsmb_cdevsw = {
nsmb_dev_open, nsmb_dev_close, noread, nowrite,
nsmb_dev_ioctl, nostop, notty, nopoll, nommap, nokqfilter, D_OTHER,
};
#else
static struct cdevsw nsmb_cdevsw = {
/* open */ nsmb_dev_open,
/* close */ nsmb_dev_close,
/* read */ nsmb_dev_read,
/* write */ nsmb_dev_write,
/* ioctl */ nsmb_dev_ioctl,
/* poll */ nsmb_dev_poll,
/* mmap */ nommap,
/* strategy */ nostrategy,
/* name */ NSMB_NAME,
/* maj */ NSMB_MAJOR,
/* dump */ nodump,
/* psize */ nopsize,
/* flags */ 0,
};
#endif /* !__NetBSD__ */
#ifndef __NetBSD__
static eventhandler_tag nsmb_dev_tag;
static void
nsmb_dev_clone(void *arg, char *name, int namelen, dev_t *dev)
{
int min;
if (*dev != NODEV)
return;
if (dev_stdclone(name, NULL, NSMB_NAME, &min) != 1)
return;
*dev = make_dev(&nsmb_cdevsw, min, 0, 0, 0600, NSMB_NAME"%d", min);
}
#else /* __NetBSD__ */
void nsmbattach(int);
@ -178,7 +123,6 @@ nsmbattach(int num)
}
smb_rqpool_init();
}
#endif /* __NetBSD__ */
int
nsmb_dev_open(dev_t dev, int oflags, int devtype,
@ -195,15 +139,6 @@ nsmb_dev_open(dev_t dev, int oflags, int devtype,
smb_devtbl[minor(dev)] = (void*)sdp;
}
#ifndef __NetBSD__
/*
* XXX: this is just crazy - make a device for an already passed device...
* someone should take care of it.
*/
if ((dev->si_flags & SI_NAMED) == 0)
make_dev(&nsmb_cdevsw, minor(dev), cred->cr_uid, cred->cr_gid, 0700,
NSMB_NAME"%d", dev2unit(dev));
#endif /* !__NetBSD__ */
memset(sdp, 0, sizeof(*sdp));
/*
@ -254,9 +189,6 @@ nsmb_dev_close(dev_t dev, int flag, int fmt, struct lwp *l)
*/
smb_devtbl[minor(dev)] = NULL;
free(sdp, M_NSMBDEV);
#ifndef __NetBSD__
destroy_dev(dev);
#endif
splx(s);
return 0;
}
@ -408,61 +340,6 @@ nsmb_dev_ioctl(dev_t dev, u_long cmd, void *data, int flag,
return error;
}
#ifndef __NetBSD__
int
nsmb_dev_read(dev_t dev, struct uio *uio, int flag)
{
return EACCES;
}
int
nsmb_dev_write(dev_t dev, struct uio *uio, int flag)
{
return EACCES;
}
int
nsmb_dev_poll(dev_t dev, int events, struct proc *p)
{
return ENODEV;
}
static int
nsmb_dev_load(module_t mod, int cmd, void *arg)
{
int error = 0;
switch (cmd) {
case MOD_LOAD:
error = smb_sm_init();
if (error)
break;
error = smb_iod_init();
if (error) {
smb_sm_done();
break;
}
cdevsw_add(&nsmb_cdevsw);
nsmb_dev_tag = EVENTHANDLER_REGISTER(dev_clone, nsmb_dev_clone, 0, 1000);
printf("netsmb_dev: loaded\n");
break;
case MOD_UNLOAD:
smb_iod_done();
error = smb_sm_done();
error = 0;
EVENTHANDLER_DEREGISTER(dev_clone, nsmb_dev_tag);
cdevsw_remove(&nsmb_cdevsw);
printf("netsmb_dev: unloaded\n");
break;
default:
error = EINVAL;
break;
}
return error;
}
DEV_MODULE (dev_netsmb, nsmb_dev_load, 0);
#else
#ifdef _MODULE
@ -502,7 +379,6 @@ nsmb_modcmd(modcmd_t cmd, void *arg)
}
#endif /* _MODULE */
#endif /* !__NetBSD__ */
/*
* Convert a file descriptor to appropriate smb_share pointer

View File

@ -1,4 +1,4 @@
/* $NetBSD: smb_iod.c,v 1.38 2010/12/15 12:58:13 ahoka Exp $ */
/* $NetBSD: smb_iod.c,v 1.39 2010/12/17 13:05:29 pooka Exp $ */
/*
* Copyright (c) 2000-2001 Boris Popov
@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: smb_iod.c,v 1.38 2010/12/15 12:58:13 ahoka Exp $");
__KERNEL_RCSID(0, "$NetBSD: smb_iod.c,v 1.39 2010/12/17 13:05:29 pooka Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -713,13 +713,8 @@ smb_iod_create(struct smb_vc *vcp)
SIMPLEQ_INIT(&iod->iod_rqlist);
smb_sl_init(&iod->iod_evlock, "smbevl");
SIMPLEQ_INIT(&iod->iod_evlist);
#ifdef __NetBSD__
error = kthread_create(PRI_NONE, 0, NULL, smb_iod_thread, iod,
&iod->iod_l, "smbiod%d", iod->iod_id);
#else
error = kthread_create(smb_iod_thread, iod, &iod->iod_p,
RFNOWAIT, "smbiod%d", iod->iod_id);
#endif
if (error) {
SMBIODEBUG(("can't start smbiod: %d", error));
free(iod, M_SMBIOD);

View File

@ -1,4 +1,4 @@
/* $NetBSD: smb_rq.c,v 1.33 2009/09/12 12:52:21 pooka Exp $ */
/* $NetBSD: smb_rq.c,v 1.34 2010/12/17 13:05:29 pooka Exp $ */
/*
* Copyright (c) 2000-2001, Boris Popov
@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: smb_rq.c,v 1.33 2009/09/12 12:52:21 pooka Exp $");
__KERNEL_RCSID(0, "$NetBSD: smb_rq.c,v 1.34 2010/12/17 13:05:29 pooka Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -53,9 +53,6 @@ __KERNEL_RCSID(0, "$NetBSD: smb_rq.c,v 1.33 2009/09/12 12:52:21 pooka Exp $");
#include <netsmb/smb_subr.h>
#include <netsmb/smb_tran.h>
#ifndef __NetBSD__
MODULE_DEPEND(netsmb, libmchain, 1, 1, 1);
#endif
static int smb_rq_init(struct smb_rq *, struct smb_connobj *, u_char,
struct smb_cred *);

View File

@ -1,4 +1,4 @@
/* $NetBSD: smb_subr.h,v 1.19 2010/07/12 02:58:01 christos Exp $ */
/* $NetBSD: smb_subr.h,v 1.20 2010/12/17 13:05:29 pooka Exp $ */
/*
* Copyright (c) 2000-2001, Boris Popov
@ -64,9 +64,7 @@ void m_dumpm(struct mbuf *m);
#define m_dumpm(m)
#endif
#ifdef __NetBSD__
#define SIGISMEMBER(s,n) sigismember(&(s),n)
#endif
#define SMB_SIGMASK(set) \
(SIGISMEMBER(set, SIGINT) || SIGISMEMBER(set, SIGTERM) || \

View File

@ -1,4 +1,4 @@
/* $NetBSD: subr_mchain.c,v 1.19 2010/07/12 02:58:01 christos Exp $ */
/* $NetBSD: subr_mchain.c,v 1.20 2010/12/17 13:05:29 pooka Exp $ */
/*
* Copyright (c) 2000, 2001 Boris Popov
@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: subr_mchain.c,v 1.19 2010/07/12 02:58:01 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: subr_mchain.c,v 1.20 2010/12/17 13:05:29 pooka Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -50,7 +50,6 @@ __KERNEL_RCSID(0, "$NetBSD: subr_mchain.c,v 1.19 2010/07/12 02:58:01 christos Ex
#define MBERROR(x) aprint_error x
#define MBPANIC(x) aprint_error x
#ifdef __NetBSD__
static struct mbuf *
m_getm(struct mbuf *m, size_t len, int how, int type)
{
@ -101,7 +100,6 @@ failed:
return (NULL);
}
#endif /* __NetBSD__ */
/*
* Various helper functions