| // SPDX-License-Identifier: GPL-2.0 |
| * Copyright (c) 1999 Al Smith |
| * Portions derived from work (c) 1995,1996 Christian Vogelgsang. |
| #include <linux/string.h> |
| #include <linux/pagemap.h> |
| #include <linux/buffer_head.h> |
| static int efs_symlink_read_folio(struct file *file, struct folio *folio) |
| struct page *page = &folio->page; |
| char *link = page_address(page); |
| struct inode * inode = page->mapping->host; |
| efs_block_t size = inode->i_size; |
| if (size > 2 * EFS_BLOCKSIZE) |
| /* read first 512 bytes of link target */ |
| bh = sb_bread(inode->i_sb, efs_bmap(inode, 0)); |
| memcpy(link, bh->b_data, (size > EFS_BLOCKSIZE) ? EFS_BLOCKSIZE : size); |
| if (size > EFS_BLOCKSIZE) { |
| bh = sb_bread(inode->i_sb, efs_bmap(inode, 1)); |
| memcpy(link + EFS_BLOCKSIZE, bh->b_data, size - EFS_BLOCKSIZE); |
| const struct address_space_operations efs_symlink_aops = { |
| .read_folio = efs_symlink_read_folio |