hostfs_kern.c (6b2553918d8b4e6de9853fd6315bec7271a2e592) | hostfs_kern.c (fceef393a538134f03b778c5d2519e670269342f) |
---|---|
1/* 2 * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) 3 * Licensed under the GPL 4 * 5 * Ported the filesystem routines to 2.5. 6 * 2003-02-10 Petr Baudis <pasky@ucw.cz> 7 */ 8 --- 879 unchanged lines hidden (view full) --- 888 .rmdir = hostfs_rmdir, 889 .mknod = hostfs_mknod, 890 .rename2 = hostfs_rename2, 891 .permission = hostfs_permission, 892 .setattr = hostfs_setattr, 893}; 894 895static const char *hostfs_get_link(struct dentry *dentry, | 1/* 2 * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) 3 * Licensed under the GPL 4 * 5 * Ported the filesystem routines to 2.5. 6 * 2003-02-10 Petr Baudis <pasky@ucw.cz> 7 */ 8 --- 879 unchanged lines hidden (view full) --- 888 .rmdir = hostfs_rmdir, 889 .mknod = hostfs_mknod, 890 .rename2 = hostfs_rename2, 891 .permission = hostfs_permission, 892 .setattr = hostfs_setattr, 893}; 894 895static const char *hostfs_get_link(struct dentry *dentry, |
896 struct inode *inode, void **cookie) | 896 struct inode *inode, 897 struct delayed_call *done) |
897{ 898 char *link; 899 if (!dentry) 900 return ERR_PTR(-ECHILD); | 898{ 899 char *link; 900 if (!dentry) 901 return ERR_PTR(-ECHILD); |
901 link = __getname(); | 902 link = kmalloc(PATH_MAX, GFP_KERNEL); |
902 if (link) { 903 char *path = dentry_name(dentry); 904 int err = -ENOMEM; 905 if (path) { 906 err = hostfs_do_readlink(path, link, PATH_MAX); 907 if (err == PATH_MAX) 908 err = -E2BIG; 909 __putname(path); 910 } 911 if (err < 0) { | 903 if (link) { 904 char *path = dentry_name(dentry); 905 int err = -ENOMEM; 906 if (path) { 907 err = hostfs_do_readlink(path, link, PATH_MAX); 908 if (err == PATH_MAX) 909 err = -E2BIG; 910 __putname(path); 911 } 912 if (err < 0) { |
912 __putname(link); | 913 kfree(link); |
913 return ERR_PTR(err); 914 } 915 } else { 916 return ERR_PTR(-ENOMEM); 917 } 918 | 914 return ERR_PTR(err); 915 } 916 } else { 917 return ERR_PTR(-ENOMEM); 918 } 919 |
919 return *cookie = link; | 920 set_delayed_call(done, kfree_link, link); 921 return link; |
920} 921 | 922} 923 |
922static void hostfs_put_link(struct inode *unused, void *cookie) 923{ 924 __putname(cookie); 925} 926 | |
927static const struct inode_operations hostfs_link_iops = { 928 .readlink = generic_readlink, 929 .get_link = hostfs_get_link, | 924static const struct inode_operations hostfs_link_iops = { 925 .readlink = generic_readlink, 926 .get_link = hostfs_get_link, |
930 .put_link = hostfs_put_link, | |
931}; 932 933static int hostfs_fill_sb_common(struct super_block *sb, void *d, int silent) 934{ 935 struct inode *root_inode; 936 char *host_root_path, *req_root = d; 937 int err; 938 --- 86 unchanged lines hidden --- | 927}; 928 929static int hostfs_fill_sb_common(struct super_block *sb, void *d, int silent) 930{ 931 struct inode *root_inode; 932 char *host_root_path, *req_root = d; 933 int err; 934 --- 86 unchanged lines hidden --- |