]> www.infradead.org Git - mtd-utils.git/commitdiff
libubi: add ubi_set_property interface
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Fri, 8 May 2009 15:09:21 +0000 (18:09 +0300)
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Fri, 8 May 2009 16:07:26 +0000 (19:07 +0300)
This is needed for io_paral test.

ubi-utils/include/libubi.h
ubi-utils/src/libubi.c

index 7ff0934bc6a15e7232a6324a7dec220b82b60d2e..243bcbb1847639cb32aee17ff910fbc1752872d7 100644 (file)
@@ -393,6 +393,17 @@ int ubi_update_start(libubi_t desc, int fd, long long bytes);
  */
 int ubi_leb_change_start(libubi_t desc, int fd, int lnum, int bytes, int dtype);
 
+/**
+ * ubi_set_property - set volume propety.
+ * @fd: volume character device file descriptor
+ * @property: the property to change (%UBI_PROP_DIRECT_WRITE, etc)
+ * @value: new value of the changed property
+ *
+ * This function changes a property of a volume. Returns zero in case of
+ * success and a negative error code in case of error.
+ */
+int ubi_set_property(int fd, uint8_t property, uint64_t value);
+
 #ifdef __cplusplus
 }
 #endif
index 167460c31794f55d82382799b541a15cd9ba922e..c63beebc064eda679dd7c5052b7196ffdc133464 100644 (file)
@@ -1239,3 +1239,14 @@ int ubi_get_vol_info1_nm(libubi_t desc, int dev_num, const char *name,
        errno = ENOENT;
        return -1;
 }
+
+int ubi_set_property(int fd, uint8_t property, uint64_t value)
+{
+       struct ubi_set_prop_req r;
+
+       memset(&r, sizeof(struct ubi_set_prop_req), '\0');
+       r.property = property;
+       r.value = value;
+
+       return ioctl(fd, UBI_IOCSETPROP, &r);
+}