linux.conf.au 2003
File operations - read

static ssize_t power_read_file (struct file *file, char *buf, size_t count,
                                   loff_t *offset)
{
        struct hotplug_slot *slot = file->private_data;
        unsigned char *page;
        int retval;
        int len;
        u8 value;

        if (*offset < 0)
                return -EINVAL;
        if (count == 0 || count > 16384)
                return 0;
        if (*offset != 0)
                return 0;
        
        if (slot == NULL)
                return -ENODEV;

        page = (unsigned char *)__get_free_page(GFP_KERNEL);
        if (!page)
                return -ENOMEM;

