Lines Matching refs:desc

44 static int get_exclusive(struct ubi_volume_desc *desc)  in get_exclusive()  argument
47 struct ubi_volume *vol = desc->vol; in get_exclusive()
58 err = desc->mode; in get_exclusive()
59 desc->mode = UBI_EXCLUSIVE; in get_exclusive()
71 static void revoke_exclusive(struct ubi_volume_desc *desc, int mode) in revoke_exclusive() argument
73 struct ubi_volume *vol = desc->vol; in revoke_exclusive()
77 ubi_assert(vol->exclusive == 1 && desc->mode == UBI_EXCLUSIVE); in revoke_exclusive()
89 desc->mode = mode; in revoke_exclusive()
94 struct ubi_volume_desc *desc; in vol_cdev_open() local
109 desc = ubi_open_volume(ubi_num, vol_id, mode); in vol_cdev_open()
110 if (IS_ERR(desc)) in vol_cdev_open()
111 return PTR_ERR(desc); 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() local
120 struct ubi_volume *vol = desc->vol; in vol_cdev_release()
123 vol->ubi->ubi_num, vol->vol_id, desc->mode); in vol_cdev_release()
139 ubi_close_volume(desc); in vol_cdev_release()
145 struct ubi_volume_desc *desc = file->private_data; in vol_cdev_llseek() local
146 struct ubi_volume *vol = desc->vol; in vol_cdev_llseek()
160 struct ubi_volume_desc *desc = file->private_data; in vol_cdev_fsync() local
161 struct ubi_device *ubi = desc->vol->ubi; in vol_cdev_fsync()
174 struct ubi_volume_desc *desc = file->private_data; in vol_cdev_read() local
175 struct ubi_volume *vol = desc->vol; in vol_cdev_read()
251 struct ubi_volume_desc *desc = file->private_data; in vol_cdev_direct_write() local
252 struct ubi_volume *vol = desc->vol; in vol_cdev_direct_write()
327 struct ubi_volume_desc *desc = file->private_data; in vol_cdev_write() local
328 struct ubi_volume *vol = desc->vol; in vol_cdev_write()
353 revoke_exclusive(desc, UBI_READWRITE); in vol_cdev_write()
372 revoke_exclusive(desc, UBI_READWRITE); in vol_cdev_write()
382 struct ubi_volume_desc *desc = file->private_data; in vol_cdev_ioctl() local
383 struct ubi_volume *vol = desc->vol; in vol_cdev_ioctl()
404 if (desc->mode == UBI_READONLY) { in vol_cdev_ioctl()
416 err = get_exclusive(desc); in vol_cdev_ioctl()
423 revoke_exclusive(desc, UBI_READWRITE); in vol_cdev_ioctl()
440 if (desc->mode == UBI_READONLY || in vol_cdev_ioctl()
452 err = get_exclusive(desc); in vol_cdev_ioctl()
458 revoke_exclusive(desc, UBI_READWRITE); in vol_cdev_ioctl()
473 if (desc->mode == UBI_READONLY || in vol_cdev_ioctl()
503 err = ubi_leb_map(desc, req.lnum); in vol_cdev_ioctl()
517 err = ubi_leb_unmap(desc, lnum); in vol_cdev_ioctl()
531 err = ubi_is_mapped(desc, lnum); in vol_cdev_ioctl()
549 desc->vol->direct_writes = !!req.value; in vol_cdev_ioctl()
564 ubi_get_volume_info(desc, &vi); in vol_cdev_ioctl()
574 ubi_get_volume_info(desc, &vi); in vol_cdev_ioctl()
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()
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()
757 vol_id, re->desc->vol->name, name); in rename_volumes()
765 struct ubi_volume_desc *desc; in rename_volumes() local
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()
790 desc = ubi_open_volume_nm(ubi->ubi_num, re->new_name, in rename_volumes()
792 if (IS_ERR(desc)) { in rename_volumes()
793 err = PTR_ERR(desc); in rename_volumes()
807 ubi_close_volume(desc); in rename_volumes()
812 re1->desc = desc; in rename_volumes()
815 re1->desc->vol->vol_id, re1->desc->vol->name); in rename_volumes()
824 ubi_close_volume(re->desc); in rename_volumes()
836 struct ubi_volume_desc *desc; in ubi_cdev_ioctl() local
888 desc = ubi_open_volume(ubi->ubi_num, vol_id, UBI_EXCLUSIVE); in ubi_cdev_ioctl()
889 if (IS_ERR(desc)) { in ubi_cdev_ioctl()
890 err = PTR_ERR(desc); in ubi_cdev_ioctl()
895 err = ubi_remove_volume(desc, 0); in ubi_cdev_ioctl()
903 ubi_close_volume(desc); in ubi_cdev_ioctl()
924 desc = ubi_open_volume(ubi->ubi_num, req.vol_id, UBI_EXCLUSIVE); in ubi_cdev_ioctl()
925 if (IS_ERR(desc)) { in ubi_cdev_ioctl()
926 err = PTR_ERR(desc); 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()
934 err = ubi_resize_volume(desc, pebs); in ubi_cdev_ioctl()
936 ubi_close_volume(desc); in ubi_cdev_ioctl()