#include <linux/module.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>

#define PROC_FILE_NAME  "Hello_World"
static struct proc_dir_entry *proc_file;
static char *output_string;

static int prochello_show( struct seq_file *m, void *v )
{
    int error = 0;

    error = seq_printf( m, "%s\n", output_string);
    return error;
}

static int prochello_open(struct inode *inode, struct file *file)
{
    return single_open(file, prochello_show, NULL);
}

static const struct file_operations prochello_fops = {
    .owner  = THIS_MODULE,
    .open   = prochello_open,
    .release= single_release,
    .read   = seq_read,
};

static int __init prochello_init(void)
{
    output_string = "Hello World";
    proc_file= proc_create_data( PROC_FILE_NAME, S_IRUGO , NULL,
        &prochello_fops, NULL); 
    if (!proc_file)
        return -ENOMEM;
    return 0;
}

static void __exit prochello_exit(void)
{
    if( proc_file )
        remove_proc_entry( PROC_FILE_NAME, NULL );
}

module_init( prochello_init );
module_exit( prochello_exit );
MODULE_LICENSE("GPL");

