aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/smb1ops.c
diff options
context:
space:
mode:
authorPavel Shilovsky <pshilovsky@samba.org>2012-05-27 09:34:43 -0400
committerPavel Shilovsky <pshilovsky@samba.org>2012-07-24 13:55:07 -0400
commit1208ef1f76540b621f80e6130c4fb7bed8ece360 (patch)
tree65edaf646b06ba93ffe2a0ee4a98e7b9378bb59f /fs/cifs/smb1ops.c
parent2503a0dba989486c59523a947a1dcb50ad90fee9 (diff)
CIFS: Move query inode info code to ops struct
Signed-off-by: Pavel Shilovsky <pshilovsky@samba.org> Signed-off-by: Steve French <smfrench@gmail.com>
Diffstat (limited to 'fs/cifs/smb1ops.c')
-rw-r--r--fs/cifs/smb1ops.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/fs/cifs/smb1ops.c b/fs/cifs/smb1ops.c
index 43f3881ad3b8..fa210010358d 100644
--- a/fs/cifs/smb1ops.c
+++ b/fs/cifs/smb1ops.c
@@ -441,6 +441,54 @@ cifs_is_path_accessible(const unsigned int xid, struct cifs_tcon *tcon,
441 return rc; 441 return rc;
442} 442}
443 443
444static int
445cifs_query_path_info(const unsigned int xid, struct cifs_tcon *tcon,
446 struct cifs_sb_info *cifs_sb, const char *full_path,
447 FILE_ALL_INFO *data, bool *adjustTZ)
448{
449 int rc;
450
451 /* could do find first instead but this returns more info */
452 rc = CIFSSMBQPathInfo(xid, tcon, full_path, data, 0 /* not legacy */,
453 cifs_sb->local_nls, cifs_sb->mnt_cifs_flags &
454 CIFS_MOUNT_MAP_SPECIAL_CHR);
455 /*
456 * BB optimize code so we do not make the above call when server claims
457 * no NT SMB support and the above call failed at least once - set flag
458 * in tcon or mount.
459 */
460 if ((rc == -EOPNOTSUPP) || (rc == -EINVAL)) {
461 rc = SMBQueryInformation(xid, tcon, full_path, data,
462 cifs_sb->local_nls,
463 cifs_sb->mnt_cifs_flags &
464 CIFS_MOUNT_MAP_SPECIAL_CHR);
465 *adjustTZ = true;
466 }
467 return rc;
468}
469
470static int
471cifs_get_srv_inum(const unsigned int xid, struct cifs_tcon *tcon,
472 struct cifs_sb_info *cifs_sb, const char *full_path,
473 u64 *uniqueid, FILE_ALL_INFO *data)
474{
475 /*
476 * We can not use the IndexNumber field by default from Windows or
477 * Samba (in ALL_INFO buf) but we can request it explicitly. The SNIA
478 * CIFS spec claims that this value is unique within the scope of a
479 * share, and the windows docs hint that it's actually unique
480 * per-machine.
481 *
482 * There may be higher info levels that work but are there Windows
483 * server or network appliances for which IndexNumber field is not
484 * guaranteed unique?
485 */
486 return CIFSGetSrvInodeNumber(xid, tcon, full_path, uniqueid,
487 cifs_sb->local_nls,
488 cifs_sb->mnt_cifs_flags &
489 CIFS_MOUNT_MAP_SPECIAL_CHR);
490}
491
444struct smb_version_operations smb1_operations = { 492struct smb_version_operations smb1_operations = {
445 .send_cancel = send_nt_cancel, 493 .send_cancel = send_nt_cancel,
446 .compare_fids = cifs_compare_fids, 494 .compare_fids = cifs_compare_fids,
@@ -468,6 +516,8 @@ struct smb_version_operations smb1_operations = {
468 .get_dfs_refer = CIFSGetDFSRefer, 516 .get_dfs_refer = CIFSGetDFSRefer,
469 .qfs_tcon = cifs_qfs_tcon, 517 .qfs_tcon = cifs_qfs_tcon,
470 .is_path_accessible = cifs_is_path_accessible, 518 .is_path_accessible = cifs_is_path_accessible,
519 .query_path_info = cifs_query_path_info,
520 .get_srv_inum = cifs_get_srv_inum,
471}; 521};
472 522
473struct smb_version_values smb1_values = { 523struct smb_version_values smb1_values = {