kernels/linux-2.4.0/fs/smbfs/dir.c
/*
 * This code is common to all routines creating a new inode.
 */
This code is common to all routines creating a new inode.
This code is common to all routines creating a new inode .
static int
smb_instantiate(struct dentry *dentry, __u16 fileid, int have_id)
{
	struct smb_sb_info *server = server_from_dentry(dentry);
	struct inode *inode;
	int error;
	struct smb_fattr fattr;
	VERBOSE("file %s/%s, fileid=%u\n", DENTRY_PATH(dentry), fileid);
	error = smb_proc_getattr(dentry, &fattr);
	if (error)
		goto out_close;
	smb_renew_times(dentry);
	fattr.f_ino = iunique(dentry->d_sb, 2);
	inode = smb_iget(dentry->d_sb, &fattr);
	if (!inode)
		goto out_no_inode;
	if (have_id)
	{
		inode->u.smbfs_i.fileid = fileid;
		inode->u.smbfs_i.access = SMB_O_RDWR;
		inode->u.smbfs_i.open = server->generation;
	}
	d_instantiate(dentry, inode);
out:
	return error;
out_no_inode:
	error = -EACCES;
out_close:
	if (have_id)
	{
		PARANOIA("%s/%s failed, error=%d, closing %u\n",
			 DENTRY_PATH(dentry), error, fileid);
		smb_close_fileid(dentry, fileid);
	}
	goto out;
}
static int smb_instantiate ( struct dentry * dentry , __u16 fileid , int have_id ) { struct smb_sb_info * server = server_from_dentry ( dentry ) ; struct inode * inode ; int error ; struct smb_fattr fattr ; VERBOSE ( " \n " , DENTRY_PATH ( dentry ) , fileid ) ; error = smb_proc_getattr ( dentry , & fattr ) ; if ( error ) goto out_close ; smb_renew_times ( dentry ) ; fattr . f_ino = iunique ( dentry -> d_sb , 2 ) ; inode = smb_iget ( dentry -> d_sb , & fattr ) ; if ( ! inode ) goto out_no_inode ; if ( have_id ) { inode -> u . smbfs_i . fileid = fileid ; inode -> u . smbfs_i . access = SMB_O_RDWR ; inode -> u . smbfs_i . open = server -> generation ; } d_instantiate ( dentry , inode ) ; out : return error ; out_no_inode : error = - EACCES ; out_close : if ( have_id ) { PARANOIA ( " \n " , DENTRY_PATH ( dentry ) , error , fileid ) ; smb_close_fileid ( dentry , fileid ) ; } goto out ; }
This code is common to all routines creating a new inode.
This code is common to all routines creating a new inode .