summaryrefslogtreecommitdiff
path: root/patricia.h
blob: 81e0f6af3ec025616a30ad472aef2cafa3a2cfe5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*
 * netsniff-ng - the packet sniffing beast
 * Copyright 2011 Daniel Borkmann, rewritten
 * Copyright 1991-2007 Kawahara Lab., Kyoto University
 * Copyright 2000-2005 Shikano Lab., Nara Institute of Science and Technology
 * Copyright 2005-2007 Julius project team, Nagoya Institute of Technology
 * All rights reserved
 * Subject to the GPL, version 2.
 */

#ifndef PATRICIA_H
#define PATRICIA_H

#include <netinet/in.h>

#include "built_in.h"

struct patricia_node {
	void *key;
	size_t klen;
	struct sockaddr_storage *addr;
	size_t alen;
	union {
		int data;
		int thres_bit;
	} value;
	struct patricia_node *l, *r;
} __cacheline_aligned;

extern int ptree_search_data_nearest(void *str, size_t sstr,
				     struct sockaddr_storage *addr, size_t *alen,
				     struct patricia_node *root);
extern int ptree_search_data_exact(void *str, size_t sstr,
				   struct sockaddr_storage *addr, size_t *alen,
				   struct patricia_node *root);
extern int ptree_add_entry(void *str, size_t sstr, int data,
			   struct sockaddr_storage *addr, size_t alen,
			   struct patricia_node **root);
extern void ptree_del_entry(void *str, size_t sstr,
			    struct patricia_node **root);
extern void ptree_get_key(int data, struct patricia_node *node,
			  struct patricia_node **wanted);
extern void ptree_get_key_addr(struct sockaddr_storage *addr, size_t alen,
			       struct patricia_node *node,
			       struct patricia_node **wanted);
extern void ptree_display(struct patricia_node *node, int level);
extern void ptree_free(struct patricia_node *root);

#endif /* PATRICIA_H */
ts_fs_info *" instead of "struct inode *ptmx_inode" now. NOTE! The "struct pts_fs_info" thing is a completely opaque structure as far as the pty driver is concerned: it's still declared entirely internally to devpts. So the pty code can't actually access it in any way, just pass it as a "cookie" to the devpts code. - the "look up the pts fs info" is now a single clear operation, that also does the reference count increment on the pts superblock. So "devpts_add/del_ref()" is gone, and replaced by a "lookup and get ref" operation (devpts_get_ref(inode)), along with a "put ref" op (devpts_put_ref()). - the pty master "tty->driver_data" field now contains the pts_fs_info, not the ptmx inode. - because we don't care about the ptmx inode any more as some kind of base index, the ref counting can now drop the inode games - it just gets the ref on the superblock. - the pts_fs_info now has a back-pointer to the super_block. That's so that we can easily look up the information we actually need. Although quite often, the pts fs info was actually all we wanted, and not having to look it up based on some magical inode makes things more straightforward. In particular, now that "devpts_get_ref(inode)" operation should really be the *only* place we need to look up what devpts instance we're associated with, and we do it exactly once, at ptmx_open() time. The other side of this is that one ptmx node could now be associated with multiple different devpts instances - you could have a single /dev/ptmx node, and then have multiple mount namespaces with their own instances of devpts mounted on /dev/pts/. And that's all perfectly sane in a model where we just look up the pts instance at open time. This will eventually allow us to get rid of our odd single-vs-multiple pts instance model, but this patch in itself changes no semantics, only an internal binding model. Cc: Eric Biederman <ebiederm@xmission.com> Cc: Peter Anvin <hpa@zytor.com> Cc: Andy Lutomirski <luto@amacapital.net> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Peter Hurley <peter@hurleysoftware.com> Cc: Serge Hallyn <serge.hallyn@ubuntu.com> Cc: Willy Tarreau <w@1wt.eu> Cc: Aurelien Jarno <aurelien@aurel32.net> Cc: Alan Cox <gnomes@lxorguk.ukuu.org.uk> Cc: Jann Horn <jann@thejh.net> Cc: Greg KH <greg@kroah.com> Cc: Jiri Slaby <jslaby@suse.com> Cc: Florian Weimer <fw@deneb.enyo.de> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'Documentation/dcdbas.txt')