[PATCH] cifs: Remove pre-historic unused CIFSSMBCopy

linux@treblig.org posted 1 patch 1 month, 2 weeks ago
fs/smb/client/cifsproto.h |  7 -----
fs/smb/client/cifssmb.c   | 63 ---------------------------------------
2 files changed, 70 deletions(-)
[PATCH] cifs: Remove pre-historic unused CIFSSMBCopy
Posted by linux@treblig.org 1 month, 2 weeks ago
From: "Dr. David Alan Gilbert" <linux@treblig.org>

CIFSSMBCopy() is unused, remove it.

It seems to have been that way pre-git; looking in a historic
archive, I think it landed around May 2004 in Linus'
BKrev: 40ab7591J_OgkpHW-qhzZukvAUAw9g
and was unused back then.

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
---
 fs/smb/client/cifsproto.h |  7 -----
 fs/smb/client/cifssmb.c   | 63 ---------------------------------------
 2 files changed, 70 deletions(-)

diff --git a/fs/smb/client/cifsproto.h b/fs/smb/client/cifsproto.h
index 1d3470bca45e..8235b5a0aa2b 100644
--- a/fs/smb/client/cifsproto.h
+++ b/fs/smb/client/cifsproto.h
@@ -549,13 +549,6 @@ extern int generate_smb311signingkey(struct cifs_ses *ses,
 				     struct TCP_Server_Info *server);
 
 #ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY
-extern int CIFSSMBCopy(unsigned int xid,
-			struct cifs_tcon *source_tcon,
-			const char *fromName,
-			const __u16 target_tid,
-			const char *toName, const int flags,
-			const struct nls_table *nls_codepage,
-			int remap_special_chars);
 extern ssize_t CIFSSMBQAllEAs(const unsigned int xid, struct cifs_tcon *tcon,
 			const unsigned char *searchName,
 			const unsigned char *ea_name, char *EAData,
diff --git a/fs/smb/client/cifssmb.c b/fs/smb/client/cifssmb.c
index c6f15dbe860a..ca50ac652e02 100644
--- a/fs/smb/client/cifssmb.c
+++ b/fs/smb/client/cifssmb.c
@@ -2339,69 +2339,6 @@ int CIFSSMBRenameOpenFile(const unsigned int xid, struct cifs_tcon *pTcon,
 	return rc;
 }
 
-int
-CIFSSMBCopy(const unsigned int xid, struct cifs_tcon *tcon,
-	    const char *fromName, const __u16 target_tid, const char *toName,
-	    const int flags, const struct nls_table *nls_codepage, int remap)
-{
-	int rc = 0;
-	COPY_REQ *pSMB = NULL;
-	COPY_RSP *pSMBr = NULL;
-	int bytes_returned;
-	int name_len, name_len2;
-	__u16 count;
-
-	cifs_dbg(FYI, "In CIFSSMBCopy\n");
-copyRetry:
-	rc = smb_init(SMB_COM_COPY, 1, tcon, (void **) &pSMB,
-			(void **) &pSMBr);
-	if (rc)
-		return rc;
-
-	pSMB->BufferFormat = 0x04;
-	pSMB->Tid2 = target_tid;
-
-	pSMB->Flags = cpu_to_le16(flags & COPY_TREE);
-
-	if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
-		name_len = cifsConvertToUTF16((__le16 *) pSMB->OldFileName,
-					      fromName, PATH_MAX, nls_codepage,
-					      remap);
-		name_len++;     /* trailing null */
-		name_len *= 2;
-		pSMB->OldFileName[name_len] = 0x04;     /* pad */
-		/* protocol requires ASCII signature byte on Unicode string */
-		pSMB->OldFileName[name_len + 1] = 0x00;
-		name_len2 =
-		    cifsConvertToUTF16((__le16 *)&pSMB->OldFileName[name_len+2],
-				       toName, PATH_MAX, nls_codepage, remap);
-		name_len2 += 1 /* trailing null */  + 1 /* Signature word */ ;
-		name_len2 *= 2; /* convert to bytes */
-	} else {
-		name_len = copy_path_name(pSMB->OldFileName, fromName);
-		pSMB->OldFileName[name_len] = 0x04;  /* 2nd buffer format */
-		name_len2 = copy_path_name(pSMB->OldFileName+name_len+1, toName);
-		name_len2++;    /* signature byte */
-	}
-
-	count = 1 /* 1st signature byte */  + name_len + name_len2;
-	inc_rfc1001_len(pSMB, count);
-	pSMB->ByteCount = cpu_to_le16(count);
-
-	rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
-		(struct smb_hdr *) pSMBr, &bytes_returned, 0);
-	if (rc) {
-		cifs_dbg(FYI, "Send error in copy = %d with %d files copied\n",
-			 rc, le16_to_cpu(pSMBr->CopyCount));
-	}
-	cifs_buf_release(pSMB);
-
-	if (rc == -EAGAIN)
-		goto copyRetry;
-
-	return rc;
-}
-
 int
 CIFSUnixCreateSymLink(const unsigned int xid, struct cifs_tcon *tcon,
 		      const char *fromName, const char *toName,
-- 
2.46.2
Re: [PATCH] cifs: Remove pre-historic unused CIFSSMBCopy
Posted by Steve French 2 weeks ago
merged into cifs-2.6.git for-next

On Mon, Oct 7, 2024 at 4:02 PM <linux@treblig.org> wrote:
>
> From: "Dr. David Alan Gilbert" <linux@treblig.org>
>
> CIFSSMBCopy() is unused, remove it.
>
> It seems to have been that way pre-git; looking in a historic
> archive, I think it landed around May 2004 in Linus'
> BKrev: 40ab7591J_OgkpHW-qhzZukvAUAw9g
> and was unused back then.
>
> Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
> ---
>  fs/smb/client/cifsproto.h |  7 -----
>  fs/smb/client/cifssmb.c   | 63 ---------------------------------------
>  2 files changed, 70 deletions(-)
>
> diff --git a/fs/smb/client/cifsproto.h b/fs/smb/client/cifsproto.h
> index 1d3470bca45e..8235b5a0aa2b 100644
> --- a/fs/smb/client/cifsproto.h
> +++ b/fs/smb/client/cifsproto.h
> @@ -549,13 +549,6 @@ extern int generate_smb311signingkey(struct cifs_ses *ses,
>                                      struct TCP_Server_Info *server);
>
>  #ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY
> -extern int CIFSSMBCopy(unsigned int xid,
> -                       struct cifs_tcon *source_tcon,
> -                       const char *fromName,
> -                       const __u16 target_tid,
> -                       const char *toName, const int flags,
> -                       const struct nls_table *nls_codepage,
> -                       int remap_special_chars);
>  extern ssize_t CIFSSMBQAllEAs(const unsigned int xid, struct cifs_tcon *tcon,
>                         const unsigned char *searchName,
>                         const unsigned char *ea_name, char *EAData,
> diff --git a/fs/smb/client/cifssmb.c b/fs/smb/client/cifssmb.c
> index c6f15dbe860a..ca50ac652e02 100644
> --- a/fs/smb/client/cifssmb.c
> +++ b/fs/smb/client/cifssmb.c
> @@ -2339,69 +2339,6 @@ int CIFSSMBRenameOpenFile(const unsigned int xid, struct cifs_tcon *pTcon,
>         return rc;
>  }
>
> -int
> -CIFSSMBCopy(const unsigned int xid, struct cifs_tcon *tcon,
> -           const char *fromName, const __u16 target_tid, const char *toName,
> -           const int flags, const struct nls_table *nls_codepage, int remap)
> -{
> -       int rc = 0;
> -       COPY_REQ *pSMB = NULL;
> -       COPY_RSP *pSMBr = NULL;
> -       int bytes_returned;
> -       int name_len, name_len2;
> -       __u16 count;
> -
> -       cifs_dbg(FYI, "In CIFSSMBCopy\n");
> -copyRetry:
> -       rc = smb_init(SMB_COM_COPY, 1, tcon, (void **) &pSMB,
> -                       (void **) &pSMBr);
> -       if (rc)
> -               return rc;
> -
> -       pSMB->BufferFormat = 0x04;
> -       pSMB->Tid2 = target_tid;
> -
> -       pSMB->Flags = cpu_to_le16(flags & COPY_TREE);
> -
> -       if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
> -               name_len = cifsConvertToUTF16((__le16 *) pSMB->OldFileName,
> -                                             fromName, PATH_MAX, nls_codepage,
> -                                             remap);
> -               name_len++;     /* trailing null */
> -               name_len *= 2;
> -               pSMB->OldFileName[name_len] = 0x04;     /* pad */
> -               /* protocol requires ASCII signature byte on Unicode string */
> -               pSMB->OldFileName[name_len + 1] = 0x00;
> -               name_len2 =
> -                   cifsConvertToUTF16((__le16 *)&pSMB->OldFileName[name_len+2],
> -                                      toName, PATH_MAX, nls_codepage, remap);
> -               name_len2 += 1 /* trailing null */  + 1 /* Signature word */ ;
> -               name_len2 *= 2; /* convert to bytes */
> -       } else {
> -               name_len = copy_path_name(pSMB->OldFileName, fromName);
> -               pSMB->OldFileName[name_len] = 0x04;  /* 2nd buffer format */
> -               name_len2 = copy_path_name(pSMB->OldFileName+name_len+1, toName);
> -               name_len2++;    /* signature byte */
> -       }
> -
> -       count = 1 /* 1st signature byte */  + name_len + name_len2;
> -       inc_rfc1001_len(pSMB, count);
> -       pSMB->ByteCount = cpu_to_le16(count);
> -
> -       rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
> -               (struct smb_hdr *) pSMBr, &bytes_returned, 0);
> -       if (rc) {
> -               cifs_dbg(FYI, "Send error in copy = %d with %d files copied\n",
> -                        rc, le16_to_cpu(pSMBr->CopyCount));
> -       }
> -       cifs_buf_release(pSMB);
> -
> -       if (rc == -EAGAIN)
> -               goto copyRetry;
> -
> -       return rc;
> -}
> -
>  int
>  CIFSUnixCreateSymLink(const unsigned int xid, struct cifs_tcon *tcon,
>                       const char *fromName, const char *toName,
> --
> 2.46.2
>
>


-- 
Thanks,

Steve
Re: [PATCH] cifs: Remove pre-historic unused CIFSSMBCopy
Posted by Dr. David Alan Gilbert 1 week, 6 days ago
* Steve French (smfrench@gmail.com) wrote:
> merged into cifs-2.6.git for-next

Thanks!

Dave

> On Mon, Oct 7, 2024 at 4:02 PM <linux@treblig.org> wrote:
> >
> > From: "Dr. David Alan Gilbert" <linux@treblig.org>
> >
> > CIFSSMBCopy() is unused, remove it.
> >
> > It seems to have been that way pre-git; looking in a historic
> > archive, I think it landed around May 2004 in Linus'
> > BKrev: 40ab7591J_OgkpHW-qhzZukvAUAw9g
> > and was unused back then.
> >
> > Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
> > ---
> >  fs/smb/client/cifsproto.h |  7 -----
> >  fs/smb/client/cifssmb.c   | 63 ---------------------------------------
> >  2 files changed, 70 deletions(-)
> >
> > diff --git a/fs/smb/client/cifsproto.h b/fs/smb/client/cifsproto.h
> > index 1d3470bca45e..8235b5a0aa2b 100644
> > --- a/fs/smb/client/cifsproto.h
> > +++ b/fs/smb/client/cifsproto.h
> > @@ -549,13 +549,6 @@ extern int generate_smb311signingkey(struct cifs_ses *ses,
> >                                      struct TCP_Server_Info *server);
> >
> >  #ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY
> > -extern int CIFSSMBCopy(unsigned int xid,
> > -                       struct cifs_tcon *source_tcon,
> > -                       const char *fromName,
> > -                       const __u16 target_tid,
> > -                       const char *toName, const int flags,
> > -                       const struct nls_table *nls_codepage,
> > -                       int remap_special_chars);
> >  extern ssize_t CIFSSMBQAllEAs(const unsigned int xid, struct cifs_tcon *tcon,
> >                         const unsigned char *searchName,
> >                         const unsigned char *ea_name, char *EAData,
> > diff --git a/fs/smb/client/cifssmb.c b/fs/smb/client/cifssmb.c
> > index c6f15dbe860a..ca50ac652e02 100644
> > --- a/fs/smb/client/cifssmb.c
> > +++ b/fs/smb/client/cifssmb.c
> > @@ -2339,69 +2339,6 @@ int CIFSSMBRenameOpenFile(const unsigned int xid, struct cifs_tcon *pTcon,
> >         return rc;
> >  }
> >
> > -int
> > -CIFSSMBCopy(const unsigned int xid, struct cifs_tcon *tcon,
> > -           const char *fromName, const __u16 target_tid, const char *toName,
> > -           const int flags, const struct nls_table *nls_codepage, int remap)
> > -{
> > -       int rc = 0;
> > -       COPY_REQ *pSMB = NULL;
> > -       COPY_RSP *pSMBr = NULL;
> > -       int bytes_returned;
> > -       int name_len, name_len2;
> > -       __u16 count;
> > -
> > -       cifs_dbg(FYI, "In CIFSSMBCopy\n");
> > -copyRetry:
> > -       rc = smb_init(SMB_COM_COPY, 1, tcon, (void **) &pSMB,
> > -                       (void **) &pSMBr);
> > -       if (rc)
> > -               return rc;
> > -
> > -       pSMB->BufferFormat = 0x04;
> > -       pSMB->Tid2 = target_tid;
> > -
> > -       pSMB->Flags = cpu_to_le16(flags & COPY_TREE);
> > -
> > -       if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
> > -               name_len = cifsConvertToUTF16((__le16 *) pSMB->OldFileName,
> > -                                             fromName, PATH_MAX, nls_codepage,
> > -                                             remap);
> > -               name_len++;     /* trailing null */
> > -               name_len *= 2;
> > -               pSMB->OldFileName[name_len] = 0x04;     /* pad */
> > -               /* protocol requires ASCII signature byte on Unicode string */
> > -               pSMB->OldFileName[name_len + 1] = 0x00;
> > -               name_len2 =
> > -                   cifsConvertToUTF16((__le16 *)&pSMB->OldFileName[name_len+2],
> > -                                      toName, PATH_MAX, nls_codepage, remap);
> > -               name_len2 += 1 /* trailing null */  + 1 /* Signature word */ ;
> > -               name_len2 *= 2; /* convert to bytes */
> > -       } else {
> > -               name_len = copy_path_name(pSMB->OldFileName, fromName);
> > -               pSMB->OldFileName[name_len] = 0x04;  /* 2nd buffer format */
> > -               name_len2 = copy_path_name(pSMB->OldFileName+name_len+1, toName);
> > -               name_len2++;    /* signature byte */
> > -       }
> > -
> > -       count = 1 /* 1st signature byte */  + name_len + name_len2;
> > -       inc_rfc1001_len(pSMB, count);
> > -       pSMB->ByteCount = cpu_to_le16(count);
> > -
> > -       rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
> > -               (struct smb_hdr *) pSMBr, &bytes_returned, 0);
> > -       if (rc) {
> > -               cifs_dbg(FYI, "Send error in copy = %d with %d files copied\n",
> > -                        rc, le16_to_cpu(pSMBr->CopyCount));
> > -       }
> > -       cifs_buf_release(pSMB);
> > -
> > -       if (rc == -EAGAIN)
> > -               goto copyRetry;
> > -
> > -       return rc;
> > -}
> > -
> >  int
> >  CIFSUnixCreateSymLink(const unsigned int xid, struct cifs_tcon *tcon,
> >                       const char *fromName, const char *toName,
> > --
> > 2.46.2
> >
> >
> 
> 
> -- 
> Thanks,
> 
> Steve
> 
-- 
 -----Open up your eyes, open up your mind, open up your code -------   
/ Dr. David Alan Gilbert    |       Running GNU/Linux       | Happy  \ 
\        dave @ treblig.org |                               | In Hex /
 \ _________________________|_____ http://www.treblig.org   |_______/
Re: [PATCH] cifs: Remove pre-historic unused CIFSSMBCopy
Posted by Dr. David Alan Gilbert 2 weeks, 5 days ago
* linux@treblig.org (linux@treblig.org) wrote:
> From: "Dr. David Alan Gilbert" <linux@treblig.org>
> 
> CIFSSMBCopy() is unused, remove it.
> 
> It seems to have been that way pre-git; looking in a historic
> archive, I think it landed around May 2004 in Linus'
> BKrev: 40ab7591J_OgkpHW-qhzZukvAUAw9g
> and was unused back then.
> 
> Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>

Ping?

Dave

> ---
>  fs/smb/client/cifsproto.h |  7 -----
>  fs/smb/client/cifssmb.c   | 63 ---------------------------------------
>  2 files changed, 70 deletions(-)
> 
> diff --git a/fs/smb/client/cifsproto.h b/fs/smb/client/cifsproto.h
> index 1d3470bca45e..8235b5a0aa2b 100644
> --- a/fs/smb/client/cifsproto.h
> +++ b/fs/smb/client/cifsproto.h
> @@ -549,13 +549,6 @@ extern int generate_smb311signingkey(struct cifs_ses *ses,
>  				     struct TCP_Server_Info *server);
>  
>  #ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY
> -extern int CIFSSMBCopy(unsigned int xid,
> -			struct cifs_tcon *source_tcon,
> -			const char *fromName,
> -			const __u16 target_tid,
> -			const char *toName, const int flags,
> -			const struct nls_table *nls_codepage,
> -			int remap_special_chars);
>  extern ssize_t CIFSSMBQAllEAs(const unsigned int xid, struct cifs_tcon *tcon,
>  			const unsigned char *searchName,
>  			const unsigned char *ea_name, char *EAData,
> diff --git a/fs/smb/client/cifssmb.c b/fs/smb/client/cifssmb.c
> index c6f15dbe860a..ca50ac652e02 100644
> --- a/fs/smb/client/cifssmb.c
> +++ b/fs/smb/client/cifssmb.c
> @@ -2339,69 +2339,6 @@ int CIFSSMBRenameOpenFile(const unsigned int xid, struct cifs_tcon *pTcon,
>  	return rc;
>  }
>  
> -int
> -CIFSSMBCopy(const unsigned int xid, struct cifs_tcon *tcon,
> -	    const char *fromName, const __u16 target_tid, const char *toName,
> -	    const int flags, const struct nls_table *nls_codepage, int remap)
> -{
> -	int rc = 0;
> -	COPY_REQ *pSMB = NULL;
> -	COPY_RSP *pSMBr = NULL;
> -	int bytes_returned;
> -	int name_len, name_len2;
> -	__u16 count;
> -
> -	cifs_dbg(FYI, "In CIFSSMBCopy\n");
> -copyRetry:
> -	rc = smb_init(SMB_COM_COPY, 1, tcon, (void **) &pSMB,
> -			(void **) &pSMBr);
> -	if (rc)
> -		return rc;
> -
> -	pSMB->BufferFormat = 0x04;
> -	pSMB->Tid2 = target_tid;
> -
> -	pSMB->Flags = cpu_to_le16(flags & COPY_TREE);
> -
> -	if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
> -		name_len = cifsConvertToUTF16((__le16 *) pSMB->OldFileName,
> -					      fromName, PATH_MAX, nls_codepage,
> -					      remap);
> -		name_len++;     /* trailing null */
> -		name_len *= 2;
> -		pSMB->OldFileName[name_len] = 0x04;     /* pad */
> -		/* protocol requires ASCII signature byte on Unicode string */
> -		pSMB->OldFileName[name_len + 1] = 0x00;
> -		name_len2 =
> -		    cifsConvertToUTF16((__le16 *)&pSMB->OldFileName[name_len+2],
> -				       toName, PATH_MAX, nls_codepage, remap);
> -		name_len2 += 1 /* trailing null */  + 1 /* Signature word */ ;
> -		name_len2 *= 2; /* convert to bytes */
> -	} else {
> -		name_len = copy_path_name(pSMB->OldFileName, fromName);
> -		pSMB->OldFileName[name_len] = 0x04;  /* 2nd buffer format */
> -		name_len2 = copy_path_name(pSMB->OldFileName+name_len+1, toName);
> -		name_len2++;    /* signature byte */
> -	}
> -
> -	count = 1 /* 1st signature byte */  + name_len + name_len2;
> -	inc_rfc1001_len(pSMB, count);
> -	pSMB->ByteCount = cpu_to_le16(count);
> -
> -	rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
> -		(struct smb_hdr *) pSMBr, &bytes_returned, 0);
> -	if (rc) {
> -		cifs_dbg(FYI, "Send error in copy = %d with %d files copied\n",
> -			 rc, le16_to_cpu(pSMBr->CopyCount));
> -	}
> -	cifs_buf_release(pSMB);
> -
> -	if (rc == -EAGAIN)
> -		goto copyRetry;
> -
> -	return rc;
> -}
> -
>  int
>  CIFSUnixCreateSymLink(const unsigned int xid, struct cifs_tcon *tcon,
>  		      const char *fromName, const char *toName,
> -- 
> 2.46.2
> 
-- 
 -----Open up your eyes, open up your mind, open up your code -------   
/ Dr. David Alan Gilbert    |       Running GNU/Linux       | Happy  \ 
\        dave @ treblig.org |                               | In Hex /
 \ _________________________|_____ http://www.treblig.org   |_______/