Commit ecdcf622 authored by Joe Perches via samba-technical's avatar Joe Perches via samba-technical Committed by Steve French

cifs: cifsacl: Use a temporary ops variable to reduce code length

Create an ops variable to store tcon->ses->server->ops and cache
indirections and reduce code size a trivial bit.

$ size fs/cifs/cifsacl.o*
   text	   data	    bss	    dec	    hex	filename
   5338	    136	      8	   5482	   156a	fs/cifs/cifsacl.o.new
   5371	    136	      8	   5515	   158b	fs/cifs/cifsacl.o.old
Signed-off-by: default avatarJoe Perches <joe@perches.com>
Acked-by: default avatarShirish Pargaonkar <shirishpargaonkar@gmail.com>
Signed-off-by: default avatarSteve French <smfrench@gmail.com>
parent de1892b8
...@@ -1135,20 +1135,19 @@ cifs_acl_to_fattr(struct cifs_sb_info *cifs_sb, struct cifs_fattr *fattr, ...@@ -1135,20 +1135,19 @@ cifs_acl_to_fattr(struct cifs_sb_info *cifs_sb, struct cifs_fattr *fattr,
u32 acllen = 0; u32 acllen = 0;
int rc = 0; int rc = 0;
struct tcon_link *tlink = cifs_sb_tlink(cifs_sb); struct tcon_link *tlink = cifs_sb_tlink(cifs_sb);
struct cifs_tcon *tcon; struct smb_version_operations *ops;
cifs_dbg(NOISY, "converting ACL to mode for %s\n", path); cifs_dbg(NOISY, "converting ACL to mode for %s\n", path);
if (IS_ERR(tlink)) if (IS_ERR(tlink))
return PTR_ERR(tlink); return PTR_ERR(tlink);
tcon = tlink_tcon(tlink);
if (pfid && (tcon->ses->server->ops->get_acl_by_fid)) ops = tlink_tcon(tlink)->ses->server->ops;
pntsd = tcon->ses->server->ops->get_acl_by_fid(cifs_sb, pfid,
&acllen); if (pfid && (ops->get_acl_by_fid))
else if (tcon->ses->server->ops->get_acl) pntsd = ops->get_acl_by_fid(cifs_sb, pfid, &acllen);
pntsd = tcon->ses->server->ops->get_acl(cifs_sb, inode, path, else if (ops->get_acl)
&acllen); pntsd = ops->get_acl(cifs_sb, inode, path, &acllen);
else { else {
cifs_put_tlink(tlink); cifs_put_tlink(tlink);
return -EOPNOTSUPP; return -EOPNOTSUPP;
...@@ -1181,23 +1180,23 @@ id_mode_to_cifs_acl(struct inode *inode, const char *path, __u64 nmode, ...@@ -1181,23 +1180,23 @@ id_mode_to_cifs_acl(struct inode *inode, const char *path, __u64 nmode,
struct cifs_ntsd *pnntsd = NULL; /* modified acl to be sent to server */ struct cifs_ntsd *pnntsd = NULL; /* modified acl to be sent to server */
struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
struct tcon_link *tlink = cifs_sb_tlink(cifs_sb); struct tcon_link *tlink = cifs_sb_tlink(cifs_sb);
struct cifs_tcon *tcon; struct smb_version_operations *ops;
if (IS_ERR(tlink)) if (IS_ERR(tlink))
return PTR_ERR(tlink); return PTR_ERR(tlink);
tcon = tlink_tcon(tlink);
ops = tlink_tcon(tlink)->ses->server->ops;
cifs_dbg(NOISY, "set ACL from mode for %s\n", path); cifs_dbg(NOISY, "set ACL from mode for %s\n", path);
/* Get the security descriptor */ /* Get the security descriptor */
if (tcon->ses->server->ops->get_acl == NULL) { if (ops->get_acl == NULL) {
cifs_put_tlink(tlink); cifs_put_tlink(tlink);
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
pntsd = tcon->ses->server->ops->get_acl(cifs_sb, inode, path, pntsd = ops->get_acl(cifs_sb, inode, path, &secdesclen);
&secdesclen);
if (IS_ERR(pntsd)) { if (IS_ERR(pntsd)) {
rc = PTR_ERR(pntsd); rc = PTR_ERR(pntsd);
cifs_dbg(VFS, "%s: error %d getting sec desc\n", __func__, rc); cifs_dbg(VFS, "%s: error %d getting sec desc\n", __func__, rc);
...@@ -1224,13 +1223,12 @@ id_mode_to_cifs_acl(struct inode *inode, const char *path, __u64 nmode, ...@@ -1224,13 +1223,12 @@ id_mode_to_cifs_acl(struct inode *inode, const char *path, __u64 nmode,
cifs_dbg(NOISY, "build_sec_desc rc: %d\n", rc); cifs_dbg(NOISY, "build_sec_desc rc: %d\n", rc);
if (tcon->ses->server->ops->set_acl == NULL) if (ops->set_acl == NULL)
rc = -EOPNOTSUPP; rc = -EOPNOTSUPP;
if (!rc) { if (!rc) {
/* Set the security descriptor */ /* Set the security descriptor */
rc = tcon->ses->server->ops->set_acl(pnntsd, secdesclen, inode, rc = ops->set_acl(pnntsd, secdesclen, inode, path, aclflag);
path, aclflag);
cifs_dbg(NOISY, "set_cifs_acl rc: %d\n", rc); cifs_dbg(NOISY, "set_cifs_acl rc: %d\n", rc);
} }
cifs_put_tlink(tlink); cifs_put_tlink(tlink);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment