aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Shilovsky <piastry@etersoft.ru>2014-01-16 06:53:35 -0500
committerSteve French <smfrench@gmail.com>2014-01-20 10:52:09 -0500
commit0360d605a236355f9501d21175e405536e2acd48 (patch)
treebfa1df03281141d837ab1a80e87e515bd0ad0a4c
parentdd12067156b442801a7d636de354efe1d4dc467c (diff)
CIFS: Remove extra indentation in cifs_sfu_type
Signed-off-by: Pavel Shilovsky <piastry@etersoft.ru> Signed-off-by: Steve French <smfrench@gmail.com>
-rw-r--r--fs/cifs/inode.c97
1 files changed, 50 insertions, 47 deletions
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index 6f7f57a3a46a..5793b5a557e9 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -404,7 +404,7 @@ int cifs_get_inode_info_unix(struct inode **pinode,
404} 404}
405 405
406static int 406static int
407cifs_sfu_type(struct cifs_fattr *fattr, const unsigned char *path, 407cifs_sfu_type(struct cifs_fattr *fattr, const char *path,
408 struct cifs_sb_info *cifs_sb, unsigned int xid) 408 struct cifs_sb_info *cifs_sb, unsigned int xid)
409{ 409{
410 int rc; 410 int rc;
@@ -416,6 +416,7 @@ cifs_sfu_type(struct cifs_fattr *fattr, const unsigned char *path,
416 char buf[24]; 416 char buf[24];
417 unsigned int bytes_read; 417 unsigned int bytes_read;
418 char *pbuf; 418 char *pbuf;
419 int buf_type = CIFS_NO_BUFFER;
419 420
420 pbuf = buf; 421 pbuf = buf;
421 422
@@ -441,57 +442,59 @@ cifs_sfu_type(struct cifs_fattr *fattr, const unsigned char *path,
441 cifs_sb->local_nls, 442 cifs_sb->local_nls,
442 cifs_sb->mnt_cifs_flags & 443 cifs_sb->mnt_cifs_flags &
443 CIFS_MOUNT_MAP_SPECIAL_CHR); 444 CIFS_MOUNT_MAP_SPECIAL_CHR);
444 if (rc == 0) { 445 if (rc) {
445 int buf_type = CIFS_NO_BUFFER; 446 cifs_put_tlink(tlink);
446 /* Read header */ 447 return rc;
447 io_parms.netfid = netfid; 448 }
448 io_parms.pid = current->tgid; 449
449 io_parms.tcon = tcon; 450 /* Read header */
450 io_parms.offset = 0; 451 io_parms.netfid = netfid;
451 io_parms.length = 24; 452 io_parms.pid = current->tgid;
452 rc = CIFSSMBRead(xid, &io_parms, &bytes_read, &pbuf, 453 io_parms.tcon = tcon;
453 &buf_type); 454 io_parms.offset = 0;
454 if ((rc == 0) && (bytes_read >= 8)) { 455 io_parms.length = 24;
455 if (memcmp("IntxBLK", pbuf, 8) == 0) { 456
456 cifs_dbg(FYI, "Block device\n"); 457 rc = CIFSSMBRead(xid, &io_parms, &bytes_read, &pbuf, &buf_type);
457 fattr->cf_mode |= S_IFBLK; 458 if ((rc == 0) && (bytes_read >= 8)) {
458 fattr->cf_dtype = DT_BLK; 459 if (memcmp("IntxBLK", pbuf, 8) == 0) {
459 if (bytes_read == 24) { 460 cifs_dbg(FYI, "Block device\n");
460 /* we have enough to decode dev num */ 461 fattr->cf_mode |= S_IFBLK;
461 __u64 mjr; /* major */ 462 fattr->cf_dtype = DT_BLK;
462 __u64 mnr; /* minor */ 463 if (bytes_read == 24) {
463 mjr = le64_to_cpu(*(__le64 *)(pbuf+8)); 464 /* we have enough to decode dev num */
464 mnr = le64_to_cpu(*(__le64 *)(pbuf+16)); 465 __u64 mjr; /* major */
465 fattr->cf_rdev = MKDEV(mjr, mnr); 466 __u64 mnr; /* minor */
466 } 467 mjr = le64_to_cpu(*(__le64 *)(pbuf+8));
467 } else if (memcmp("IntxCHR", pbuf, 8) == 0) { 468 mnr = le64_to_cpu(*(__le64 *)(pbuf+16));
468 cifs_dbg(FYI, "Char device\n"); 469 fattr->cf_rdev = MKDEV(mjr, mnr);
469 fattr->cf_mode |= S_IFCHR; 470 }
470 fattr->cf_dtype = DT_CHR; 471 } else if (memcmp("IntxCHR", pbuf, 8) == 0) {
471 if (bytes_read == 24) { 472 cifs_dbg(FYI, "Char device\n");
472 /* we have enough to decode dev num */ 473 fattr->cf_mode |= S_IFCHR;
473 __u64 mjr; /* major */ 474 fattr->cf_dtype = DT_CHR;
474 __u64 mnr; /* minor */ 475 if (bytes_read == 24) {
475 mjr = le64_to_cpu(*(__le64 *)(pbuf+8)); 476 /* we have enough to decode dev num */
476 mnr = le64_to_cpu(*(__le64 *)(pbuf+16)); 477 __u64 mjr; /* major */
477 fattr->cf_rdev = MKDEV(mjr, mnr); 478 __u64 mnr; /* minor */
478 } 479 mjr = le64_to_cpu(*(__le64 *)(pbuf+8));
479 } else if (memcmp("IntxLNK", pbuf, 7) == 0) { 480 mnr = le64_to_cpu(*(__le64 *)(pbuf+16));
480 cifs_dbg(FYI, "Symlink\n"); 481 fattr->cf_rdev = MKDEV(mjr, mnr);
481 fattr->cf_mode |= S_IFLNK;
482 fattr->cf_dtype = DT_LNK;
483 } else {
484 fattr->cf_mode |= S_IFREG; /* file? */
485 fattr->cf_dtype = DT_REG;
486 rc = -EOPNOTSUPP;
487 } 482 }
483 } else if (memcmp("IntxLNK", pbuf, 7) == 0) {
484 cifs_dbg(FYI, "Symlink\n");
485 fattr->cf_mode |= S_IFLNK;
486 fattr->cf_dtype = DT_LNK;
488 } else { 487 } else {
489 fattr->cf_mode |= S_IFREG; /* then it is a file */ 488 fattr->cf_mode |= S_IFREG; /* file? */
490 fattr->cf_dtype = DT_REG; 489 fattr->cf_dtype = DT_REG;
491 rc = -EOPNOTSUPP; /* or some unknown SFU type */ 490 rc = -EOPNOTSUPP;
492 } 491 }
493 CIFSSMBClose(xid, tcon, netfid); 492 } else {
493 fattr->cf_mode |= S_IFREG; /* then it is a file */
494 fattr->cf_dtype = DT_REG;
495 rc = -EOPNOTSUPP; /* or some unknown SFU type */
494 } 496 }
497 CIFSSMBClose(xid, tcon, netfid);
495 cifs_put_tlink(tlink); 498 cifs_put_tlink(tlink);
496 return rc; 499 return rc;
497} 500}