-/**
- * pdcs_osdep1_write - Stable Storage OS-Dependent data area 1 input.
- * @entry: An allocated and populated subsytem struct. We don't use it tho.
- * @buf: The input buffer to read from.
- * @count: The number of bytes to be read.
- *
- * This can store 16 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_osdep1_write(struct subsystem *entry, const char *buf, size_t count)
-{
- u8 in[16];
-
- if (!capable(CAP_SYS_ADMIN))
- return -EACCES;
-
- if (!entry || !buf || !count)
- return -EINVAL;
-
- if (unlikely(pdcs_osid != OS_ID_LINUX))
- return -EPERM;
-
- if (count > 16)
- return -EMSGSIZE;
-
- /* We'll use a local copy of buf */
- memset(in, 0, 16);
- memcpy(in, buf, count);
-
- if (pdc_stable_write(PDCS_ADDR_OSD1, &in, sizeof(in)) != PDC_OK)
- return -EIO;
-
- return count;
-}
-
-/**
- * pdcs_osdep2_write - Stable Storage OS-Dependent data area 2 input.
- * @entry: An allocated and populated subsytem struct. We don't use it tho.
- * @buf: The input buffer to read from.
- * @count: The number of bytes to be read.
- *
- * 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 subsystem *entry, const char *buf, size_t count)
-{
- unsigned long size;
- unsigned short i;
- u8 in[4];
-
- if (!capable(CAP_SYS_ADMIN))
- return -EACCES;
-
- if (!entry || !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;
-
- /* We'll use a local copy of buf */
-
- 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;
-}
-