]>
Commit | Line | Data |
---|---|---|
4b32b600 PS |
1 | --- fuse-1.4/kernel/dir.c.orig 2004-09-14 08:56:36.000000000 +0200 |
2 | +++ fuse-1.4/kernel/dir.c 2004-11-01 13:49:54.145950656 +0100 | |
3 | @@ -23,19 +23,10 @@ | |
4 | /* FIXME: This should be user configurable */ | |
5 | #define FUSE_REVALIDATE_TIME (1 * HZ) | |
6 | ||
7 | -#ifndef KERNEL_2_6 | |
8 | -#define new_decode_dev(x) (x) | |
9 | -#define new_encode_dev(x) (x) | |
10 | -#endif | |
11 | - | |
12 | static void change_attributes(struct inode *inode, struct fuse_attr *attr) | |
13 | { | |
14 | if(S_ISREG(inode->i_mode) && i_size_read(inode) != attr->size) { | |
15 | -#ifdef KERNEL_2_6 | |
16 | invalidate_inode_pages(inode->i_mapping); | |
17 | -#else | |
18 | - invalidate_inode_pages(inode); | |
19 | -#endif | |
20 | } | |
21 | ||
22 | inode->i_mode = (inode->i_mode & S_IFMT) + (attr->mode & 07777); | |
23 | @@ -45,18 +36,12 @@ | |
24 | i_size_write(inode, attr->size); | |
25 | inode->i_blksize = PAGE_CACHE_SIZE; | |
26 | inode->i_blocks = attr->blocks; | |
27 | -#ifdef KERNEL_2_6 | |
28 | inode->i_atime.tv_sec = attr->atime; | |
29 | inode->i_atime.tv_nsec = 0; | |
30 | inode->i_mtime.tv_sec = attr->mtime; | |
31 | inode->i_mtime.tv_nsec = 0; | |
32 | inode->i_ctime.tv_sec = attr->ctime; | |
33 | inode->i_ctime.tv_nsec = 0; | |
34 | -#else | |
35 | - inode->i_atime = attr->atime; | |
36 | - inode->i_mtime = attr->mtime; | |
37 | - inode->i_ctime = attr->ctime; | |
38 | -#endif | |
39 | } | |
40 | ||
41 | static void fuse_init_inode(struct inode *inode, struct fuse_attr *attr) | |
42 | @@ -410,14 +395,14 @@ | |
43 | return fuse_do_getattr(inode); | |
44 | } | |
45 | ||
46 | -static int _fuse_permission(struct inode *inode, int mask) | |
47 | +static int _fuse_permission(struct inode *inode, int mask, struct nameidata *nd) | |
48 | { | |
49 | struct fuse_conn *fc = INO_FC(inode); | |
50 | ||
51 | if(!(fc->flags & FUSE_ALLOW_OTHER) && current->fsuid != fc->uid) | |
52 | return -EACCES; | |
53 | else if(fc->flags & FUSE_DEFAULT_PERMISSIONS) { | |
54 | - int err = vfs_permission(inode, mask); | |
55 | + int err = permission(inode, mask, nd); | |
56 | ||
57 | /* If permission is denied, try to refresh file | |
58 | attributes. This is also needed, because the root | |
59 | @@ -426,7 +411,7 @@ | |
60 | if(err == -EACCES) { | |
61 | err = fuse_do_getattr(inode); | |
62 | if(!err) | |
63 | - err = vfs_permission(inode, mask); | |
64 | + err = permission(inode, mask, nd); | |
65 | } | |
66 | ||
67 | /* FIXME: Need some mechanism to revoke permissions: | |
68 | @@ -613,13 +598,8 @@ | |
69 | /* You can only _set_ these together (they may change by themselves) */ | |
70 | if((ivalid & (ATTR_ATIME | ATTR_MTIME)) == (ATTR_ATIME | ATTR_MTIME)) { | |
71 | fvalid |= FATTR_UTIME; | |
72 | -#ifdef KERNEL_2_6 | |
73 | fattr->atime = iattr->ia_atime.tv_sec; | |
74 | fattr->mtime = iattr->ia_mtime.tv_sec; | |
75 | -#else | |
76 | - fattr->atime = iattr->ia_atime; | |
77 | - fattr->mtime = iattr->ia_mtime; | |
78 | -#endif | |
79 | } | |
80 | ||
81 | return fvalid; | |
82 | @@ -692,8 +672,6 @@ | |
83 | return 1; | |
84 | } | |
85 | ||
86 | -#ifdef KERNEL_2_6 | |
87 | - | |
88 | #define fuse_mknod _fuse_mknod | |
89 | ||
90 | static int fuse_getattr(struct vfsmount *mnt, struct dentry *entry, | |
91 | @@ -726,51 +704,13 @@ | |
92 | static int fuse_permission(struct inode *inode, int mask, | |
93 | struct nameidata *nd) | |
94 | { | |
95 | - return _fuse_permission(inode, mask); | |
96 | + return _fuse_permission(inode, mask, nd); | |
97 | } | |
98 | ||
99 | static int fuse_dentry_revalidate(struct dentry *entry, struct nameidata *nd) | |
100 | { | |
101 | return _fuse_dentry_revalidate(entry); | |
102 | } | |
103 | -#else /* KERNEL_2_6 */ | |
104 | - | |
105 | -#define fuse_create _fuse_create | |
106 | -#define fuse_permission _fuse_permission | |
107 | - | |
108 | -static struct dentry *fuse_lookup(struct inode *dir, struct dentry *entry) | |
109 | -{ | |
110 | - struct inode *inode; | |
111 | - struct dentry *alias; | |
112 | - | |
113 | - int err = fuse_lookup_iget(dir, entry, &inode); | |
114 | - if(err) | |
115 | - return ERR_PTR(err); | |
116 | - | |
117 | - if(inode && S_ISDIR(inode->i_mode) && | |
118 | - (alias = d_find_alias(inode)) != NULL) { | |
119 | - dput(alias); | |
120 | - iput(inode); | |
121 | - printk("fuse: cannot assign an existing directory\n"); | |
122 | - return ERR_PTR(-EPROTO); | |
123 | - } | |
124 | - | |
125 | - d_add(entry, inode); | |
126 | - return NULL; | |
127 | -} | |
128 | - | |
129 | -static int fuse_mknod(struct inode *dir, struct dentry *entry, int mode, | |
130 | - int rdev) | |
131 | -{ | |
132 | - return _fuse_mknod(dir, entry, mode, rdev); | |
133 | -} | |
134 | - | |
135 | -static int fuse_dentry_revalidate(struct dentry *entry, int flags) | |
136 | -{ | |
137 | - return _fuse_dentry_revalidate(entry); | |
138 | -} | |
139 | -#endif /* KERNEL_2_6 */ | |
140 | - | |
141 | ||
142 | static struct inode_operations fuse_dir_inode_operations = | |
143 | { | |
144 | @@ -785,11 +725,7 @@ | |
145 | .link = fuse_link, | |
146 | .setattr = fuse_setattr, | |
147 | .permission = fuse_permission, | |
148 | -#ifdef KERNEL_2_6 | |
149 | .getattr = fuse_getattr, | |
150 | -#else | |
151 | - .revalidate = fuse_revalidate, | |
152 | -#endif | |
153 | }; | |
154 | ||
155 | static struct file_operations fuse_dir_operations = { | |
156 | @@ -802,11 +738,7 @@ | |
157 | static struct inode_operations fuse_file_inode_operations = { | |
158 | .setattr = fuse_setattr, | |
159 | .permission = fuse_permission, | |
160 | -#ifdef KERNEL_2_6 | |
161 | .getattr = fuse_getattr, | |
162 | -#else | |
163 | - .revalidate = fuse_revalidate, | |
164 | -#endif | |
165 | }; | |
166 | ||
167 | static struct inode_operations fuse_symlink_inode_operations = | |
168 | @@ -814,11 +746,7 @@ | |
169 | .setattr = fuse_setattr, | |
170 | .readlink = fuse_readlink, | |
171 | .follow_link = fuse_follow_link, | |
172 | -#ifdef KERNEL_2_6 | |
173 | .getattr = fuse_getattr, | |
174 | -#else | |
175 | - .revalidate = fuse_revalidate, | |
176 | -#endif | |
177 | }; | |
178 | ||
179 | static struct dentry_operations fuse_dentry_operations = { |