Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

namei: page_getlink() and page_follow_link_light() are the same thing

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Al Viro aa80deab 9cdce3c0

+13 -19
+13 -19
fs/namei.c
··· 4518 4518 EXPORT_SYMBOL(generic_readlink); 4519 4519 4520 4520 /* get the link contents into pagecache */ 4521 - static char *page_getlink(struct dentry * dentry, struct page **ppage) 4521 + static const char *page_getlink(struct dentry * dentry, void **cookie) 4522 4522 { 4523 4523 char *kaddr; 4524 4524 struct page *page; ··· 4526 4526 page = read_mapping_page(mapping, 0, NULL); 4527 4527 if (IS_ERR(page)) 4528 4528 return (char*)page; 4529 - *ppage = page; 4529 + *cookie = page; 4530 4530 kaddr = kmap(page); 4531 4531 nd_terminate_link(kaddr, dentry->d_inode->i_size, PAGE_SIZE - 1); 4532 4532 return kaddr; 4533 4533 } 4534 4534 4535 - int page_readlink(struct dentry *dentry, char __user *buffer, int buflen) 4536 - { 4537 - struct page *page = NULL; 4538 - int res = readlink_copy(buffer, buflen, page_getlink(dentry, &page)); 4539 - if (page) { 4540 - kunmap(page); 4541 - page_cache_release(page); 4542 - } 4543 - return res; 4544 - } 4545 - EXPORT_SYMBOL(page_readlink); 4546 - 4547 4535 const char *page_follow_link_light(struct dentry *dentry, void **cookie) 4548 4536 { 4549 - struct page *page = NULL; 4550 - char *res = page_getlink(dentry, &page); 4551 - if (!IS_ERR(res)) 4552 - *cookie = page; 4553 - return res; 4537 + return page_getlink(dentry, cookie); 4554 4538 } 4555 4539 EXPORT_SYMBOL(page_follow_link_light); 4556 4540 ··· 4545 4561 page_cache_release(page); 4546 4562 } 4547 4563 EXPORT_SYMBOL(page_put_link); 4564 + 4565 + int page_readlink(struct dentry *dentry, char __user *buffer, int buflen) 4566 + { 4567 + void *cookie = NULL; 4568 + int res = readlink_copy(buffer, buflen, page_getlink(dentry, &cookie)); 4569 + if (cookie) 4570 + page_put_link(NULL, cookie); 4571 + return res; 4572 + } 4573 + EXPORT_SYMBOL(page_readlink); 4548 4574 4549 4575 /* 4550 4576 * The nofs argument instructs pagecache_write_begin to pass AOP_FLAG_NOFS