From 4230cee9ebf35aff6cbe265d63ba8d10cbf5fb0e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 4 Jan 2014 09:05:04 +0400 Subject: [PATCH] split internal.h into defaults.h and util.h --- bus.h | 2 +- connection.h | 3 ++- defaults.h | 55 ++++++++++++++++++++++++++++++++++++++++++++ endpoint.h | 3 ++- main.c | 3 ++- memfd.c | 1 + memfd.h | 2 -- message.h | 2 +- namespace.c | 3 ++- pool.c | 2 +- internal.h => util.h | 43 ++-------------------------------- 11 files changed, 69 insertions(+), 50 deletions(-) create mode 100644 defaults.h rename internal.h => util.h (75%) diff --git a/bus.h b/bus.h index 1d58b45..5af1712 100644 --- a/bus.h +++ b/bus.h @@ -16,7 +16,7 @@ #include #include -#include "internal.h" +#include "util.h" /** * struct kdbus_bus - bus in a namespace diff --git a/connection.h b/connection.h index 27babdf..7cfcec4 100644 --- a/connection.h +++ b/connection.h @@ -13,7 +13,8 @@ #ifndef __KDBUS_CONNECTION_H #define __KDBUS_CONNECTION_H -#include "internal.h" +#include "defaults.h" +#include "util.h" #include "metadata.h" #include "pool.h" diff --git a/defaults.h b/defaults.h new file mode 100644 index 0000000..50a9b6a --- /dev/null +++ b/defaults.h @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2013 Kay Sievers + * Copyright (C) 2013 Greg Kroah-Hartman + * Copyright (C) 2013 Daniel Mack + * Copyright (C) 2013 Linux Foundation + * + * kdbus is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the + * Free Software Foundation; either version 2.1 of the License, or (at + * your option) any later version. + */ + +#ifndef __KDBUS_DEFAULTS_H +#define __KDBUS_DEFAULTS_H + +/* maximum size of message header and items */ +#define KDBUS_MSG_MAX_SIZE SZ_8K + +/* maximum number of message items */ +#define KDBUS_MSG_MAX_ITEMS 128 + +/* maximum number of passed file descriptors */ +#define KDBUS_MSG_MAX_FDS 256 + +/* maximum message payload size */ +#define KDBUS_MSG_MAX_PAYLOAD_VEC_SIZE SZ_2M + +/* maximum length of well-known bus name */ +#define KDBUS_NAME_MAX_LEN 255 + +/* maximum length of bus, ns, ep name */ +#define KDBUS_MAKE_MAX_LEN 63 + +/* maximum size of make data */ +#define KDBUS_MAKE_MAX_SIZE SZ_32K + +/* maximum size of hello data */ +#define KDBUS_HELLO_MAX_SIZE SZ_32K + +/* maximum size of match data */ +#define KDBUS_MATCH_MAX_SIZE SZ_32K + +/* maximum size of policy data */ +#define KDBUS_POLICY_MAX_SIZE SZ_32K + +/* maximum number of queued messages per connection */ +#define KDBUS_CONN_MAX_MSGS 64 + +/* maximum number of well-known names */ +#define KDBUS_CONN_MAX_NAMES 64 + +/* maximum number of queud requests waiting ot a reply */ +#define KDBUS_CONN_MAX_REQUESTS_PENDING 64 + +#endif diff --git a/endpoint.h b/endpoint.h index 0db1bda..f3a37e2 100644 --- a/endpoint.h +++ b/endpoint.h @@ -13,7 +13,8 @@ #ifndef __KDBUS_EP_H #define __KDBUS_EP_H -#include "internal.h" +#include "defaults.h" +#include "util.h" /* * struct kdbus_endpoint - enpoint to access a bus diff --git a/main.c b/main.c index f7f1e53..b865d15 100644 --- a/main.c +++ b/main.c @@ -18,7 +18,8 @@ #include #include -#include "internal.h" +#include "defaults.h" +#include "util.h" #include "namespace.h" static int __init kdbus_init(void) diff --git a/memfd.c b/memfd.c index 2c08891..2af6291 100644 --- a/memfd.c +++ b/memfd.c @@ -25,6 +25,7 @@ #include #include "memfd.h" +#include "util.h" static const struct file_operations kdbus_memfd_fops; diff --git a/memfd.h b/memfd.h index 7fc327a..3a7b213 100644 --- a/memfd.h +++ b/memfd.h @@ -13,8 +13,6 @@ #ifndef __KDBUS_MEMFD_H #define __KDBUS_MEMFD_H -#include "internal.h" - bool kdbus_is_memfd(const struct file *fp); bool kdbus_is_memfd_sealed(const struct file *fp); u64 kdbus_memfd_size(const struct file *fp); diff --git a/message.h b/message.h index 1fc6f2e..55fa6cf 100644 --- a/message.h +++ b/message.h @@ -13,7 +13,7 @@ #ifndef __KDBUS_MESSAGE_H #define __KDBUS_MESSAGE_H -#include "internal.h" +#include "util.h" #include "metadata.h" /** diff --git a/namespace.c b/namespace.c index a9aa379..836e96f 100644 --- a/namespace.c +++ b/namespace.c @@ -20,9 +20,10 @@ #include #include +#include "defaults.h" +#include "util.h" #include "bus.h" #include "handle.h" -#include "internal.h" #include "namespace.h" /* map of majors to namespaces */ diff --git a/pool.c b/pool.c index 3f5ae36..5f7339e 100644 --- a/pool.c +++ b/pool.c @@ -25,7 +25,7 @@ #include #include -#include "internal.h" +#include "util.h" #include "pool.h" /** diff --git a/internal.h b/util.h similarity index 75% rename from internal.h rename to util.h index 8c1594f..bee27ab 100644 --- a/internal.h +++ b/util.h @@ -10,50 +10,11 @@ * your option) any later version. */ -#ifndef __KDBUS_INTERNAL_H -#define __KDBUS_INTERNAL_H +#ifndef __KDBUS_UTIL_H +#define __KDBUS_UTIL_H #include "kdbus.h" -/* maximum size of message header and items */ -#define KDBUS_MSG_MAX_SIZE SZ_8K - -/* maximum number of message items */ -#define KDBUS_MSG_MAX_ITEMS 128 - -/* maximum number of passed file descriptors */ -#define KDBUS_MSG_MAX_FDS 256 - -/* maximum message payload size */ -#define KDBUS_MSG_MAX_PAYLOAD_VEC_SIZE SZ_2M - -/* maximum length of well-known bus name */ -#define KDBUS_NAME_MAX_LEN 255 - -/* maximum length of bus, ns, ep name */ -#define KDBUS_MAKE_MAX_LEN 63 - -/* maximum size of make data */ -#define KDBUS_MAKE_MAX_SIZE SZ_32K - -/* maximum size of hello data */ -#define KDBUS_HELLO_MAX_SIZE SZ_32K - -/* maximum size of match data */ -#define KDBUS_MATCH_MAX_SIZE SZ_32K - -/* maximum size of policy data */ -#define KDBUS_POLICY_MAX_SIZE SZ_32K - -/* maximum number of queued messages per connection */ -#define KDBUS_CONN_MAX_MSGS 64 - -/* maximum number of well-known names */ -#define KDBUS_CONN_MAX_NAMES 64 - -/* maximum number of queud requests waiting ot a reply */ -#define KDBUS_CONN_MAX_REQUESTS_PENDING 64 - /* all exported addresses are 64 bit */ #define KDBUS_PTR(addr) ((void __user *)(uintptr_t)(addr)) -- 2.34.1