/* This can store pdcs_size - 224 bytes of OS-Dependent data. We use a byte-by-byte write approach. It's up to userspace to deal with it when constructing its input buffer.  */
static ssize_t pdcs_osdep2_write(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, size_t count)
/* This can store pdcs_size - 224 bytes of OS-Dependent data. We use a byte-by-byte write approach. It's up to userspace to deal with it when constructing its input buffer.  */
static ssize_t pdcs_osdep2_write(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, size_t count)
{
	unsigned long size;
	unsigned short i;
	u8 in[4];
	if (!capable(CAP_SYS_ADMIN))
		return -EACCES;
	if (!buf || !count)
		return -EINVAL;
	if (unlikely(pdcs_size <= 224))
		return -ENOSYS;
	if (unlikely(pdcs_osid != OS_ID_LINUX))
		return -EPERM;
	size = pdcs_size - 224;
	if (count > size)
		return -EMSGSIZE;
	for (i=0; i<count; i+=4) {
		memset(in, 0, 4);
		memcpy(in, buf+i, (count-i < 4) ? count-i : 4);
		if (unlikely(pdc_stable_write(PDCS_ADDR_OSD2 + i, &in,
					sizeof(in)) != PDC_OK))
			return -EIO;
	}
	return count;
}