Guest User

Untitled

a guest
Mar 22nd, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. static ssize_t dev_read(struct file *filep, char __user *buffer, size_t len, loff_t *offset){
  2. unsigned long sent;
  3. // ...
  4. pr_err("MYLOGGER: copying from buffer: head=%d, tail=%d, cnt=%d, sent=%lu, access=%lun",
  5. head, tail, cnt, sent,
  6. access_ok(VERIFY_WRITE, buffer, sent));
  7.  
  8. if(sent >= 1) {
  9. sent -= copy_to_user(buffer, mybuf + tail, sent);
  10. pr_err("MYLOGGER: sent %lu bytesn", sent);
  11. // ...
  12. }
  13. // ...
  14. }
  15.  
  16. [ 56.476834] MYLOGGER: device opened
  17. [ 56.476861] MYLOGGER: reading from buffer
  18. [ 56.476872] MYLOGGER: copying from buffer: head=5666644, tail=0, cnt=5666644, sent=4096, access=1
  19. [ 56.476882] MYLOGGER: sent 0 bytes
Add Comment
Please, Sign In to add comment