diff options
author | Jeff Layton <jlayton@redhat.com> | 2011-01-07 11:30:28 -0500 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2011-01-09 18:39:12 -0500 |
commit | 1397f2ee4be65542fdc3460c7e8b6317779ea680 (patch) | |
tree | 77e0946defb1ea1b52b166ab46d21c07d04dac22 /fs | |
parent | a0f8b4fb4cab4bc32caaf34fc0a0c9d5dd369186 (diff) |
cifs: replace some hardcoded values with preprocessor constants
A number of places that deal with RFC1001/1002 negotiations have bare
"15" or "16" values. Replace them with RFC_1001_NAME_LEN and
RFC_1001_NAME_LEN_WITH_NULL.
The patch also cleans up some checkpatch warnings for code surrounding
the changes. This should apply cleanly on top of the patch to remove
Local_System_Name.
Reported-and-Reviwed-by: Shirish Pargaonkar <shirishpargaonkar@gmail.com>
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/cifs/connect.c | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 41f002fb4a04..5e7a7bcc39a6 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -64,8 +64,8 @@ struct smb_vol { | |||
64 | char *UNC; | 64 | char *UNC; |
65 | char *UNCip; | 65 | char *UNCip; |
66 | char *iocharset; /* local code page for mapping to and from Unicode */ | 66 | char *iocharset; /* local code page for mapping to and from Unicode */ |
67 | char source_rfc1001_name[16]; /* netbios name of client */ | 67 | char source_rfc1001_name[RFC1001_NAME_LEN_WITH_NULL]; /* clnt nb name */ |
68 | char target_rfc1001_name[16]; /* netbios name of server for Win9x/ME */ | 68 | char target_rfc1001_name[RFC1001_NAME_LEN_WITH_NULL]; /* srvr nb name */ |
69 | uid_t cred_uid; | 69 | uid_t cred_uid; |
70 | uid_t linux_uid; | 70 | uid_t linux_uid; |
71 | gid_t linux_gid; | 71 | gid_t linux_gid; |
@@ -816,11 +816,11 @@ cifs_parse_mount_options(char *options, const char *devname, | |||
816 | * informational, only used for servers that do not support | 816 | * informational, only used for servers that do not support |
817 | * port 445 and it can be overridden at mount time | 817 | * port 445 and it can be overridden at mount time |
818 | */ | 818 | */ |
819 | memset(vol->source_rfc1001_name, 0x20, 15); | 819 | memset(vol->source_rfc1001_name, 0x20, RFC1001_NAME_LEN); |
820 | for (i = 0; i < strnlen(nodename, 15); i++) | 820 | for (i = 0; i < strnlen(nodename, RFC1001_NAME_LEN); i++) |
821 | vol->source_rfc1001_name[i] = toupper(nodename[i]); | 821 | vol->source_rfc1001_name[i] = toupper(nodename[i]); |
822 | 822 | ||
823 | vol->source_rfc1001_name[15] = 0; | 823 | vol->source_rfc1001_name[RFC1001_NAME_LEN] = 0; |
824 | /* null target name indicates to use *SMBSERVR default called name | 824 | /* null target name indicates to use *SMBSERVR default called name |
825 | if we end up sending RFC1001 session initialize */ | 825 | if we end up sending RFC1001 session initialize */ |
826 | vol->target_rfc1001_name[0] = 0; | 826 | vol->target_rfc1001_name[0] = 0; |
@@ -1167,22 +1167,22 @@ cifs_parse_mount_options(char *options, const char *devname, | |||
1167 | if (!value || !*value || (*value == ' ')) { | 1167 | if (!value || !*value || (*value == ' ')) { |
1168 | cFYI(1, "invalid (empty) netbiosname"); | 1168 | cFYI(1, "invalid (empty) netbiosname"); |
1169 | } else { | 1169 | } else { |
1170 | memset(vol->source_rfc1001_name, 0x20, 15); | 1170 | memset(vol->source_rfc1001_name, 0x20, |
1171 | for (i = 0; i < 15; i++) { | 1171 | RFC1001_NAME_LEN); |
1172 | /* BB are there cases in which a comma can be | 1172 | /* |
1173 | valid in this workstation netbios name (and need | 1173 | * FIXME: are there cases in which a comma can |
1174 | special handling)? */ | 1174 | * be valid in workstation netbios name (and |
1175 | 1175 | * need special handling)? | |
1176 | /* We do not uppercase netbiosname for user */ | 1176 | */ |
1177 | for (i = 0; i < RFC1001_NAME_LEN; i++) { | ||
1178 | /* don't ucase netbiosname for user */ | ||
1177 | if (value[i] == 0) | 1179 | if (value[i] == 0) |
1178 | break; | 1180 | break; |
1179 | else | 1181 | vol->source_rfc1001_name[i] = value[i]; |
1180 | vol->source_rfc1001_name[i] = | ||
1181 | value[i]; | ||
1182 | } | 1182 | } |
1183 | /* The string has 16th byte zero still from | 1183 | /* The string has 16th byte zero still from |
1184 | set at top of the function */ | 1184 | set at top of the function */ |
1185 | if ((i == 15) && (value[i] != 0)) | 1185 | if (i == RFC1001_NAME_LEN && value[i] != 0) |
1186 | printk(KERN_WARNING "CIFS: netbiosname" | 1186 | printk(KERN_WARNING "CIFS: netbiosname" |
1187 | " longer than 15 truncated.\n"); | 1187 | " longer than 15 truncated.\n"); |
1188 | } | 1188 | } |
@@ -1192,7 +1192,8 @@ cifs_parse_mount_options(char *options, const char *devname, | |||
1192 | cFYI(1, "empty server netbiosname specified"); | 1192 | cFYI(1, "empty server netbiosname specified"); |
1193 | } else { | 1193 | } else { |
1194 | /* last byte, type, is 0x20 for servr type */ | 1194 | /* last byte, type, is 0x20 for servr type */ |
1195 | memset(vol->target_rfc1001_name, 0x20, 16); | 1195 | memset(vol->target_rfc1001_name, 0x20, |
1196 | RFC1001_NAME_LEN_WITH_NULL); | ||
1196 | 1197 | ||
1197 | for (i = 0; i < 15; i++) { | 1198 | for (i = 0; i < 15; i++) { |
1198 | /* BB are there cases in which a comma can be | 1199 | /* BB are there cases in which a comma can be |
@@ -1209,7 +1210,7 @@ cifs_parse_mount_options(char *options, const char *devname, | |||
1209 | } | 1210 | } |
1210 | /* The string has 16th byte zero still from | 1211 | /* The string has 16th byte zero still from |
1211 | set at top of the function */ | 1212 | set at top of the function */ |
1212 | if ((i == 15) && (value[i] != 0)) | 1213 | if (i == RFC1001_NAME_LEN && value[i] != 0) |
1213 | printk(KERN_WARNING "CIFS: server net" | 1214 | printk(KERN_WARNING "CIFS: server net" |
1214 | "biosname longer than 15 truncated.\n"); | 1215 | "biosname longer than 15 truncated.\n"); |
1215 | } | 1216 | } |