kernels/linux-2.4.0/fs/smbfs/proc.c
/*
 * This version uses the trans2 TRANSACT2_FINDFIRST message 
 * to get the attribute data.
 * Note: called with the server locked.
 *
 * Bugs Noted:
 */
This version uses the trans2 TRANSACT2_FINDFIRST message
to get the attribute data.
Note: called with the server locked.

Bugs Noted.
This version uses the trans2 TRANSACT2_FINDFIRST message to get the attribute data . Note : called with the server locked . Bugs Noted .
static int
smb_proc_getattr_ff(struct smb_sb_info *server, struct dentry *dentry,
			struct smb_fattr *fattr)
{
	char *param = server->temp_buf, *mask = param + 12;
	__u16 date, time;
	unsigned char *resp_data = NULL;
	unsigned char *resp_param = NULL;
	int resp_data_len = 0;
	int resp_param_len = 0;
	int mask_len, result;
retry:
	mask_len = smb_encode_path(server, mask, dentry, NULL);
	if (mask_len < 0) {
		result = mask_len;
		goto out;
	}
	VERBOSE("name=%s, len=%d\n", mask, mask_len);
	WSET(param, 0, aSYSTEM | aHIDDEN | aDIR);
	WSET(param, 2, 1);	
	WSET(param, 4, 1);	
	WSET(param, 6, 1);	
	DSET(param, 8, 0);
	result = smb_trans2_request(server, TRANSACT2_FINDFIRST,
				    0, NULL, 12 + mask_len + 1, param,
				    &resp_data_len, &resp_data,
				    &resp_param_len, &resp_param);
	if (result < 0)
	{
		if (smb_retry(server))
			goto retry;
		goto out;
	}
	if (server->rcls != 0)
	{ 
		result = -smb_errno(server);
#ifdef SMBFS_PARANOIA
		if (result != -ENOENT)
			PARANOIA("error for %s, rcls=%d, err=%d\n",
				 mask, server->rcls, server->err);
#endif
		goto out;
	}
	result = -EINVAL;
	if (resp_data_len < 22 || WVAL(resp_param, 2) != 1)
	{
		PARANOIA("bad result for %s, len=%d, count=%d\n",
			 mask, resp_data_len, WVAL(resp_param, 2));
		goto out;
	}
	date = WVAL(resp_data, 0);
	time = WVAL(resp_data, 2);
	fattr->f_ctime = date_dos2unix(server, date, time);
	date = WVAL(resp_data, 4);
	time = WVAL(resp_data, 6);
	fattr->f_atime = date_dos2unix(server, date, time);
	date = WVAL(resp_data, 8);
	time = WVAL(resp_data, 10);
	fattr->f_mtime = date_dos2unix(server, date, time);
	VERBOSE("name=%s, date=%x, time=%x, mtime=%ld\n",
		mask, date, time, fattr->f_mtime);
	fattr->f_size = DVAL(resp_data, 12);
	fattr->attr = WVAL(resp_data, 20);
	result = 0;
out:
	return result;
}
static int smb_proc_getattr_ff ( struct smb_sb_info * server , struct dentry * dentry , struct smb_fattr * fattr ) { char * param = server -> temp_buf , * mask = param + 12 ; __u16 date , time ; unsigned char * resp_data = NULL ; unsigned char * resp_param = NULL ; int resp_data_len = 0 ; int resp_param_len = 0 ; int mask_len , result ; retry : mask_len = smb_encode_path ( server , mask , dentry , NULL ) ; if ( mask_len < 0 ) { result = mask_len ; goto out ; } VERBOSE ( " \n " , mask , mask_len ) ; WSET ( param , 0 , aSYSTEM | aHIDDEN | aDIR ) ; WSET ( param , 2 , 1 ) ; WSET ( param , 4 , 1 ) ; WSET ( param , 6 , 1 ) ; DSET ( param , 8 , 0 ) ; result = smb_trans2_request ( server , TRANSACT2_FINDFIRST , 0 , NULL , 12 + mask_len + 1 , param , & resp_data_len , & resp_data , & resp_param_len , & resp_param ) ; if ( result < 0 ) { if ( smb_retry ( server ) ) goto retry ; goto out ; } if ( server -> rcls != 0 ) { result = - smb_errno ( server ) ; #ifdef SMBFS_PARANOIA if ( result != - ENOENT ) PARANOIA ( " \n " , mask , server -> rcls , server -> err ) ; #endif goto out ; } result = - EINVAL ; if ( resp_data_len < 22 || WVAL ( resp_param , 2 ) != 1 ) { PARANOIA ( " \n " , mask , resp_data_len , WVAL ( resp_param , 2 ) ) ; goto out ; } date = WVAL ( resp_data , 0 ) ; time = WVAL ( resp_data , 2 ) ; fattr -> f_ctime = date_dos2unix ( server , date , time ) ; date = WVAL ( resp_data , 4 ) ; time = WVAL ( resp_data , 6 ) ; fattr -> f_atime = date_dos2unix ( server , date , time ) ; date = WVAL ( resp_data , 8 ) ; time = WVAL ( resp_data , 10 ) ; fattr -> f_mtime = date_dos2unix ( server , date , time ) ; VERBOSE ( " \n " , mask , date , time , fattr -> f_mtime ) ; fattr -> f_size = DVAL ( resp_data , 12 ) ; fattr -> attr = WVAL ( resp_data , 20 ) ; result = 0 ; out : return result ; }
This version uses the trans2 TRANSACT2_FINDFIRST message
 to get the attribute data.
This version uses the trans2 TRANSACT2_FINDFIRST message to get the attribute data .
/* max count */ /* close after this call */ /* info_level */ /* Make sure we got enough data ... */ /*
	 * Decode the response into the fattr ...
	 */ /* ULONG allocation size */