Commit b5be1a1c4c57a092cb60c709a0491d4ecead3d58

Authored by Sachin Prabhu
Committed by Steve French
1 parent abf9767c82

cifs: Rename and cleanup open_query_close_cifs_symlink()

Rename open_query_close_cifs_symlink to cifs_query_mf_symlink() to make
the name more consistent with other protocol version specific functions.

We also pass tcon as an argument to the function. This is already
available in the calling functions and we can avoid having to make an
unnecessary lookup.

Signed-off-by: Sachin Prabhu <sprabhu@redhat.com>
Reviewed-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <smfrench@gmail.com>

Showing 4 changed files with 20 additions and 31 deletions Side-by-side Diff

... ... @@ -370,8 +370,9 @@
370 370 void (*new_lease_key)(struct cifs_fid *);
371 371 int (*generate_signingkey)(struct cifs_ses *);
372 372 int (*calc_signature)(struct smb_rqst *, struct TCP_Server_Info *);
373   - int (*query_mf_symlink)(const unsigned char *, char *, unsigned int *,
374   - struct cifs_sb_info *, unsigned int);
  373 + int (*query_mf_symlink)(unsigned int, struct cifs_tcon *,
  374 + struct cifs_sb_info *, const unsigned char *,
  375 + char *, unsigned int *);
375 376 /* if we can do cache read operations */
376 377 bool (*is_read_op)(__u32);
377 378 /* set oplock level for the inode */
... ... @@ -496,8 +496,9 @@
496 496 struct cifs_writedata *cifs_writedata_alloc(unsigned int nr_pages,
497 497 work_func_t complete);
498 498 void cifs_writedata_release(struct kref *refcount);
499   -int open_query_close_cifs_symlink(const unsigned char *path, char *pbuf,
500   - unsigned int *pbytes_read, struct cifs_sb_info *cifs_sb,
501   - unsigned int xid);
  499 +int cifs_query_mf_symlink(unsigned int xid, struct cifs_tcon *tcon,
  500 + struct cifs_sb_info *cifs_sb,
  501 + const unsigned char *path, char *pbuf,
  502 + unsigned int *pbytes_read);
502 503 #endif /* _CIFSPROTO_H */
... ... @@ -305,54 +305,41 @@
305 305 }
306 306  
307 307 int
308   -open_query_close_cifs_symlink(const unsigned char *path, char *pbuf,
309   - unsigned int *pbytes_read, struct cifs_sb_info *cifs_sb,
310   - unsigned int xid)
  308 +cifs_query_mf_symlink(unsigned int xid, struct cifs_tcon *tcon,
  309 + struct cifs_sb_info *cifs_sb, const unsigned char *path,
  310 + char *pbuf, unsigned int *pbytes_read)
311 311 {
312 312 int rc;
313 313 int oplock = 0;
314 314 __u16 netfid = 0;
315   - struct tcon_link *tlink;
316   - struct cifs_tcon *ptcon;
317 315 struct cifs_io_parms io_parms;
318 316 int buf_type = CIFS_NO_BUFFER;
319 317 FILE_ALL_INFO file_info;
320 318  
321   - tlink = cifs_sb_tlink(cifs_sb);
322   - if (IS_ERR(tlink))
323   - return PTR_ERR(tlink);
324   - ptcon = tlink_tcon(tlink);
325   -
326   - rc = CIFSSMBOpen(xid, ptcon, path, FILE_OPEN, GENERIC_READ,
  319 + rc = CIFSSMBOpen(xid, tcon, path, FILE_OPEN, GENERIC_READ,
327 320 CREATE_NOT_DIR, &netfid, &oplock, &file_info,
328 321 cifs_sb->local_nls,
329 322 cifs_sb->mnt_cifs_flags &
330 323 CIFS_MOUNT_MAP_SPECIAL_CHR);
331   - if (rc != 0) {
332   - cifs_put_tlink(tlink);
  324 + if (rc)
333 325 return rc;
334   - }
335 326  
336   - if (file_info.EndOfFile != cpu_to_le64(CIFS_MF_SYMLINK_FILE_SIZE)) {
337   - CIFSSMBClose(xid, ptcon, netfid);
338   - cifs_put_tlink(tlink);
  327 + if (file_info.EndOfFile != cpu_to_le64(CIFS_MF_SYMLINK_FILE_SIZE))
339 328 /* it's not a symlink */
340   - return rc;
341   - }
  329 + goto out;
342 330  
343 331 io_parms.netfid = netfid;
344 332 io_parms.pid = current->tgid;
345   - io_parms.tcon = ptcon;
  333 + io_parms.tcon = tcon;
346 334 io_parms.offset = 0;
347 335 io_parms.length = CIFS_MF_SYMLINK_FILE_SIZE;
348 336  
349 337 rc = CIFSSMBRead(xid, &io_parms, pbytes_read, &pbuf, &buf_type);
350   - CIFSSMBClose(xid, ptcon, netfid);
351   - cifs_put_tlink(tlink);
  338 +out:
  339 + CIFSSMBClose(xid, tcon, netfid);
352 340 return rc;
353 341 }
354 342  
355   -
356 343 int
357 344 CIFSCheckMFSymlink(unsigned int xid, struct cifs_tcon *tcon,
358 345 struct cifs_sb_info *cifs_sb, struct cifs_fattr *fattr,
... ... @@ -372,8 +359,8 @@
372 359 return -ENOMEM;
373 360  
374 361 if (tcon->ses->server->ops->query_mf_symlink)
375   - rc = tcon->ses->server->ops->query_mf_symlink(path, buf,
376   - &bytes_read, cifs_sb, xid);
  362 + rc = tcon->ses->server->ops->query_mf_symlink(xid, tcon,
  363 + cifs_sb, path, buf, &bytes_read);
377 364 else
378 365 rc = -ENOSYS;
379 366  
... ... @@ -1009,7 +1009,7 @@
1009 1009 .mand_lock = cifs_mand_lock,
1010 1010 .mand_unlock_range = cifs_unlock_range,
1011 1011 .push_mand_locks = cifs_push_mandatory_locks,
1012   - .query_mf_symlink = open_query_close_cifs_symlink,
  1012 + .query_mf_symlink = cifs_query_mf_symlink,
1013 1013 .is_read_op = cifs_is_read_op,
1014 1014 };
1015 1015