From: pmf Date: Wed, 6 Aug 2008 17:46:53 +0000 (+0000) Subject: move obsolete ltt-modules to attic X-Git-Tag: 0.80~63 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=e0ee50f1f17b49471f554f62380196b09b0d183a;p=ltt-control.git move obsolete ltt-modules to attic git-svn-id: http://ltt.polymtl.ca/svn@2986 04897980-b3bd-0310-b5e0-8ef037075253 --- diff --git a/trunk/attic/ltt-modules/ltt-control.c b/trunk/attic/ltt-modules/ltt-control.c new file mode 100644 index 0000000..45b44f0 --- /dev/null +++ b/trunk/attic/ltt-modules/ltt-control.c @@ -0,0 +1,115 @@ +/* ltt-control.c + * + * LTT control module over a netlink socket. + * + * Inspired from Relay Apps, by Tom Zanussi and iptables + * + * Copyright 2005 - + * Mathieu Desnoyers + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "ltt-control.h" + + +#define LTTCTLM_BASE 0x10 +#define LTTCTLM_CONTROL (LTTCTLM_BASE + 1) /* LTT control message */ + +static struct sock *socket; + +void ltt_control_input(struct sock *sk, int len) +{ + struct sk_buff *skb; + struct nlmsghdr *nlh = NULL; + u8 *payload = NULL; + lttctl_peer_msg_t *msg; + int err; + + printk(KERN_ALERT "ltt-control ltt_control_input\n"); + + while ((skb = skb_dequeue(&sk->sk_receive_queue)) + != NULL) { + + nlh = (struct nlmsghdr *)skb->data; + + if(security_netlink_recv(skb)) { + netlink_ack(skb, nlh, EPERM); + kfree_skb(skb); + continue; + } + + /* process netlink message pointed by skb->data */ + err = EINVAL; + payload = NLMSG_DATA(nlh); + /* process netlink message with header pointed by + * nlh and payload pointed by payload + */ + if(nlh->nlmsg_len != sizeof(lttctl_peer_msg_t) + sizeof(struct nlmsghdr)) { + printk(KERN_ALERT "ltt-control bad message length\n"); + netlink_ack(skb, nlh, EINVAL); + kfree_skb(skb); + continue; + } + msg = (lttctl_peer_msg_t*)payload; + + switch(msg->op) { + case OP_CREATE: + err = ltt_control(LTT_CONTROL_CREATE_TRACE, msg->trace_name, + msg->args); + break; + case OP_DESTROY: + err = ltt_control(LTT_CONTROL_DESTROY_TRACE, msg->trace_name, + msg->args); + break; + case OP_START: + err = ltt_control(LTT_CONTROL_START, msg->trace_name, + msg->args); + break; + case OP_STOP: + err = ltt_control(LTT_CONTROL_STOP, msg->trace_name, + msg->args); + break; + default: + err = EBADRQC; + printk(KERN_INFO "ltt-control invalid operation\n"); + } + netlink_ack(skb, nlh, err); + kfree_skb(skb); + } +} + + +static int ltt_control_init(void) +{ + printk(KERN_ALERT "ltt-control init\n"); + + socket = netlink_kernel_create(NETLINK_LTT, 1, + ltt_control_input, THIS_MODULE); + if(socket == NULL) return -EPERM; + else return 0; +} + +static void ltt_control_exit(void) +{ + printk(KERN_ALERT "ltt-control exit\n"); + + sock_release(socket->sk_socket); +} + + +module_init(ltt_control_init) +module_exit(ltt_control_exit) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mathieu Desnoyers"); +MODULE_DESCRIPTION("Linux Trace Toolkit Controller"); + diff --git a/trunk/attic/ltt-modules/ltt-control.h b/trunk/attic/ltt-modules/ltt-control.h new file mode 100644 index 0000000..430d5d1 --- /dev/null +++ b/trunk/attic/ltt-modules/ltt-control.h @@ -0,0 +1,26 @@ +#ifndef _LTT_CONTROL_H +#define _LTT_CONTROL_H + + +//enum trace_mode { +// TRACE_NORMAL, +// TRACE_FLIGHT +//}; + +enum trace_op { + OP_CREATE, + OP_DESTROY, + OP_START, + OP_STOP, + OP_ALIGN, + OP_NONE +}; + +typedef struct lttctl_peer_msg { + char trace_name[NAME_MAX]; + enum trace_op op; + union ltt_control_args args; +} lttctl_peer_msg_t; + +#endif //_LTT_CONTROL_H + diff --git a/trunk/ltt-modules/ltt-control.c b/trunk/ltt-modules/ltt-control.c deleted file mode 100644 index 45b44f0..0000000 --- a/trunk/ltt-modules/ltt-control.c +++ /dev/null @@ -1,115 +0,0 @@ -/* ltt-control.c - * - * LTT control module over a netlink socket. - * - * Inspired from Relay Apps, by Tom Zanussi and iptables - * - * Copyright 2005 - - * Mathieu Desnoyers - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "ltt-control.h" - - -#define LTTCTLM_BASE 0x10 -#define LTTCTLM_CONTROL (LTTCTLM_BASE + 1) /* LTT control message */ - -static struct sock *socket; - -void ltt_control_input(struct sock *sk, int len) -{ - struct sk_buff *skb; - struct nlmsghdr *nlh = NULL; - u8 *payload = NULL; - lttctl_peer_msg_t *msg; - int err; - - printk(KERN_ALERT "ltt-control ltt_control_input\n"); - - while ((skb = skb_dequeue(&sk->sk_receive_queue)) - != NULL) { - - nlh = (struct nlmsghdr *)skb->data; - - if(security_netlink_recv(skb)) { - netlink_ack(skb, nlh, EPERM); - kfree_skb(skb); - continue; - } - - /* process netlink message pointed by skb->data */ - err = EINVAL; - payload = NLMSG_DATA(nlh); - /* process netlink message with header pointed by - * nlh and payload pointed by payload - */ - if(nlh->nlmsg_len != sizeof(lttctl_peer_msg_t) + sizeof(struct nlmsghdr)) { - printk(KERN_ALERT "ltt-control bad message length\n"); - netlink_ack(skb, nlh, EINVAL); - kfree_skb(skb); - continue; - } - msg = (lttctl_peer_msg_t*)payload; - - switch(msg->op) { - case OP_CREATE: - err = ltt_control(LTT_CONTROL_CREATE_TRACE, msg->trace_name, - msg->args); - break; - case OP_DESTROY: - err = ltt_control(LTT_CONTROL_DESTROY_TRACE, msg->trace_name, - msg->args); - break; - case OP_START: - err = ltt_control(LTT_CONTROL_START, msg->trace_name, - msg->args); - break; - case OP_STOP: - err = ltt_control(LTT_CONTROL_STOP, msg->trace_name, - msg->args); - break; - default: - err = EBADRQC; - printk(KERN_INFO "ltt-control invalid operation\n"); - } - netlink_ack(skb, nlh, err); - kfree_skb(skb); - } -} - - -static int ltt_control_init(void) -{ - printk(KERN_ALERT "ltt-control init\n"); - - socket = netlink_kernel_create(NETLINK_LTT, 1, - ltt_control_input, THIS_MODULE); - if(socket == NULL) return -EPERM; - else return 0; -} - -static void ltt_control_exit(void) -{ - printk(KERN_ALERT "ltt-control exit\n"); - - sock_release(socket->sk_socket); -} - - -module_init(ltt_control_init) -module_exit(ltt_control_exit) - -MODULE_LICENSE("GPL"); -MODULE_AUTHOR("Mathieu Desnoyers"); -MODULE_DESCRIPTION("Linux Trace Toolkit Controller"); - diff --git a/trunk/ltt-modules/ltt-control.h b/trunk/ltt-modules/ltt-control.h deleted file mode 100644 index 430d5d1..0000000 --- a/trunk/ltt-modules/ltt-control.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef _LTT_CONTROL_H -#define _LTT_CONTROL_H - - -//enum trace_mode { -// TRACE_NORMAL, -// TRACE_FLIGHT -//}; - -enum trace_op { - OP_CREATE, - OP_DESTROY, - OP_START, - OP_STOP, - OP_ALIGN, - OP_NONE -}; - -typedef struct lttctl_peer_msg { - char trace_name[NAME_MAX]; - enum trace_op op; - union ltt_control_args args; -} lttctl_peer_msg_t; - -#endif //_LTT_CONTROL_H -