1 From: Goldwyn Rodrigues <rgoldwyn@novell.com
2 Subject: Merge changes left out during code pull
5 Also contains the fix for a clean shutdown during umount.
8 fs/novfs/file.c | 55 ++++++++++++++++++++---------------------
9 fs/novfs/inode.c | 71 ++++++++++++++++++++++++++++++++++++------------------
10 fs/novfs/nwcapi.c | 13 ++++++---
12 4 files changed, 85 insertions(+), 57 deletions(-)
14 Index: linux-2.6.27/fs/novfs/file.c
15 ===================================================================
16 --- linux-2.6.27.orig/fs/novfs/file.c 2008-12-02 11:57:24.000000000 +0530
17 +++ linux-2.6.27/fs/novfs/file.c 2008-12-02 11:58:18.000000000 +0530
18 @@ -405,7 +405,7 @@ int novfs_setx_file_info(char *Path, con
21 cmd->pathLen = pathlen;
22 - memcpy(cmd->data, Path, cmd->pathLen + 1); //+ '\0'
23 + memcpy(cmd->data, Path, cmd->pathLen);
25 cmd->nameLen = namelen;
26 memcpy(cmd->data + cmd->pathLen + 1, Name, cmd->nameLen + 1);
27 @@ -601,7 +601,7 @@ static int begin_directory_enumerate(uns
31 -static int end_directory_enumerate(void *EnumHandle, struct novfs_schandle SessionId)
32 +int novfs_end_directory_enumerate(void *EnumHandle, struct novfs_schandle SessionId)
34 struct novfs_end_enumerate_directory_request cmd;
35 struct novfs_end_enumerate_directory_reply *reply = NULL;
36 @@ -793,11 +793,9 @@ int novfs_get_dir_listex(unsigned char *
37 directory_enumerate_ex(EnumHandle, SessionId, Count, Info,
40 - end_directory_enumerate(*EnumHandle, SessionId);
41 - if (-1 == retCode) {
43 - *EnumHandle = Uint32toHandle(-1);
45 + novfs_end_directory_enumerate(*EnumHandle, SessionId);
47 + *EnumHandle = Uint32toHandle(-1);
51 @@ -915,32 +913,33 @@ int novfs_create(unsigned char * Path, i
53 cmdlen = offsetof(struct novfs_create_file_request, path) + pathlen;
54 cmd = kmalloc(cmdlen, GFP_KERNEL);
56 - cmd->Command.CommandType = VFS_COMMAND_CREATE_FILE;
57 - if (DirectoryFlag) {
58 - cmd->Command.CommandType = VFS_COMMAND_CREATE_DIRECOTRY;
60 - cmd->Command.SequenceNumber = 0;
61 - cmd->Command.SessionId = SessionId;
64 + cmd->Command.CommandType = VFS_COMMAND_CREATE_FILE;
65 + if (DirectoryFlag) {
66 + cmd->Command.CommandType = VFS_COMMAND_CREATE_DIRECOTRY;
68 + cmd->Command.SequenceNumber = 0;
69 + cmd->Command.SessionId = SessionId;
71 - cmd->pathlength = pathlen;
72 - memcpy(cmd->path, Path, pathlen);
73 + cmd->pathlength = pathlen;
74 + memcpy(cmd->path, Path, pathlen);
77 - Queue_Daemon_Command(cmd, cmdlen, NULL, 0, (void *)&reply,
78 - &replylen, INTERRUPTIBLE);
80 + Queue_Daemon_Command(cmd, cmdlen, NULL, 0, (void *)&reply,
81 + &replylen, INTERRUPTIBLE);
85 + if (reply->Reply.ErrorCode) {
87 + if (reply->Reply.ErrorCode == NWE_ACCESS_DENIED)
92 - if (reply->Reply.ErrorCode) {
106 Index: linux-2.6.27/fs/novfs/inode.c
107 ===================================================================
108 --- linux-2.6.27.orig/fs/novfs/inode.c 2008-12-02 11:57:24.000000000 +0530
109 +++ linux-2.6.27/fs/novfs/inode.c 2008-12-02 11:58:35.000000000 +0530
110 @@ -137,11 +137,11 @@ int novfs_i_revalidate(struct dentry *de
111 * Extended attributes operations
114 -int novfs_i_getxattr(struct dentry *dentry, const char *name, void *buffer,
115 +ssize_t novfs_i_getxattr(struct dentry *dentry, const char *name, void *buffer,
117 int novfs_i_setxattr(struct dentry *dentry, const char *name, const void *value,
118 size_t value_size, int flags);
119 -int novfs_i_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size);
120 +ssize_t novfs_i_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size);
122 void update_inode(struct inode *Inode, struct novfs_entry_info *Info);
124 @@ -262,21 +262,17 @@ static struct inode_operations novfs_ino
125 .rename = novfs_i_rename,
126 .setattr = novfs_i_setattr,
127 .getattr = novfs_i_getattr,
129 .getxattr = novfs_i_getxattr,
130 .setxattr = novfs_i_setxattr,
131 .listxattr = novfs_i_listxattr,
135 static struct inode_operations novfs_file_inode_operations = {
136 .setattr = novfs_i_setattr,
137 .getattr = novfs_i_getattr,
139 .getxattr = novfs_i_getxattr,
140 .setxattr = novfs_i_setxattr,
141 .listxattr = novfs_i_listxattr,
145 static struct super_operations novfs_ops = {
146 @@ -935,14 +931,23 @@ int novfs_dir_open(struct inode *dir, st
148 int novfs_dir_release(struct inode *dir, struct file *file)
150 - struct file_private *file_private;
151 - file_private = (struct file_private *) file->private_data;
152 + struct file_private *file_private = file->private_data;
153 + struct inode *inode = file->f_dentry->d_inode;
154 + struct novfs_schandle sessionId;
156 DbgPrint("novfs_dir_release: Inode 0x%p %d Name %.*s\n", dir,
157 dir->i_ino, file->f_dentry->d_name.len,
158 file->f_dentry->d_name.name);
161 + if (file_private->enumHandle && (file_private->enumHandle != ((void *)-1))) {
162 + sessionId = novfs_scope_get_sessionId(((struct inode_data *)inode->i_private)->Scope);
163 + if (SC_PRESENT(sessionId) == 0) {
164 + ((struct inode_data *)inode->i_private)->Scope = novfs_get_scope(file->f_dentry);
165 + sessionId = novfs_scope_get_sessionId(((struct inode_data *)inode->i_private)->Scope);
167 + novfs_end_directory_enumerate(file_private->enumHandle, sessionId);
170 file->private_data = NULL;
172 @@ -966,6 +971,16 @@ loff_t novfs_dir_lseek(struct file * fil
174 file_private = (struct file_private *) file->private_data;
175 file_private->listedall = 0;
176 + if (file_private->enumHandle && (file_private->enumHandle != ((void *)-1))) {
177 + struct novfs_schandle sessionId;
178 + struct inode *inode = file->f_dentry->d_inode;
179 + sessionId = novfs_scope_get_sessionId(((struct inode_data *)inode->i_private)->Scope);
180 + if (SC_PRESENT(sessionId) == 0) {
181 + ((struct inode_data *)inode->i_private)->Scope = novfs_get_scope(file->f_dentry);
182 + sessionId = novfs_scope_get_sessionId(((struct inode_data *)inode->i_private)->Scope);
184 + novfs_end_directory_enumerate(file_private->enumHandle, sessionId);
186 file_private->enumHandle = NULL;
189 @@ -2864,9 +2879,15 @@ int novfs_i_unlink(struct inode *dir, st
196 + S_ISDIR(inode->i_mode), session);
199 + memset(&ia, 0, sizeof(ia));
200 + ia.ia_valid = ATTR_MODE;
201 + ia.ia_mode = S_IRWXU;
202 + novfs_set_attr(path, &ia, session);
203 + retCode = novfs_delete(path, S_ISDIR(inode->i_mode), session);
206 if (!retCode || IS_DEADDIR(inode)) {
207 novfs_remove_inode_entry(dir,
208 @@ -3119,13 +3140,16 @@ int novfs_i_rename(struct inode *odir, s
219 + novfs_delete(newpath, S_ISDIR(nd->d_inode->i_mode), session);
222 + memset(&ia, 0, sizeof(ia));
223 + ia.ia_valid = ATTR_MODE;
224 + ia.ia_mode = S_IRWXU;
225 + novfs_set_attr(newpath, &ia, session);
226 + retCode = novfs_delete(newpath, S_ISDIR(nd->d_inode->i_mode), session);
231 session = novfs_scope_get_sessionId(((struct inode_data *) ndir->i_private)->Scope);
232 @@ -3378,7 +3402,7 @@ int novfs_i_getattr(struct vfsmount *mnt
236 -int novfs_i_getxattr(struct dentry *dentry, const char *name, void *buffer,
237 +ssize_t novfs_i_getxattr(struct dentry *dentry, const char *name, void *buffer,
240 struct inode *inode = dentry->d_inode;
241 @@ -3528,7 +3552,7 @@ int novfs_i_setxattr(struct dentry *dent
245 -int novfs_i_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size)
246 +ssize_t novfs_i_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size)
248 struct inode *inode = dentry->d_inode;
249 struct novfs_schandle sessionId;
250 @@ -3720,6 +3744,9 @@ int novfs_statfs(struct dentry *de, stru
251 DbgPrint("fd=%llu\n", fd);
252 DbgPrint("te=%llu\n", te);
253 DbgPrint("fe=%llu\n", fd);
254 + /* fix for Nautilus */
255 + if (sb->s_blocksize == 0)
256 + sb->s_blocksize = 4096;
258 buf->f_type = sb->s_magic;
259 buf->f_bsize = sb->s_blocksize;
260 @@ -3762,7 +3789,6 @@ struct inode *novfs_get_inode(struct sup
261 inode->i_mode = mode;
264 - inode->i_sb->s_blocksize = sb->s_blocksize;
265 inode->i_blkbits = sb->s_blocksize_bits;
268 @@ -3826,8 +3852,6 @@ struct inode *novfs_get_inode(struct sup
270 inode->i_op = &novfs_inode_operations;
271 inode->i_fop = &novfs_dir_operations;
273 - inode->i_sb->s_blocksize = 0;
274 inode->i_blkbits = 0;
277 @@ -3957,6 +3981,7 @@ static int novfs_get_sb(struct file_syst
279 static void novfs_kill_sb(struct super_block *super)
281 + shrink_dcache_sb(super);
282 kill_litter_super(super);
285 Index: linux-2.6.27/fs/novfs/vfs.h
286 ===================================================================
287 --- linux-2.6.27.orig/fs/novfs/vfs.h 2008-12-02 11:57:24.000000000 +0530
288 +++ linux-2.6.27/fs/novfs/vfs.h 2008-12-02 11:58:18.000000000 +0530
289 @@ -344,7 +344,8 @@ extern int novfs_close_stream(void * Con
290 struct novfs_schandle SessionId);
292 extern int novfs_add_to_root(char *);
294 +extern int novfs_end_directory_enumerate(void *EnumHandle,
295 + struct novfs_schandle SessionId);
299 Index: linux-2.6.27/fs/novfs/nwcapi.c
300 ===================================================================
301 --- linux-2.6.27.orig/fs/novfs/nwcapi.c 2008-12-02 11:57:24.000000000 +0530
302 +++ linux-2.6.27/fs/novfs/nwcapi.c 2008-12-02 11:58:18.000000000 +0530
303 @@ -1845,14 +1845,14 @@ int novfs_set_map_drive(struct novfs_xpl
305 struct novfs_xplat_call_request *cmd;
306 struct novfs_xplat_call_reply *reply;
307 - unsigned long status = 0, datalen, cmdlen, replylen, cpylen;
308 + unsigned long status = 0, datalen, cmdlen, replylen;
309 struct nwc_map_drive_ex symInfo;
311 DbgPrint("Call to NwcSetMapDrive\n");
312 - cpylen = copy_from_user(&symInfo, pdata->reqData, sizeof(symInfo));
313 cmdlen = sizeof(*cmd);
315 - sizeof(symInfo) + symInfo.dirPathOffsetLength +
316 + if (copy_from_user(&symInfo, pdata->reqData, sizeof(symInfo)))
318 + datalen = sizeof(symInfo) + symInfo.dirPathOffsetLength +
319 symInfo.linkOffsetLength;
321 DbgPrint(" cmdlen = %d\n", cmdlen);
322 @@ -1876,7 +1876,10 @@ int novfs_set_map_drive(struct novfs_xpl
323 cmd->Command.SessionId = Session;
324 cmd->NwcCommand = NWC_MAP_DRIVE;
326 - cpylen = copy_from_user(cmd->data, pdata->reqData, datalen);
327 + if (copy_from_user(cmd->data, pdata->reqData, datalen)) {
332 Queue_Daemon_Command((void *)cmd, cmdlen, NULL, 0,
333 (void **)&reply, &replylen,