8 #include <mtd/ubi-user.h>
10 #define zero(x) memset(&x, 0, sizeof(x))
13 int fd = open("/dev/null", 0);
14 struct ubi_mkvol_req mkvol = {
17 .bytes = 1125899906842624ULL,
22 struct ubi_rsvol_req rsvol = {
23 .bytes = 1125899906842624ULL,
26 struct ubi_rnvol_req rnvol = {
29 struct ubi_attach_req attach;
30 struct ubi_map_req map;
31 struct ubi_set_vol_prop_req prop = {
33 .value = 1125899906842624ULL,
35 uint64_t bytes = ((uint64_t)1 << 50) | 0x123;
37 ioctl(fd, UBI_IOCMKVOL, &mkvol);
38 ioctl(fd, UBI_IOCRSVOL, &rsvol);
39 ioctl(fd, UBI_IOCRNVOL, &rnvol);
40 ioctl(fd, UBI_IOCATT, &attach);
41 ioctl(fd, UBI_IOCVOLUP, &bytes);
42 ioctl(fd, UBI_IOCEBMAP, &map);
43 ioctl(fd, UBI_IOCSETVOLPROP, &prop);
45 ioctl(fd, UBI_IOCSETVOLPROP, &prop);
46 ioctl(fd, UBI_IOCRMVOL, 1);
47 ioctl(fd, UBI_IOCDET, 2);
48 ioctl(fd, UBI_IOCEBER, 3);
49 ioctl(fd, UBI_IOCEBCH, 4);
50 ioctl(fd, UBI_IOCEBUNMAP, 5);
51 ioctl(fd, UBI_IOCEBISMAP, 6);