<commit_before>/*
 * In The Name Of God
 * ========================================
 * [] File Name : misc.c
 *
 * [] Creation Date : 29-12-2014
 *
 * [] Last Modified : Thu 08 Jan 2015 07:46:23 AM IRST
 *
 * [] Created By : <NAME> (<EMAIL>)
 * =======================================
*/
#include <linux/module.h>
#include <linux/init.h>

#include <linux/kernel.h>       /* printk() */
#include <linux/string.h>	/* strlen() */
#include <linux/fs.h>           /* everything... */
#include <linux/errno.h>        /* error codes */
#include <linux/types.h>        /* size_t */
#include <linux/cdev.h>
#include <asm/uaccess.h>        /* copy_*_user */

/*
 * Parameters which can be set at load time.
*/
int misc_major = 0;
int misc_minor = 0;

struct cdev dev;

MODULE_AUTHOR("<NAME>");
MODULE_LICENSE("GPL");

/*
 * Data management: read and write
*/
ssize_t misc_read(struct file *filp, char __user *buf, size_t count,
		loff_t *f_pos)
{
	copy_to_user(buf, "8d7990499d47\n", strlen("8d7990499d47\n"));
	return (*f_pos) ? 0 : (*f_pos += strlen("8d7990499d47\n"));
}

ssize_t misc_write(struct file *filp, const char __user *buf, size_t count,
		loff_t *f_pos)
{
	int retval = 0;
	const char idstr[] = "8d7990499d47";
	const int idlen = strlen(idstr);
	char input_id[idlen + 1];

	if (copy_from_user(input_id, buf, idlen)) {
		retval = -EFAULT;
		goto out;
	}
	input_id[idlen] = 0;

	if (strcmp(idstr, input_id))
		retval = -EINVAL;
	else
		retval = count;
out:
	return retval;
}

const struct file_operations misc_fops = {
	.owner =	THIS_MODULE,
	.read =		misc_read,
	.write =	misc_write,
};<commit_msg>Task06 improved.<commit_after>/*
 * In The Name Of God
 * ========================================
 * [] File Name : misc.c
 *
 * [] Creation Date : 29-12-2014
 *
 * [] Last Modified : Thu 08 Jan 2015 10:44:27 AM IRST
 *
 * [] Created By : <NAME> (<EMAIL>)
 * =======================================
*/
#include <linux/module.h>
#include <linux/init.h>

#include <linux/kernel.h>       /* printk() */
#include <linux/string.h>	/* strlen() */
#include <linux/fs.h>           /* everything... */
#include <linux/errno.h>        /* error codes */
#include <linux/types.h>        /* size_t */
#include <linux/cdev.h>
#include <asm/uaccess.h>        /* copy_*_user */

/*
 * Parameters which can be set at load time.
*/
int misc_major = 0;
int misc_minor = 0;

struct cdev dev;

MODULE_AUTHOR("<NAME>");
MODULE_LICENSE("GPL");

/*
 * Data management: read and write
*/
ssize_t misc_read(struct file *filp, char __user *buf, size_t count,
		loff_t *f_pos)
{
	if (count >= strlen("8d7990499d47\n"))
		return copy_to_user(buf, "8d7990499d47\n",
				strlen("8d7990499d47\n")) ? -EFAULT :
			(*f_pos) ? 0 : (*f_pos += strlen("8d7990499d47\n"));
	else
		return -EFAULT;

}

ssize_t misc_write(struct file *filp, const char __user *buf, size_t count,
		loff_t *f_pos)
{
	int retval = 0;
	const char idstr[] = "8d7990499d47";
	const int idlen = strlen(idstr);
	char input_id[idlen + 1];

	if (copy_from_user(input_id, buf, idlen)) {
		retval = -EFAULT;
		goto out;
	}
	input_id[idlen] = 0;

	if (strcmp(idstr, input_id))
		retval = -EINVAL;
	else
		retval = count;
out:
	return retval;
}

const struct file_operations misc_fops = {
	.owner =	THIS_MODULE,
	.read =		misc_read,
	.write =	misc_write,
};
{'fraction_non_alphanumeric': 0.20559610705596107, 'fraction_numerical': 0.043795620437956206, 'mean_word_length': 3.517857142857143, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 28, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1591611', 'n_tokens_mistral': 1398, 'n_tokens_neox': 1264, 'n_words': 308}