--- /dev/null
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ */
+
+#include <linux/fs.h>
+#include <linux/security.h>
+
+#include "log.h"
+#include "dir.h"
+
+static struct dentry *audittrail_dir = NULL;
+static struct dentry *audittrail_command = NULL;
+static struct dentry *audittrail_buffer = NULL;
+
+static int audittrail_command_open(struct inode * inode, struct file *file)
+{
+ if ((file->f_flags & O_ACCMODE) != O_WRONLY)
+ return -EACCES;
+
+ return 0;
+}
+
+static ssize_t audittrail_command_write(struct file *file, const char __user *buf,
+ size_t datalen, loff_t *ppos)
+{
+ return -EINVAL;
+}
+
+static const struct file_operations audittrail_command_ops = {
+ .open = audittrail_command_open,
+ .write = audittrail_command_write,
+};
+
+static int audittrail_buffer_open(struct inode * inode, struct file *file)
+{
+ return 0;
+}
+
+static ssize_t audittrail_buffer_read(struct file *file,
+ char __user *buf,
+ size_t datalen, loff_t *ppos)
+{
+ return -EINVAL;
+}
+
+static ssize_t audittrail_buffer_write(struct file *file,
+ const char __user *buf,
+ size_t datalen, loff_t *ppos)
+{
+ return -EINVAL;
+}
+
+static int audittrail_buffer_release(struct inode *inode, struct file *file)
+{
+ return 0;
+}
+
+static const struct file_operations audittrail_buffer_ops = {
+ .open = audittrail_buffer_open,
+ .read = audittrail_buffer_read,
+ .write = audittrail_buffer_write,
+ .release = audittrail_buffer_release,
+};
+
+
+int audittrail_dir_create(void)
+{
+ audittrail_dir = securityfs_create_dir("audittrail", NULL);
+ if (IS_ERR(audittrail_dir))
+ goto err;
+
+ audittrail_command =
+ securityfs_create_file("command",
+ S_IWUSR | S_IWGRP, audittrail_dir, NULL,
+ &audittrail_command_ops);
+ if (IS_ERR(audittrail_command))
+ goto err;
+
+ audittrail_buffer =
+ securityfs_create_file("buffer",
+ S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP,
+ audittrail_dir, NULL,
+ &audittrail_buffer_ops);
+ if (IS_ERR(audittrail_buffer))
+ goto err;
+
+ return 0;
+
+err:
+ audittrail_dir_destroy();
+ return -1;
+}
+
+void audittrail_dir_destroy(void)
+{
+ securityfs_remove(audittrail_buffer);
+ securityfs_remove(audittrail_command);
+ securityfs_remove(audittrail_dir);
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ */
+#ifndef __AUDITTRAIL_DIR_H__
+#define __AUDITTRAIL_DIR_H__
+
+int audittrail_dir_create(void);
+void audittrail_dir_destroy(void);
+
+#endif //! __AUDITTRAIL_DIR_H__