/* open an AFS file or directory and attach a key to it  */
int afs_open(struct inode *inode, struct file *file)
/* open an AFS file or directory and attach a key to it  */
int afs_open(struct inode *inode, struct file *file)
{
	struct afs_vnode *vnode = AFS_FS_I(inode);
	struct key *key;
	int ret;
	_enter("{%x:%u},", vnode->fid.vid, vnode->fid.vnode);
	key = afs_request_key(vnode->volume->cell);
	if (IS_ERR(key)) {
		_leave(" = %ld [key]", PTR_ERR(key));
		return PTR_ERR(key);
	}
	ret = afs_validate(vnode, key);
	if (ret < 0) {
		_leave(" = %d [val]", ret);
		return ret;
	}
	file->private_data = key;
	_leave(" = 0");
	return 0;
}