Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

cifs: Make extract_hostname function public

Move the function to misc.c and give it a public header.

Signed-off-by: Samuel Cabrero <scabrero@suse.de>
Reviewed-by: Aurelien Aptel <aaptel@suse.com>
Signed-off-by: Steve French <stfrench@microsoft.com>

authored by

Samuel Cabrero and committed by
Steve French
a87e6725 a2a52a8a

+33 -34
+1
fs/cifs/cifsproto.h
··· 617 617 struct super_block *cifs_get_tcp_super(struct TCP_Server_Info *server); 618 618 void cifs_put_tcp_super(struct super_block *sb); 619 619 int update_super_prepath(struct cifs_tcon *tcon, char *prefix); 620 + char *extract_hostname(const char *unc); 620 621 621 622 #ifdef CONFIG_CIFS_DFS_UPCALL 622 623 static inline int get_dfs_path(const unsigned int xid, struct cifs_ses *ses,
-34
fs/cifs/connect.c
··· 77 77 static int generic_ip_connect(struct TCP_Server_Info *server); 78 78 static void tlink_rb_insert(struct rb_root *root, struct tcon_link *new_tlink); 79 79 static void cifs_prune_tlinks(struct work_struct *work); 80 - static char *extract_hostname(const char *unc); 81 80 82 81 /* 83 82 * Resolve hostname and set ip addr in tcp ses. Useful for hostnames that may ··· 1022 1023 1023 1024 memalloc_noreclaim_restore(noreclaim_flag); 1024 1025 module_put_and_exit(0); 1025 - } 1026 - 1027 - /* extract the host portion of the UNC string */ 1028 - static char * 1029 - extract_hostname(const char *unc) 1030 - { 1031 - const char *src; 1032 - char *dst, *delim; 1033 - unsigned int len; 1034 - 1035 - /* skip double chars at beginning of string */ 1036 - /* BB: check validity of these bytes? */ 1037 - if (strlen(unc) < 3) 1038 - return ERR_PTR(-EINVAL); 1039 - for (src = unc; *src && *src == '\\'; src++) 1040 - ; 1041 - if (!*src) 1042 - return ERR_PTR(-EINVAL); 1043 - 1044 - /* delimiter between hostname and sharename is always '\\' now */ 1045 - delim = strchr(src, '\\'); 1046 - if (!delim) 1047 - return ERR_PTR(-EINVAL); 1048 - 1049 - len = delim - src; 1050 - dst = kmalloc((len + 1), GFP_KERNEL); 1051 - if (dst == NULL) 1052 - return ERR_PTR(-ENOMEM); 1053 - 1054 - memcpy(dst, src, len); 1055 - dst[len] = '\0'; 1056 - 1057 - return dst; 1058 1026 } 1059 1027 1060 1028 /** Returns true if srcaddr isn't specified and rhs isn't
+32
fs/cifs/misc.c
··· 1195 1195 cifs_put_tcon_super(sb); 1196 1196 return rc; 1197 1197 } 1198 + 1199 + /* extract the host portion of the UNC string */ 1200 + char *extract_hostname(const char *unc) 1201 + { 1202 + const char *src; 1203 + char *dst, *delim; 1204 + unsigned int len; 1205 + 1206 + /* skip double chars at beginning of string */ 1207 + /* BB: check validity of these bytes? */ 1208 + if (strlen(unc) < 3) 1209 + return ERR_PTR(-EINVAL); 1210 + for (src = unc; *src && *src == '\\'; src++) 1211 + ; 1212 + if (!*src) 1213 + return ERR_PTR(-EINVAL); 1214 + 1215 + /* delimiter between hostname and sharename is always '\\' now */ 1216 + delim = strchr(src, '\\'); 1217 + if (!delim) 1218 + return ERR_PTR(-EINVAL); 1219 + 1220 + len = delim - src; 1221 + dst = kmalloc((len + 1), GFP_KERNEL); 1222 + if (dst == NULL) 1223 + return ERR_PTR(-ENOMEM); 1224 + 1225 + memcpy(dst, src, len); 1226 + dst[len] = '\0'; 1227 + 1228 + return dst; 1229 + }