From: Ingo Oeser Fold __scm_send() into scm_send() and remove that interface completly from the kernel. Signed-off-by: Ingo Oeser Signed-off-by: Andrew Morton --- include/net/scm.h | 4 --- net/core/scm.c | 52 ++++++++++++++++++-------------------------- 2 files changed, 23 insertions(+), 33 deletions(-) diff -puN include/net/scm.h~scm-fold-__scm_send-into-scm_send include/net/scm.h --- devel/include/net/scm.h~scm-fold-__scm_send-into-scm_send 2006-03-13 17:27:38.000000000 -0800 +++ devel-akpm/include/net/scm.h 2006-03-13 17:27:38.000000000 -0800 @@ -26,11 +26,9 @@ struct scm_cookie extern void scm_detach_fds(struct msghdr *msg, struct scm_cookie *scm); extern void scm_detach_fds_compat(struct msghdr *msg, struct scm_cookie *scm); -extern int __scm_send(struct socket *sock, struct msghdr *msg, struct scm_cookie *scm); extern void __scm_destroy(struct scm_cookie *scm); extern struct scm_fp_list * scm_fp_dup(struct scm_fp_list *fpl); -extern int scm_send(struct socket *sock, struct msghdr *msg, - struct scm_cookie *scm); +extern int scm_send(struct socket *sock, struct msghdr *msg, struct scm_cookie *scm); extern void scm_recv(struct socket *sock, struct msghdr *msg, struct scm_cookie *scm, int flags); diff -puN net/core/scm.c~scm-fold-__scm_send-into-scm_send net/core/scm.c --- devel/net/core/scm.c~scm-fold-__scm_send-into-scm_send 2006-03-13 17:27:38.000000000 -0800 +++ devel-akpm/net/core/scm.c 2006-03-13 17:31:31.000000000 -0800 @@ -110,13 +110,23 @@ void __scm_destroy(struct scm_cookie *sc } } -int __scm_send(struct socket *sock, struct msghdr *msg, struct scm_cookie *p) +int scm_send(struct socket *sock, struct msghdr *msg, struct scm_cookie *scm) { struct cmsghdr *cmsg; int err; + struct task_struct *tsk = current; + scm->creds = (struct ucred) { + .uid = tsk->uid, + .gid = tsk->gid, + .pid = tsk->tgid + }; + scm->fp = NULL; + scm->sid = security_sk_sid(sock->sk, NULL, 0); + scm->seq = 0; + if (msg->msg_controllen <= 0) + return 0; - for (cmsg = CMSG_FIRSTHDR(msg); cmsg; cmsg = CMSG_NXTHDR(msg, cmsg)) - { + for (cmsg = CMSG_FIRSTHDR(msg); cmsg; cmsg = CMSG_NXTHDR(msg, cmsg)) { err = -EINVAL; /* Verify that cmsg_len is at least sizeof(struct cmsghdr) */ @@ -133,18 +143,18 @@ int __scm_send(struct socket *sock, stru if (cmsg->cmsg_level != SOL_SOCKET) continue; - switch (cmsg->cmsg_type) - { + switch (cmsg->cmsg_type) { case SCM_RIGHTS: - err=scm_fp_copy(cmsg, &p->fp); + err=scm_fp_copy(cmsg, &scm->fp); if (err<0) goto error; break; case SCM_CREDENTIALS: if (cmsg->cmsg_len != CMSG_LEN(sizeof(struct ucred))) goto error; - memcpy(&p->creds, CMSG_DATA(cmsg), sizeof(struct ucred)); - err = scm_check_creds(&p->creds); + memcpy(&scm->creds, CMSG_DATA(cmsg), + sizeof(struct ucred)); + err = scm_check_creds(&scm->creds); if (err) goto error; break; @@ -153,15 +163,14 @@ int __scm_send(struct socket *sock, stru } } - if (p->fp && !p->fp->count) - { - kfree(p->fp); - p->fp = NULL; + if (scm->fp && !scm->fp->count) { + kfree(scm->fp); + scm->fp = NULL; } return 0; error: - scm_destroy(p); + scm_destroy(scm); return err; } @@ -284,22 +293,6 @@ struct scm_fp_list *scm_fp_dup(struct sc return new_fpl; } -int scm_send(struct socket *sock, struct msghdr *msg, struct scm_cookie *scm) -{ - struct task_struct *p = current; - scm->creds = (struct ucred) { - .uid = p->uid, - .gid = p->gid, - .pid = p->tgid - }; - scm->fp = NULL; - scm->sid = security_sk_sid(sock->sk, NULL, 0); - scm->seq = 0; - if (msg->msg_controllen <= 0) - return 0; - return __scm_send(sock, msg, scm); -} - void scm_recv(struct socket *sock, struct msghdr *msg, struct scm_cookie *scm, int flags) { @@ -332,7 +325,6 @@ void scm_recv(struct socket *sock, struc } EXPORT_SYMBOL(__scm_destroy); -EXPORT_SYMBOL(__scm_send); EXPORT_SYMBOL(scm_send); EXPORT_SYMBOL(scm_recv); EXPORT_SYMBOL(put_cmsg); _