kernels/linux-2.4.0/fs/smbfs/proc.c
/*
 * Interpret a long filename structure using the specified info level:
 *   level 1 for anything below NT1 protocol
 *   level 260 for NT1 protocol
 *
 * We return a reference to the name string to avoid copying, and perform
 * any needed upper/lower casing in place.
 *
 * Bugs Noted:
 * (1) Win NT 4.0 appends a null byte to names and counts it in the length!
 */
Interpret a long filename structure using the specified info level:
level 1 for anything below NT1 protocol
level 260 for NT1 protocol

We return a reference to the name string to avoid copying, and perform
any needed upper/lower casing in place.

Bugs Noted:
(1) Win NT 4.0 appends a null byte to names and counts it in the length!
Interpret a long filename structure using the specified info level : level 1 for anything below NT1 protocol level 260 for NT1 protocol We return a reference to the name string to avoid copying and perform any needed upper / lower casing in place . Bugs Noted : ( 1 ) Win NT 4 . 0 appends a null byte to names and counts it in the length!
static char *
smb_decode_long_dirent(struct smb_sb_info *server, char *p,
			struct cache_dirent *entry, int level)
{
	char *result;
	unsigned int len = 0;
	entry->ino = 0;
	switch (level) {
	case 1:
		len = *((unsigned char *) p + 22);
		entry->name = p + 23;
		result = p + 24 + len;
		VERBOSE("info 1 at %p, len=%d, name=%.*s\n",
			p, len, len, entry->name);
		break;
	case 260:
		result = p + WVAL(p, 0);
		len = DVAL(p, 60);
		if (len > 255) len = 255;
		entry->name = p + 94;
		if (len && entry->name[len-1] == '\0')
			len--;
		VERBOSE("info 260 at %p, len=%d, name=%.*s\n",
			p, len, len, entry->name);
		break;
	default:
		PARANOIA("Unknown info level %d\n", level);
		result = p + WVAL(p, 0);
		goto out;
	}
	switch (server->opt.case_handling) {
	case SMB_CASE_UPPER:
		str_upper(entry->name, len);
		break;
	case SMB_CASE_LOWER:
		str_lower(entry->name, len);
		break;
	default:
		break;
	}
	entry->len = server->convert(server->name_buf, SMB_MAXNAMELEN,
				     entry->name, len,
				     server->remote_nls, server->local_nls);
	entry->name = server->name_buf;
out:
	return result;
}
static char * smb_decode_long_dirent ( struct smb_sb_info * server , char * p , struct cache_dirent * entry , int level ) { char * result ; unsigned int len = 0 ; entry -> ino = 0 ; switch ( level ) { case 1 : len = * ( ( unsigned char * ) p + 22 ) ; entry -> name = p + 23 ; result = p + 24 + len ; VERBOSE ( " \n " , p , len , len , entry -> name ) ; break ; case 260 : result = p + WVAL ( p , 0 ) ; len = DVAL ( p , 60 ) ; if ( len > 255 ) len = 255 ; entry -> name = p + 94 ; if ( len && entry -> name [ len - 1 ] == ' \0 ' ) len -- ; VERBOSE ( " \n " , p , len , len , entry -> name ) ; break ; default : PARANOIA ( " \n " , level ) ; result = p + WVAL ( p , 0 ) ; goto out ; } switch ( server -> opt . case_handling ) { case SMB_CASE_UPPER : str_upper ( entry -> name , len ) ; break ; case SMB_CASE_LOWER : str_lower ( entry -> name , len ) ; break ; default : break ; } entry -> len = server -> convert ( server -> name_buf , SMB_MAXNAMELEN , entry -> name , len , server -> remote_nls , server -> local_nls ) ; entry -> name = server -> name_buf ; out : return result ; }
Interpret a long filename structure using the specified info level:
   level 1 for anything below NT1 protocol
   level 260 for NT1 protocol
Interpret a long filename structure using the specified info level : level 1 for anything below NT1 protocol level 260 for NT1 protocol
/*
	 * SMB doesn't have a concept of inode numbers ...
	 */ /* NT4 null terminates */