From owner-svn-src-all@FreeBSD.ORG Wed Dec 25 01:52:56 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 25005212; Wed, 25 Dec 2013 01:52:56 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 107781485; Wed, 25 Dec 2013 01:52:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBP1qtQl080352; Wed, 25 Dec 2013 01:52:55 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBP1qtlY080350; Wed, 25 Dec 2013 01:52:55 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201312250152.rBP1qtlY080350@svn.freebsd.org> From: Gleb Smirnoff Date: Wed, 25 Dec 2013 01:52:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r259856 - head/sys/netinet/libalias X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Dec 2013 01:52:56 -0000 Author: glebius Date: Wed Dec 25 01:52:55 2013 New Revision: 259856 URL: http://svnweb.freebsd.org/changeset/base/259856 Log: Whitespace cleanup. Modified: head/sys/netinet/libalias/alias_mod.c head/sys/netinet/libalias/alias_mod.h Modified: head/sys/netinet/libalias/alias_mod.c ============================================================================== --- head/sys/netinet/libalias/alias_mod.c Wed Dec 25 01:20:14 2013 (r259855) +++ head/sys/netinet/libalias/alias_mod.c Wed Dec 25 01:52:55 2013 (r259856) @@ -56,15 +56,15 @@ LIST_HEAD(handler_chain, proto_handler) #ifdef _KERNEL struct rwlock handler_rw; #endif -SLIST_HEAD(dll_chain, dll) dll_chain = SLIST_HEAD_INITIALIZER(dll_chain); +SLIST_HEAD(dll_chain, dll) dll_chain = SLIST_HEAD_INITIALIZER(dll_chain); #ifdef _KERNEL #define LIBALIAS_RWLOCK_INIT() \ - rw_init(&handler_rw, "Libalias_modules_rwlock") + rw_init(&handler_rw, "Libalias_modules_rwlock") #define LIBALIAS_RWLOCK_DESTROY() rw_destroy(&handler_rw) #define LIBALIAS_WLOCK_ASSERT() \ - rw_assert(&handler_rw, RA_WLOCKED) + rw_assert(&handler_rw, RA_WLOCKED) static __inline void LIBALIAS_RLOCK(void) @@ -116,7 +116,7 @@ _handler_chain_destroy(void) #define LIBALIAS_WUNLOCK() ; #define _handler_chain_init() ; #define _handler_chain_destroy() ; -#endif +#endif void handler_chain_init(void) @@ -138,7 +138,7 @@ _attach_handler(struct proto_handler *p) LIBALIAS_WLOCK_ASSERT(); b = NULL; LIST_FOREACH(b, &handler_chain, entries) { - if ((b->pri == p->pri) && + if ((b->pri == p->pri) && (b->dir == p->dir) && (b->proto == p->proto)) return (EEXIST); /* Priority conflict. */ @@ -160,7 +160,7 @@ _detach_handler(struct proto_handler *p) { struct proto_handler *b, *b_tmp; - LIBALIAS_WLOCK_ASSERT(); + LIBALIAS_WLOCK_ASSERT(); LIST_FOREACH_SAFE(b, &handler_chain, entries, b_tmp) { if (b == p) { LIST_REMOVE(b, entries); @@ -178,10 +178,10 @@ LibAliasAttachHandlers(struct proto_hand LIBALIAS_WLOCK(); error = -1; for (i = 0; 1; i++) { - if (*((int *)&_p[i]) == EOH) + if (*((int *)&_p[i]) == EOH) break; error = _attach_handler(&_p[i]); - if (error != 0) + if (error != 0) break; } LIBALIAS_WUNLOCK(); @@ -196,10 +196,10 @@ LibAliasDetachHandlers(struct proto_hand LIBALIAS_WLOCK(); error = -1; for (i = 0; 1; i++) { - if (*((int *)&_p[i]) == EOH) + if (*((int *)&_p[i]) == EOH) break; error = _detach_handler(&_p[i]); - if (error != 0) + if (error != 0) break; } LIBALIAS_WUNLOCK(); @@ -219,7 +219,7 @@ detach_handler(struct proto_handler *_p) } int -find_handler(int8_t dir, int8_t proto, struct libalias *la, __unused struct ip *pip, +find_handler(int8_t dir, int8_t proto, struct libalias *la, __unused struct ip *pip, struct alias_data *ad) { struct proto_handler *p; @@ -235,14 +235,14 @@ find_handler(int8_t dir, int8_t proto, s } } LIBALIAS_RUNLOCK(); - return (error); + return (error); } struct proto_handler * first_handler(void) { - - return (LIST_FIRST(&handler_chain)); + + return (LIST_FIRST(&handler_chain)); } /* Dll manipulation code - this code is not thread safe... */ @@ -270,7 +270,7 @@ detach_dll(char *p) error = NULL; SLIST_FOREACH_SAFE(b, &dll_chain, next, b_tmp) if (!strncmp(b->name, p, DLL_LEN)) { - SLIST_REMOVE(&dll_chain, b, dll, next); + SLIST_REMOVE(&dll_chain, b, dll, next); error = b; break; } Modified: head/sys/netinet/libalias/alias_mod.h ============================================================================== --- head/sys/netinet/libalias/alias_mod.h Wed Dec 25 01:20:14 2013 (r259855) +++ head/sys/netinet/libalias/alias_mod.h Wed Dec 25 01:52:55 2013 (r259856) @@ -45,102 +45,94 @@ MALLOC_DECLARE(M_ALIAS); #endif #endif -/* Protocol handlers struct & function. */ - /* Packet flow direction. */ -#define IN 1 -#define OUT 2 +#define IN 1 +#define OUT 2 /* Working protocol. */ -#define IP 1 -#define TCP 2 -#define UDP 4 +#define IP 1 +#define TCP 2 +#define UDP 4 -/* +/* * Data passed to protocol handler module, it must be filled * right before calling find_handler() to determine which * module is elegible to be called. */ +struct alias_data { + struct alias_link *lnk; + struct in_addr *oaddr; /* Original address. */ + struct in_addr *aaddr; /* Alias address. */ + uint16_t *aport; /* Alias port. */ + uint16_t *sport, *dport; /* Source & destination port */ + uint16_t maxpktsize; /* Max packet size. */ +}; -struct alias_data { - struct alias_link *lnk; - struct in_addr *oaddr; /* Original address. */ - struct in_addr *aaddr; /* Alias address. */ - uint16_t *aport; /* Alias port. */ - uint16_t *sport, *dport; /* Source & destination port */ - uint16_t maxpktsize; /* Max packet size. */ -}; - -/* +/* * This structure contains all the information necessary to make * a protocol handler correctly work. */ - struct proto_handler { - u_int pri; /* Handler priority. */ - int16_t dir; /* Flow direction. */ - uint8_t proto; /* Working protocol. */ - int (*fingerprint)(struct libalias *, /* Fingerprint * function. */ - struct alias_data *); - int (*protohandler)(struct libalias *, /* Aliasing * function. */ - struct ip *, struct alias_data *); + u_int pri; /* Handler priority. */ + int16_t dir; /* Flow direction. */ + uint8_t proto; /* Working protocol. */ + /* Fingerprint * function. */ + int (*fingerprint)(struct libalias *, struct alias_data *); + /* Aliasing * function. */ + int (*protohandler)(struct libalias *, struct ip *, + struct alias_data *); LIST_ENTRY(proto_handler) entries; }; - -/* +/* * Used only in userland when libalias needs to keep track of all * module loaded. In kernel land (kld mode) we don't need to care * care about libalias modules cause it's kld to do it for us. */ - -#define DLL_LEN 32 -struct dll { - char name[DLL_LEN]; /* Name of module. */ - void *handle; /* - * Ptr to shared obj obtained through - * dlopen() - use this ptr to get access - * to any symbols from a loaded module - * via dlsym(). - */ - SLIST_ENTRY(dll) next; +#define DLL_LEN 32 +struct dll { + char name[DLL_LEN]; /* Name of module. */ + void *handle; /* + * Ptr to shared obj obtained through + * dlopen() - use this ptr to get access + * to any symbols from a loaded module + * via dlsym(). + */ + SLIST_ENTRY(dll) next; }; /* Functions used with protocol handlers. */ - -void handler_chain_init(void); -void handler_chain_destroy(void); -int LibAliasAttachHandlers(struct proto_handler *); -int LibAliasDetachHandlers(struct proto_handler *); -int detach_handler(struct proto_handler *); -int find_handler(int8_t, int8_t, struct libalias *, - struct ip *, struct alias_data *); +void handler_chain_init(void); +void handler_chain_destroy(void); +int LibAliasAttachHandlers(struct proto_handler *); +int LibAliasDetachHandlers(struct proto_handler *); +int detach_handler(struct proto_handler *); +int find_handler(int8_t, int8_t, struct libalias *, struct ip *, + struct alias_data *); struct proto_handler *first_handler(void); /* Functions used with dll module. */ - -void dll_chain_init(void); -void dll_chain_destroy(void); -int attach_dll(struct dll *); -void *detach_dll(char *); -struct dll *walk_dll_chain(void); +void dll_chain_init(void); +void dll_chain_destroy(void); +int attach_dll(struct dll *); +void *detach_dll(char *); +struct dll *walk_dll_chain(void); /* End of handlers. */ #define EOH -1 -/* +/* * Some defines borrowed from sys/module.h used to compile a kld * in userland as a shared lib. */ - #ifndef _KERNEL typedef enum modeventtype { - MOD_LOAD, - MOD_UNLOAD, - MOD_SHUTDOWN, - MOD_QUIESCE + MOD_LOAD, + MOD_UNLOAD, + MOD_SHUTDOWN, + MOD_QUIESCE } modeventtype_t; - + typedef struct module *module_t; typedef int (*modeventhand_t)(module_t, int /* modeventtype_t */, void *); @@ -148,10 +140,10 @@ typedef int (*modeventhand_t)(module_t, * Struct for registering modules statically via SYSINIT. */ typedef struct moduledata { - const char *name; /* module name */ - modeventhand_t evhand; /* event handler */ - void *priv; /* extra data */ + const char *name; /* module name */ + modeventhand_t evhand; /* event handler */ + void *priv; /* extra data */ } moduledata_t; #endif -#endif /* !_ALIAS_MOD_H_ */ +#endif /* !_ALIAS_MOD_H_ */