Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static ssize_t dice_read(struct file * file, char * buf,
- size_t count, loff_t *ppos)
- {
- char roll;
- int i;
- char newBuffer[count];
- /*
- * We only support reading the whole string at once.
- */
- for (int i=0; i<count; i++)
- {
- roll = get_random_byte(6) +1;
- newBuffer[i] = roll;
- }
- if (copy_to_user(buf, newBuffer, count))
- return -EINVAL;
- /*
- * Tell the user how much data we wrote.
- */
- *ppos = count;
- return count;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement