Lines Matching +full:ubi +full:- +full:volume +full:-

1 // SPDX-License-Identifier: GPL-2.0-or-later
9 * This file includes implementation of UBI character device operations.
11 * There are two kinds of character devices in UBI: UBI character devices and
12 * UBI volume character devices. UBI character devices allow users to
13 * manipulate whole volumes: create, remove, and re-size them. Volume character
14 * devices provide volume I/O capabilities.
16 * Major and minor numbers are assigned dynamically to both UBI and volume
19 * Well, there is the third kind of character devices - the UBI control
20 * character device, which allows to manipulate by UBI devices - create and
33 #include <mtd/ubi-user.h>
34 #include "ubi.h"
37 * get_exclusive - get exclusive access to an UBI volume.
38 * @desc: volume descriptor
40 * This function changes UBI volume open mode to "exclusive". Returns previous
47 struct ubi_volume *vol = desc->vol; in get_exclusive()
49 spin_lock(&vol->ubi->volumes_lock); in get_exclusive()
50 users = vol->readers + vol->writers + vol->exclusive + vol->metaonly; in get_exclusive()
53 ubi_err(vol->ubi, "%d users for volume %d", users, vol->vol_id); in get_exclusive()
54 err = -EBUSY; in get_exclusive()
56 vol->readers = vol->writers = vol->metaonly = 0; in get_exclusive()
57 vol->exclusive = 1; in get_exclusive()
58 err = desc->mode; in get_exclusive()
59 desc->mode = UBI_EXCLUSIVE; in get_exclusive()
61 spin_unlock(&vol->ubi->volumes_lock); in get_exclusive()
67 * revoke_exclusive - revoke exclusive mode.
68 * @desc: volume descriptor
73 struct ubi_volume *vol = desc->vol; in revoke_exclusive()
75 spin_lock(&vol->ubi->volumes_lock); in revoke_exclusive()
76 ubi_assert(vol->readers == 0 && vol->writers == 0 && vol->metaonly == 0); in revoke_exclusive()
77 ubi_assert(vol->exclusive == 1 && desc->mode == UBI_EXCLUSIVE); in revoke_exclusive()
78 vol->exclusive = 0; in revoke_exclusive()
80 vol->readers = 1; in revoke_exclusive()
82 vol->writers = 1; in revoke_exclusive()
84 vol->metaonly = 1; in revoke_exclusive()
86 vol->exclusive = 1; in revoke_exclusive()
87 spin_unlock(&vol->ubi->volumes_lock); in revoke_exclusive()
89 desc->mode = mode; in revoke_exclusive()
95 int vol_id = iminor(inode) - 1, mode, ubi_num; in vol_cdev_open()
101 if (file->f_mode & FMODE_WRITE) in vol_cdev_open()
106 dbg_gen("open device %d, volume %d, mode %d", in vol_cdev_open()
113 file->private_data = desc; in vol_cdev_open()
119 struct ubi_volume_desc *desc = file->private_data; in vol_cdev_release()
120 struct ubi_volume *vol = desc->vol; in vol_cdev_release()
122 dbg_gen("release device %d, volume %d, mode %d", in vol_cdev_release()
123 vol->ubi->ubi_num, vol->vol_id, desc->mode); in vol_cdev_release()
125 if (vol->updating) { in vol_cdev_release()
126 ubi_warn(vol->ubi, "update of volume %d not finished, volume is damaged", in vol_cdev_release()
127 vol->vol_id); in vol_cdev_release()
128 ubi_assert(!vol->changing_leb); in vol_cdev_release()
129 vol->updating = 0; in vol_cdev_release()
130 vfree(vol->upd_buf); in vol_cdev_release()
131 } else if (vol->changing_leb) { in vol_cdev_release()
132 dbg_gen("only %lld of %lld bytes received for atomic LEB change for volume %d:%d, cancel", in vol_cdev_release()
133 vol->upd_received, vol->upd_bytes, vol->ubi->ubi_num, in vol_cdev_release()
134 vol->vol_id); in vol_cdev_release()
135 vol->changing_leb = 0; in vol_cdev_release()
136 vfree(vol->upd_buf); in vol_cdev_release()
145 struct ubi_volume_desc *desc = file->private_data; in vol_cdev_llseek()
146 struct ubi_volume *vol = desc->vol; in vol_cdev_llseek()
148 if (vol->updating) { in vol_cdev_llseek()
150 ubi_err(vol->ubi, "updating"); in vol_cdev_llseek()
151 return -EBUSY; in vol_cdev_llseek()
154 return fixed_size_llseek(file, offset, origin, vol->used_bytes); in vol_cdev_llseek()
160 struct ubi_volume_desc *desc = file->private_data; in vol_cdev_fsync()
161 struct ubi_device *ubi = desc->vol->ubi; in vol_cdev_fsync() local
165 err = ubi_sync(ubi->ubi_num); in vol_cdev_fsync()
174 struct ubi_volume_desc *desc = file->private_data; in vol_cdev_read()
175 struct ubi_volume *vol = desc->vol; in vol_cdev_read()
176 struct ubi_device *ubi = vol->ubi; in vol_cdev_read() local
181 dbg_gen("read %zd bytes from offset %lld of volume %d", in vol_cdev_read()
182 count, *offp, vol->vol_id); in vol_cdev_read()
184 if (vol->updating) { in vol_cdev_read()
185 ubi_err(vol->ubi, "updating"); in vol_cdev_read()
186 return -EBUSY; in vol_cdev_read()
188 if (vol->upd_marker) { in vol_cdev_read()
189 ubi_err(vol->ubi, "damaged volume, update marker is set"); in vol_cdev_read()
190 return -EBADF; in vol_cdev_read()
192 if (*offp == vol->used_bytes || count == 0) in vol_cdev_read()
195 if (vol->corrupted) in vol_cdev_read()
196 dbg_gen("read from corrupted volume %d", vol->vol_id); in vol_cdev_read()
198 if (*offp + count > vol->used_bytes) in vol_cdev_read()
199 count_save = count = vol->used_bytes - *offp; in vol_cdev_read()
201 tbuf_size = vol->usable_leb_size; in vol_cdev_read()
203 tbuf_size = ALIGN(count, ubi->min_io_size); in vol_cdev_read()
206 return -ENOMEM; in vol_cdev_read()
209 lnum = div_u64_rem(*offp, vol->usable_leb_size, &off); in vol_cdev_read()
214 if (off + len >= vol->usable_leb_size) in vol_cdev_read()
215 len = vol->usable_leb_size - off; in vol_cdev_read()
217 err = ubi_eba_read_leb(ubi, vol, lnum, tbuf, off, len, 0); in vol_cdev_read()
222 if (off == vol->usable_leb_size) { in vol_cdev_read()
224 off -= vol->usable_leb_size; in vol_cdev_read()
227 count -= len; in vol_cdev_read()
232 err = -EFAULT; in vol_cdev_read()
241 return err ? err : count_save - count; in vol_cdev_read()
245 * This function allows to directly write to dynamic UBI volumes, without
246 * issuing the volume update operation.
251 struct ubi_volume_desc *desc = file->private_data; in vol_cdev_direct_write()
252 struct ubi_volume *vol = desc->vol; in vol_cdev_direct_write()
253 struct ubi_device *ubi = vol->ubi; in vol_cdev_direct_write() local
258 if (!vol->direct_writes) in vol_cdev_direct_write()
259 return -EPERM; in vol_cdev_direct_write()
261 dbg_gen("requested: write %zd bytes to offset %lld of volume %u", in vol_cdev_direct_write()
262 count, *offp, vol->vol_id); in vol_cdev_direct_write()
264 if (vol->vol_type == UBI_STATIC_VOLUME) in vol_cdev_direct_write()
265 return -EROFS; in vol_cdev_direct_write()
267 lnum = div_u64_rem(*offp, vol->usable_leb_size, &off); in vol_cdev_direct_write()
268 if (off & (ubi->min_io_size - 1)) { in vol_cdev_direct_write()
269 ubi_err(ubi, "unaligned position"); in vol_cdev_direct_write()
270 return -EINVAL; in vol_cdev_direct_write()
273 if (*offp + count > vol->used_bytes) in vol_cdev_direct_write()
274 count_save = count = vol->used_bytes - *offp; in vol_cdev_direct_write()
277 if (count & (ubi->min_io_size - 1)) { in vol_cdev_direct_write()
278 ubi_err(ubi, "unaligned write length"); in vol_cdev_direct_write()
279 return -EINVAL; in vol_cdev_direct_write()
282 tbuf_size = vol->usable_leb_size; in vol_cdev_direct_write()
284 tbuf_size = ALIGN(count, ubi->min_io_size); in vol_cdev_direct_write()
287 return -ENOMEM; in vol_cdev_direct_write()
294 if (off + len >= vol->usable_leb_size) in vol_cdev_direct_write()
295 len = vol->usable_leb_size - off; in vol_cdev_direct_write()
299 err = -EFAULT; in vol_cdev_direct_write()
303 err = ubi_eba_write_leb(ubi, vol, lnum, tbuf, off, len); in vol_cdev_direct_write()
308 if (off == vol->usable_leb_size) { in vol_cdev_direct_write()
310 off -= vol->usable_leb_size; in vol_cdev_direct_write()
313 count -= len; in vol_cdev_direct_write()
320 return err ? err : count_save - count; in vol_cdev_direct_write()
327 struct ubi_volume_desc *desc = file->private_data; in vol_cdev_write()
328 struct ubi_volume *vol = desc->vol; in vol_cdev_write()
329 struct ubi_device *ubi = vol->ubi; in vol_cdev_write() local
331 if (!vol->updating && !vol->changing_leb) in vol_cdev_write()
334 if (vol->updating) in vol_cdev_write()
335 err = ubi_more_update_data(ubi, vol, buf, count); in vol_cdev_write()
337 err = ubi_more_leb_change_data(ubi, vol, buf, count); in vol_cdev_write()
340 ubi_err(ubi, "cannot accept more %zd bytes of data, error %d", in vol_cdev_write()
352 if (vol->changing_leb) { in vol_cdev_write()
361 err = ubi_check_volume(ubi, vol->vol_id); in vol_cdev_write()
366 ubi_warn(ubi, "volume %d on UBI device %d is corrupted", in vol_cdev_write()
367 vol->vol_id, ubi->ubi_num); in vol_cdev_write()
368 vol->corrupted = 1; in vol_cdev_write()
370 vol->checked = 1; in vol_cdev_write()
371 ubi_volume_notify(ubi, vol, UBI_VOLUME_UPDATED); in vol_cdev_write()
382 struct ubi_volume_desc *desc = file->private_data; in vol_cdev_ioctl()
383 struct ubi_volume *vol = desc->vol; in vol_cdev_ioctl()
384 struct ubi_device *ubi = vol->ubi; in vol_cdev_ioctl() local
388 /* Volume update command */ in vol_cdev_ioctl()
394 err = -EPERM; in vol_cdev_ioctl()
400 err = -EFAULT; in vol_cdev_ioctl()
404 if (desc->mode == UBI_READONLY) { in vol_cdev_ioctl()
405 err = -EROFS; in vol_cdev_ioctl()
409 rsvd_bytes = (long long)vol->reserved_pebs * in vol_cdev_ioctl()
410 vol->usable_leb_size; in vol_cdev_ioctl()
412 err = -EINVAL; in vol_cdev_ioctl()
420 err = ubi_start_update(ubi, vol, bytes); in vol_cdev_ioctl()
422 ubi_volume_notify(ubi, vol, UBI_VOLUME_UPDATED); in vol_cdev_ioctl()
436 err = -EFAULT; in vol_cdev_ioctl()
440 if (desc->mode == UBI_READONLY || in vol_cdev_ioctl()
441 vol->vol_type == UBI_STATIC_VOLUME) { in vol_cdev_ioctl()
442 err = -EROFS; in vol_cdev_ioctl()
447 err = -EINVAL; in vol_cdev_ioctl()
449 req.bytes < 0 || req.bytes > vol->usable_leb_size) in vol_cdev_ioctl()
456 err = ubi_start_leb_change(ubi, vol, &req); in vol_cdev_ioctl()
469 err = -EFAULT; in vol_cdev_ioctl()
473 if (desc->mode == UBI_READONLY || in vol_cdev_ioctl()
474 vol->vol_type == UBI_STATIC_VOLUME) { in vol_cdev_ioctl()
475 err = -EROFS; in vol_cdev_ioctl()
480 err = -EINVAL; in vol_cdev_ioctl()
484 dbg_gen("erase LEB %d:%d", vol->vol_id, lnum); in vol_cdev_ioctl()
485 err = ubi_eba_unmap_leb(ubi, vol, lnum); in vol_cdev_ioctl()
489 err = ubi_wl_flush(ubi, UBI_ALL, UBI_ALL); in vol_cdev_ioctl()
500 err = -EFAULT; in vol_cdev_ioctl()
507 /* Logical eraseblock un-map command */ in vol_cdev_ioctl()
514 err = -EFAULT; in vol_cdev_ioctl()
528 err = -EFAULT; in vol_cdev_ioctl()
535 /* Set volume property command */ in vol_cdev_ioctl()
543 err = -EFAULT; in vol_cdev_ioctl()
548 mutex_lock(&ubi->device_mutex); in vol_cdev_ioctl()
549 desc->vol->direct_writes = !!req.value; in vol_cdev_ioctl()
550 mutex_unlock(&ubi->device_mutex); in vol_cdev_ioctl()
553 err = -EINVAL; in vol_cdev_ioctl()
559 /* Create a R/O block device on top of the UBI volume */ in vol_cdev_ioctl()
580 err = -ENOTTY; in vol_cdev_ioctl()
587 * verify_mkvol_req - verify volume creation request.
588 * @ubi: UBI device description object
591 * This function zero if the request is correct, and %-EINVAL if not.
593 static int verify_mkvol_req(const struct ubi_device *ubi, in verify_mkvol_req() argument
596 int n, err = -EINVAL; in verify_mkvol_req()
598 if (req->bytes < 0 || req->alignment < 0 || req->vol_type < 0 || in verify_mkvol_req()
599 req->name_len < 0) in verify_mkvol_req()
602 if ((req->vol_id < 0 || req->vol_id >= ubi->vtbl_slots) && in verify_mkvol_req()
603 req->vol_id != UBI_VOL_NUM_AUTO) in verify_mkvol_req()
606 if (req->alignment == 0) in verify_mkvol_req()
609 if (req->bytes == 0) in verify_mkvol_req()
612 if (req->vol_type != UBI_DYNAMIC_VOLUME && in verify_mkvol_req()
613 req->vol_type != UBI_STATIC_VOLUME) in verify_mkvol_req()
616 if (req->flags & ~UBI_VOL_VALID_FLGS) in verify_mkvol_req()
619 if (req->flags & UBI_VOL_SKIP_CRC_CHECK_FLG && in verify_mkvol_req()
620 req->vol_type != UBI_STATIC_VOLUME) in verify_mkvol_req()
623 if (req->alignment > ubi->leb_size) in verify_mkvol_req()
626 n = req->alignment & (ubi->min_io_size - 1); in verify_mkvol_req()
627 if (req->alignment != 1 && n) in verify_mkvol_req()
630 if (!req->name[0] || !req->name_len) in verify_mkvol_req()
633 if (req->name_len > UBI_VOL_NAME_MAX) { in verify_mkvol_req()
634 err = -ENAMETOOLONG; in verify_mkvol_req()
638 n = strnlen(req->name, req->name_len + 1); in verify_mkvol_req()
639 if (n != req->name_len) in verify_mkvol_req()
645 ubi_err(ubi, "bad volume creation request"); in verify_mkvol_req()
651 * verify_rsvol_req - verify volume re-size request.
652 * @ubi: UBI device description object
655 * This function returns zero if the request is correct, and %-EINVAL if not.
657 static int verify_rsvol_req(const struct ubi_device *ubi, in verify_rsvol_req() argument
660 if (req->bytes <= 0) in verify_rsvol_req()
661 return -EINVAL; in verify_rsvol_req()
663 if (req->vol_id < 0 || req->vol_id >= ubi->vtbl_slots) in verify_rsvol_req()
664 return -EINVAL; in verify_rsvol_req()
670 * rename_volumes - rename UBI volumes.
671 * @ubi: UBI device description object
672 * @req: volumes re-name request
674 * This is a helper function for the volume re-name IOCTL which validates the
675 * request, opens the volume and calls corresponding volumes management
679 static int rename_volumes(struct ubi_device *ubi, in rename_volumes() argument
686 if (req->count < 0 || req->count > UBI_MAX_RNVOL) in rename_volumes()
687 return -EINVAL; in rename_volumes()
689 if (req->count == 0) in rename_volumes()
692 /* Validate volume IDs and names in the request */ in rename_volumes()
693 for (i = 0; i < req->count; i++) { in rename_volumes()
694 if (req->ents[i].vol_id < 0 || in rename_volumes()
695 req->ents[i].vol_id >= ubi->vtbl_slots) in rename_volumes()
696 return -EINVAL; in rename_volumes()
697 if (req->ents[i].name_len < 0) in rename_volumes()
698 return -EINVAL; in rename_volumes()
699 if (req->ents[i].name_len > UBI_VOL_NAME_MAX) in rename_volumes()
700 return -ENAMETOOLONG; in rename_volumes()
701 req->ents[i].name[req->ents[i].name_len] = '\0'; in rename_volumes()
702 n = strlen(req->ents[i].name); in rename_volumes()
703 if (n != req->ents[i].name_len) in rename_volumes()
704 return -EINVAL; in rename_volumes()
707 /* Make sure volume IDs and names are unique */ in rename_volumes()
708 for (i = 0; i < req->count - 1; i++) { in rename_volumes()
709 for (n = i + 1; n < req->count; n++) { in rename_volumes()
710 if (req->ents[i].vol_id == req->ents[n].vol_id) { in rename_volumes()
711 ubi_err(ubi, "duplicated volume id %d", in rename_volumes()
712 req->ents[i].vol_id); in rename_volumes()
713 return -EINVAL; in rename_volumes()
715 if (!strcmp(req->ents[i].name, req->ents[n].name)) { in rename_volumes()
716 ubi_err(ubi, "duplicated volume name \"%s\"", in rename_volumes()
717 req->ents[i].name); in rename_volumes()
718 return -EINVAL; in rename_volumes()
723 /* Create the re-name list */ in rename_volumes()
725 for (i = 0; i < req->count; i++) { in rename_volumes()
726 int vol_id = req->ents[i].vol_id; in rename_volumes()
727 int name_len = req->ents[i].name_len; in rename_volumes()
728 const char *name = req->ents[i].name; in rename_volumes()
732 err = -ENOMEM; in rename_volumes()
736 re->desc = ubi_open_volume(ubi->ubi_num, vol_id, UBI_METAONLY); in rename_volumes()
737 if (IS_ERR(re->desc)) { in rename_volumes()
738 err = PTR_ERR(re->desc); in rename_volumes()
739 ubi_err(ubi, "cannot open volume %d, error %d", in rename_volumes()
745 /* Skip this re-naming if the name does not really change */ in rename_volumes()
746 if (re->desc->vol->name_len == name_len && in rename_volumes()
747 !memcmp(re->desc->vol->name, name, name_len)) { in rename_volumes()
748 ubi_close_volume(re->desc); in rename_volumes()
753 re->new_name_len = name_len; in rename_volumes()
754 memcpy(re->new_name, name, name_len); in rename_volumes()
755 list_add_tail(&re->list, &rename_list); in rename_volumes()
756 dbg_gen("will rename volume %d from \"%s\" to \"%s\"", in rename_volumes()
757 vol_id, re->desc->vol->name, name); in rename_volumes()
769 * Volume @re->vol_id is going to be re-named to in rename_volumes()
770 * @re->new_name, while its current name is @name. If a volume in rename_volumes()
771 * with name @re->new_name currently exists, it has to be in rename_volumes()
772 * removed, unless it is also re-named in the request (@req). in rename_volumes()
775 if (re->new_name_len == re1->desc->vol->name_len && in rename_volumes()
776 !memcmp(re->new_name, re1->desc->vol->name, in rename_volumes()
777 re1->desc->vol->name_len)) { in rename_volumes()
787 * It seems we need to remove volume with name @re->new_name, in rename_volumes()
790 desc = ubi_open_volume_nm(ubi->ubi_num, re->new_name, in rename_volumes()
794 if (err == -ENODEV) in rename_volumes()
795 /* Re-naming into a non-existing volume name */ in rename_volumes()
798 /* The volume exists but busy, or an error occurred */ in rename_volumes()
799 ubi_err(ubi, "cannot open volume \"%s\", error %d", in rename_volumes()
800 re->new_name, err); in rename_volumes()
806 err = -ENOMEM; in rename_volumes()
811 re1->remove = 1; in rename_volumes()
812 re1->desc = desc; in rename_volumes()
813 list_add(&re1->list, &rename_list); in rename_volumes()
814 dbg_gen("will remove volume %d, name \"%s\"", in rename_volumes()
815 re1->desc->vol->vol_id, re1->desc->vol->name); in rename_volumes()
818 mutex_lock(&ubi->device_mutex); in rename_volumes()
819 err = ubi_rename_volumes(ubi, &rename_list); in rename_volumes()
820 mutex_unlock(&ubi->device_mutex); in rename_volumes()
824 ubi_close_volume(re->desc); in rename_volumes()
825 list_del(&re->list); in rename_volumes()
835 struct ubi_device *ubi; in ubi_cdev_ioctl() local
840 return -EPERM; in ubi_cdev_ioctl()
842 ubi = ubi_get_by_major(imajor(file->f_mapping->host)); in ubi_cdev_ioctl()
843 if (!ubi) in ubi_cdev_ioctl()
844 return -ENODEV; in ubi_cdev_ioctl()
847 /* Create volume command */ in ubi_cdev_ioctl()
852 dbg_gen("create volume"); in ubi_cdev_ioctl()
855 err = -EFAULT; in ubi_cdev_ioctl()
859 err = verify_mkvol_req(ubi, &req); in ubi_cdev_ioctl()
863 mutex_lock(&ubi->device_mutex); in ubi_cdev_ioctl()
864 err = ubi_create_volume(ubi, &req); in ubi_cdev_ioctl()
865 mutex_unlock(&ubi->device_mutex); in ubi_cdev_ioctl()
871 err = -EFAULT; in ubi_cdev_ioctl()
876 /* Remove volume command */ in ubi_cdev_ioctl()
881 dbg_gen("remove volume"); in ubi_cdev_ioctl()
884 err = -EFAULT; in ubi_cdev_ioctl()
888 desc = ubi_open_volume(ubi->ubi_num, vol_id, UBI_EXCLUSIVE); in ubi_cdev_ioctl()
894 mutex_lock(&ubi->device_mutex); in ubi_cdev_ioctl()
896 mutex_unlock(&ubi->device_mutex); in ubi_cdev_ioctl()
899 * The volume is deleted (unless an error occurred), and the in ubi_cdev_ioctl()
907 /* Re-size volume command */ in ubi_cdev_ioctl()
913 dbg_gen("re-size volume"); in ubi_cdev_ioctl()
916 err = -EFAULT; in ubi_cdev_ioctl()
920 err = verify_rsvol_req(ubi, &req); in ubi_cdev_ioctl()
924 desc = ubi_open_volume(ubi->ubi_num, req.vol_id, UBI_EXCLUSIVE); in ubi_cdev_ioctl()
930 pebs = div_u64(req.bytes + desc->vol->usable_leb_size - 1, in ubi_cdev_ioctl()
931 desc->vol->usable_leb_size); in ubi_cdev_ioctl()
933 mutex_lock(&ubi->device_mutex); in ubi_cdev_ioctl()
935 mutex_unlock(&ubi->device_mutex); in ubi_cdev_ioctl()
940 /* Re-name volumes command */ in ubi_cdev_ioctl()
945 dbg_gen("re-name volumes"); in ubi_cdev_ioctl()
948 err = -ENOMEM; in ubi_cdev_ioctl()
954 err = -EFAULT; in ubi_cdev_ioctl()
959 err = rename_volumes(ubi, req); in ubi_cdev_ioctl()
971 err = -EFAULT; in ubi_cdev_ioctl()
975 err = ubi_bitflip_check(ubi, pnum, 0); in ubi_cdev_ioctl()
986 err = -EFAULT; in ubi_cdev_ioctl()
990 err = ubi_bitflip_check(ubi, pnum, 1); in ubi_cdev_ioctl()
995 err = -ENOTTY; in ubi_cdev_ioctl()
999 ubi_put_device(ubi); in ubi_cdev_ioctl()
1010 return -EPERM; in ctrl_cdev_ioctl()
1022 err = -EFAULT; in ctrl_cdev_ioctl()
1028 err = -EINVAL; in ctrl_cdev_ioctl()
1050 /* @err contains UBI device number */ in ctrl_cdev_ioctl()
1064 err = -EFAULT; in ctrl_cdev_ioctl()
1075 err = -ENOTTY; in ctrl_cdev_ioctl()
1082 /* UBI volume character device operations */
1095 /* UBI character device operations */
1102 /* UBI control character device operations */