Implement afs_read and afs_write