diff options
author | Steve French <sfrench@us.ibm.com> | 2007-07-09 21:16:18 -0400 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2007-07-09 21:16:18 -0400 |
commit | fb8c4b14d9259ba467241a7aaeb712caedce7ee8 (patch) | |
tree | 8f94a3b3b5e9e1bbdf9b38156ab2bfe2c055b47d /fs/cifs/inode.c | |
parent | b609f06ac4ac77433035366e9aa4dcd7a0f743a0 (diff) |
[CIFS] whitespace cleanup
More than halfway there
Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/inode.c')
-rw-r--r-- | fs/cifs/inode.c | 259 |
1 files changed, 131 insertions, 128 deletions
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index f0ff12b3f398..d8ae20f1a47a 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c | |||
@@ -57,14 +57,14 @@ int cifs_get_inode_info_unix(struct inode **pinode, | |||
57 | if (tmp_path == NULL) { | 57 | if (tmp_path == NULL) { |
58 | return -ENOMEM; | 58 | return -ENOMEM; |
59 | } | 59 | } |
60 | /* have to skip first of the double backslash of | 60 | /* have to skip first of the double backslash of |
61 | UNC name */ | 61 | UNC name */ |
62 | strncpy(tmp_path, pTcon->treeName, MAX_TREE_SIZE); | 62 | strncpy(tmp_path, pTcon->treeName, MAX_TREE_SIZE); |
63 | strncat(tmp_path, search_path, MAX_PATHCONF); | 63 | strncat(tmp_path, search_path, MAX_PATHCONF); |
64 | rc = connect_to_dfs_path(xid, pTcon->ses, | 64 | rc = connect_to_dfs_path(xid, pTcon->ses, |
65 | /* treename + */ tmp_path, | 65 | /* treename + */ tmp_path, |
66 | cifs_sb->local_nls, | 66 | cifs_sb->local_nls, |
67 | cifs_sb->mnt_cifs_flags & | 67 | cifs_sb->mnt_cifs_flags & |
68 | CIFS_MOUNT_MAP_SPECIAL_CHR); | 68 | CIFS_MOUNT_MAP_SPECIAL_CHR); |
69 | kfree(tmp_path); | 69 | kfree(tmp_path); |
70 | 70 | ||
@@ -81,7 +81,7 @@ int cifs_get_inode_info_unix(struct inode **pinode, | |||
81 | /* get new inode */ | 81 | /* get new inode */ |
82 | if (*pinode == NULL) { | 82 | if (*pinode == NULL) { |
83 | *pinode = new_inode(sb); | 83 | *pinode = new_inode(sb); |
84 | if (*pinode == NULL) | 84 | if (*pinode == NULL) |
85 | return -ENOMEM; | 85 | return -ENOMEM; |
86 | /* Is an i_ino of zero legal? */ | 86 | /* Is an i_ino of zero legal? */ |
87 | /* Are there sanity checks we can use to ensure that | 87 | /* Are there sanity checks we can use to ensure that |
@@ -103,7 +103,7 @@ int cifs_get_inode_info_unix(struct inode **pinode, | |||
103 | cifsInfo->time = jiffies; | 103 | cifsInfo->time = jiffies; |
104 | cFYI(1, ("New time %ld", cifsInfo->time)); | 104 | cFYI(1, ("New time %ld", cifsInfo->time)); |
105 | /* this is ok to set on every inode revalidate */ | 105 | /* this is ok to set on every inode revalidate */ |
106 | atomic_set(&cifsInfo->inUse,1); | 106 | atomic_set(&cifsInfo->inUse, 1); |
107 | 107 | ||
108 | inode->i_atime = | 108 | inode->i_atime = |
109 | cifs_NTtimeToUnix(le64_to_cpu(findData.LastAccessTime)); | 109 | cifs_NTtimeToUnix(le64_to_cpu(findData.LastAccessTime)); |
@@ -114,8 +114,8 @@ int cifs_get_inode_info_unix(struct inode **pinode, | |||
114 | cifs_NTtimeToUnix(le64_to_cpu(findData.LastStatusChange)); | 114 | cifs_NTtimeToUnix(le64_to_cpu(findData.LastStatusChange)); |
115 | inode->i_mode = le64_to_cpu(findData.Permissions); | 115 | inode->i_mode = le64_to_cpu(findData.Permissions); |
116 | /* since we set the inode type below we need to mask off | 116 | /* since we set the inode type below we need to mask off |
117 | to avoid strange results if bits set above */ | 117 | to avoid strange results if bits set above */ |
118 | inode->i_mode &= ~S_IFMT; | 118 | inode->i_mode &= ~S_IFMT; |
119 | if (type == UNIX_FILE) { | 119 | if (type == UNIX_FILE) { |
120 | inode->i_mode |= S_IFREG; | 120 | inode->i_mode |= S_IFREG; |
121 | } else if (type == UNIX_SYMLINK) { | 121 | } else if (type == UNIX_SYMLINK) { |
@@ -137,7 +137,7 @@ int cifs_get_inode_info_unix(struct inode **pinode, | |||
137 | } else { | 137 | } else { |
138 | /* safest to call it a file if we do not know */ | 138 | /* safest to call it a file if we do not know */ |
139 | inode->i_mode |= S_IFREG; | 139 | inode->i_mode |= S_IFREG; |
140 | cFYI(1,("unknown type %d",type)); | 140 | cFYI(1, ("unknown type %d", type)); |
141 | } | 141 | } |
142 | 142 | ||
143 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_OVERR_UID) | 143 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_OVERR_UID) |
@@ -183,17 +183,17 @@ int cifs_get_inode_info_unix(struct inode **pinode, | |||
183 | inode->i_op = &cifs_file_inode_ops; | 183 | inode->i_op = &cifs_file_inode_ops; |
184 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO) { | 184 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO) { |
185 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL) | 185 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL) |
186 | inode->i_fop = | 186 | inode->i_fop = |
187 | &cifs_file_direct_nobrl_ops; | 187 | &cifs_file_direct_nobrl_ops; |
188 | else | 188 | else |
189 | inode->i_fop = &cifs_file_direct_ops; | 189 | inode->i_fop = &cifs_file_direct_ops; |
190 | } else if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL) | 190 | } else if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL) |
191 | inode->i_fop = &cifs_file_nobrl_ops; | 191 | inode->i_fop = &cifs_file_nobrl_ops; |
192 | else /* not direct, send byte range locks */ | 192 | else /* not direct, send byte range locks */ |
193 | inode->i_fop = &cifs_file_ops; | 193 | inode->i_fop = &cifs_file_ops; |
194 | 194 | ||
195 | /* check if server can support readpages */ | 195 | /* check if server can support readpages */ |
196 | if (pTcon->ses->server->maxBuf < | 196 | if (pTcon->ses->server->maxBuf < |
197 | PAGE_CACHE_SIZE + MAX_CIFS_HDR_SIZE) | 197 | PAGE_CACHE_SIZE + MAX_CIFS_HDR_SIZE) |
198 | inode->i_data.a_ops = &cifs_addr_ops_smallbuf; | 198 | inode->i_data.a_ops = &cifs_addr_ops_smallbuf; |
199 | else | 199 | else |
@@ -215,7 +215,7 @@ int cifs_get_inode_info_unix(struct inode **pinode, | |||
215 | return rc; | 215 | return rc; |
216 | } | 216 | } |
217 | 217 | ||
218 | static int decode_sfu_inode(struct inode * inode, __u64 size, | 218 | static int decode_sfu_inode(struct inode *inode, __u64 size, |
219 | const unsigned char *path, | 219 | const unsigned char *path, |
220 | struct cifs_sb_info *cifs_sb, int xid) | 220 | struct cifs_sb_info *cifs_sb, int xid) |
221 | { | 221 | { |
@@ -225,7 +225,7 @@ static int decode_sfu_inode(struct inode * inode, __u64 size, | |||
225 | struct cifsTconInfo *pTcon = cifs_sb->tcon; | 225 | struct cifsTconInfo *pTcon = cifs_sb->tcon; |
226 | char buf[24]; | 226 | char buf[24]; |
227 | unsigned int bytes_read; | 227 | unsigned int bytes_read; |
228 | char * pbuf; | 228 | char *pbuf; |
229 | 229 | ||
230 | pbuf = buf; | 230 | pbuf = buf; |
231 | 231 | ||
@@ -241,16 +241,16 @@ static int decode_sfu_inode(struct inode * inode, __u64 size, | |||
241 | cifs_sb->local_nls, | 241 | cifs_sb->local_nls, |
242 | cifs_sb->mnt_cifs_flags & | 242 | cifs_sb->mnt_cifs_flags & |
243 | CIFS_MOUNT_MAP_SPECIAL_CHR); | 243 | CIFS_MOUNT_MAP_SPECIAL_CHR); |
244 | if (rc==0) { | 244 | if (rc == 0) { |
245 | int buf_type = CIFS_NO_BUFFER; | 245 | int buf_type = CIFS_NO_BUFFER; |
246 | /* Read header */ | 246 | /* Read header */ |
247 | rc = CIFSSMBRead(xid, pTcon, | 247 | rc = CIFSSMBRead(xid, pTcon, |
248 | netfid, | 248 | netfid, |
249 | 24 /* length */, 0 /* offset */, | 249 | 24 /* length */, 0 /* offset */, |
250 | &bytes_read, &pbuf, &buf_type); | 250 | &bytes_read, &pbuf, &buf_type); |
251 | if ((rc == 0) && (bytes_read >= 8)) { | 251 | if ((rc == 0) && (bytes_read >= 8)) { |
252 | if (memcmp("IntxBLK", pbuf, 8) == 0) { | 252 | if (memcmp("IntxBLK", pbuf, 8) == 0) { |
253 | cFYI(1,("Block device")); | 253 | cFYI(1, ("Block device")); |
254 | inode->i_mode |= S_IFBLK; | 254 | inode->i_mode |= S_IFBLK; |
255 | if (bytes_read == 24) { | 255 | if (bytes_read == 24) { |
256 | /* we have enough to decode dev num */ | 256 | /* we have enough to decode dev num */ |
@@ -261,7 +261,7 @@ static int decode_sfu_inode(struct inode * inode, __u64 size, | |||
261 | inode->i_rdev = MKDEV(mjr, mnr); | 261 | inode->i_rdev = MKDEV(mjr, mnr); |
262 | } | 262 | } |
263 | } else if (memcmp("IntxCHR", pbuf, 8) == 0) { | 263 | } else if (memcmp("IntxCHR", pbuf, 8) == 0) { |
264 | cFYI(1,("Char device")); | 264 | cFYI(1, ("Char device")); |
265 | inode->i_mode |= S_IFCHR; | 265 | inode->i_mode |= S_IFCHR; |
266 | if (bytes_read == 24) { | 266 | if (bytes_read == 24) { |
267 | /* we have enough to decode dev num */ | 267 | /* we have enough to decode dev num */ |
@@ -270,18 +270,18 @@ static int decode_sfu_inode(struct inode * inode, __u64 size, | |||
270 | mjr = le64_to_cpu(*(__le64 *)(pbuf+8)); | 270 | mjr = le64_to_cpu(*(__le64 *)(pbuf+8)); |
271 | mnr = le64_to_cpu(*(__le64 *)(pbuf+16)); | 271 | mnr = le64_to_cpu(*(__le64 *)(pbuf+16)); |
272 | inode->i_rdev = MKDEV(mjr, mnr); | 272 | inode->i_rdev = MKDEV(mjr, mnr); |
273 | } | 273 | } |
274 | } else if (memcmp("IntxLNK", pbuf, 7) == 0) { | 274 | } else if (memcmp("IntxLNK", pbuf, 7) == 0) { |
275 | cFYI(1,("Symlink")); | 275 | cFYI(1, ("Symlink")); |
276 | inode->i_mode |= S_IFLNK; | 276 | inode->i_mode |= S_IFLNK; |
277 | } else { | 277 | } else { |
278 | inode->i_mode |= S_IFREG; /* file? */ | 278 | inode->i_mode |= S_IFREG; /* file? */ |
279 | rc = -EOPNOTSUPP; | 279 | rc = -EOPNOTSUPP; |
280 | } | 280 | } |
281 | } else { | 281 | } else { |
282 | inode->i_mode |= S_IFREG; /* then it is a file */ | 282 | inode->i_mode |= S_IFREG; /* then it is a file */ |
283 | rc = -EOPNOTSUPP; /* or some unknown SFU type */ | 283 | rc = -EOPNOTSUPP; /* or some unknown SFU type */ |
284 | } | 284 | } |
285 | CIFSSMBClose(xid, pTcon, netfid); | 285 | CIFSSMBClose(xid, pTcon, netfid); |
286 | } | 286 | } |
287 | return rc; | 287 | return rc; |
@@ -290,7 +290,7 @@ static int decode_sfu_inode(struct inode * inode, __u64 size, | |||
290 | 290 | ||
291 | #define SFBITS_MASK (S_ISVTX | S_ISGID | S_ISUID) /* SETFILEBITS valid bits */ | 291 | #define SFBITS_MASK (S_ISVTX | S_ISGID | S_ISUID) /* SETFILEBITS valid bits */ |
292 | 292 | ||
293 | static int get_sfu_uid_mode(struct inode * inode, | 293 | static int get_sfu_uid_mode(struct inode *inode, |
294 | const unsigned char *path, | 294 | const unsigned char *path, |
295 | struct cifs_sb_info *cifs_sb, int xid) | 295 | struct cifs_sb_info *cifs_sb, int xid) |
296 | { | 296 | { |
@@ -301,15 +301,15 @@ static int get_sfu_uid_mode(struct inode * inode, | |||
301 | 301 | ||
302 | rc = CIFSSMBQueryEA(xid, cifs_sb->tcon, path, "SETFILEBITS", | 302 | rc = CIFSSMBQueryEA(xid, cifs_sb->tcon, path, "SETFILEBITS", |
303 | ea_value, 4 /* size of buf */, cifs_sb->local_nls, | 303 | ea_value, 4 /* size of buf */, cifs_sb->local_nls, |
304 | cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); | 304 | cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); |
305 | if (rc < 0) | 305 | if (rc < 0) |
306 | return (int)rc; | 306 | return (int)rc; |
307 | else if (rc > 3) { | 307 | else if (rc > 3) { |
308 | mode = le32_to_cpu(*((__le32 *)ea_value)); | 308 | mode = le32_to_cpu(*((__le32 *)ea_value)); |
309 | inode->i_mode &= ~SFBITS_MASK; | 309 | inode->i_mode &= ~SFBITS_MASK; |
310 | cFYI(1,("special bits 0%o org mode 0%o", mode, inode->i_mode)); | 310 | cFYI(1, ("special bits 0%o org mode 0%o", mode, inode->i_mode)); |
311 | inode->i_mode = (mode & SFBITS_MASK) | inode->i_mode; | 311 | inode->i_mode = (mode & SFBITS_MASK) | inode->i_mode; |
312 | cFYI(1,("special mode bits 0%o", mode)); | 312 | cFYI(1, ("special mode bits 0%o", mode)); |
313 | return 0; | 313 | return 0; |
314 | } else { | 314 | } else { |
315 | return 0; | 315 | return 0; |
@@ -334,11 +334,11 @@ int cifs_get_inode_info(struct inode **pinode, | |||
334 | int adjustTZ = FALSE; | 334 | int adjustTZ = FALSE; |
335 | 335 | ||
336 | pTcon = cifs_sb->tcon; | 336 | pTcon = cifs_sb->tcon; |
337 | cFYI(1,("Getting info on %s", search_path)); | 337 | cFYI(1, ("Getting info on %s", search_path)); |
338 | 338 | ||
339 | if ((pfindData == NULL) && (*pinode != NULL)) { | 339 | if ((pfindData == NULL) && (*pinode != NULL)) { |
340 | if (CIFS_I(*pinode)->clientCanCacheRead) { | 340 | if (CIFS_I(*pinode)->clientCanCacheRead) { |
341 | cFYI(1,("No need to revalidate cached inode sizes")); | 341 | cFYI(1, ("No need to revalidate cached inode sizes")); |
342 | return rc; | 342 | return rc; |
343 | } | 343 | } |
344 | } | 344 | } |
@@ -359,7 +359,7 @@ int cifs_get_inode_info(struct inode **pinode, | |||
359 | failed at least once - set flag in tcon or mount */ | 359 | failed at least once - set flag in tcon or mount */ |
360 | if ((rc == -EOPNOTSUPP) || (rc == -EINVAL)) { | 360 | if ((rc == -EOPNOTSUPP) || (rc == -EINVAL)) { |
361 | rc = SMBQueryInformation(xid, pTcon, search_path, | 361 | rc = SMBQueryInformation(xid, pTcon, search_path, |
362 | pfindData, cifs_sb->local_nls, | 362 | pfindData, cifs_sb->local_nls, |
363 | cifs_sb->mnt_cifs_flags & | 363 | cifs_sb->mnt_cifs_flags & |
364 | CIFS_MOUNT_MAP_SPECIAL_CHR); | 364 | CIFS_MOUNT_MAP_SPECIAL_CHR); |
365 | adjustTZ = TRUE; | 365 | adjustTZ = TRUE; |
@@ -384,8 +384,8 @@ int cifs_get_inode_info(struct inode **pinode, | |||
384 | strncat(tmp_path, search_path, MAX_PATHCONF); | 384 | strncat(tmp_path, search_path, MAX_PATHCONF); |
385 | rc = connect_to_dfs_path(xid, pTcon->ses, | 385 | rc = connect_to_dfs_path(xid, pTcon->ses, |
386 | /* treename + */ tmp_path, | 386 | /* treename + */ tmp_path, |
387 | cifs_sb->local_nls, | 387 | cifs_sb->local_nls, |
388 | cifs_sb->mnt_cifs_flags & | 388 | cifs_sb->mnt_cifs_flags & |
389 | CIFS_MOUNT_MAP_SPECIAL_CHR); | 389 | CIFS_MOUNT_MAP_SPECIAL_CHR); |
390 | kfree(tmp_path); | 390 | kfree(tmp_path); |
391 | /* BB fix up inode etc. */ | 391 | /* BB fix up inode etc. */ |
@@ -419,17 +419,17 @@ int cifs_get_inode_info(struct inode **pinode, | |||
419 | there Windows server or network appliances for which | 419 | there Windows server or network appliances for which |
420 | IndexNumber field is not guaranteed unique? */ | 420 | IndexNumber field is not guaranteed unique? */ |
421 | 421 | ||
422 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM){ | 422 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) { |
423 | int rc1 = 0; | 423 | int rc1 = 0; |
424 | __u64 inode_num; | 424 | __u64 inode_num; |
425 | 425 | ||
426 | rc1 = CIFSGetSrvInodeNumber(xid, pTcon, | 426 | rc1 = CIFSGetSrvInodeNumber(xid, pTcon, |
427 | search_path, &inode_num, | 427 | search_path, &inode_num, |
428 | cifs_sb->local_nls, | 428 | cifs_sb->local_nls, |
429 | cifs_sb->mnt_cifs_flags & | 429 | cifs_sb->mnt_cifs_flags & |
430 | CIFS_MOUNT_MAP_SPECIAL_CHR); | 430 | CIFS_MOUNT_MAP_SPECIAL_CHR); |
431 | if (rc1) { | 431 | if (rc1) { |
432 | cFYI(1,("GetSrvInodeNum rc %d", rc1)); | 432 | cFYI(1, ("GetSrvInodeNum rc %d", rc1)); |
433 | /* BB EOPNOSUPP disable SERVER_INUM? */ | 433 | /* BB EOPNOSUPP disable SERVER_INUM? */ |
434 | } else /* do we need cast or hash to ino? */ | 434 | } else /* do we need cast or hash to ino? */ |
435 | (*pinode)->i_ino = inode_num; | 435 | (*pinode)->i_ino = inode_num; |
@@ -463,7 +463,7 @@ int cifs_get_inode_info(struct inode **pinode, | |||
463 | cFYI(0, ("Attributes came in as 0x%x", attr)); | 463 | cFYI(0, ("Attributes came in as 0x%x", attr)); |
464 | if (adjustTZ && (pTcon->ses) && (pTcon->ses->server)) { | 464 | if (adjustTZ && (pTcon->ses) && (pTcon->ses->server)) { |
465 | inode->i_ctime.tv_sec += pTcon->ses->server->timeAdj; | 465 | inode->i_ctime.tv_sec += pTcon->ses->server->timeAdj; |
466 | inode->i_mtime.tv_sec += pTcon->ses->server->timeAdj; | 466 | inode->i_mtime.tv_sec += pTcon->ses->server->timeAdj; |
467 | } | 467 | } |
468 | 468 | ||
469 | /* set default mode. will override for dirs below */ | 469 | /* set default mode. will override for dirs below */ |
@@ -471,8 +471,9 @@ int cifs_get_inode_info(struct inode **pinode, | |||
471 | /* new inode, can safely set these fields */ | 471 | /* new inode, can safely set these fields */ |
472 | inode->i_mode = cifs_sb->mnt_file_mode; | 472 | inode->i_mode = cifs_sb->mnt_file_mode; |
473 | else /* since we set the inode type below we need to mask off | 473 | else /* since we set the inode type below we need to mask off |
474 | to avoid strange results if type changes and both get orred in */ | 474 | to avoid strange results if type changes and both |
475 | inode->i_mode &= ~S_IFMT; | 475 | get orred in */ |
476 | inode->i_mode &= ~S_IFMT; | ||
476 | /* if (attr & ATTR_REPARSE) */ | 477 | /* if (attr & ATTR_REPARSE) */ |
477 | /* We no longer handle these as symlinks because we could not | 478 | /* We no longer handle these as symlinks because we could not |
478 | follow them due to the absolute path with drive letter */ | 479 | follow them due to the absolute path with drive letter */ |
@@ -490,13 +491,13 @@ int cifs_get_inode_info(struct inode **pinode, | |||
490 | /* BB Finish for SFU style symlinks and devices */ | 491 | /* BB Finish for SFU style symlinks and devices */ |
491 | } else if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) && | 492 | } else if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) && |
492 | (cifsInfo->cifsAttrs & ATTR_SYSTEM)) { | 493 | (cifsInfo->cifsAttrs & ATTR_SYSTEM)) { |
493 | if (decode_sfu_inode(inode, | 494 | if (decode_sfu_inode(inode, |
494 | le64_to_cpu(pfindData->EndOfFile), | 495 | le64_to_cpu(pfindData->EndOfFile), |
495 | search_path, | 496 | search_path, |
496 | cifs_sb, xid)) { | 497 | cifs_sb, xid)) { |
497 | cFYI(1,("Unrecognized sfu inode type")); | 498 | cFYI(1, ("Unrecognized sfu inode type")); |
498 | } | 499 | } |
499 | cFYI(1,("sfu mode 0%o",inode->i_mode)); | 500 | cFYI(1, ("sfu mode 0%o", inode->i_mode)); |
500 | } else { | 501 | } else { |
501 | inode->i_mode |= S_IFREG; | 502 | inode->i_mode |= S_IFREG; |
502 | /* treat the dos attribute of read-only as read-only | 503 | /* treat the dos attribute of read-only as read-only |
@@ -517,7 +518,7 @@ int cifs_get_inode_info(struct inode **pinode, | |||
517 | if (is_size_safe_to_change(cifsInfo, le64_to_cpu(pfindData->EndOfFile))) { | 518 | if (is_size_safe_to_change(cifsInfo, le64_to_cpu(pfindData->EndOfFile))) { |
518 | /* can not safely shrink the file size here if the | 519 | /* can not safely shrink the file size here if the |
519 | client is writing to it due to potential races */ | 520 | client is writing to it due to potential races */ |
520 | i_size_write(inode,le64_to_cpu(pfindData->EndOfFile)); | 521 | i_size_write(inode, le64_to_cpu(pfindData->EndOfFile)); |
521 | 522 | ||
522 | /* 512 bytes (2**9) is the fake blocksize that must be | 523 | /* 512 bytes (2**9) is the fake blocksize that must be |
523 | used for this calculation */ | 524 | used for this calculation */ |
@@ -528,7 +529,7 @@ int cifs_get_inode_info(struct inode **pinode, | |||
528 | 529 | ||
529 | inode->i_nlink = le32_to_cpu(pfindData->NumberOfLinks); | 530 | inode->i_nlink = le32_to_cpu(pfindData->NumberOfLinks); |
530 | 531 | ||
531 | /* BB fill in uid and gid here? with help from winbind? | 532 | /* BB fill in uid and gid here? with help from winbind? |
532 | or retrieve from NTFS stream extended attribute */ | 533 | or retrieve from NTFS stream extended attribute */ |
533 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) { | 534 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) { |
534 | /* fill in uid, gid, mode from server ACL */ | 535 | /* fill in uid, gid, mode from server ACL */ |
@@ -540,7 +541,7 @@ int cifs_get_inode_info(struct inode **pinode, | |||
540 | inode->i_gid = cifs_sb->mnt_gid; | 541 | inode->i_gid = cifs_sb->mnt_gid; |
541 | /* set so we do not keep refreshing these fields with | 542 | /* set so we do not keep refreshing these fields with |
542 | bad data after user has changed them in memory */ | 543 | bad data after user has changed them in memory */ |
543 | atomic_set(&cifsInfo->inUse,1); | 544 | atomic_set(&cifsInfo->inUse, 1); |
544 | } | 545 | } |
545 | 546 | ||
546 | if (S_ISREG(inode->i_mode)) { | 547 | if (S_ISREG(inode->i_mode)) { |
@@ -557,7 +558,7 @@ int cifs_get_inode_info(struct inode **pinode, | |||
557 | else /* not direct, send byte range locks */ | 558 | else /* not direct, send byte range locks */ |
558 | inode->i_fop = &cifs_file_ops; | 559 | inode->i_fop = &cifs_file_ops; |
559 | 560 | ||
560 | if (pTcon->ses->server->maxBuf < | 561 | if (pTcon->ses->server->maxBuf < |
561 | PAGE_CACHE_SIZE + MAX_CIFS_HDR_SIZE) | 562 | PAGE_CACHE_SIZE + MAX_CIFS_HDR_SIZE) |
562 | inode->i_data.a_ops = &cifs_addr_ops_smallbuf; | 563 | inode->i_data.a_ops = &cifs_addr_ops_smallbuf; |
563 | else | 564 | else |
@@ -587,9 +588,9 @@ void cifs_read_inode(struct inode *inode) | |||
587 | cifs_sb = CIFS_SB(inode->i_sb); | 588 | cifs_sb = CIFS_SB(inode->i_sb); |
588 | xid = GetXid(); | 589 | xid = GetXid(); |
589 | if (cifs_sb->tcon->ses->capabilities & CAP_UNIX) | 590 | if (cifs_sb->tcon->ses->capabilities & CAP_UNIX) |
590 | cifs_get_inode_info_unix(&inode, "", inode->i_sb,xid); | 591 | cifs_get_inode_info_unix(&inode, "", inode->i_sb, xid); |
591 | else | 592 | else |
592 | cifs_get_inode_info(&inode, "", NULL, inode->i_sb,xid); | 593 | cifs_get_inode_info(&inode, "", NULL, inode->i_sb, xid); |
593 | /* can not call macro FreeXid here since in a void func */ | 594 | /* can not call macro FreeXid here since in a void func */ |
594 | _FreeXid(xid); | 595 | _FreeXid(xid); |
595 | } | 596 | } |
@@ -638,12 +639,12 @@ int cifs_unlink(struct inode *inode, struct dentry *direntry) | |||
638 | rc = CIFSSMBOpen(xid, pTcon, full_path, FILE_OPEN, DELETE, | 639 | rc = CIFSSMBOpen(xid, pTcon, full_path, FILE_OPEN, DELETE, |
639 | CREATE_NOT_DIR | CREATE_DELETE_ON_CLOSE, | 640 | CREATE_NOT_DIR | CREATE_DELETE_ON_CLOSE, |
640 | &netfid, &oplock, NULL, cifs_sb->local_nls, | 641 | &netfid, &oplock, NULL, cifs_sb->local_nls, |
641 | cifs_sb->mnt_cifs_flags & | 642 | cifs_sb->mnt_cifs_flags & |
642 | CIFS_MOUNT_MAP_SPECIAL_CHR); | 643 | CIFS_MOUNT_MAP_SPECIAL_CHR); |
643 | if (rc==0) { | 644 | if (rc == 0) { |
644 | CIFSSMBRenameOpenFile(xid, pTcon, netfid, NULL, | 645 | CIFSSMBRenameOpenFile(xid, pTcon, netfid, NULL, |
645 | cifs_sb->local_nls, | 646 | cifs_sb->local_nls, |
646 | cifs_sb->mnt_cifs_flags & | 647 | cifs_sb->mnt_cifs_flags & |
647 | CIFS_MOUNT_MAP_SPECIAL_CHR); | 648 | CIFS_MOUNT_MAP_SPECIAL_CHR); |
648 | CIFSSMBClose(xid, pTcon, netfid); | 649 | CIFSSMBClose(xid, pTcon, netfid); |
649 | if (direntry->d_inode) | 650 | if (direntry->d_inode) |
@@ -659,7 +660,7 @@ int cifs_unlink(struct inode *inode, struct dentry *direntry) | |||
659 | rc = CIFSSMBSetTimes(xid, pTcon, full_path, | 660 | rc = CIFSSMBSetTimes(xid, pTcon, full_path, |
660 | pinfo_buf, | 661 | pinfo_buf, |
661 | cifs_sb->local_nls, | 662 | cifs_sb->local_nls, |
662 | cifs_sb->mnt_cifs_flags & | 663 | cifs_sb->mnt_cifs_flags & |
663 | CIFS_MOUNT_MAP_SPECIAL_CHR); | 664 | CIFS_MOUNT_MAP_SPECIAL_CHR); |
664 | else | 665 | else |
665 | rc = -EOPNOTSUPP; | 666 | rc = -EOPNOTSUPP; |
@@ -670,7 +671,7 @@ int cifs_unlink(struct inode *inode, struct dentry *direntry) | |||
670 | /* rc = CIFSSMBSetAttrLegacy(xid, pTcon, | 671 | /* rc = CIFSSMBSetAttrLegacy(xid, pTcon, |
671 | full_path, | 672 | full_path, |
672 | (__u16)ATTR_NORMAL, | 673 | (__u16)ATTR_NORMAL, |
673 | cifs_sb->local_nls); | 674 | cifs_sb->local_nls); |
674 | For some strange reason it seems that NT4 eats the | 675 | For some strange reason it seems that NT4 eats the |
675 | old setattr call without actually setting the | 676 | old setattr call without actually setting the |
676 | attributes so on to the third attempted workaround | 677 | attributes so on to the third attempted workaround |
@@ -683,9 +684,9 @@ int cifs_unlink(struct inode *inode, struct dentry *direntry) | |||
683 | FILE_WRITE_ATTRIBUTES, 0, | 684 | FILE_WRITE_ATTRIBUTES, 0, |
684 | &netfid, &oplock, NULL, | 685 | &netfid, &oplock, NULL, |
685 | cifs_sb->local_nls, | 686 | cifs_sb->local_nls, |
686 | cifs_sb->mnt_cifs_flags & | 687 | cifs_sb->mnt_cifs_flags & |
687 | CIFS_MOUNT_MAP_SPECIAL_CHR); | 688 | CIFS_MOUNT_MAP_SPECIAL_CHR); |
688 | if (rc==0) { | 689 | if (rc == 0) { |
689 | rc = CIFSSMBSetFileTimes(xid, pTcon, | 690 | rc = CIFSSMBSetFileTimes(xid, pTcon, |
690 | pinfo_buf, | 691 | pinfo_buf, |
691 | netfid); | 692 | netfid); |
@@ -694,10 +695,10 @@ int cifs_unlink(struct inode *inode, struct dentry *direntry) | |||
694 | } | 695 | } |
695 | kfree(pinfo_buf); | 696 | kfree(pinfo_buf); |
696 | } | 697 | } |
697 | if (rc==0) { | 698 | if (rc == 0) { |
698 | rc = CIFSSMBDelFile(xid, pTcon, full_path, | 699 | rc = CIFSSMBDelFile(xid, pTcon, full_path, |
699 | cifs_sb->local_nls, | 700 | cifs_sb->local_nls, |
700 | cifs_sb->mnt_cifs_flags & | 701 | cifs_sb->mnt_cifs_flags & |
701 | CIFS_MOUNT_MAP_SPECIAL_CHR); | 702 | CIFS_MOUNT_MAP_SPECIAL_CHR); |
702 | if (!rc) { | 703 | if (!rc) { |
703 | if (direntry->d_inode) | 704 | if (direntry->d_inode) |
@@ -711,10 +712,10 @@ int cifs_unlink(struct inode *inode, struct dentry *direntry) | |||
711 | CREATE_NOT_DIR | | 712 | CREATE_NOT_DIR | |
712 | CREATE_DELETE_ON_CLOSE, | 713 | CREATE_DELETE_ON_CLOSE, |
713 | &netfid, &oplock, NULL, | 714 | &netfid, &oplock, NULL, |
714 | cifs_sb->local_nls, | 715 | cifs_sb->local_nls, |
715 | cifs_sb->mnt_cifs_flags & | 716 | cifs_sb->mnt_cifs_flags & |
716 | CIFS_MOUNT_MAP_SPECIAL_CHR); | 717 | CIFS_MOUNT_MAP_SPECIAL_CHR); |
717 | if (rc==0) { | 718 | if (rc == 0) { |
718 | CIFSSMBRenameOpenFile(xid, pTcon, | 719 | CIFSSMBRenameOpenFile(xid, pTcon, |
719 | netfid, NULL, | 720 | netfid, NULL, |
720 | cifs_sb->local_nls, | 721 | cifs_sb->local_nls, |
@@ -773,8 +774,8 @@ static void posix_fill_in_inode(struct inode *tmp_inode, | |||
773 | 774 | ||
774 | tmp_inode->i_mode = le64_to_cpu(pData->Permissions); | 775 | tmp_inode->i_mode = le64_to_cpu(pData->Permissions); |
775 | /* since we set the inode type below we need to mask off type | 776 | /* since we set the inode type below we need to mask off type |
776 | to avoid strange results if bits above were corrupt */ | 777 | to avoid strange results if bits above were corrupt */ |
777 | tmp_inode->i_mode &= ~S_IFMT; | 778 | tmp_inode->i_mode &= ~S_IFMT; |
778 | if (type == UNIX_FILE) { | 779 | if (type == UNIX_FILE) { |
779 | *pobject_type = DT_REG; | 780 | *pobject_type = DT_REG; |
780 | tmp_inode->i_mode |= S_IFREG; | 781 | tmp_inode->i_mode |= S_IFREG; |
@@ -804,11 +805,11 @@ static void posix_fill_in_inode(struct inode *tmp_inode, | |||
804 | /* safest to just call it a file */ | 805 | /* safest to just call it a file */ |
805 | *pobject_type = DT_REG; | 806 | *pobject_type = DT_REG; |
806 | tmp_inode->i_mode |= S_IFREG; | 807 | tmp_inode->i_mode |= S_IFREG; |
807 | cFYI(1,("unknown inode type %d",type)); | 808 | cFYI(1, ("unknown inode type %d", type)); |
808 | } | 809 | } |
809 | 810 | ||
810 | #ifdef CONFIG_CIFS_DEBUG2 | 811 | #ifdef CONFIG_CIFS_DEBUG2 |
811 | cFYI(1,("object type: %d", type)); | 812 | cFYI(1, ("object type: %d", type)); |
812 | #endif | 813 | #endif |
813 | tmp_inode->i_uid = le64_to_cpu(pData->Uid); | 814 | tmp_inode->i_uid = le64_to_cpu(pData->Uid); |
814 | tmp_inode->i_gid = le64_to_cpu(pData->Gid); | 815 | tmp_inode->i_gid = le64_to_cpu(pData->Gid); |
@@ -816,7 +817,7 @@ static void posix_fill_in_inode(struct inode *tmp_inode, | |||
816 | 817 | ||
817 | spin_lock(&tmp_inode->i_lock); | 818 | spin_lock(&tmp_inode->i_lock); |
818 | if (is_size_safe_to_change(cifsInfo, end_of_file)) { | 819 | if (is_size_safe_to_change(cifsInfo, end_of_file)) { |
819 | /* can not safely change the file size here if the | 820 | /* can not safely change the file size here if the |
820 | client is writing to it due to potential races */ | 821 | client is writing to it due to potential races */ |
821 | i_size_write(tmp_inode, end_of_file); | 822 | i_size_write(tmp_inode, end_of_file); |
822 | 823 | ||
@@ -830,27 +831,28 @@ static void posix_fill_in_inode(struct inode *tmp_inode, | |||
830 | cFYI(1, ("File inode")); | 831 | cFYI(1, ("File inode")); |
831 | tmp_inode->i_op = &cifs_file_inode_ops; | 832 | tmp_inode->i_op = &cifs_file_inode_ops; |
832 | 833 | ||
833 | if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO) { | 834 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO) { |
834 | if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL) | 835 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL) |
835 | tmp_inode->i_fop = &cifs_file_direct_nobrl_ops; | 836 | tmp_inode->i_fop = &cifs_file_direct_nobrl_ops; |
836 | else | 837 | else |
837 | tmp_inode->i_fop = &cifs_file_direct_ops; | 838 | tmp_inode->i_fop = &cifs_file_direct_ops; |
838 | 839 | ||
839 | } else if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL) | 840 | } else if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL) |
840 | tmp_inode->i_fop = &cifs_file_nobrl_ops; | 841 | tmp_inode->i_fop = &cifs_file_nobrl_ops; |
841 | else | 842 | else |
842 | tmp_inode->i_fop = &cifs_file_ops; | 843 | tmp_inode->i_fop = &cifs_file_ops; |
843 | 844 | ||
844 | if((cifs_sb->tcon) && (cifs_sb->tcon->ses) && | 845 | if ((cifs_sb->tcon) && (cifs_sb->tcon->ses) && |
845 | (cifs_sb->tcon->ses->server->maxBuf < | 846 | (cifs_sb->tcon->ses->server->maxBuf < |
846 | PAGE_CACHE_SIZE + MAX_CIFS_HDR_SIZE)) | 847 | PAGE_CACHE_SIZE + MAX_CIFS_HDR_SIZE)) |
847 | tmp_inode->i_data.a_ops = &cifs_addr_ops_smallbuf; | 848 | tmp_inode->i_data.a_ops = &cifs_addr_ops_smallbuf; |
848 | else | 849 | else |
849 | tmp_inode->i_data.a_ops = &cifs_addr_ops; | 850 | tmp_inode->i_data.a_ops = &cifs_addr_ops; |
850 | 851 | ||
851 | if(isNewInode) | 852 | if (isNewInode) |
852 | return; /* No sense invalidating pages for new inode since we | 853 | return; /* No sense invalidating pages for new inode |
853 | have not started caching readahead file data yet */ | 854 | since we we have not started caching |
855 | readahead file data yet */ | ||
854 | 856 | ||
855 | if (timespec_equal(&tmp_inode->i_mtime, &local_mtime) && | 857 | if (timespec_equal(&tmp_inode->i_mtime, &local_mtime) && |
856 | (local_size == tmp_inode->i_size)) { | 858 | (local_size == tmp_inode->i_size)) { |
@@ -869,10 +871,10 @@ static void posix_fill_in_inode(struct inode *tmp_inode, | |||
869 | tmp_inode->i_op = &cifs_symlink_inode_ops; | 871 | tmp_inode->i_op = &cifs_symlink_inode_ops; |
870 | /* tmp_inode->i_fop = *//* do not need to set to anything */ | 872 | /* tmp_inode->i_fop = *//* do not need to set to anything */ |
871 | } else { | 873 | } else { |
872 | cFYI(1, ("Special inode")); | 874 | cFYI(1, ("Special inode")); |
873 | init_special_inode(tmp_inode, tmp_inode->i_mode, | 875 | init_special_inode(tmp_inode, tmp_inode->i_mode, |
874 | tmp_inode->i_rdev); | 876 | tmp_inode->i_rdev); |
875 | } | 877 | } |
876 | } | 878 | } |
877 | 879 | ||
878 | int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode) | 880 | int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode) |
@@ -897,21 +899,21 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode) | |||
897 | return -ENOMEM; | 899 | return -ENOMEM; |
898 | } | 900 | } |
899 | 901 | ||
900 | if((pTcon->ses->capabilities & CAP_UNIX) && | 902 | if ((pTcon->ses->capabilities & CAP_UNIX) && |
901 | (CIFS_UNIX_POSIX_PATH_OPS_CAP & | 903 | (CIFS_UNIX_POSIX_PATH_OPS_CAP & |
902 | le64_to_cpu(pTcon->fsUnixInfo.Capability))) { | 904 | le64_to_cpu(pTcon->fsUnixInfo.Capability))) { |
903 | u32 oplock = 0; | 905 | u32 oplock = 0; |
904 | FILE_UNIX_BASIC_INFO * pInfo = | 906 | FILE_UNIX_BASIC_INFO * pInfo = |
905 | kzalloc(sizeof(FILE_UNIX_BASIC_INFO), GFP_KERNEL); | 907 | kzalloc(sizeof(FILE_UNIX_BASIC_INFO), GFP_KERNEL); |
906 | if(pInfo == NULL) { | 908 | if (pInfo == NULL) { |
907 | rc = -ENOMEM; | 909 | rc = -ENOMEM; |
908 | goto mkdir_out; | 910 | goto mkdir_out; |
909 | } | 911 | } |
910 | 912 | ||
911 | rc = CIFSPOSIXCreate(xid, pTcon, SMB_O_DIRECTORY | SMB_O_CREAT, | 913 | rc = CIFSPOSIXCreate(xid, pTcon, SMB_O_DIRECTORY | SMB_O_CREAT, |
912 | mode, NULL /* netfid */, pInfo, &oplock, | 914 | mode, NULL /* netfid */, pInfo, &oplock, |
913 | full_path, cifs_sb->local_nls, | 915 | full_path, cifs_sb->local_nls, |
914 | cifs_sb->mnt_cifs_flags & | 916 | cifs_sb->mnt_cifs_flags & |
915 | CIFS_MOUNT_MAP_SPECIAL_CHR); | 917 | CIFS_MOUNT_MAP_SPECIAL_CHR); |
916 | if (rc) { | 918 | if (rc) { |
917 | cFYI(1, ("posix mkdir returned 0x%x", rc)); | 919 | cFYI(1, ("posix mkdir returned 0x%x", rc)); |
@@ -919,8 +921,9 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode) | |||
919 | } else { | 921 | } else { |
920 | int obj_type; | 922 | int obj_type; |
921 | if (pInfo->Type == -1) /* no return info - go query */ | 923 | if (pInfo->Type == -1) /* no return info - go query */ |
922 | goto mkdir_get_info; | 924 | goto mkdir_get_info; |
923 | /*BB check (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID ) to see if need to set uid/gid */ | 925 | /*BB check (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID ) to see if need |
926 | to set uid/gid */ | ||
924 | inc_nlink(inode); | 927 | inc_nlink(inode); |
925 | if (pTcon->nocase) | 928 | if (pTcon->nocase) |
926 | direntry->d_op = &cifs_ci_dentry_ops; | 929 | direntry->d_op = &cifs_ci_dentry_ops; |
@@ -937,7 +940,7 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode) | |||
937 | newinode->i_ino = | 940 | newinode->i_ino = |
938 | (unsigned long)pInfo->UniqueId; | 941 | (unsigned long)pInfo->UniqueId; |
939 | } /* note ino incremented to unique num in new_inode */ | 942 | } /* note ino incremented to unique num in new_inode */ |
940 | if(inode->i_sb->s_flags & MS_NOATIME) | 943 | if (inode->i_sb->s_flags & MS_NOATIME) |
941 | newinode->i_flags |= S_NOATIME | S_NOCMTIME; | 944 | newinode->i_flags |= S_NOATIME | S_NOCMTIME; |
942 | newinode->i_nlink = 2; | 945 | newinode->i_nlink = 2; |
943 | 946 | ||
@@ -949,17 +952,17 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode) | |||
949 | posix_fill_in_inode(direntry->d_inode, | 952 | posix_fill_in_inode(direntry->d_inode, |
950 | pInfo, &obj_type, 1 /* NewInode */); | 953 | pInfo, &obj_type, 1 /* NewInode */); |
951 | #ifdef CONFIG_CIFS_DEBUG2 | 954 | #ifdef CONFIG_CIFS_DEBUG2 |
952 | cFYI(1,("instantiated dentry %p %s to inode %p", | 955 | cFYI(1, ("instantiated dentry %p %s to inode %p", |
953 | direntry, direntry->d_name.name, newinode)); | 956 | direntry, direntry->d_name.name, newinode)); |
954 | 957 | ||
955 | if(newinode->i_nlink != 2) | 958 | if (newinode->i_nlink != 2) |
956 | cFYI(1,("unexpected number of links %d", | 959 | cFYI(1, ("unexpected number of links %d", |
957 | newinode->i_nlink)); | 960 | newinode->i_nlink)); |
958 | #endif | 961 | #endif |
959 | } | 962 | } |
960 | kfree(pInfo); | 963 | kfree(pInfo); |
961 | goto mkdir_out; | 964 | goto mkdir_out; |
962 | } | 965 | } |
963 | 966 | ||
964 | /* BB add setting the equivalent of mode via CreateX w/ACLs */ | 967 | /* BB add setting the equivalent of mode via CreateX w/ACLs */ |
965 | rc = CIFSSMBMkDir(xid, pTcon, full_path, cifs_sb->local_nls, | 968 | rc = CIFSSMBMkDir(xid, pTcon, full_path, cifs_sb->local_nls, |
@@ -968,14 +971,14 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode) | |||
968 | cFYI(1, ("cifs_mkdir returned 0x%x", rc)); | 971 | cFYI(1, ("cifs_mkdir returned 0x%x", rc)); |
969 | d_drop(direntry); | 972 | d_drop(direntry); |
970 | } else { | 973 | } else { |
971 | mkdir_get_info: | 974 | mkdir_get_info: |
972 | inc_nlink(inode); | 975 | inc_nlink(inode); |
973 | if (pTcon->ses->capabilities & CAP_UNIX) | 976 | if (pTcon->ses->capabilities & CAP_UNIX) |
974 | rc = cifs_get_inode_info_unix(&newinode, full_path, | 977 | rc = cifs_get_inode_info_unix(&newinode, full_path, |
975 | inode->i_sb,xid); | 978 | inode->i_sb, xid); |
976 | else | 979 | else |
977 | rc = cifs_get_inode_info(&newinode, full_path, NULL, | 980 | rc = cifs_get_inode_info(&newinode, full_path, NULL, |
978 | inode->i_sb,xid); | 981 | inode->i_sb, xid); |
979 | 982 | ||
980 | if (pTcon->nocase) | 983 | if (pTcon->nocase) |
981 | direntry->d_op = &cifs_ci_dentry_ops; | 984 | direntry->d_op = &cifs_ci_dentry_ops; |
@@ -983,9 +986,9 @@ mkdir_get_info: | |||
983 | direntry->d_op = &cifs_dentry_ops; | 986 | direntry->d_op = &cifs_dentry_ops; |
984 | d_instantiate(direntry, newinode); | 987 | d_instantiate(direntry, newinode); |
985 | /* setting nlink not necessary except in cases where we | 988 | /* setting nlink not necessary except in cases where we |
986 | * failed to get it from the server or was set bogus */ | 989 | * failed to get it from the server or was set bogus */ |
987 | if ((direntry->d_inode) && (direntry->d_inode->i_nlink < 2)) | 990 | if ((direntry->d_inode) && (direntry->d_inode->i_nlink < 2)) |
988 | direntry->d_inode->i_nlink = 2; | 991 | direntry->d_inode->i_nlink = 2; |
989 | if (cifs_sb->tcon->ses->capabilities & CAP_UNIX) { | 992 | if (cifs_sb->tcon->ses->capabilities & CAP_UNIX) { |
990 | mode &= ~current->fs->umask; | 993 | mode &= ~current->fs->umask; |
991 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) { | 994 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) { |
@@ -1002,27 +1005,27 @@ mkdir_get_info: | |||
1002 | mode, (__u64)-1, | 1005 | mode, (__u64)-1, |
1003 | (__u64)-1, 0 /* dev_t */, | 1006 | (__u64)-1, 0 /* dev_t */, |
1004 | cifs_sb->local_nls, | 1007 | cifs_sb->local_nls, |
1005 | cifs_sb->mnt_cifs_flags & | 1008 | cifs_sb->mnt_cifs_flags & |
1006 | CIFS_MOUNT_MAP_SPECIAL_CHR); | 1009 | CIFS_MOUNT_MAP_SPECIAL_CHR); |
1007 | } | 1010 | } |
1008 | } else { | 1011 | } else { |
1009 | /* BB to be implemented via Windows secrty descriptors | 1012 | /* BB to be implemented via Windows secrty descriptors |
1010 | eg CIFSSMBWinSetPerms(xid, pTcon, full_path, mode, | 1013 | eg CIFSSMBWinSetPerms(xid, pTcon, full_path, mode, |
1011 | -1, -1, local_nls); */ | 1014 | -1, -1, local_nls); */ |
1012 | if(direntry->d_inode) { | 1015 | if (direntry->d_inode) { |
1013 | direntry->d_inode->i_mode = mode; | 1016 | direntry->d_inode->i_mode = mode; |
1014 | direntry->d_inode->i_mode |= S_IFDIR; | 1017 | direntry->d_inode->i_mode |= S_IFDIR; |
1015 | if(cifs_sb->mnt_cifs_flags & | 1018 | if (cifs_sb->mnt_cifs_flags & |
1016 | CIFS_MOUNT_SET_UID) { | 1019 | CIFS_MOUNT_SET_UID) { |
1017 | direntry->d_inode->i_uid = | 1020 | direntry->d_inode->i_uid = |
1018 | current->fsuid; | 1021 | current->fsuid; |
1019 | direntry->d_inode->i_gid = | 1022 | direntry->d_inode->i_gid = |
1020 | current->fsgid; | 1023 | current->fsgid; |
1021 | } | 1024 | } |
1022 | } | 1025 | } |
1023 | } | 1026 | } |
1024 | } | 1027 | } |
1025 | mkdir_out: | 1028 | mkdir_out: |
1026 | kfree(full_path); | 1029 | kfree(full_path); |
1027 | FreeXid(xid); | 1030 | FreeXid(xid); |
1028 | return rc; | 1031 | return rc; |
@@ -1056,7 +1059,7 @@ int cifs_rmdir(struct inode *inode, struct dentry *direntry) | |||
1056 | if (!rc) { | 1059 | if (!rc) { |
1057 | drop_nlink(inode); | 1060 | drop_nlink(inode); |
1058 | spin_lock(&direntry->d_inode->i_lock); | 1061 | spin_lock(&direntry->d_inode->i_lock); |
1059 | i_size_write(direntry->d_inode,0); | 1062 | i_size_write(direntry->d_inode, 0); |
1060 | clear_nlink(direntry->d_inode); | 1063 | clear_nlink(direntry->d_inode); |
1061 | spin_unlock(&direntry->d_inode->i_lock); | 1064 | spin_unlock(&direntry->d_inode->i_lock); |
1062 | } | 1065 | } |
@@ -1121,7 +1124,7 @@ int cifs_rename(struct inode *source_inode, struct dentry *source_direntry, | |||
1121 | info_buf_target = info_buf_source + 1; | 1124 | info_buf_target = info_buf_source + 1; |
1122 | if (pTcon->ses->capabilities & CAP_UNIX) | 1125 | if (pTcon->ses->capabilities & CAP_UNIX) |
1123 | rc = CIFSSMBUnixQPathInfo(xid, pTcon, fromName, | 1126 | rc = CIFSSMBUnixQPathInfo(xid, pTcon, fromName, |
1124 | info_buf_source, | 1127 | info_buf_source, |
1125 | cifs_sb_source->local_nls, | 1128 | cifs_sb_source->local_nls, |
1126 | cifs_sb_source->mnt_cifs_flags & | 1129 | cifs_sb_source->mnt_cifs_flags & |
1127 | CIFS_MOUNT_MAP_SPECIAL_CHR); | 1130 | CIFS_MOUNT_MAP_SPECIAL_CHR); |
@@ -1171,12 +1174,12 @@ int cifs_rename(struct inode *source_inode, struct dentry *source_direntry, | |||
1171 | might not right be right access to request */ | 1174 | might not right be right access to request */ |
1172 | rc = CIFSSMBOpen(xid, pTcon, fromName, FILE_OPEN, GENERIC_READ, | 1175 | rc = CIFSSMBOpen(xid, pTcon, fromName, FILE_OPEN, GENERIC_READ, |
1173 | CREATE_NOT_DIR, &netfid, &oplock, NULL, | 1176 | CREATE_NOT_DIR, &netfid, &oplock, NULL, |
1174 | cifs_sb_source->local_nls, | 1177 | cifs_sb_source->local_nls, |
1175 | cifs_sb_source->mnt_cifs_flags & | 1178 | cifs_sb_source->mnt_cifs_flags & |
1176 | CIFS_MOUNT_MAP_SPECIAL_CHR); | 1179 | CIFS_MOUNT_MAP_SPECIAL_CHR); |
1177 | if (rc==0) { | 1180 | if (rc == 0) { |
1178 | rc = CIFSSMBRenameOpenFile(xid, pTcon, netfid, toName, | 1181 | rc = CIFSSMBRenameOpenFile(xid, pTcon, netfid, toName, |
1179 | cifs_sb_source->local_nls, | 1182 | cifs_sb_source->local_nls, |
1180 | cifs_sb_source->mnt_cifs_flags & | 1183 | cifs_sb_source->mnt_cifs_flags & |
1181 | CIFS_MOUNT_MAP_SPECIAL_CHR); | 1184 | CIFS_MOUNT_MAP_SPECIAL_CHR); |
1182 | CIFSSMBClose(xid, pTcon, netfid); | 1185 | CIFSSMBClose(xid, pTcon, netfid); |
@@ -1249,7 +1252,7 @@ int cifs_revalidate(struct dentry *direntry) | |||
1249 | 1252 | ||
1250 | if (cifs_sb->tcon->ses->capabilities & CAP_UNIX) { | 1253 | if (cifs_sb->tcon->ses->capabilities & CAP_UNIX) { |
1251 | rc = cifs_get_inode_info_unix(&direntry->d_inode, full_path, | 1254 | rc = cifs_get_inode_info_unix(&direntry->d_inode, full_path, |
1252 | direntry->d_sb,xid); | 1255 | direntry->d_sb, xid); |
1253 | if (rc) { | 1256 | if (rc) { |
1254 | cFYI(1, ("error on getting revalidate info %d", rc)); | 1257 | cFYI(1, ("error on getting revalidate info %d", rc)); |
1255 | /* if (rc != -ENOENT) | 1258 | /* if (rc != -ENOENT) |
@@ -1258,7 +1261,7 @@ int cifs_revalidate(struct dentry *direntry) | |||
1258 | } | 1261 | } |
1259 | } else { | 1262 | } else { |
1260 | rc = cifs_get_inode_info(&direntry->d_inode, full_path, NULL, | 1263 | rc = cifs_get_inode_info(&direntry->d_inode, full_path, NULL, |
1261 | direntry->d_sb,xid); | 1264 | direntry->d_sb, xid); |
1262 | if (rc) { | 1265 | if (rc) { |
1263 | cFYI(1, ("error on getting revalidate info %d", rc)); | 1266 | cFYI(1, ("error on getting revalidate info %d", rc)); |
1264 | /* if (rc != -ENOENT) | 1267 | /* if (rc != -ENOENT) |
@@ -1271,7 +1274,7 @@ int cifs_revalidate(struct dentry *direntry) | |||
1271 | /* if not oplocked, we invalidate inode pages if mtime or file size | 1274 | /* if not oplocked, we invalidate inode pages if mtime or file size |
1272 | had changed on server */ | 1275 | had changed on server */ |
1273 | 1276 | ||
1274 | if (timespec_equal(&local_mtime,&direntry->d_inode->i_mtime) && | 1277 | if (timespec_equal(&local_mtime, &direntry->d_inode->i_mtime) && |
1275 | (local_size == direntry->d_inode->i_size)) { | 1278 | (local_size == direntry->d_inode->i_size)) { |
1276 | cFYI(1, ("cifs_revalidate - inode unchanged")); | 1279 | cFYI(1, ("cifs_revalidate - inode unchanged")); |
1277 | } else { | 1280 | } else { |
@@ -1298,7 +1301,7 @@ int cifs_revalidate(struct dentry *direntry) | |||
1298 | if (invalidate_inode) { | 1301 | if (invalidate_inode) { |
1299 | /* shrink_dcache not necessary now that cifs dentry ops | 1302 | /* shrink_dcache not necessary now that cifs dentry ops |
1300 | are exported for negative dentries */ | 1303 | are exported for negative dentries */ |
1301 | /* if(S_ISDIR(direntry->d_inode->i_mode)) | 1304 | /* if (S_ISDIR(direntry->d_inode->i_mode)) |
1302 | shrink_dcache_parent(direntry); */ | 1305 | shrink_dcache_parent(direntry); */ |
1303 | if (S_ISREG(direntry->d_inode->i_mode)) { | 1306 | if (S_ISREG(direntry->d_inode->i_mode)) { |
1304 | if (direntry->d_inode->i_mapping) | 1307 | if (direntry->d_inode->i_mapping) |
@@ -1351,7 +1354,7 @@ static int cifs_truncate_page(struct address_space *mapping, loff_t from) | |||
1351 | return rc; | 1354 | return rc; |
1352 | } | 1355 | } |
1353 | 1356 | ||
1354 | static int cifs_vmtruncate(struct inode * inode, loff_t offset) | 1357 | static int cifs_vmtruncate(struct inode *inode, loff_t offset) |
1355 | { | 1358 | { |
1356 | struct address_space *mapping = inode->i_mapping; | 1359 | struct address_space *mapping = inode->i_mapping; |
1357 | unsigned long limit; | 1360 | unsigned long limit; |
@@ -1424,7 +1427,7 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs) | |||
1424 | if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_PERM) == 0) { | 1427 | if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_PERM) == 0) { |
1425 | /* check if we have permission to change attrs */ | 1428 | /* check if we have permission to change attrs */ |
1426 | rc = inode_change_ok(direntry->d_inode, attrs); | 1429 | rc = inode_change_ok(direntry->d_inode, attrs); |
1427 | if(rc < 0) { | 1430 | if (rc < 0) { |
1428 | FreeXid(xid); | 1431 | FreeXid(xid); |
1429 | return rc; | 1432 | return rc; |
1430 | } else | 1433 | } else |
@@ -1459,16 +1462,16 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs) | |||
1459 | rc = CIFSSMBSetFileSize(xid, pTcon, attrs->ia_size, | 1462 | rc = CIFSSMBSetFileSize(xid, pTcon, attrs->ia_size, |
1460 | nfid, npid, FALSE); | 1463 | nfid, npid, FALSE); |
1461 | atomic_dec(&open_file->wrtPending); | 1464 | atomic_dec(&open_file->wrtPending); |
1462 | cFYI(1,("SetFSize for attrs rc = %d", rc)); | 1465 | cFYI(1, ("SetFSize for attrs rc = %d", rc)); |
1463 | if((rc == -EINVAL) || (rc == -EOPNOTSUPP)) { | 1466 | if ((rc == -EINVAL) || (rc == -EOPNOTSUPP)) { |
1464 | int bytes_written; | 1467 | int bytes_written; |
1465 | rc = CIFSSMBWrite(xid, pTcon, | 1468 | rc = CIFSSMBWrite(xid, pTcon, |
1466 | nfid, 0, attrs->ia_size, | 1469 | nfid, 0, attrs->ia_size, |
1467 | &bytes_written, NULL, NULL, | 1470 | &bytes_written, NULL, NULL, |
1468 | 1 /* 45 seconds */); | 1471 | 1 /* 45 seconds */); |
1469 | cFYI(1,("Wrt seteof rc %d", rc)); | 1472 | cFYI(1, ("Wrt seteof rc %d", rc)); |
1470 | } | 1473 | } |
1471 | } else | 1474 | } else |
1472 | rc = -EINVAL; | 1475 | rc = -EINVAL; |
1473 | 1476 | ||
1474 | if (rc != 0) { | 1477 | if (rc != 0) { |
@@ -1478,11 +1481,11 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs) | |||
1478 | it by handle */ | 1481 | it by handle */ |
1479 | rc = CIFSSMBSetEOF(xid, pTcon, full_path, | 1482 | rc = CIFSSMBSetEOF(xid, pTcon, full_path, |
1480 | attrs->ia_size, FALSE, | 1483 | attrs->ia_size, FALSE, |
1481 | cifs_sb->local_nls, | 1484 | cifs_sb->local_nls, |
1482 | cifs_sb->mnt_cifs_flags & | 1485 | cifs_sb->mnt_cifs_flags & |
1483 | CIFS_MOUNT_MAP_SPECIAL_CHR); | 1486 | CIFS_MOUNT_MAP_SPECIAL_CHR); |
1484 | cFYI(1, ("SetEOF by path (setattrs) rc = %d", rc)); | 1487 | cFYI(1, ("SetEOF by path (setattrs) rc = %d", rc)); |
1485 | if((rc == -EINVAL) || (rc == -EOPNOTSUPP)) { | 1488 | if ((rc == -EINVAL) || (rc == -EOPNOTSUPP)) { |
1486 | __u16 netfid; | 1489 | __u16 netfid; |
1487 | int oplock = FALSE; | 1490 | int oplock = FALSE; |
1488 | 1491 | ||
@@ -1493,14 +1496,14 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs) | |||
1493 | NULL, cifs_sb->local_nls, | 1496 | NULL, cifs_sb->local_nls, |
1494 | cifs_sb->mnt_cifs_flags & | 1497 | cifs_sb->mnt_cifs_flags & |
1495 | CIFS_MOUNT_MAP_SPECIAL_CHR); | 1498 | CIFS_MOUNT_MAP_SPECIAL_CHR); |
1496 | if (rc==0) { | 1499 | if (rc == 0) { |
1497 | int bytes_written; | 1500 | int bytes_written; |
1498 | rc = CIFSSMBWrite(xid, pTcon, | 1501 | rc = CIFSSMBWrite(xid, pTcon, |
1499 | netfid, 0, | 1502 | netfid, 0, |
1500 | attrs->ia_size, | 1503 | attrs->ia_size, |
1501 | &bytes_written, NULL, | 1504 | &bytes_written, NULL, |
1502 | NULL, 1 /* 45 sec */); | 1505 | NULL, 1 /* 45 sec */); |
1503 | cFYI(1,("wrt seteof rc %d",rc)); | 1506 | cFYI(1, ("wrt seteof rc %d", rc)); |
1504 | CIFSSMBClose(xid, pTcon, netfid); | 1507 | CIFSSMBClose(xid, pTcon, netfid); |
1505 | } | 1508 | } |
1506 | 1509 | ||
@@ -1517,7 +1520,7 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs) | |||
1517 | rc = cifs_vmtruncate(direntry->d_inode, attrs->ia_size); | 1520 | rc = cifs_vmtruncate(direntry->d_inode, attrs->ia_size); |
1518 | cifs_truncate_page(direntry->d_inode->i_mapping, | 1521 | cifs_truncate_page(direntry->d_inode->i_mapping, |
1519 | direntry->d_inode->i_size); | 1522 | direntry->d_inode->i_size); |
1520 | } else | 1523 | } else |
1521 | goto cifs_setattr_exit; | 1524 | goto cifs_setattr_exit; |
1522 | } | 1525 | } |
1523 | if (attrs->ia_valid & ATTR_UID) { | 1526 | if (attrs->ia_valid & ATTR_UID) { |
@@ -1539,7 +1542,7 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs) | |||
1539 | && (attrs->ia_valid & (ATTR_MODE | ATTR_GID | ATTR_UID))) | 1542 | && (attrs->ia_valid & (ATTR_MODE | ATTR_GID | ATTR_UID))) |
1540 | rc = CIFSSMBUnixSetPerms(xid, pTcon, full_path, mode, uid, gid, | 1543 | rc = CIFSSMBUnixSetPerms(xid, pTcon, full_path, mode, uid, gid, |
1541 | 0 /* dev_t */, cifs_sb->local_nls, | 1544 | 0 /* dev_t */, cifs_sb->local_nls, |
1542 | cifs_sb->mnt_cifs_flags & | 1545 | cifs_sb->mnt_cifs_flags & |
1543 | CIFS_MOUNT_MAP_SPECIAL_CHR); | 1546 | CIFS_MOUNT_MAP_SPECIAL_CHR); |
1544 | else if (attrs->ia_valid & ATTR_MODE) { | 1547 | else if (attrs->ia_valid & ATTR_MODE) { |
1545 | rc = 0; | 1548 | rc = 0; |
@@ -1559,7 +1562,7 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs) | |||
1559 | time_buf.Attributes = cpu_to_le32(cifsInode->cifsAttrs & | 1562 | time_buf.Attributes = cpu_to_le32(cifsInode->cifsAttrs & |
1560 | (~ATTR_READONLY)); | 1563 | (~ATTR_READONLY)); |
1561 | /* Windows ignores set to zero */ | 1564 | /* Windows ignores set to zero */ |
1562 | if(time_buf.Attributes == 0) | 1565 | if (time_buf.Attributes == 0) |
1563 | time_buf.Attributes |= cpu_to_le32(ATTR_NORMAL); | 1566 | time_buf.Attributes |= cpu_to_le32(ATTR_NORMAL); |
1564 | } | 1567 | } |
1565 | /* BB to be implemented - | 1568 | /* BB to be implemented - |
@@ -1624,7 +1627,7 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs) | |||
1624 | NULL, cifs_sb->local_nls, | 1627 | NULL, cifs_sb->local_nls, |
1625 | cifs_sb->mnt_cifs_flags & | 1628 | cifs_sb->mnt_cifs_flags & |
1626 | CIFS_MOUNT_MAP_SPECIAL_CHR); | 1629 | CIFS_MOUNT_MAP_SPECIAL_CHR); |
1627 | if (rc==0) { | 1630 | if (rc == 0) { |
1628 | rc = CIFSSMBSetFileTimes(xid, pTcon, &time_buf, | 1631 | rc = CIFSSMBSetFileTimes(xid, pTcon, &time_buf, |
1629 | netfid); | 1632 | netfid); |
1630 | CIFSSMBClose(xid, pTcon, netfid); | 1633 | CIFSSMBClose(xid, pTcon, netfid); |
@@ -1634,7 +1637,7 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs) | |||
1634 | granularity */ | 1637 | granularity */ |
1635 | 1638 | ||
1636 | /* rc = CIFSSMBSetTimesLegacy(xid, pTcon, full_path, | 1639 | /* rc = CIFSSMBSetTimesLegacy(xid, pTcon, full_path, |
1637 | &time_buf, cifs_sb->local_nls); */ | 1640 | &time_buf, cifs_sb->local_nls); */ |
1638 | } | 1641 | } |
1639 | } | 1642 | } |
1640 | /* Even if error on time set, no sense failing the call if | 1643 | /* Even if error on time set, no sense failing the call if |
@@ -1642,7 +1645,7 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs) | |||
1642 | and this check ensures that we are not being called from | 1645 | and this check ensures that we are not being called from |
1643 | sys_utimes in which case we ought to fail the call back to | 1646 | sys_utimes in which case we ought to fail the call back to |
1644 | the user when the server rejects the call */ | 1647 | the user when the server rejects the call */ |
1645 | if((rc) && (attrs->ia_valid & | 1648 | if ((rc) && (attrs->ia_valid & |
1646 | (ATTR_MODE | ATTR_GID | ATTR_UID | ATTR_SIZE))) | 1649 | (ATTR_MODE | ATTR_GID | ATTR_UID | ATTR_SIZE))) |
1647 | rc = 0; | 1650 | rc = 0; |
1648 | } | 1651 | } |