aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/inode.c
diff options
context:
space:
mode:
authorSteve French <smfrench@austin.rr.com>2005-04-29 01:41:06 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-29 01:41:06 -0400
commit737b758c965a9b223ac1243ab38d9e507ac86c64 (patch)
tree9dcdaf3b573a2a27d0d43c1477a18867b144e5f4 /fs/cifs/inode.c
parent6c91d362f1e1ebbd4513adb68fc79d552c11e2c0 (diff)
[PATCH] cifs: character mapping of special characters (part 3 of 3)
Signed-off-by: Steve French (sfrench@us.ibm.com) Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/cifs/inode.c')
-rw-r--r--fs/cifs/inode.c106
1 files changed, 78 insertions, 28 deletions
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index d73b0aa86775..670947288262 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -44,7 +44,8 @@ int cifs_get_inode_info_unix(struct inode **pinode,
44 cFYI(1, (" Getting info on %s ", search_path)); 44 cFYI(1, (" Getting info on %s ", search_path));
45 /* could have done a find first instead but this returns more info */ 45 /* could have done a find first instead but this returns more info */
46 rc = CIFSSMBUnixQPathInfo(xid, pTcon, search_path, &findData, 46 rc = CIFSSMBUnixQPathInfo(xid, pTcon, search_path, &findData,
47 cifs_sb->local_nls); 47 cifs_sb->local_nls, cifs_sb->mnt_cifs_flags &
48 CIFS_MOUNT_MAP_SPECIAL_CHR);
48/* dump_mem("\nUnixQPathInfo return data", &findData, 49/* dump_mem("\nUnixQPathInfo return data", &findData,
49 sizeof(findData)); */ 50 sizeof(findData)); */
50 if (rc) { 51 if (rc) {
@@ -63,7 +64,9 @@ int cifs_get_inode_info_unix(struct inode **pinode,
63 strncat(tmp_path, search_path, MAX_PATHCONF); 64 strncat(tmp_path, search_path, MAX_PATHCONF);
64 rc = connect_to_dfs_path(xid, pTcon->ses, 65 rc = connect_to_dfs_path(xid, pTcon->ses,
65 /* treename + */ tmp_path, 66 /* treename + */ tmp_path,
66 cifs_sb->local_nls); 67 cifs_sb->local_nls,
68 cifs_sb->mnt_cifs_flags &
69 CIFS_MOUNT_MAP_SPECIAL_CHR);
67 kfree(tmp_path); 70 kfree(tmp_path);
68 71
69 /* BB fix up inode etc. */ 72 /* BB fix up inode etc. */
@@ -210,7 +213,8 @@ int cifs_get_inode_info(struct inode **pinode,
210 pfindData = (FILE_ALL_INFO *)buf; 213 pfindData = (FILE_ALL_INFO *)buf;
211 /* could do find first instead but this returns more info */ 214 /* could do find first instead but this returns more info */
212 rc = CIFSSMBQPathInfo(xid, pTcon, search_path, pfindData, 215 rc = CIFSSMBQPathInfo(xid, pTcon, search_path, pfindData,
213 cifs_sb->local_nls); 216 cifs_sb->local_nls, cifs_sb->mnt_cifs_flags &
217 CIFS_MOUNT_MAP_SPECIAL_CHR);
214 } 218 }
215 /* dump_mem("\nQPathInfo return data",&findData, sizeof(findData)); */ 219 /* dump_mem("\nQPathInfo return data",&findData, sizeof(findData)); */
216 if (rc) { 220 if (rc) {
@@ -230,7 +234,9 @@ int cifs_get_inode_info(struct inode **pinode,
230 strncat(tmp_path, search_path, MAX_PATHCONF); 234 strncat(tmp_path, search_path, MAX_PATHCONF);
231 rc = connect_to_dfs_path(xid, pTcon->ses, 235 rc = connect_to_dfs_path(xid, pTcon->ses,
232 /* treename + */ tmp_path, 236 /* treename + */ tmp_path,
233 cifs_sb->local_nls); 237 cifs_sb->local_nls,
238 cifs_sb->mnt_cifs_flags &
239 CIFS_MOUNT_MAP_SPECIAL_CHR);
234 kfree(tmp_path); 240 kfree(tmp_path);
235 /* BB fix up inode etc. */ 241 /* BB fix up inode etc. */
236 } else if (rc) { 242 } else if (rc) {
@@ -268,7 +274,9 @@ int cifs_get_inode_info(struct inode **pinode,
268 274
269 rc1 = CIFSGetSrvInodeNumber(xid, pTcon, 275 rc1 = CIFSGetSrvInodeNumber(xid, pTcon,
270 search_path, &inode_num, 276 search_path, &inode_num,
271 cifs_sb->local_nls); 277 cifs_sb->local_nls,
278 cifs_sb->mnt_cifs_flags &
279 CIFS_MOUNT_MAP_SPECIAL_CHR);
272 if(rc1) { 280 if(rc1) {
273 cFYI(1,("GetSrvInodeNum rc %d", rc1)); 281 cFYI(1,("GetSrvInodeNum rc %d", rc1));
274 /* BB EOPNOSUPP disable SERVER_INUM? */ 282 /* BB EOPNOSUPP disable SERVER_INUM? */
@@ -410,7 +418,8 @@ int cifs_unlink(struct inode *inode, struct dentry *direntry)
410 FreeXid(xid); 418 FreeXid(xid);
411 return -ENOMEM; 419 return -ENOMEM;
412 } 420 }
413 rc = CIFSSMBDelFile(xid, pTcon, full_path, cifs_sb->local_nls); 421 rc = CIFSSMBDelFile(xid, pTcon, full_path, cifs_sb->local_nls,
422 cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
414 423
415 if (!rc) { 424 if (!rc) {
416 direntry->d_inode->i_nlink--; 425 direntry->d_inode->i_nlink--;
@@ -422,10 +431,14 @@ int cifs_unlink(struct inode *inode, struct dentry *direntry)
422 431
423 rc = CIFSSMBOpen(xid, pTcon, full_path, FILE_OPEN, DELETE, 432 rc = CIFSSMBOpen(xid, pTcon, full_path, FILE_OPEN, DELETE,
424 CREATE_NOT_DIR | CREATE_DELETE_ON_CLOSE, 433 CREATE_NOT_DIR | CREATE_DELETE_ON_CLOSE,
425 &netfid, &oplock, NULL, cifs_sb->local_nls); 434 &netfid, &oplock, NULL, cifs_sb->local_nls,
435 cifs_sb->mnt_cifs_flags &
436 CIFS_MOUNT_MAP_SPECIAL_CHR);
426 if (rc==0) { 437 if (rc==0) {
427 CIFSSMBRenameOpenFile(xid, pTcon, netfid, NULL, 438 CIFSSMBRenameOpenFile(xid, pTcon, netfid, NULL,
428 cifs_sb->local_nls); 439 cifs_sb->local_nls,
440 cifs_sb->mnt_cifs_flags &
441 CIFS_MOUNT_MAP_SPECIAL_CHR);
429 CIFSSMBClose(xid, pTcon, netfid); 442 CIFSSMBClose(xid, pTcon, netfid);
430 direntry->d_inode->i_nlink--; 443 direntry->d_inode->i_nlink--;
431 } 444 }
@@ -439,7 +452,9 @@ int cifs_unlink(struct inode *inode, struct dentry *direntry)
439 if (!(pTcon->ses->flags & CIFS_SES_NT4)) 452 if (!(pTcon->ses->flags & CIFS_SES_NT4))
440 rc = CIFSSMBSetTimes(xid, pTcon, full_path, 453 rc = CIFSSMBSetTimes(xid, pTcon, full_path,
441 pinfo_buf, 454 pinfo_buf,
442 cifs_sb->local_nls); 455 cifs_sb->local_nls,
456 cifs_sb->mnt_cifs_flags &
457 CIFS_MOUNT_MAP_SPECIAL_CHR);
443 else 458 else
444 rc = -EOPNOTSUPP; 459 rc = -EOPNOTSUPP;
445 460
@@ -461,7 +476,9 @@ int cifs_unlink(struct inode *inode, struct dentry *direntry)
461 FILE_OPEN, SYNCHRONIZE | 476 FILE_OPEN, SYNCHRONIZE |
462 FILE_WRITE_ATTRIBUTES, 0, 477 FILE_WRITE_ATTRIBUTES, 0,
463 &netfid, &oplock, NULL, 478 &netfid, &oplock, NULL,
464 cifs_sb->local_nls); 479 cifs_sb->local_nls,
480 cifs_sb->mnt_cifs_flags &
481 CIFS_MOUNT_MAP_SPECIAL_CHR);
465 if (rc==0) { 482 if (rc==0) {
466 rc = CIFSSMBSetFileTimes(xid, pTcon, 483 rc = CIFSSMBSetFileTimes(xid, pTcon,
467 pinfo_buf, 484 pinfo_buf,
@@ -472,8 +489,10 @@ int cifs_unlink(struct inode *inode, struct dentry *direntry)
472 kfree(pinfo_buf); 489 kfree(pinfo_buf);
473 } 490 }
474 if (rc==0) { 491 if (rc==0) {
475 rc = CIFSSMBDelFile(xid, pTcon, full_path, 492 rc = CIFSSMBDelFile(xid, pTcon, full_path,
476 cifs_sb->local_nls); 493 cifs_sb->local_nls,
494 cifs_sb->mnt_cifs_flags &
495 CIFS_MOUNT_MAP_SPECIAL_CHR);
477 if (!rc) { 496 if (!rc) {
478 direntry->d_inode->i_nlink--; 497 direntry->d_inode->i_nlink--;
479 } else if (rc == -ETXTBSY) { 498 } else if (rc == -ETXTBSY) {
@@ -485,11 +504,15 @@ int cifs_unlink(struct inode *inode, struct dentry *direntry)
485 CREATE_NOT_DIR | 504 CREATE_NOT_DIR |
486 CREATE_DELETE_ON_CLOSE, 505 CREATE_DELETE_ON_CLOSE,
487 &netfid, &oplock, NULL, 506 &netfid, &oplock, NULL,
488 cifs_sb->local_nls); 507 cifs_sb->local_nls,
508 cifs_sb->mnt_cifs_flags &
509 CIFS_MOUNT_MAP_SPECIAL_CHR);
489 if (rc==0) { 510 if (rc==0) {
490 CIFSSMBRenameOpenFile(xid, pTcon, 511 CIFSSMBRenameOpenFile(xid, pTcon,
491 netfid, NULL, 512 netfid, NULL,
492 cifs_sb->local_nls); 513 cifs_sb->local_nls,
514 cifs_sb->mnt_cifs_flags &
515 CIFS_MOUNT_MAP_SPECIAL_CHR);
493 CIFSSMBClose(xid, pTcon, netfid); 516 CIFSSMBClose(xid, pTcon, netfid);
494 direntry->d_inode->i_nlink--; 517 direntry->d_inode->i_nlink--;
495 } 518 }
@@ -534,7 +557,8 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode)
534 return -ENOMEM; 557 return -ENOMEM;
535 } 558 }
536 /* BB add setting the equivalent of mode via CreateX w/ACLs */ 559 /* BB add setting the equivalent of mode via CreateX w/ACLs */
537 rc = CIFSSMBMkDir(xid, pTcon, full_path, cifs_sb->local_nls); 560 rc = CIFSSMBMkDir(xid, pTcon, full_path, cifs_sb->local_nls,
561 cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
538 if (rc) { 562 if (rc) {
539 cFYI(1, ("cifs_mkdir returned 0x%x ", rc)); 563 cFYI(1, ("cifs_mkdir returned 0x%x ", rc));
540 d_drop(direntry); 564 d_drop(direntry);
@@ -558,12 +582,16 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode)
558 (__u64)current->euid, 582 (__u64)current->euid,
559 (__u64)current->egid, 583 (__u64)current->egid,
560 0 /* dev_t */, 584 0 /* dev_t */,
561 cifs_sb->local_nls); 585 cifs_sb->local_nls,
586 cifs_sb->mnt_cifs_flags &
587 CIFS_MOUNT_MAP_SPECIAL_CHR);
562 } else { 588 } else {
563 CIFSSMBUnixSetPerms(xid, pTcon, full_path, 589 CIFSSMBUnixSetPerms(xid, pTcon, full_path,
564 mode, (__u64)-1, 590 mode, (__u64)-1,
565 (__u64)-1, 0 /* dev_t */, 591 (__u64)-1, 0 /* dev_t */,
566 cifs_sb->local_nls); 592 cifs_sb->local_nls,
593 cifs_sb->mnt_cifs_flags &
594 CIFS_MOUNT_MAP_SPECIAL_CHR);
567 } 595 }
568 else { 596 else {
569 /* BB to be implemented via Windows secrty descriptors 597 /* BB to be implemented via Windows secrty descriptors
@@ -600,7 +628,8 @@ int cifs_rmdir(struct inode *inode, struct dentry *direntry)
600 return -ENOMEM; 628 return -ENOMEM;
601 } 629 }
602 630
603 rc = CIFSSMBRmDir(xid, pTcon, full_path, cifs_sb->local_nls); 631 rc = CIFSSMBRmDir(xid, pTcon, full_path, cifs_sb->local_nls,
632 cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
604 633
605 if (!rc) { 634 if (!rc) {
606 inode->i_nlink--; 635 inode->i_nlink--;
@@ -653,7 +682,9 @@ int cifs_rename(struct inode *source_inode, struct dentry *source_direntry,
653 } 682 }
654 683
655 rc = CIFSSMBRename(xid, pTcon, fromName, toName, 684 rc = CIFSSMBRename(xid, pTcon, fromName, toName,
656 cifs_sb_source->local_nls); 685 cifs_sb_source->local_nls,
686 cifs_sb_source->mnt_cifs_flags &
687 CIFS_MOUNT_MAP_SPECIAL_CHR);
657 if (rc == -EEXIST) { 688 if (rc == -EEXIST) {
658 /* check if they are the same file because rename of hardlinked 689 /* check if they are the same file because rename of hardlinked
659 files is a noop */ 690 files is a noop */
@@ -665,11 +696,16 @@ int cifs_rename(struct inode *source_inode, struct dentry *source_direntry,
665 if (info_buf_source != NULL) { 696 if (info_buf_source != NULL) {
666 info_buf_target = info_buf_source + 1; 697 info_buf_target = info_buf_source + 1;
667 rc = CIFSSMBUnixQPathInfo(xid, pTcon, fromName, 698 rc = CIFSSMBUnixQPathInfo(xid, pTcon, fromName,
668 info_buf_source, cifs_sb_source->local_nls); 699 info_buf_source, cifs_sb_source->local_nls,
700 cifs_sb_source->mnt_cifs_flags &
701 CIFS_MOUNT_MAP_SPECIAL_CHR);
669 if (rc == 0) { 702 if (rc == 0) {
670 rc = CIFSSMBUnixQPathInfo(xid, pTcon, toName, 703 rc = CIFSSMBUnixQPathInfo(xid, pTcon, toName,
671 info_buf_target, 704 info_buf_target,
672 cifs_sb_target->local_nls); 705 cifs_sb_target->local_nls,
706 /* remap based on source sb */
707 cifs_sb_source->mnt_cifs_flags &
708 CIFS_MOUNT_MAP_SPECIAL_CHR);
673 } 709 }
674 if ((rc == 0) && 710 if ((rc == 0) &&
675 (info_buf_source->UniqueId == 711 (info_buf_source->UniqueId ==
@@ -685,7 +721,9 @@ int cifs_rename(struct inode *source_inode, struct dentry *source_direntry,
685 cifs_unlink(target_inode, target_direntry); 721 cifs_unlink(target_inode, target_direntry);
686 rc = CIFSSMBRename(xid, pTcon, fromName, 722 rc = CIFSSMBRename(xid, pTcon, fromName,
687 toName, 723 toName,
688 cifs_sb_source->local_nls); 724 cifs_sb_source->local_nls,
725 cifs_sb_source->mnt_cifs_flags
726 & CIFS_MOUNT_MAP_SPECIAL_CHR);
689 } 727 }
690 kfree(info_buf_source); 728 kfree(info_buf_source);
691 } /* if we can not get memory just leave rc as EEXIST */ 729 } /* if we can not get memory just leave rc as EEXIST */
@@ -705,10 +743,14 @@ int cifs_rename(struct inode *source_inode, struct dentry *source_direntry,
705 might not right be right access to request */ 743 might not right be right access to request */
706 rc = CIFSSMBOpen(xid, pTcon, fromName, FILE_OPEN, GENERIC_READ, 744 rc = CIFSSMBOpen(xid, pTcon, fromName, FILE_OPEN, GENERIC_READ,
707 CREATE_NOT_DIR, &netfid, &oplock, NULL, 745 CREATE_NOT_DIR, &netfid, &oplock, NULL,
708 cifs_sb_source->local_nls); 746 cifs_sb_source->local_nls,
747 cifs_sb_source->mnt_cifs_flags &
748 CIFS_MOUNT_MAP_SPECIAL_CHR);
709 if (rc==0) { 749 if (rc==0) {
710 CIFSSMBRenameOpenFile(xid, pTcon, netfid, toName, 750 CIFSSMBRenameOpenFile(xid, pTcon, netfid, toName,
711 cifs_sb_source->local_nls); 751 cifs_sb_source->local_nls,
752 cifs_sb_source->mnt_cifs_flags &
753 CIFS_MOUNT_MAP_SPECIAL_CHR);
712 CIFSSMBClose(xid, pTcon, netfid); 754 CIFSSMBClose(xid, pTcon, netfid);
713 } 755 }
714 } 756 }
@@ -962,7 +1004,9 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
962 it by handle */ 1004 it by handle */
963 rc = CIFSSMBSetEOF(xid, pTcon, full_path, 1005 rc = CIFSSMBSetEOF(xid, pTcon, full_path,
964 attrs->ia_size, FALSE, 1006 attrs->ia_size, FALSE,
965 cifs_sb->local_nls); 1007 cifs_sb->local_nls,
1008 cifs_sb->mnt_cifs_flags &
1009 CIFS_MOUNT_MAP_SPECIAL_CHR);
966 cFYI(1, (" SetEOF by path (setattrs) rc = %d", rc)); 1010 cFYI(1, (" SetEOF by path (setattrs) rc = %d", rc));
967 } 1011 }
968 1012
@@ -999,7 +1043,9 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
999 if ((cifs_sb->tcon->ses->capabilities & CAP_UNIX) 1043 if ((cifs_sb->tcon->ses->capabilities & CAP_UNIX)
1000 && (attrs->ia_valid & (ATTR_MODE | ATTR_GID | ATTR_UID))) 1044 && (attrs->ia_valid & (ATTR_MODE | ATTR_GID | ATTR_UID)))
1001 rc = CIFSSMBUnixSetPerms(xid, pTcon, full_path, mode, uid, gid, 1045 rc = CIFSSMBUnixSetPerms(xid, pTcon, full_path, mode, uid, gid,
1002 0 /* dev_t */, cifs_sb->local_nls); 1046 0 /* dev_t */, cifs_sb->local_nls,
1047 cifs_sb->mnt_cifs_flags &
1048 CIFS_MOUNT_MAP_SPECIAL_CHR);
1003 else if (attrs->ia_valid & ATTR_MODE) { 1049 else if (attrs->ia_valid & ATTR_MODE) {
1004 if ((mode & S_IWUGO) == 0) /* not writeable */ { 1050 if ((mode & S_IWUGO) == 0) /* not writeable */ {
1005 if ((cifsInode->cifsAttrs & ATTR_READONLY) == 0) 1051 if ((cifsInode->cifsAttrs & ATTR_READONLY) == 0)
@@ -1048,7 +1094,9 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
1048 via Handle (SetFileInfo) instead of by path */ 1094 via Handle (SetFileInfo) instead of by path */
1049 if (!(pTcon->ses->flags & CIFS_SES_NT4)) 1095 if (!(pTcon->ses->flags & CIFS_SES_NT4))
1050 rc = CIFSSMBSetTimes(xid, pTcon, full_path, &time_buf, 1096 rc = CIFSSMBSetTimes(xid, pTcon, full_path, &time_buf,
1051 cifs_sb->local_nls); 1097 cifs_sb->local_nls,
1098 cifs_sb->mnt_cifs_flags &
1099 CIFS_MOUNT_MAP_SPECIAL_CHR);
1052 else 1100 else
1053 rc = -EOPNOTSUPP; 1101 rc = -EOPNOTSUPP;
1054 1102
@@ -1063,7 +1111,9 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
1063 rc = CIFSSMBOpen(xid, pTcon, full_path, FILE_OPEN, 1111 rc = CIFSSMBOpen(xid, pTcon, full_path, FILE_OPEN,
1064 SYNCHRONIZE | FILE_WRITE_ATTRIBUTES, 1112 SYNCHRONIZE | FILE_WRITE_ATTRIBUTES,
1065 CREATE_NOT_DIR, &netfid, &oplock, 1113 CREATE_NOT_DIR, &netfid, &oplock,
1066 NULL, cifs_sb->local_nls); 1114 NULL, cifs_sb->local_nls,
1115 cifs_sb->mnt_cifs_flags &
1116 CIFS_MOUNT_MAP_SPECIAL_CHR);
1067 if (rc==0) { 1117 if (rc==0) {
1068 rc = CIFSSMBSetFileTimes(xid, pTcon, &time_buf, 1118 rc = CIFSSMBSetFileTimes(xid, pTcon, &time_buf,
1069 netfid); 1119 netfid);