/* Returns number of bytes read or error code, as appropriate  */
static ssize_t smk_read_ambient(struct file *filp, char __user *buf, size_t cn, loff_t *ppos)
/* Returns number of bytes read or error code, as appropriate  */
static ssize_t smk_read_ambient(struct file *filp, char __user *buf, size_t cn, loff_t *ppos)
{
	ssize_t rc;
	int asize;
	if (*ppos != 0)
		return 0;
	mutex_lock(&smack_ambient_lock);
	asize = strlen(smack_net_ambient) + 1;
	if (cn >= asize)
		rc = simple_read_from_buffer(buf, cn, ppos,
					     smack_net_ambient, asize);
	else
		rc = -EINVAL;
	mutex_unlock(&smack_ambient_lock);
	return rc;
}