Blame


1 89fd757a 2019-02-07 stsp /* $OpenBSD: worklist.h,v 1.4 2015/01/16 06:40:11 deraadt Exp $ */
2 89fd757a 2019-02-07 stsp /*
3 89fd757a 2019-02-07 stsp * Copyright (c) 2006 Joris Vink <joris@openbsd.org>
4 89fd757a 2019-02-07 stsp * All rights reserved.
5 89fd757a 2019-02-07 stsp *
6 89fd757a 2019-02-07 stsp * Redistribution and use in source and binary forms, with or without
7 89fd757a 2019-02-07 stsp * modification, are permitted provided that the following conditions
8 89fd757a 2019-02-07 stsp * are met:
9 89fd757a 2019-02-07 stsp *
10 89fd757a 2019-02-07 stsp * 1. Redistributions of source code must retain the above copyright
11 89fd757a 2019-02-07 stsp * notice, this list of conditions and the following disclaimer.
12 89fd757a 2019-02-07 stsp * 2. The name of the author may not be used to endorse or promote products
13 89fd757a 2019-02-07 stsp * derived from this software without specific prior written permission.
14 89fd757a 2019-02-07 stsp *
15 89fd757a 2019-02-07 stsp * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
16 89fd757a 2019-02-07 stsp * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
17 89fd757a 2019-02-07 stsp * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
18 89fd757a 2019-02-07 stsp * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19 89fd757a 2019-02-07 stsp * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20 89fd757a 2019-02-07 stsp * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
21 89fd757a 2019-02-07 stsp * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
22 89fd757a 2019-02-07 stsp * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
23 89fd757a 2019-02-07 stsp * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
24 89fd757a 2019-02-07 stsp * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 89fd757a 2019-02-07 stsp */
26 89fd757a 2019-02-07 stsp
27 89fd757a 2019-02-07 stsp #ifndef WORKLIST_H
28 89fd757a 2019-02-07 stsp #define WORKLIST_H
29 89fd757a 2019-02-07 stsp
30 89fd757a 2019-02-07 stsp #include <sys/types.h>
31 89fd757a 2019-02-07 stsp #include <limits.h>
32 89fd757a 2019-02-07 stsp
33 89fd757a 2019-02-07 stsp struct worklist {
34 89fd757a 2019-02-07 stsp char wkl_path[PATH_MAX];
35 89fd757a 2019-02-07 stsp volatile SLIST_ENTRY(worklist) wkl_list;
36 89fd757a 2019-02-07 stsp };
37 89fd757a 2019-02-07 stsp
38 89fd757a 2019-02-07 stsp SLIST_HEAD(wklhead, worklist);
39 89fd757a 2019-02-07 stsp
40 f54c4c24 2019-02-08 stsp const struct got_error *worklist_add(const char *, struct wklhead *);
41 89fd757a 2019-02-07 stsp void worklist_run(struct wklhead *, void (*cb)(struct worklist *));
42 89fd757a 2019-02-07 stsp void worklist_clean(struct wklhead *, void (*cb)(struct worklist *));
43 89fd757a 2019-02-07 stsp
44 89fd757a 2019-02-07 stsp void worklist_unlink(struct worklist *);
45 89fd757a 2019-02-07 stsp
46 89fd757a 2019-02-07 stsp #endif