Commit 72ff44d0 authored by Tycho Andersen's avatar Tycho Andersen Committed by Pavel Emelyanov

usernsd: move MAX_MSG_SIZE to namespaces.h

We'll use this size in the next patch to avoid having to do some dynamic
allocation.

v2: call it MAX_UNSFD_MSG_SIZE instead
v3: fix all uses of MAX_MSG_SIZE :)
Signed-off-by: 's avatarTycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 459fb8b7
...@@ -95,6 +95,8 @@ typedef int (*uns_call_t)(void *arg, int fd); ...@@ -95,6 +95,8 @@ typedef int (*uns_call_t)(void *arg, int fd);
*/ */
#define UNS_FDOUT 0x2 #define UNS_FDOUT 0x2
#define MAX_UNSFD_MSG_SIZE 256
/* /*
* When we're restoring inside user namespace, some things are * When we're restoring inside user namespace, some things are
* not allowed to be done there due to insufficient capabilities. * not allowed to be done there due to insufficient capabilities.
......
...@@ -849,8 +849,6 @@ struct unsc_msg { ...@@ -849,8 +849,6 @@ struct unsc_msg {
char c[CMSG_SPACE(sizeof(int))]; char c[CMSG_SPACE(sizeof(int))];
}; };
#define MAX_MSG_SIZE 256
static int usernsd_pid; static int usernsd_pid;
static inline void unsc_msg_init(struct unsc_msg *m, uns_call_t *c, static inline void unsc_msg_init(struct unsc_msg *m, uns_call_t *c,
...@@ -910,7 +908,7 @@ static int usernsd(int sk) ...@@ -910,7 +908,7 @@ static int usernsd(int sk)
while (1) { while (1) {
struct unsc_msg um; struct unsc_msg um;
static char msg[MAX_MSG_SIZE]; static char msg[MAX_UNSFD_MSG_SIZE];
uns_call_t call; uns_call_t call;
int flags, fd, ret; int flags, fd, ret;
...@@ -977,7 +975,7 @@ int userns_call(uns_call_t call, int flags, ...@@ -977,7 +975,7 @@ int userns_call(uns_call_t call, int flags,
bool async = flags & UNS_ASYNC; bool async = flags & UNS_ASYNC;
struct unsc_msg um; struct unsc_msg um;
if (unlikely(arg_size > MAX_MSG_SIZE)) { if (unlikely(arg_size > MAX_UNSFD_MSG_SIZE)) {
pr_err("UNS: message size exceeded\n"); pr_err("UNS: message size exceeded\n");
return -1; return -1;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment