summaryrefslogtreecommitdiffstats
path: root/runtime/transport/debugfs.c
diff options
context:
space:
mode:
authorDavid Smith <dsmith@redhat.com>2009-02-17 08:32:43 -0600
committerDavid Smith <dsmith@redhat.com>2009-02-17 08:32:43 -0600
commita79ec729450bc24d0943c2c1ee67efa8acb58273 (patch)
treedeae00cc69b4bf5da3a440bb47004c371cefc75f /runtime/transport/debugfs.c
parentea1248d39b26b7f4288751cdf9eb019266bfd91b (diff)
downloadsystemtap-steved-a79ec729450bc24d0943c2c1ee67efa8acb58273.tar.gz
systemtap-steved-a79ec729450bc24d0943c2c1ee67efa8acb58273.tar.xz
systemtap-steved-a79ec729450bc24d0943c2c1ee67efa8acb58273.zip
Reduced control channel code duplication.
2009-02-17 David Smith <dsmith@redhat.com> * control.c: Contains generic control channel functions. * procfs.c: Specific procfs control channel functions. All generic control channel functions moved to control.c. * debugfs.c: New file containing debugfs specific control channel functions. * control.h: New file. * transport.c: Updated file inclusion.
Diffstat (limited to 'runtime/transport/debugfs.c')
-rw-r--r--runtime/transport/debugfs.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/runtime/transport/debugfs.c b/runtime/transport/debugfs.c
new file mode 100644
index 00000000..dc651a56
--- /dev/null
+++ b/runtime/transport/debugfs.c
@@ -0,0 +1,45 @@
+/* -*- linux-c -*-
+ *
+ * debugfs functions
+ * Copyright (C) 2009 Red Hat Inc.
+ *
+ * This file is part of systemtap, and is free software. You can
+ * redistribute it and/or modify it under the terms of the GNU General
+ * Public License (GPL); either version 2, or (at your option) any
+ * later version.
+ */
+
+#define STP_DEFAULT_BUFFERS 50
+
+inline static int _stp_ctl_write_fs(int type, void *data, unsigned len)
+{
+ return 0;
+}
+
+static struct dentry *_stp_cmd_file = NULL;
+
+static int _stp_register_ctl_channel_fs(void)
+{
+ if (_stp_utt == NULL) {
+ errk("_expected _stp_utt to be set.\n");
+ return -1;
+ }
+
+ /* create [debugfs]/systemtap/module_name/.cmd */
+ _stp_cmd_file = debugfs_create_file(".cmd", 0600, _stp_utt->dir,
+ NULL, &_stp_ctl_fops_cmd);
+ if (_stp_cmd_file == NULL) {
+ errk("Error creating systemtap debugfs entries.\n");
+ return -1;
+ }
+ _stp_cmd_file->d_inode->i_uid = _stp_uid;
+ _stp_cmd_file->d_inode->i_gid = _stp_gid;
+
+ return 0;
+}
+
+static void _stp_unregister_ctl_channel_fs(void)
+{
+ if (_stp_cmd_file)
+ debugfs_remove(_stp_cmd_file);
+}