struct lgtd_router_device_list *
lgtd_router_targets_to_devices(const struct lgtd_proto_target_list *targets)
{
    if (targets != (void *)0x2a) {
        lgtd_errx(1, "unexpected targets list");
    }

    static struct lgtd_router_device_list devices =
        SLIST_HEAD_INITIALIZER(&devices);

    static struct lgtd_lifx_gateway gw_bulb_1 = {
        .bulbs = LIST_HEAD_INITIALIZER(&gw_bulb_1.bulbs),
        .peeraddr = "[::ffff:127.0.0.1]:1"
    };
    static struct lgtd_lifx_bulb bulb_1 = {
        .addr = { 1, 2, 3, 4, 5 },
        .state = {
            .hue = 0xaaaa,
            .saturation = 0xffff,
            .brightness = 0xbbbb,
            .kelvin = 3600,
            .label = "wave",
            .power = LGTD_LIFX_POWER_ON,
            .tags = 5
        },
        .gw = &gw_bulb_1
    };
Esempio n. 2
0
ATF_TC_BODY(slist_test, tc)
{
	SLIST_HEAD(stailhead, entry) head = SLIST_HEAD_INITIALIZER(head);
	struct entry {
		SLIST_ENTRY(entry) entries;
		int i;
	} *n1, *n2, *n3, *np;
Esempio n. 3
0
void
IT_destroy(IntervalTree *it)
{
    IntervalTreeNode *x = it->root->left;
    SLIST_HEAD(node_head, nodeent)
        stuffToFree = SLIST_HEAD_INITIALIZER(stuffToFree);
    struct nodeent {
        SLIST_ENTRY(nodeent) link;
        struct IntervalTreeNode *node;
    } *np;
struct lgtd_router_device_list *
lgtd_router_targets_to_devices(const struct lgtd_proto_target_list *targets)
{
    if (targets != (void *)0x2a) {
        lgtd_errx(1, "unexpected targets list");
    }

    static struct lgtd_router_device_list devices =
        SLIST_HEAD_INITIALIZER(&devices);

    return &devices;
}
Esempio n. 5
0
END_TEST

/* 
 * Insert at the head. Check SLIST_NEXT().
 */
START_TEST(SLIST02)
{
    SLIST_HEAD(slisthead_t, node_t) slisthead = SLIST_HEAD_INITIALIZER(slisthead);
    struct node_t {
        int data;
         SLIST_ENTRY(node_t) links;
    } *elm1, *elm2;
Esempio n. 6
0
    LIST_HEAD_INITIALIZER(ieee80211com_head);

const char *ieee80211_phymode_name[] = {
	"auto",		/* IEEE80211_MODE_AUTO */
	"11a",		/* IEEE80211_MODE_11A */
	"11b",		/* IEEE80211_MODE_11B */
	"11g",		/* IEEE80211_MODE_11G */
	"FH",		/* IEEE80211_MODE_FH */
	"turboA",	/* IEEE80211_MODE_TURBO_A */
	"turboG",	/* IEEE80211_MODE_TURBO_G */
};

/* list of all instances */
SLIST_HEAD(ieee80211_list, ieee80211com);
static struct ieee80211_list ieee80211_list =
	SLIST_HEAD_INITIALIZER(ieee80211_list);
static u_int8_t ieee80211_vapmap[32];		/* enough for 256 */

static void
ieee80211_add_vap(struct ieee80211com *ic)
{
#define	N(a)	(sizeof(a)/sizeof(a[0]))
	int i;
	int s;
	u_int8_t b;

	s = splnet();
	ic->ic_vap = 0;
	for (i = 0; i < N(ieee80211_vapmap) && ieee80211_vapmap[i] == 0xff; i++)
		ic->ic_vap += NBBY;
	if (i == N(ieee80211_vapmap))
Esempio n. 7
0
#include <ctype.h>
#include <syslog.h>
#include <unistd.h>
#include <netinet/in.h>
#include <arpa/inet.h>

#include "snmpmod.h"
#include "snmpd.h"
#include "tree.h"
#include "oid.h"

struct trapsink_list trapsink_list = TAILQ_HEAD_INITIALIZER(trapsink_list);

/* List of target addresses */
struct target_addresslist target_addresslist =
    SLIST_HEAD_INITIALIZER(target_addresslist);

/* List of target parameters */
struct target_paramlist target_paramlist =
    SLIST_HEAD_INITIALIZER(target_paramlist);

/* List of notification targets */
struct target_notifylist target_notifylist =
    SLIST_HEAD_INITIALIZER(target_notifylist);

static const struct asn_oid oid_begemotTrapSinkTable =
    OIDX_begemotTrapSinkTable;
static const struct asn_oid oid_sysUpTime = OIDX_sysUpTime;
static const struct asn_oid oid_snmpTrapOID = OIDX_snmpTrapOID;

struct trapsink_dep {
Esempio n. 8
0
#include <netinet/tcp.h>

#include <net/if.h>
#include <net/vnet.h>
#include <net/pfvar.h>

#include <netinet/ip6.h>

static MALLOC_DEFINE(M_PFOSFP, "pf_osfp", "pf(4) operating system fingerprints");
#define	DPFPRINTF(format, x...)		\
	if (V_pf_status.debug >= PF_DEBUG_NOISY)	\
		printf(format , ##x)

SLIST_HEAD(pf_osfp_list, pf_os_fingerprint);
static VNET_DEFINE(struct pf_osfp_list,	pf_osfp_list) =
	SLIST_HEAD_INITIALIZER();
#define	V_pf_osfp_list			VNET(pf_osfp_list)

static struct pf_osfp_enlist	*pf_osfp_fingerprint_hdr(const struct ip *,
				    const struct ip6_hdr *,
				    const struct tcphdr *);
static struct pf_os_fingerprint	*pf_osfp_find(struct pf_osfp_list *,
				    struct pf_os_fingerprint *, u_int8_t);
static struct pf_os_fingerprint	*pf_osfp_find_exact(struct pf_osfp_list *,
				    struct pf_os_fingerprint *);
static void			 pf_osfp_insert(struct pf_osfp_list *,
				    struct pf_os_fingerprint *);
#ifdef PFDEBUG
static struct pf_os_fingerprint	*pf_osfp_validate(void);
#endif
Esempio n. 9
0
#include <sys/queue.h>

#include <err.h>
#include <stdio.h>
#include <stdlib.h>

struct number {
	int			n_number;
	SLIST_ENTRY(number)	n_entry;
};
static SLIST_HEAD(NHEAD, number) nhead = SLIST_HEAD_INITIALIZER(&nhead);

static int
number_cmp(struct number *n, struct number *nn)
{
	if (n->n_number > nn->n_number)
		return (1);
	else if (n->n_number < nn->n_number)
		return (-1);
	return (0);
}

SLIST_MERGESORT_PROTOTYPE_STATIC(NHEAD, number, n_entry)
SLIST_MERGESORT_GENERATE_STATIC(NHEAD, number, n_entry, number_cmp)

int
main(int argc, char *argv[])
{
	struct	 number *n;
	int	 i;
Esempio n. 10
0
static u_int ifmib_reg;
static u_int ipmib_reg;
static u_int tcpmib_reg;
static u_int udpmib_reg;
static u_int ipForward_reg;

/*****************************/

/* list of all IP addresses */
struct mibifa_list mibifa_list = TAILQ_HEAD_INITIALIZER(mibifa_list);

/* list of all interfaces */
struct mibif_list mibif_list = TAILQ_HEAD_INITIALIZER(mibif_list);

/* list of dynamic interface names */
struct mibdynif_list mibdynif_list = SLIST_HEAD_INITIALIZER(mibdynif_list);

/* list of all interface index mappings */
struct mibindexmap_list mibindexmap_list = STAILQ_HEAD_INITIALIZER(mibindexmap_list);

/* list of all stacking entries */
struct mibifstack_list mibifstack_list = TAILQ_HEAD_INITIALIZER(mibifstack_list);

/* list of all receive addresses */
struct mibrcvaddr_list mibrcvaddr_list = TAILQ_HEAD_INITIALIZER(mibrcvaddr_list);

/* list of all NetToMedia entries */
struct mibarp_list mibarp_list = TAILQ_HEAD_INITIALIZER(mibarp_list);

/* number of interfaces */
int32_t mib_if_number;
Esempio n. 11
0
STAILQ_HEAD(sym_head, sym_entry);

struct sym_entry {
	char		*name;
	GElf_Sym	*sym;
	STAILQ_ENTRY(sym_entry) sym_entries;
};

typedef int (*fn_sort)(const void *, const void *);
typedef void (*fn_elem_print)(char, const char *, const GElf_Sym *, const char *);
typedef void (*fn_sym_print)(const GElf_Sym *);
typedef int (*fn_filter)(char, const GElf_Sym *, const char *);

/* output filter list */
static SLIST_HEAD(filter_head, filter_entry) nm_out_filter =
    SLIST_HEAD_INITIALIZER(nm_out_filter);

struct filter_entry {
	fn_filter	fn;
	SLIST_ENTRY(filter_entry) filter_entries;
};

struct sym_print_data {
	struct sym_head	*headp;
	size_t		sh_num, list_num;
	const char	*t_table, **s_table, *filename, *objname;
};

struct nm_prog_info {
	const char	*name;
	const char	*def_filename;
Esempio n. 12
0
#include <sys/param.h>
#include <sys/mman.h>

#include <errno.h>
#include <pthread.h>
#include <stdint.h>
#include <stdlib.h>
#include <unistd.h>

#include "rthread.h"

/*
 * Follow uthread's example and keep around stacks that have default
 * attributes for possible reuse.
 */
static SLIST_HEAD(, stack) def_stacks = SLIST_HEAD_INITIALIZER(head);
static struct _spinlock def_stacks_lock = _SPINLOCK_UNLOCKED;

struct stack *
_rthread_alloc_stack(pthread_t thread)
{
	struct stack *stack;
	u_int32_t rnd;
	caddr_t base;
	caddr_t guard;
	size_t size;
	size_t guardsize;

	/* if the request uses the defaults, try to reuse one */
	if (thread->attr.stack_addr == NULL &&
	    thread->attr.stack_size == RTHREAD_STACK_SIZE_DEF &&
Esempio n. 13
0
 * tables it will release all its current tables and wait for some more to
 * be freed. A threads allocated tables are freed each time a TA is
 * unmapped so each thread should be able to allocate the needed tables in
 * turn if needed.
 */

#if defined(CFG_WITH_PAGER) && !defined(CFG_WITH_LPAE)
struct pgt_parent {
	size_t num_used;
	struct pgt_cache pgt_cache;
};

static struct pgt_parent pgt_parents[PGT_CACHE_SIZE / PGT_NUM_PGT_PER_PAGE];
#else

static struct pgt_cache pgt_free_list = SLIST_HEAD_INITIALIZER(pgt_free_list);
#endif

#ifdef CFG_PAGED_USER_TA
/*
 * When a user TA context is temporarily unmapped the used struct pgt's of
 * the context (page tables holding valid physical pages) are saved in this
 * cache in the hope that some of the valid physical pages may still be
 * valid when the context is mapped again.
 */
static struct pgt_cache pgt_cache_list = SLIST_HEAD_INITIALIZER(pgt_cache_list);
#endif

static struct pgt pgt_entries[PGT_CACHE_SIZE];

static struct mutex pgt_mu = MUTEX_INITIALIZER;
Esempio n. 14
0
#include <machine/bus.h>
#include <sys/rman.h>
#include <machine/resource.h>
#include <machine/stdarg.h>

#include <dev/uart/uart.h>
#include <dev/uart/uart_bus.h>
#include <dev/uart/uart_cpu.h>

#include "uart_if.h"

devclass_t uart_devclass;
char uart_driver_name[] = "uart";

SLIST_HEAD(uart_devinfo_list, uart_devinfo) uart_sysdevs =
    SLIST_HEAD_INITIALIZER(uart_sysdevs);

static MALLOC_DEFINE(M_UART, "UART", "UART driver");

#ifndef	UART_POLL_FREQ
#define	UART_POLL_FREQ		50
#endif
static int uart_poll_freq = UART_POLL_FREQ;
TUNABLE_INT("debug.uart_poll_freq", &uart_poll_freq);

void
uart_add_sysdev(struct uart_devinfo *di)
{
	SLIST_INSERT_HEAD(&uart_sysdevs, di, next);
}
Esempio n. 15
0
#define MOCKED_LIFX_GATEWAY_SEND_TO_SITE
#define MOCKED_LIFX_GATEWAY_ALLOCATE_TAG_ID
#include "mock_gateway.h"
#include "mock_event2.h"
#include "mock_timer.h"
#include "tests_utils.h"

#define MOCKED_ROUTER_TARGETS_TO_DEVICES
#define MOCKED_ROUTER_SEND_TO_DEVICE
#define MOCKED_ROUTER_DEVICE_LIST_FREE
#include "tests_proto_utils.h"

#define FAKE_TARGET_LIST (void *)0x2a

static struct lgtd_router_device_list devices =
    SLIST_HEAD_INITIALIZER(&devices);

static bool send_to_device_called = false;

void
lgtd_router_send_to_device(struct lgtd_lifx_bulb *bulb,
                           enum lgtd_lifx_packet_type pkt_type,
                           void *pkt)
{
    if (send_to_device_called) {
        errx(1, "lgtd_router_send_to_device should have been called once only");
    }

    if (!bulb) {
        errx(1, "lgtd_router_send_to_device must be called with a bulb");
    }
Esempio n. 16
0
/* $Id: diskfs.c,v 1.1.1.1 2006/09/14 01:59:08 root Exp $ */

#include <stdio.h>
#include <string.h>
#include <termio.h>
#include <fcntl.h>
#include <file.h>
#include <ctype.h>
#include <diskfs.h>
#include <sys/unistd.h>
#include <stdlib.h>
#undef _KERNEL
#include <errno.h>
#include <pmon.h>

SLIST_HEAD(DiskFileSystems,DiskFileSystem)DiskFileSystems=SLIST_HEAD_INITIALIZER(DiskFileSystems);

static int diskfs_open (int , const char *, int, int);
static int diskfs_close (int);
static int diskfs_read (int, void *, size_t);
static int diskfs_write (int, const void *, size_t);
static off_t diskfs_lseek (int, off_t, int);

/*
 * Supported paths:
 *	/dev/fs/msdos@wd0/bsd
 *	/dev/fs/iso9660@cd0/bsd
 */


static int
Esempio n. 17
0
#include <err.h>
#include <errno.h>
#include <nv.h>
#include <signal.h>
#include <stdarg.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>

/*
 * The only function allocating space
 * for struct sandbox is startChild().
 */

/* head of singly-linked list. */
SLIST_HEAD(slisthead, sandbox) sandboxes = SLIST_HEAD_INITIALIZER(sandboxes);

struct sandbox {
	void * dataptr;	/* Pointer to the data structure of the lib */
	int pd;				/* Process descriptor */
	int socket;			/* Socket we have to pass the data through */
	SLIST_ENTRY(sandbox)	next;	/* Singly-linked list. */
};

void startSandbox(void *data);
void stopSandbox(void *ptr);
void startNullSandbox(void);
struct sandbox * findSandbox(void *ptr);
struct sandbox *startChild(void *data);
void killChild(void);
void suicide(int signal);
Esempio n. 18
0
static int rpc_gss_svc_getcred(struct svc_req *, struct ucred **, int *);

static struct svc_auth_ops svc_auth_gss_ops = {
	svc_rpc_gss_wrap,
	svc_rpc_gss_unwrap,
	svc_rpc_gss_release,
};

struct sx svc_rpc_gss_lock;

struct svc_rpc_gss_callback {
	SLIST_ENTRY(svc_rpc_gss_callback) cb_link;
	rpc_gss_callback_t	cb_callback;
};
static SLIST_HEAD(svc_rpc_gss_callback_list, svc_rpc_gss_callback)
	svc_rpc_gss_callbacks = SLIST_HEAD_INITIALIZER(svc_rpc_gss_callbacks);

struct svc_rpc_gss_svc_name {
	SLIST_ENTRY(svc_rpc_gss_svc_name) sn_link;
	char			*sn_principal;
	gss_OID			sn_mech;
	u_int			sn_req_time;
	gss_cred_id_t		sn_cred;
	u_int			sn_program;
	u_int			sn_version;
};
static SLIST_HEAD(svc_rpc_gss_svc_name_list, svc_rpc_gss_svc_name)
	svc_rpc_gss_svc_names = SLIST_HEAD_INITIALIZER(svc_rpc_gss_svc_names);

enum svc_rpc_gss_client_state {
	CLIENT_NEW,				/* still authenticating */
Esempio n. 19
0
#endif

MALLOC_DEFINE(M_PCPU, "Per-cpu", "Per-cpu resource accouting.");

struct dpcpu_free {
	uintptr_t	df_start;
	int		df_len;
	TAILQ_ENTRY(dpcpu_free) df_link;
};

static DPCPU_DEFINE(char, modspace[DPCPU_MODMIN]);
static TAILQ_HEAD(, dpcpu_free) dpcpu_head = TAILQ_HEAD_INITIALIZER(dpcpu_head);
static struct sx dpcpu_lock;
uintptr_t dpcpu_off[MAXCPU];
struct pcpu *cpuid_to_pcpu[MAXCPU];
struct cpuhead cpuhead = SLIST_HEAD_INITIALIZER(cpuhead);

/*
 * Initialize the MI portions of a struct pcpu.
 */
void
pcpu_init(struct pcpu *pcpu, int cpuid, size_t size)
{

	bzero(pcpu, size);
	KASSERT(cpuid >= 0 && cpuid < MAXCPU,
	    ("pcpu_init: invalid cpuid %d", cpuid));
	pcpu->pc_cpuid = cpuid;
	pcpu->pc_cpumask = 1 << cpuid;
	cpuid_to_pcpu[cpuid] = pcpu;
	SLIST_INSERT_HEAD(&cpuhead, pcpu, pc_allcpu);
Esempio n. 20
0
	STAILQ_HEAD_INITIALIZER(csock_bufs);

/*
 * We dispatch unsolicieted messages by node cookies and ids.
 * So we must keep a list of hook names and dispatch functions.
 */
struct msgreg {
	u_int32_t 	cookie;
	ng_ID_t		id;
	ng_cookie_f	*func;
	void		*arg;
	const struct lmodule *mod;
	SLIST_ENTRY(msgreg) link;
};
static SLIST_HEAD(, msgreg) msgreg_list =
	SLIST_HEAD_INITIALIZER(msgreg_list);

/*
 * Data messages are dispatched by hook names.
 */
struct datareg {
	char		hook[NG_HOOKSIZ];
	ng_hook_f	*func;
	void		*arg;
	const struct lmodule *mod;
	SLIST_ENTRY(datareg) link;
};
static SLIST_HEAD(, datareg) datareg_list =
	SLIST_HEAD_INITIALIZER(datareg_list);

/* the netgraph sockets */
#include "mock_event2.h"
#include "mock_log.h"
#include "mock_timer.h"
#include "mock_wire_proto.h"
#include "tests_utils.h"

#define MOCKED_CLIENT_SEND_ERROR
#define MOCKED_ROUTER_TARGETS_TO_DEVICES
#define MOCKED_ROUTER_SEND_TO_DEVICE
#define MOCKED_ROUTER_DEVICE_LIST_FREE
#include "tests_proto_utils.h"

#define FAKE_TARGET_LIST (void *)0x2a

static struct lgtd_router_device_list devices =
    SLIST_HEAD_INITIALIZER(&devices);
static struct lgtd_router_device_list device_1_only =
    SLIST_HEAD_INITIALIZER(&device_1_only);

static bool client_send_error_called = false;

void
lgtd_client_send_error(struct lgtd_client *client,
                       enum lgtd_client_error_code error,
                       const char *msg)
{
    if (!client) {
        errx(1, "client_send_error called without a client");
    }

    if (!error) {
Esempio n. 22
0
#include <sys/types.h>

#include <fcntl.h>
#include <string.h>
#include <unistd.h>

#include "tmux.h"

/*
 * Job scheduling. Run queued commands in the background and record their
 * output.
 */

/* All jobs list. */
struct joblist	all_jobs = SLIST_HEAD_INITIALIZER(&all_jobs);

RB_GENERATE(jobs, job, entry, job_cmp);

int
job_cmp(struct job *job1, struct job *job2)
{
	return (strcmp(job1->cmd, job2->cmd));
}

/* Initialise job tree. */
void
job_tree_init(struct jobs *jobs)
{
	RB_INIT(jobs);
}
Esempio n. 23
0
#include <sys/module.h>
#include <sys/mutex.h>
#include <sys/protosw.h>
#include <sys/sysctl.h>
#include <sys/socket.h>
#include <sys/socketvar.h>
#include <sys/queue.h>

static struct mtx accept_filter_mtx;
MTX_SYSINIT(accept_filter, &accept_filter_mtx, "accept_filter_mtx",
	MTX_DEF);
#define	ACCEPT_FILTER_LOCK()	mtx_lock(&accept_filter_mtx)
#define	ACCEPT_FILTER_UNLOCK()	mtx_unlock(&accept_filter_mtx)

static SLIST_HEAD(, accept_filter) accept_filtlsthd =
	SLIST_HEAD_INITIALIZER(accept_filtlsthd);

MALLOC_DEFINE(M_ACCF, "accf", "accept filter data");

static int unloadable = 0;

SYSCTL_DECL(_net_inet);	/* XXX: some header should do this for me */
SYSCTL_NODE(_net_inet, OID_AUTO, accf, CTLFLAG_RW, 0, "Accept filters");
SYSCTL_INT(_net_inet_accf, OID_AUTO, unloadable, CTLFLAG_RW, &unloadable, 0,
	"Allow unload of accept filters (not recommended)");

/*
 * Must be passed a malloc'd structure so we don't explode if the kld is
 * unloaded, we leak the struct on deallocation to deal with this, but if a
 * filter is loaded with the same name as a leaked one we re-use the entry.
 */
Esempio n. 24
0
#define debugf(fmt, args...) do { printf("%s(): ", __func__);	\
    printf(fmt,##args); } while (0)
#else
#define debugf(fmt, args...)
#endif

#define FDT_COMPAT_LEN	255
#define FDT_TYPE_LEN	64

#define FDT_REG_CELLS	4

vm_paddr_t fdt_immr_pa;
vm_offset_t fdt_immr_va;
vm_offset_t fdt_immr_size;

struct fdt_ic_list fdt_ic_list_head = SLIST_HEAD_INITIALIZER(fdt_ic_list_head);

static int
fdt_get_range_by_busaddr(phandle_t node, u_long addr, u_long *base,
    u_long *size)
{
	pcell_t ranges[32], *rangesptr;
	pcell_t addr_cells, size_cells, par_addr_cells;
	u_long bus_addr, par_bus_addr, pbase, psize;
	int err, i, len, tuple_size, tuples;

	if (node == 0) {
		*base = 0;
		*size = ULONG_MAX;
		return (0);
	}
Esempio n. 25
0
static MALLOC_DEFINE(M_DEVT, "cdev", "cdev storage");

struct mtx devmtx;
static void destroy_devl(struct cdev *dev);
#ifndef __rtems__
static int destroy_dev_sched_cbl(struct cdev *dev,
    void (*cb)(void *), void *arg);
#endif /* __rtems__ */
static int make_dev_credv(int flags, struct cdev **dres, struct cdevsw *devsw,
    int unit, struct ucred *cr, uid_t uid, gid_t gid, int mode, const char *fmt,
    va_list ap);

static struct cdev_priv_list cdevp_free_list =
    TAILQ_HEAD_INITIALIZER(cdevp_free_list);
static SLIST_HEAD(free_cdevsw, cdevsw) cdevsw_gt_post_list =
    SLIST_HEAD_INITIALIZER(cdevsw_gt_post_list);

void
dev_lock(void)
{

	mtx_lock(&devmtx);
}

/*
 * Free all the memory collected while the cdev mutex was
 * locked. Since devmtx is after the system map mutex, free() cannot
 * be called immediately and is postponed until cdev mutex can be
 * dropped.
 */
static void
Esempio n. 26
0
File: tags.c Progetto: hackalog/mg
struct ctag {
	RB_ENTRY(ctag) entry;
	char *tag;
	char *fname;
	char *pat;
};
RB_HEAD(tagtree, ctag) tags = RB_INITIALIZER(&tags);
RB_GENERATE(tagtree, ctag, entry, ctagcmp);

struct tagpos {
	SLIST_ENTRY(tagpos) entry;
	int    doto;
	int    dotline;
	char   *bname;
};
SLIST_HEAD(tagstack, tagpos) shead = SLIST_HEAD_INITIALIZER(shead);

int
ctagcmp(struct ctag *s, struct ctag *t)
{
	return strcmp(s->tag, t->tag);
}

/*
 * Record the filename that contain tags to be used while loading them
 * on first use. If a filename is already recorded, ask user to retain
 * already loaded tags (if any) and unload them if user chooses not to.
 */
/* ARGSUSED */
int
tagsvisit(int f, int n)
Esempio n. 27
0
#include "makefs.h"

#define	IS_DOT(nm)	((nm)[0] == '.' && (nm)[1] == '\0')
#define	IS_DOTDOT(nm)	((nm)[0] == '.' && (nm)[1] == '.' && (nm)[2] == '\0')

struct mtree_fileinfo {
	SLIST_ENTRY(mtree_fileinfo) next;
	FILE *fp;
	const char *name;
	u_int line;
};

/* Global state used while parsing. */
static SLIST_HEAD(, mtree_fileinfo) mtree_fileinfo =
    SLIST_HEAD_INITIALIZER(mtree_fileinfo);
static fsnode *mtree_root;
static fsnode *mtree_current;
static fsnode mtree_global;
static fsinode mtree_global_inode;
static u_int errors, warnings;

static void mtree_error(const char *, ...) __printflike(1, 2);
static void mtree_warning(const char *, ...) __printflike(1, 2);

static int
mtree_file_push(const char *name, FILE *fp)
{
	struct mtree_fileinfo *fi;

	fi = malloc(sizeof(*fi));
Esempio n. 28
0
File: xbd.c Progetto: MarginC/kame
	} _link;
	struct xbdreq		*xr_parent;	/* ptr. to parent xbdreq */
	struct buf		*xr_bp;		/* ptr. to original I/O buf */
	daddr_t			xr_bn;		/* block no. to process */
	long			xr_bqueue;	/* bytes left to queue */
	long			xr_bdone;	/* bytes left */
	vaddr_t			xr_data;	/* ptr. to data to be proc. */
	vaddr_t			xr_aligned;	/* ptr. to aligned data */
	long			xr_breq;	/* bytes in this req. */
	struct xbd_softc	*xr_sc;		/* ptr. to xbd softc */
};
#define	xr_unused	_link._unused
#define	xr_suspended	_link._suspended

SLIST_HEAD(,xbdreq) xbdreqs =
	SLIST_HEAD_INITIALIZER(xbdreqs);
static SIMPLEQ_HEAD(, xbdreq) xbdr_suspended =
	SIMPLEQ_HEAD_INITIALIZER(xbdr_suspended);

#define	CANGET_XBDREQ() (!SLIST_EMPTY(&xbdreqs))

#define	GET_XBDREQ(_xr) do {				\
	(_xr) = SLIST_FIRST(&xbdreqs);			\
	if (__predict_true(_xr))			\
		SLIST_REMOVE_HEAD(&xbdreqs, xr_unused);	\
} while (/*CONSTCOND*/0)

#define	PUT_XBDREQ(_xr) do {				\
	DEBUG_MARK_UNUSED(_xr);				\
	SLIST_INSERT_HEAD(&xbdreqs, _xr, xr_unused);	\
} while (/*CONSTCOND*/0)
Esempio n. 29
0
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <timeconv.h>

#include "dump.h"

struct dumptime {
	struct	dumpdates dt_value;
	SLIST_ENTRY(dumptime) dt_list;
};
SLIST_HEAD(dthead, dumptime) dthead = SLIST_HEAD_INITIALIZER(dthead);
struct	dumpdates **ddatev = 0;
int	nddates = 0;

static	void dumprecout(FILE *, const struct dumpdates *);
static	int getrecord(FILE *, struct dumpdates *);
static	int makedumpdate(struct dumpdates *, const char *);
static	void readdumptimes(FILE *);

void
initdumptimes(void)
{
	FILE *df;

	if ((df = fopen(dumpdates, "r")) == NULL) {
		if (errno != ENOENT) {
Esempio n. 30
0
static int dev_ioctl(file_t * file, unsigned request,
                     void * arg, size_t arg_len);

vnode_ops_t devfs_vnode_ops = {
    .read = dev_read,
    .write = dev_write,
    .lseek = dev_lseek,
    .ioctl = dev_ioctl,
    .event_fd_created = devfs_event_fd_created,
    .event_fd_closed = devfs_event_fd_closed,
};

static fs_t devfs_fs = {
    .fsname = DEVFS_FSNAME,
    .mount = devfs_mount,
    .sblist_head = SLIST_HEAD_INITIALIZER(),
};

/* There is only one devfs, but it can be mounted multiple times */
vnode_t * vn_devfs;

static int devfs_delete_vnode(vnode_t * vnode);

int __kinit__ devfs_init(void)
{
    struct fs_superblock * sb;

    SUBSYS_DEP(ramfs_init);
    SUBSYS_INIT("devfs");

    FS_GIANT_INIT(&devfs_fs.fs_giant);