Searched refs:vol (Results 1 - 200 of 208) sorted by relevance

12

/linux-4.1.27/drivers/mtd/ubi/
H A Dupd.c49 * @vol: volume description object
51 * This function sets the update marker flag for volume @vol. Returns zero
54 static int set_update_marker(struct ubi_device *ubi, struct ubi_volume *vol) set_update_marker() argument
59 dbg_gen("set update marker for volume %d", vol->vol_id); set_update_marker()
61 if (vol->upd_marker) { set_update_marker()
62 ubi_assert(ubi->vtbl[vol->vol_id].upd_marker); set_update_marker()
67 vtbl_rec = ubi->vtbl[vol->vol_id]; set_update_marker()
71 err = ubi_change_vtbl_record(ubi, vol->vol_id, &vtbl_rec); set_update_marker()
72 vol->upd_marker = 1; set_update_marker()
80 * @vol: volume description object
83 * This function clears the update marker for volume @vol, sets new volume
87 static int clear_update_marker(struct ubi_device *ubi, struct ubi_volume *vol, clear_update_marker() argument
93 dbg_gen("clear update marker for volume %d", vol->vol_id); clear_update_marker()
95 vtbl_rec = ubi->vtbl[vol->vol_id]; clear_update_marker()
96 ubi_assert(vol->upd_marker && vtbl_rec.upd_marker); clear_update_marker()
99 if (vol->vol_type == UBI_STATIC_VOLUME) { clear_update_marker()
100 vol->corrupted = 0; clear_update_marker()
101 vol->used_bytes = bytes; clear_update_marker()
102 vol->used_ebs = div_u64_rem(bytes, vol->usable_leb_size, clear_update_marker()
103 &vol->last_eb_bytes); clear_update_marker()
104 if (vol->last_eb_bytes) clear_update_marker()
105 vol->used_ebs += 1; clear_update_marker()
107 vol->last_eb_bytes = vol->usable_leb_size; clear_update_marker()
111 err = ubi_change_vtbl_record(ubi, vol->vol_id, &vtbl_rec); clear_update_marker()
112 vol->upd_marker = 0; clear_update_marker()
120 * @vol: volume description object
127 int ubi_start_update(struct ubi_device *ubi, struct ubi_volume *vol, ubi_start_update() argument
132 dbg_gen("start update of volume %d, %llu bytes", vol->vol_id, bytes); ubi_start_update()
133 ubi_assert(!vol->updating && !vol->changing_leb); ubi_start_update()
134 vol->updating = 1; ubi_start_update()
136 vol->upd_buf = vmalloc(ubi->leb_size); ubi_start_update()
137 if (!vol->upd_buf) ubi_start_update()
140 err = set_update_marker(ubi, vol); ubi_start_update()
145 for (i = 0; i < vol->reserved_pebs; i++) { ubi_start_update()
146 err = ubi_eba_unmap_leb(ubi, vol, i); ubi_start_update()
156 err = clear_update_marker(ubi, vol, 0); ubi_start_update()
160 vfree(vol->upd_buf); ubi_start_update()
161 vol->updating = 0; ubi_start_update()
165 vol->upd_ebs = div_u64(bytes + vol->usable_leb_size - 1, ubi_start_update()
166 vol->usable_leb_size); ubi_start_update()
167 vol->upd_bytes = bytes; ubi_start_update()
168 vol->upd_received = 0; ubi_start_update()
175 * @vol: volume description object
181 int ubi_start_leb_change(struct ubi_device *ubi, struct ubi_volume *vol, ubi_start_leb_change() argument
184 ubi_assert(!vol->updating && !vol->changing_leb); ubi_start_leb_change()
187 vol->vol_id, req->lnum, req->bytes); ubi_start_leb_change()
189 return ubi_eba_atomic_leb_change(ubi, vol, req->lnum, NULL, 0); ubi_start_leb_change()
191 vol->upd_bytes = req->bytes; ubi_start_leb_change()
192 vol->upd_received = 0; ubi_start_leb_change()
193 vol->changing_leb = 1; ubi_start_leb_change()
194 vol->ch_lnum = req->lnum; ubi_start_leb_change()
196 vol->upd_buf = vmalloc(ALIGN((int)req->bytes, ubi->min_io_size)); ubi_start_leb_change()
197 if (!vol->upd_buf) ubi_start_leb_change()
206 * @vol: volume description object
232 static int write_leb(struct ubi_device *ubi, struct ubi_volume *vol, int lnum, write_leb() argument
237 if (vol->vol_type == UBI_DYNAMIC_VOLUME) { write_leb()
247 err = ubi_eba_write_leb(ubi, vol, lnum, buf, 0, len); write_leb()
258 memset(buf + len, 0, vol->usable_leb_size - len); write_leb()
259 err = ubi_eba_write_leb_st(ubi, vol, lnum, buf, len, used_ebs); write_leb()
268 * @vol: volume description object
278 int ubi_more_update_data(struct ubi_device *ubi, struct ubi_volume *vol, ubi_more_update_data() argument
284 count, vol->upd_bytes, vol->upd_received); ubi_more_update_data()
289 lnum = div_u64_rem(vol->upd_received, vol->usable_leb_size, &offs); ubi_more_update_data()
290 if (vol->upd_received + count > vol->upd_bytes) ubi_more_update_data()
291 to_write = count = vol->upd_bytes - vol->upd_received; ubi_more_update_data()
305 len = vol->usable_leb_size - offs; ubi_more_update_data()
309 err = copy_from_user(vol->upd_buf + offs, buf, len); ubi_more_update_data()
313 if (offs + len == vol->usable_leb_size || ubi_more_update_data()
314 vol->upd_received + len == vol->upd_bytes) { ubi_more_update_data()
321 ubi_assert(flush_len <= vol->usable_leb_size); ubi_more_update_data()
322 err = write_leb(ubi, vol, lnum, vol->upd_buf, flush_len, ubi_more_update_data()
323 vol->upd_ebs); ubi_more_update_data()
328 vol->upd_received += len; ubi_more_update_data()
339 if (count > vol->usable_leb_size) ubi_more_update_data()
340 len = vol->usable_leb_size; ubi_more_update_data()
344 err = copy_from_user(vol->upd_buf, buf, len); ubi_more_update_data()
348 if (len == vol->usable_leb_size || ubi_more_update_data()
349 vol->upd_received + len == vol->upd_bytes) { ubi_more_update_data()
350 err = write_leb(ubi, vol, lnum, vol->upd_buf, ubi_more_update_data()
351 len, vol->upd_ebs); ubi_more_update_data()
356 vol->upd_received += len; ubi_more_update_data()
362 ubi_assert(vol->upd_received <= vol->upd_bytes); ubi_more_update_data()
363 if (vol->upd_received == vol->upd_bytes) { ubi_more_update_data()
368 err = clear_update_marker(ubi, vol, vol->upd_bytes); ubi_more_update_data()
371 vol->updating = 0; ubi_more_update_data()
373 vfree(vol->upd_buf); ubi_more_update_data()
382 * @vol: volume description object
393 int ubi_more_leb_change_data(struct ubi_device *ubi, struct ubi_volume *vol, ubi_more_leb_change_data() argument
399 count, vol->upd_bytes, vol->upd_received); ubi_more_leb_change_data()
404 if (vol->upd_received + count > vol->upd_bytes) ubi_more_leb_change_data()
405 count = vol->upd_bytes - vol->upd_received; ubi_more_leb_change_data()
407 err = copy_from_user(vol->upd_buf + vol->upd_received, buf, count); ubi_more_leb_change_data()
411 vol->upd_received += count; ubi_more_leb_change_data()
413 if (vol->upd_received == vol->upd_bytes) { ubi_more_leb_change_data()
414 int len = ALIGN((int)vol->upd_bytes, ubi->min_io_size); ubi_more_leb_change_data()
416 memset(vol->upd_buf + vol->upd_bytes, 0xFF, ubi_more_leb_change_data()
417 len - vol->upd_bytes); ubi_more_leb_change_data()
418 len = ubi_calc_data_len(ubi, vol->upd_buf, len); ubi_more_leb_change_data()
419 err = ubi_eba_atomic_leb_change(ubi, vol, vol->ch_lnum, ubi_more_leb_change_data()
420 vol->upd_buf, len); ubi_more_leb_change_data()
425 ubi_assert(vol->upd_received <= vol->upd_bytes); ubi_more_leb_change_data()
426 if (vol->upd_received == vol->upd_bytes) { ubi_more_leb_change_data()
427 vol->changing_leb = 0; ubi_more_leb_change_data()
429 vfree(vol->upd_buf); ubi_more_leb_change_data()
H A Dvmt.c71 struct ubi_volume *vol = container_of(dev, struct ubi_volume, dev); vol_attribute_show() local
74 ubi = ubi_get_device(vol->ubi->ubi_num); vol_attribute_show()
79 if (!ubi->volumes[vol->vol_id]) { vol_attribute_show()
85 vol->ref_count += 1; vol_attribute_show()
89 ret = sprintf(buf, "%d\n", vol->reserved_pebs); vol_attribute_show()
93 if (vol->vol_type == UBI_DYNAMIC_VOLUME) vol_attribute_show()
99 ret = sprintf(buf, "%s\n", vol->name); vol_attribute_show()
101 ret = sprintf(buf, "%d\n", vol->corrupted); vol_attribute_show()
103 ret = sprintf(buf, "%d\n", vol->alignment); vol_attribute_show()
105 ret = sprintf(buf, "%d\n", vol->usable_leb_size); vol_attribute_show()
107 ret = sprintf(buf, "%lld\n", vol->used_bytes); vol_attribute_show()
109 ret = sprintf(buf, "%d\n", vol->upd_marker); vol_attribute_show()
116 vol->ref_count -= 1; vol_attribute_show()
117 ubi_assert(vol->ref_count >= 0); vol_attribute_show()
126 struct ubi_volume *vol = container_of(dev, struct ubi_volume, dev); vol_release() local
128 kfree(vol->eba_tbl); vol_release()
129 kfree(vol); vol_release()
135 * @vol: volume description object
144 static int volume_sysfs_init(struct ubi_device *ubi, struct ubi_volume *vol) volume_sysfs_init() argument
148 err = device_create_file(&vol->dev, &attr_vol_reserved_ebs); volume_sysfs_init()
151 err = device_create_file(&vol->dev, &attr_vol_type); volume_sysfs_init()
154 err = device_create_file(&vol->dev, &attr_vol_name); volume_sysfs_init()
157 err = device_create_file(&vol->dev, &attr_vol_corrupted); volume_sysfs_init()
160 err = device_create_file(&vol->dev, &attr_vol_alignment); volume_sysfs_init()
163 err = device_create_file(&vol->dev, &attr_vol_usable_eb_size); volume_sysfs_init()
166 err = device_create_file(&vol->dev, &attr_vol_data_bytes); volume_sysfs_init()
169 err = device_create_file(&vol->dev, &attr_vol_upd_marker); volume_sysfs_init()
175 * @vol: volume description object
177 static void volume_sysfs_close(struct ubi_volume *vol) volume_sysfs_close() argument
179 device_remove_file(&vol->dev, &attr_vol_upd_marker); volume_sysfs_close()
180 device_remove_file(&vol->dev, &attr_vol_data_bytes); volume_sysfs_close()
181 device_remove_file(&vol->dev, &attr_vol_usable_eb_size); volume_sysfs_close()
182 device_remove_file(&vol->dev, &attr_vol_alignment); volume_sysfs_close()
183 device_remove_file(&vol->dev, &attr_vol_corrupted); volume_sysfs_close()
184 device_remove_file(&vol->dev, &attr_vol_name); volume_sysfs_close()
185 device_remove_file(&vol->dev, &attr_vol_type); volume_sysfs_close()
186 device_remove_file(&vol->dev, &attr_vol_reserved_ebs); volume_sysfs_close()
187 device_unregister(&vol->dev); volume_sysfs_close()
204 struct ubi_volume *vol; ubi_create_volume() local
211 vol = kzalloc(sizeof(struct ubi_volume), GFP_KERNEL); ubi_create_volume()
212 if (!vol) ubi_create_volume()
255 vol->usable_leb_size = ubi->leb_size - ubi->leb_size % req->alignment; ubi_create_volume()
256 vol->reserved_pebs += div_u64(req->bytes + vol->usable_leb_size - 1, ubi_create_volume()
257 vol->usable_leb_size); ubi_create_volume()
260 if (vol->reserved_pebs > ubi->avail_pebs) { ubi_create_volume()
269 ubi->avail_pebs -= vol->reserved_pebs; ubi_create_volume()
270 ubi->rsvd_pebs += vol->reserved_pebs; ubi_create_volume()
273 vol->vol_id = vol_id; ubi_create_volume()
274 vol->alignment = req->alignment; ubi_create_volume()
275 vol->data_pad = ubi->leb_size % vol->alignment; ubi_create_volume()
276 vol->vol_type = req->vol_type; ubi_create_volume()
277 vol->name_len = req->name_len; ubi_create_volume()
278 memcpy(vol->name, req->name, vol->name_len); ubi_create_volume()
279 vol->ubi = ubi; ubi_create_volume()
289 vol->eba_tbl = kmalloc(vol->reserved_pebs * sizeof(int), GFP_KERNEL); ubi_create_volume()
290 if (!vol->eba_tbl) { ubi_create_volume()
295 for (i = 0; i < vol->reserved_pebs; i++) ubi_create_volume()
296 vol->eba_tbl[i] = UBI_LEB_UNMAPPED; ubi_create_volume()
298 if (vol->vol_type == UBI_DYNAMIC_VOLUME) { ubi_create_volume()
299 vol->used_ebs = vol->reserved_pebs; ubi_create_volume()
300 vol->last_eb_bytes = vol->usable_leb_size; ubi_create_volume()
301 vol->used_bytes = ubi_create_volume()
302 (long long)vol->used_ebs * vol->usable_leb_size; ubi_create_volume()
304 vol->used_ebs = div_u64_rem(vol->used_bytes, ubi_create_volume()
305 vol->usable_leb_size, ubi_create_volume()
306 &vol->last_eb_bytes); ubi_create_volume()
307 if (vol->last_eb_bytes != 0) ubi_create_volume()
308 vol->used_ebs += 1; ubi_create_volume()
310 vol->last_eb_bytes = vol->usable_leb_size; ubi_create_volume()
314 cdev_init(&vol->cdev, &ubi_vol_cdev_operations); ubi_create_volume()
315 vol->cdev.owner = THIS_MODULE; ubi_create_volume()
317 err = cdev_add(&vol->cdev, dev, 1); ubi_create_volume()
323 vol->dev.release = vol_release; ubi_create_volume()
324 vol->dev.parent = &ubi->dev; ubi_create_volume()
325 vol->dev.devt = dev; ubi_create_volume()
326 vol->dev.class = ubi_class; ubi_create_volume()
328 dev_set_name(&vol->dev, "%s_%d", ubi->ubi_name, vol->vol_id); ubi_create_volume()
329 err = device_register(&vol->dev); ubi_create_volume()
335 err = volume_sysfs_init(ubi, vol); ubi_create_volume()
341 vtbl_rec.reserved_pebs = cpu_to_be32(vol->reserved_pebs); ubi_create_volume()
342 vtbl_rec.alignment = cpu_to_be32(vol->alignment); ubi_create_volume()
343 vtbl_rec.data_pad = cpu_to_be32(vol->data_pad); ubi_create_volume()
344 vtbl_rec.name_len = cpu_to_be16(vol->name_len); ubi_create_volume()
345 if (vol->vol_type == UBI_DYNAMIC_VOLUME) ubi_create_volume()
349 memcpy(vtbl_rec.name, vol->name, vol->name_len); ubi_create_volume()
356 ubi->volumes[vol_id] = vol; ubi_create_volume()
360 ubi_volume_notify(ubi, vol, UBI_VOLUME_ADDED); ubi_create_volume()
374 get_device(&vol->dev); ubi_create_volume()
375 volume_sysfs_close(vol); ubi_create_volume()
377 cdev_del(&vol->cdev); ubi_create_volume()
380 kfree(vol->eba_tbl); ubi_create_volume()
383 ubi->rsvd_pebs -= vol->reserved_pebs; ubi_create_volume()
384 ubi->avail_pebs += vol->reserved_pebs; ubi_create_volume()
388 kfree(vol); ubi_create_volume()
390 put_device(&vol->dev); ubi_create_volume()
407 struct ubi_volume *vol = desc->vol; ubi_remove_volume() local
408 struct ubi_device *ubi = vol->ubi; ubi_remove_volume()
409 int i, err, vol_id = vol->vol_id, reserved_pebs = vol->reserved_pebs; ubi_remove_volume()
413 ubi_assert(vol == ubi->volumes[vol_id]); ubi_remove_volume()
419 if (vol->ref_count > 1) { ubi_remove_volume()
436 for (i = 0; i < vol->reserved_pebs; i++) { ubi_remove_volume()
437 err = ubi_eba_unmap_leb(ubi, vol, i); ubi_remove_volume()
442 cdev_del(&vol->cdev); ubi_remove_volume()
443 volume_sysfs_close(vol); ubi_remove_volume()
452 ubi_volume_notify(ubi, vol, UBI_VOLUME_REMOVED); ubi_remove_volume()
461 ubi->volumes[vol_id] = vol; ubi_remove_volume()
479 struct ubi_volume *vol = desc->vol; ubi_resize_volume() local
480 struct ubi_device *ubi = vol->ubi; ubi_resize_volume()
482 int vol_id = vol->vol_id; ubi_resize_volume()
488 ubi->ubi_num, vol_id, vol->reserved_pebs, reserved_pebs); ubi_resize_volume()
490 if (vol->vol_type == UBI_STATIC_VOLUME && ubi_resize_volume()
491 reserved_pebs < vol->used_ebs) { ubi_resize_volume()
493 reserved_pebs, vol->used_ebs); ubi_resize_volume()
498 if (reserved_pebs == vol->reserved_pebs) ubi_resize_volume()
509 if (vol->ref_count > 1) { ubi_resize_volume()
517 pebs = reserved_pebs - vol->reserved_pebs; ubi_resize_volume()
532 for (i = 0; i < vol->reserved_pebs; i++) ubi_resize_volume()
533 new_mapping[i] = vol->eba_tbl[i]; ubi_resize_volume()
534 kfree(vol->eba_tbl); ubi_resize_volume()
535 vol->eba_tbl = new_mapping; ubi_resize_volume()
548 err = ubi_eba_unmap_leb(ubi, vol, reserved_pebs + i); ubi_resize_volume()
557 new_mapping[i] = vol->eba_tbl[i]; ubi_resize_volume()
558 kfree(vol->eba_tbl); ubi_resize_volume()
559 vol->eba_tbl = new_mapping; ubi_resize_volume()
563 vol->reserved_pebs = reserved_pebs; ubi_resize_volume()
564 if (vol->vol_type == UBI_DYNAMIC_VOLUME) { ubi_resize_volume()
565 vol->used_ebs = reserved_pebs; ubi_resize_volume()
566 vol->last_eb_bytes = vol->usable_leb_size; ubi_resize_volume()
567 vol->used_bytes = ubi_resize_volume()
568 (long long)vol->used_ebs * vol->usable_leb_size; ubi_resize_volume()
571 ubi_volume_notify(ubi, vol, UBI_VOLUME_RESIZED); ubi_resize_volume()
611 struct ubi_volume *vol = re->desc->vol; list_for_each_entry() local
614 vol->name_len = re->new_name_len; list_for_each_entry()
615 memcpy(vol->name, re->new_name, re->new_name_len + 1); list_for_each_entry()
617 ubi_volume_notify(ubi, vol, UBI_VOLUME_RENAMED); list_for_each_entry()
629 * @vol: volume description object
635 int ubi_add_volume(struct ubi_device *ubi, struct ubi_volume *vol) ubi_add_volume() argument
637 int err, vol_id = vol->vol_id; ubi_add_volume()
643 cdev_init(&vol->cdev, &ubi_vol_cdev_operations); ubi_add_volume()
644 vol->cdev.owner = THIS_MODULE; ubi_add_volume()
645 dev = MKDEV(MAJOR(ubi->cdev.dev), vol->vol_id + 1); ubi_add_volume()
646 err = cdev_add(&vol->cdev, dev, 1); ubi_add_volume()
653 vol->dev.release = vol_release; ubi_add_volume()
654 vol->dev.parent = &ubi->dev; ubi_add_volume()
655 vol->dev.devt = dev; ubi_add_volume()
656 vol->dev.class = ubi_class; ubi_add_volume()
657 dev_set_name(&vol->dev, "%s_%d", ubi->ubi_name, vol->vol_id); ubi_add_volume()
658 err = device_register(&vol->dev); ubi_add_volume()
662 err = volume_sysfs_init(ubi, vol); ubi_add_volume()
664 cdev_del(&vol->cdev); ubi_add_volume()
665 volume_sysfs_close(vol); ubi_add_volume()
673 cdev_del(&vol->cdev); ubi_add_volume()
680 * @vol: volume description object
682 * This function frees all resources for volume @vol but does not remove it.
685 void ubi_free_volume(struct ubi_device *ubi, struct ubi_volume *vol) ubi_free_volume() argument
687 dbg_gen("free volume %d", vol->vol_id); ubi_free_volume()
689 ubi->volumes[vol->vol_id] = NULL; ubi_free_volume()
690 cdev_del(&vol->cdev); ubi_free_volume()
691 volume_sysfs_close(vol); ubi_free_volume()
705 const struct ubi_volume *vol; self_check_volume() local
711 vol = ubi->volumes[idx]; self_check_volume()
713 if (!vol) { self_check_volume()
722 if (vol->reserved_pebs < 0 || vol->alignment < 0 || vol->data_pad < 0 || self_check_volume()
723 vol->name_len < 0) { self_check_volume()
727 if (vol->alignment > ubi->leb_size || vol->alignment == 0) { self_check_volume()
732 n = vol->alignment & (ubi->min_io_size - 1); self_check_volume()
733 if (vol->alignment != 1 && n) { self_check_volume()
738 n = ubi->leb_size % vol->alignment; self_check_volume()
739 if (vol->data_pad != n) { self_check_volume()
744 if (vol->vol_type != UBI_DYNAMIC_VOLUME && self_check_volume()
745 vol->vol_type != UBI_STATIC_VOLUME) { self_check_volume()
750 if (vol->upd_marker && vol->corrupted) { self_check_volume()
755 if (vol->reserved_pebs > ubi->good_peb_count) { self_check_volume()
760 n = ubi->leb_size - vol->data_pad; self_check_volume()
761 if (vol->usable_leb_size != ubi->leb_size - vol->data_pad) { self_check_volume()
766 if (vol->name_len > UBI_VOL_NAME_MAX) { self_check_volume()
772 n = strnlen(vol->name, vol->name_len + 1); self_check_volume()
773 if (n != vol->name_len) { self_check_volume()
778 n = (long long)vol->used_ebs * vol->usable_leb_size; self_check_volume()
779 if (vol->vol_type == UBI_DYNAMIC_VOLUME) { self_check_volume()
780 if (vol->corrupted) { self_check_volume()
784 if (vol->used_ebs != vol->reserved_pebs) { self_check_volume()
788 if (vol->last_eb_bytes != vol->usable_leb_size) { self_check_volume()
792 if (vol->used_bytes != n) { self_check_volume()
797 if (vol->used_ebs < 0 || vol->used_ebs > vol->reserved_pebs) { self_check_volume()
801 if (vol->last_eb_bytes < 0 || self_check_volume()
802 vol->last_eb_bytes > vol->usable_leb_size) { self_check_volume()
806 if (vol->used_bytes < 0 || vol->used_bytes > n || self_check_volume()
807 vol->used_bytes < n - vol->usable_leb_size) { self_check_volume()
823 if (alignment != vol->alignment || data_pad != vol->data_pad || self_check_volume()
824 upd_marker != vol->upd_marker || vol_type != vol->vol_type || self_check_volume()
825 name_len != vol->name_len || strncmp(name, vol->name, name_len)) { self_check_volume()
835 if (vol) self_check_volume()
836 ubi_dump_vol_info(vol); self_check_volume()
H A Dkapi.c77 * @vol: volume description object
80 void ubi_do_get_volume_info(struct ubi_device *ubi, struct ubi_volume *vol, ubi_do_get_volume_info() argument
83 vi->vol_id = vol->vol_id; ubi_do_get_volume_info()
85 vi->size = vol->reserved_pebs; ubi_do_get_volume_info()
86 vi->used_bytes = vol->used_bytes; ubi_do_get_volume_info()
87 vi->vol_type = vol->vol_type; ubi_do_get_volume_info()
88 vi->corrupted = vol->corrupted; ubi_do_get_volume_info()
89 vi->upd_marker = vol->upd_marker; ubi_do_get_volume_info()
90 vi->alignment = vol->alignment; ubi_do_get_volume_info()
91 vi->usable_leb_size = vol->usable_leb_size; ubi_do_get_volume_info()
92 vi->name_len = vol->name_len; ubi_do_get_volume_info()
93 vi->name = vol->name; ubi_do_get_volume_info()
94 vi->cdev = vol->cdev.dev; ubi_do_get_volume_info()
105 ubi_do_get_volume_info(desc->vol->ubi, desc->vol, vi); ubi_get_volume_info()
132 struct ubi_volume *vol; ubi_open_volume() local
166 vol = ubi->volumes[vol_id]; ubi_open_volume()
167 if (!vol) ubi_open_volume()
173 if (vol->exclusive) ubi_open_volume()
175 vol->readers += 1; ubi_open_volume()
179 if (vol->exclusive || vol->writers > 0) ubi_open_volume()
181 vol->writers += 1; ubi_open_volume()
185 if (vol->exclusive || vol->writers || vol->readers || ubi_open_volume()
186 vol->metaonly) ubi_open_volume()
188 vol->exclusive = 1; ubi_open_volume()
192 if (vol->metaonly || vol->exclusive) ubi_open_volume()
194 vol->metaonly = 1; ubi_open_volume()
197 get_device(&vol->dev); ubi_open_volume()
198 vol->ref_count += 1; ubi_open_volume()
201 desc->vol = vol; ubi_open_volume()
205 if (!vol->checked) { ubi_open_volume()
216 vol->corrupted = 1; ubi_open_volume()
218 vol->checked = 1; ubi_open_volume()
271 struct ubi_volume *vol = ubi->volumes[i]; ubi_open_volume_nm() local
273 if (vol && len == vol->name_len && !strcmp(name, vol->name)) { ubi_open_volume_nm()
337 struct ubi_volume *vol = desc->vol; ubi_close_volume() local
338 struct ubi_device *ubi = vol->ubi; ubi_close_volume()
341 ubi->ubi_num, vol->vol_id, desc->mode); ubi_close_volume()
346 vol->readers -= 1; ubi_close_volume()
349 vol->writers -= 1; ubi_close_volume()
352 vol->exclusive = 0; ubi_close_volume()
355 vol->metaonly = 0; ubi_close_volume()
358 vol->ref_count -= 1; ubi_close_volume()
362 put_device(&vol->dev); ubi_close_volume()
381 struct ubi_volume *vol = desc->vol; leb_read_sanity_check() local
382 struct ubi_device *ubi = vol->ubi; leb_read_sanity_check()
383 int vol_id = vol->vol_id; leb_read_sanity_check()
386 lnum >= vol->used_ebs || offset < 0 || len < 0 || leb_read_sanity_check()
387 offset + len > vol->usable_leb_size) leb_read_sanity_check()
390 if (vol->vol_type == UBI_STATIC_VOLUME) { leb_read_sanity_check()
391 if (vol->used_ebs == 0) leb_read_sanity_check()
394 if (lnum == vol->used_ebs - 1 && leb_read_sanity_check()
395 offset + len > vol->last_eb_bytes) leb_read_sanity_check()
399 if (vol->upd_marker) leb_read_sanity_check()
435 struct ubi_volume *vol = desc->vol; ubi_leb_read() local
436 struct ubi_device *ubi = vol->ubi; ubi_leb_read()
437 int err, vol_id = vol->vol_id; ubi_leb_read()
448 err = ubi_eba_read_leb(ubi, vol, lnum, buf, offset, len, check); ubi_leb_read()
449 if (err && mtd_is_eccerr(err) && vol->vol_type == UBI_STATIC_VOLUME) { ubi_leb_read()
451 vol->corrupted = 1; ubi_leb_read()
475 struct ubi_volume *vol = desc->vol; ubi_leb_read_sg() local
476 struct ubi_device *ubi = vol->ubi; ubi_leb_read_sg()
477 int err, vol_id = vol->vol_id; ubi_leb_read_sg()
488 err = ubi_eba_read_leb_sg(ubi, vol, sgl, lnum, offset, len, check); ubi_leb_read_sg()
489 if (err && mtd_is_eccerr(err) && vol->vol_type == UBI_STATIC_VOLUME) { ubi_leb_read_sg()
491 vol->corrupted = 1; ubi_leb_read_sg()
526 struct ubi_volume *vol = desc->vol; ubi_leb_write() local
527 struct ubi_device *ubi = vol->ubi; ubi_leb_write()
528 int vol_id = vol->vol_id; ubi_leb_write()
535 if (desc->mode == UBI_READONLY || vol->vol_type == UBI_STATIC_VOLUME) ubi_leb_write()
538 if (lnum < 0 || lnum >= vol->reserved_pebs || offset < 0 || len < 0 || ubi_leb_write()
539 offset + len > vol->usable_leb_size || ubi_leb_write()
543 if (vol->upd_marker) ubi_leb_write()
549 return ubi_eba_write_leb(ubi, vol, lnum, buf, offset, len); ubi_leb_write()
571 struct ubi_volume *vol = desc->vol; ubi_leb_change() local
572 struct ubi_device *ubi = vol->ubi; ubi_leb_change()
573 int vol_id = vol->vol_id; ubi_leb_change()
580 if (desc->mode == UBI_READONLY || vol->vol_type == UBI_STATIC_VOLUME) ubi_leb_change()
583 if (lnum < 0 || lnum >= vol->reserved_pebs || len < 0 || ubi_leb_change()
584 len > vol->usable_leb_size || len & (ubi->min_io_size - 1)) ubi_leb_change()
587 if (vol->upd_marker) ubi_leb_change()
593 return ubi_eba_atomic_leb_change(ubi, vol, lnum, buf, len); ubi_leb_change()
611 struct ubi_volume *vol = desc->vol; ubi_leb_erase() local
612 struct ubi_device *ubi = vol->ubi; ubi_leb_erase()
615 dbg_gen("erase LEB %d:%d", vol->vol_id, lnum); ubi_leb_erase()
617 if (desc->mode == UBI_READONLY || vol->vol_type == UBI_STATIC_VOLUME) ubi_leb_erase()
620 if (lnum < 0 || lnum >= vol->reserved_pebs) ubi_leb_erase()
623 if (vol->upd_marker) ubi_leb_erase()
626 err = ubi_eba_unmap_leb(ubi, vol, lnum); ubi_leb_erase()
630 return ubi_wl_flush(ubi, vol->vol_id, lnum); ubi_leb_erase()
672 struct ubi_volume *vol = desc->vol; ubi_leb_unmap() local
673 struct ubi_device *ubi = vol->ubi; ubi_leb_unmap()
675 dbg_gen("unmap LEB %d:%d", vol->vol_id, lnum); ubi_leb_unmap()
677 if (desc->mode == UBI_READONLY || vol->vol_type == UBI_STATIC_VOLUME) ubi_leb_unmap()
680 if (lnum < 0 || lnum >= vol->reserved_pebs) ubi_leb_unmap()
683 if (vol->upd_marker) ubi_leb_unmap()
686 return ubi_eba_unmap_leb(ubi, vol, lnum); ubi_leb_unmap()
708 struct ubi_volume *vol = desc->vol; ubi_leb_map() local
709 struct ubi_device *ubi = vol->ubi; ubi_leb_map()
711 dbg_gen("unmap LEB %d:%d", vol->vol_id, lnum); ubi_leb_map()
713 if (desc->mode == UBI_READONLY || vol->vol_type == UBI_STATIC_VOLUME) ubi_leb_map()
716 if (lnum < 0 || lnum >= vol->reserved_pebs) ubi_leb_map()
719 if (vol->upd_marker) ubi_leb_map()
722 if (vol->eba_tbl[lnum] >= 0) ubi_leb_map()
725 return ubi_eba_write_leb(ubi, vol, lnum, NULL, 0, 0); ubi_leb_map()
747 struct ubi_volume *vol = desc->vol; ubi_is_mapped() local
749 dbg_gen("test LEB %d:%d", vol->vol_id, lnum); ubi_is_mapped()
751 if (lnum < 0 || lnum >= vol->reserved_pebs) ubi_is_mapped()
754 if (vol->upd_marker) ubi_is_mapped()
757 return vol->eba_tbl[lnum] >= 0; ubi_is_mapped()
H A Dcdev.c60 struct ubi_volume *vol = desc->vol; get_exclusive() local
62 spin_lock(&vol->ubi->volumes_lock); get_exclusive()
63 users = vol->readers + vol->writers + vol->exclusive + vol->metaonly; get_exclusive()
66 ubi_err(vol->ubi, "%d users for volume %d", users, vol->vol_id); get_exclusive()
69 vol->readers = vol->writers = vol->metaonly = 0; get_exclusive()
70 vol->exclusive = 1; get_exclusive()
74 spin_unlock(&vol->ubi->volumes_lock); get_exclusive()
86 struct ubi_volume *vol = desc->vol; revoke_exclusive() local
88 spin_lock(&vol->ubi->volumes_lock); revoke_exclusive()
89 ubi_assert(vol->readers == 0 && vol->writers == 0 && vol->metaonly == 0); revoke_exclusive()
90 ubi_assert(vol->exclusive == 1 && desc->mode == UBI_EXCLUSIVE); revoke_exclusive()
91 vol->exclusive = 0; revoke_exclusive()
93 vol->readers = 1; revoke_exclusive()
95 vol->writers = 1; revoke_exclusive()
97 vol->metaonly = 1; revoke_exclusive()
99 vol->exclusive = 1; revoke_exclusive()
100 spin_unlock(&vol->ubi->volumes_lock); revoke_exclusive()
133 struct ubi_volume *vol = desc->vol; vol_cdev_release() local
136 vol->ubi->ubi_num, vol->vol_id, desc->mode); vol_cdev_release()
138 if (vol->updating) { vol_cdev_release()
139 ubi_warn(vol->ubi, "update of volume %d not finished, volume is damaged", vol_cdev_release()
140 vol->vol_id); vol_cdev_release()
141 ubi_assert(!vol->changing_leb); vol_cdev_release()
142 vol->updating = 0; vol_cdev_release()
143 vfree(vol->upd_buf); vol_cdev_release()
144 } else if (vol->changing_leb) { vol_cdev_release()
146 vol->upd_received, vol->upd_bytes, vol->ubi->ubi_num, vol_cdev_release()
147 vol->vol_id); vol_cdev_release()
148 vol->changing_leb = 0; vol_cdev_release()
149 vfree(vol->upd_buf); vol_cdev_release()
159 struct ubi_volume *vol = desc->vol; vol_cdev_llseek() local
161 if (vol->updating) { vol_cdev_llseek()
163 ubi_err(vol->ubi, "updating"); vol_cdev_llseek()
167 return fixed_size_llseek(file, offset, origin, vol->used_bytes); vol_cdev_llseek()
174 struct ubi_device *ubi = desc->vol->ubi; vol_cdev_fsync()
188 struct ubi_volume *vol = desc->vol; vol_cdev_read() local
189 struct ubi_device *ubi = vol->ubi; vol_cdev_read()
195 count, *offp, vol->vol_id); vol_cdev_read()
197 if (vol->updating) { vol_cdev_read()
198 ubi_err(vol->ubi, "updating"); vol_cdev_read()
201 if (vol->upd_marker) { vol_cdev_read()
202 ubi_err(vol->ubi, "damaged volume, update marker is set"); vol_cdev_read()
205 if (*offp == vol->used_bytes || count == 0) vol_cdev_read()
208 if (vol->corrupted) vol_cdev_read()
209 dbg_gen("read from corrupted volume %d", vol->vol_id); vol_cdev_read()
211 if (*offp + count > vol->used_bytes) vol_cdev_read()
212 count_save = count = vol->used_bytes - *offp; vol_cdev_read()
214 tbuf_size = vol->usable_leb_size; vol_cdev_read()
222 lnum = div_u64_rem(*offp, vol->usable_leb_size, &off); vol_cdev_read()
227 if (off + len >= vol->usable_leb_size) vol_cdev_read()
228 len = vol->usable_leb_size - off; vol_cdev_read()
230 err = ubi_eba_read_leb(ubi, vol, lnum, tbuf, off, len, 0); vol_cdev_read()
235 if (off == vol->usable_leb_size) { vol_cdev_read()
237 off -= vol->usable_leb_size; vol_cdev_read()
265 struct ubi_volume *vol = desc->vol; vol_cdev_direct_write() local
266 struct ubi_device *ubi = vol->ubi; vol_cdev_direct_write()
271 if (!vol->direct_writes) vol_cdev_direct_write()
275 count, *offp, vol->vol_id); vol_cdev_direct_write()
277 if (vol->vol_type == UBI_STATIC_VOLUME) vol_cdev_direct_write()
280 lnum = div_u64_rem(*offp, vol->usable_leb_size, &off); vol_cdev_direct_write()
286 if (*offp + count > vol->used_bytes) vol_cdev_direct_write()
287 count_save = count = vol->used_bytes - *offp; vol_cdev_direct_write()
295 tbuf_size = vol->usable_leb_size; vol_cdev_direct_write()
307 if (off + len >= vol->usable_leb_size) vol_cdev_direct_write()
308 len = vol->usable_leb_size - off; vol_cdev_direct_write()
316 err = ubi_eba_write_leb(ubi, vol, lnum, tbuf, off, len); vol_cdev_direct_write()
321 if (off == vol->usable_leb_size) { vol_cdev_direct_write()
323 off -= vol->usable_leb_size; vol_cdev_direct_write()
341 struct ubi_volume *vol = desc->vol; vol_cdev_write() local
342 struct ubi_device *ubi = vol->ubi; vol_cdev_write()
344 if (!vol->updating && !vol->changing_leb) vol_cdev_write()
347 if (vol->updating) vol_cdev_write()
348 err = ubi_more_update_data(ubi, vol, buf, count); vol_cdev_write()
350 err = ubi_more_leb_change_data(ubi, vol, buf, count); vol_cdev_write()
365 if (vol->changing_leb) { vol_cdev_write()
370 err = ubi_check_volume(ubi, vol->vol_id); vol_cdev_write()
376 vol->vol_id, ubi->ubi_num); vol_cdev_write()
377 vol->corrupted = 1; vol_cdev_write()
379 vol->checked = 1; vol_cdev_write()
380 ubi_volume_notify(ubi, vol, UBI_VOLUME_UPDATED); vol_cdev_write()
392 struct ubi_volume *vol = desc->vol; vol_cdev_ioctl() local
393 struct ubi_device *ubi = vol->ubi; vol_cdev_ioctl()
418 rsvd_bytes = (long long)vol->reserved_pebs * vol_cdev_ioctl()
419 ubi->leb_size-vol->data_pad; vol_cdev_ioctl()
429 err = ubi_start_update(ubi, vol, bytes); vol_cdev_ioctl()
431 ubi_volume_notify(ubi, vol, UBI_VOLUME_UPDATED); vol_cdev_ioctl()
450 vol->vol_type == UBI_STATIC_VOLUME) { vol_cdev_ioctl()
457 if (req.lnum < 0 || req.lnum >= vol->reserved_pebs || vol_cdev_ioctl()
458 req.bytes < 0 || req.bytes > vol->usable_leb_size) vol_cdev_ioctl()
465 err = ubi_start_leb_change(ubi, vol, &req); vol_cdev_ioctl()
483 vol->vol_type == UBI_STATIC_VOLUME) { vol_cdev_ioctl()
488 if (lnum < 0 || lnum >= vol->reserved_pebs) { vol_cdev_ioctl()
493 dbg_gen("erase LEB %d:%d", vol->vol_id, lnum); vol_cdev_ioctl()
494 err = ubi_eba_unmap_leb(ubi, vol, lnum); vol_cdev_ioctl()
558 desc->vol->direct_writes = !!req.value; vol_cdev_ioctl()
748 if (re->desc->vol->name_len == name_len && rename_volumes()
749 !memcmp(re->desc->vol->name, name, name_len)) { rename_volumes()
759 vol_id, re->desc->vol->name, name); rename_volumes()
777 if (re->new_name_len == re1->desc->vol->name_len && rename_volumes()
778 !memcmp(re->new_name, re1->desc->vol->name, rename_volumes()
779 re1->desc->vol->name_len)) { rename_volumes()
817 re1->desc->vol->vol_id, re1->desc->vol->name); rename_volumes()
932 pebs = div_u64(req.bytes + desc->vol->usable_leb_size - 1, ubi_cdev_ioctl()
933 desc->vol->usable_leb_size); ubi_cdev_ioctl()
H A Dvtbl.c130 struct ubi_volume *vol = re->desc->vol; list_for_each_entry() local
131 struct ubi_vtbl_record *vtbl_rec = &ubi->vtbl[vol->vol_id]; list_for_each_entry()
533 struct ubi_volume *vol; init_volumes() local
541 vol = kzalloc(sizeof(struct ubi_volume), GFP_KERNEL); init_volumes()
542 if (!vol) init_volumes()
545 vol->reserved_pebs = be32_to_cpu(vtbl[i].reserved_pebs); init_volumes()
546 vol->alignment = be32_to_cpu(vtbl[i].alignment); init_volumes()
547 vol->data_pad = be32_to_cpu(vtbl[i].data_pad); init_volumes()
548 vol->upd_marker = vtbl[i].upd_marker; init_volumes()
549 vol->vol_type = vtbl[i].vol_type == UBI_VID_DYNAMIC ? init_volumes()
551 vol->name_len = be16_to_cpu(vtbl[i].name_len); init_volumes()
552 vol->usable_leb_size = ubi->leb_size - vol->data_pad; init_volumes()
553 memcpy(vol->name, vtbl[i].name, vol->name_len); init_volumes()
554 vol->name[vol->name_len] = '\0'; init_volumes()
555 vol->vol_id = i; init_volumes()
562 kfree(vol); init_volumes()
570 ubi->volumes[i] = vol; init_volumes()
572 vol->ubi = ubi; init_volumes()
573 reserved_pebs += vol->reserved_pebs; init_volumes()
579 if (vol->vol_type == UBI_DYNAMIC_VOLUME) { init_volumes()
580 vol->used_ebs = vol->reserved_pebs; init_volumes()
581 vol->last_eb_bytes = vol->usable_leb_size; init_volumes()
582 vol->used_bytes = init_volumes()
583 (long long)vol->used_ebs * vol->usable_leb_size; init_volumes()
608 vol->corrupted = 1; init_volumes()
612 vol->used_ebs = av->used_ebs; init_volumes()
613 vol->used_bytes = init_volumes()
614 (long long)(vol->used_ebs - 1) * vol->usable_leb_size; init_volumes()
615 vol->used_bytes += av->last_data_size; init_volumes()
616 vol->last_eb_bytes = av->last_data_size; init_volumes()
620 vol = kzalloc(sizeof(struct ubi_volume), GFP_KERNEL); init_volumes()
621 if (!vol) init_volumes()
624 vol->reserved_pebs = UBI_LAYOUT_VOLUME_EBS; init_volumes()
625 vol->alignment = UBI_LAYOUT_VOLUME_ALIGN; init_volumes()
626 vol->vol_type = UBI_DYNAMIC_VOLUME; init_volumes()
627 vol->name_len = sizeof(UBI_LAYOUT_VOLUME_NAME) - 1; init_volumes()
628 memcpy(vol->name, UBI_LAYOUT_VOLUME_NAME, vol->name_len + 1); init_volumes()
629 vol->usable_leb_size = ubi->leb_size; init_volumes()
630 vol->used_ebs = vol->reserved_pebs; init_volumes()
631 vol->last_eb_bytes = vol->reserved_pebs; init_volumes()
632 vol->used_bytes = init_volumes()
633 (long long)vol->used_ebs * (ubi->leb_size - vol->data_pad); init_volumes()
634 vol->vol_id = UBI_LAYOUT_VOLUME_ID; init_volumes()
635 vol->ref_count = 1; init_volumes()
638 ubi->volumes[vol_id2idx(ubi, vol->vol_id)] = vol; init_volumes()
639 reserved_pebs += vol->reserved_pebs; init_volumes()
641 vol->ubi = ubi; init_volumes()
659 * @vol: UBI volume description object
665 static int check_av(const struct ubi_volume *vol, check_av() argument
670 if (av->highest_lnum >= vol->reserved_pebs) { check_av()
674 if (av->leb_count > vol->reserved_pebs) { check_av()
678 if (av->vol_type != vol->vol_type) { check_av()
682 if (av->used_ebs > vol->reserved_pebs) { check_av()
686 if (av->data_pad != vol->data_pad) { check_av()
693 ubi_err(vol->ubi, "bad attaching information, error %d", err); check_av()
695 ubi_dump_vol_info(vol); check_av()
714 struct ubi_volume *vol; check_attaching_info() local
733 vol = ubi->volumes[i]; check_attaching_info()
734 if (!vol) { check_attaching_info()
740 if (vol->reserved_pebs == 0) { check_attaching_info()
756 err = check_av(vol, av); check_attaching_info()
H A Ddebug.c105 * @vol: UBI volume description object
107 void ubi_dump_vol_info(const struct ubi_volume *vol) ubi_dump_vol_info() argument
110 pr_err("\tvol_id %d\n", vol->vol_id); ubi_dump_vol_info()
111 pr_err("\treserved_pebs %d\n", vol->reserved_pebs); ubi_dump_vol_info()
112 pr_err("\talignment %d\n", vol->alignment); ubi_dump_vol_info()
113 pr_err("\tdata_pad %d\n", vol->data_pad); ubi_dump_vol_info()
114 pr_err("\tvol_type %d\n", vol->vol_type); ubi_dump_vol_info()
115 pr_err("\tname_len %d\n", vol->name_len); ubi_dump_vol_info()
116 pr_err("\tusable_leb_size %d\n", vol->usable_leb_size); ubi_dump_vol_info()
117 pr_err("\tused_ebs %d\n", vol->used_ebs); ubi_dump_vol_info()
118 pr_err("\tused_bytes %lld\n", vol->used_bytes); ubi_dump_vol_info()
119 pr_err("\tlast_eb_bytes %d\n", vol->last_eb_bytes); ubi_dump_vol_info()
120 pr_err("\tcorrupted %d\n", vol->corrupted); ubi_dump_vol_info()
121 pr_err("\tupd_marker %d\n", vol->upd_marker); ubi_dump_vol_info()
123 if (vol->name_len <= UBI_VOL_NAME_MAX && ubi_dump_vol_info()
124 strnlen(vol->name, vol->name_len + 1) == vol->name_len) { ubi_dump_vol_info()
125 pr_err("\tname %s\n", vol->name); ubi_dump_vol_info()
128 vol->name[0], vol->name[1], vol->name[2], ubi_dump_vol_info()
129 vol->name[3], vol->name[4]); ubi_dump_vol_info()
H A Dmisc.c65 struct ubi_volume *vol = ubi->volumes[vol_id]; ubi_check_volume() local
67 if (vol->vol_type != UBI_STATIC_VOLUME) ubi_check_volume()
70 buf = vmalloc(vol->usable_leb_size); ubi_check_volume()
74 for (i = 0; i < vol->used_ebs; i++) { ubi_check_volume()
79 if (i == vol->used_ebs - 1) ubi_check_volume()
80 size = vol->last_eb_bytes; ubi_check_volume()
82 size = vol->usable_leb_size; ubi_check_volume()
84 err = ubi_eba_read_leb(ubi, vol, i, buf, 0, size, 1); ubi_check_volume()
H A Deba.c317 * @vol: volume description object
324 int ubi_eba_unmap_leb(struct ubi_device *ubi, struct ubi_volume *vol, ubi_eba_unmap_leb() argument
327 int err, pnum, vol_id = vol->vol_id; ubi_eba_unmap_leb()
336 pnum = vol->eba_tbl[lnum]; ubi_eba_unmap_leb()
344 vol->eba_tbl[lnum] = UBI_LEB_UNMAPPED; ubi_eba_unmap_leb()
356 * @vol: volume description object
372 int ubi_eba_read_leb(struct ubi_device *ubi, struct ubi_volume *vol, int lnum, ubi_eba_read_leb() argument
375 int err, pnum, scrub = 0, vol_id = vol->vol_id; ubi_eba_read_leb()
383 pnum = vol->eba_tbl[lnum]; ubi_eba_read_leb()
393 ubi_assert(vol->vol_type != UBI_STATIC_VOLUME); ubi_eba_read_leb()
401 if (vol->vol_type == UBI_DYNAMIC_VOLUME) ubi_eba_read_leb()
466 if (vol->vol_type == UBI_DYNAMIC_VOLUME) ubi_eba_read_leb()
504 * @vol: volume description object
515 int ubi_eba_read_leb_sg(struct ubi_device *ubi, struct ubi_volume *vol, ubi_eba_read_leb_sg() argument
531 ret = ubi_eba_read_leb(ubi, vol, lnum, ubi_eba_read_leb_sg()
576 struct ubi_volume *vol = ubi->volumes[idx]; recover_peb() local
634 vol->eba_tbl[lnum] = new_pnum; recover_peb()
666 * @vol: volume description object
673 * @vol. Returns zero in case of success and a negative error code in case
677 int ubi_eba_write_leb(struct ubi_device *ubi, struct ubi_volume *vol, int lnum, ubi_eba_write_leb() argument
680 int err, pnum, tries = 0, vol_id = vol->vol_id; ubi_eba_write_leb()
690 pnum = vol->eba_tbl[lnum]; ubi_eba_write_leb()
723 vid_hdr->data_pad = cpu_to_be32(vol->data_pad); ubi_eba_write_leb()
755 vol->eba_tbl[lnum] = pnum; ubi_eba_write_leb()
791 * @vol: volume description object
798 * @vol. The @used_ebs argument should contain total number of logical
810 int ubi_eba_write_leb_st(struct ubi_device *ubi, struct ubi_volume *vol, ubi_eba_write_leb_st() argument
813 int err, pnum, tries = 0, data_size = len, vol_id = vol->vol_id; ubi_eba_write_leb_st()
840 vid_hdr->data_pad = cpu_to_be32(vol->data_pad); ubi_eba_write_leb_st()
876 ubi_assert(vol->eba_tbl[lnum] < 0); ubi_eba_write_leb_st()
877 vol->eba_tbl[lnum] = pnum; ubi_eba_write_leb_st()
913 * @vol: volume description object
927 int ubi_eba_atomic_leb_change(struct ubi_device *ubi, struct ubi_volume *vol, ubi_eba_atomic_leb_change() argument
930 int err, pnum, old_pnum, tries = 0, vol_id = vol->vol_id; ubi_eba_atomic_leb_change()
942 err = ubi_eba_unmap_leb(ubi, vol, lnum); ubi_eba_atomic_leb_change()
945 return ubi_eba_write_leb(ubi, vol, lnum, NULL, 0, 0); ubi_eba_atomic_leb_change()
961 vid_hdr->data_pad = cpu_to_be32(vol->data_pad); ubi_eba_atomic_leb_change()
978 vol_id, lnum, vol->eba_tbl[lnum], pnum); ubi_eba_atomic_leb_change()
996 old_pnum = vol->eba_tbl[lnum]; ubi_eba_atomic_leb_change()
997 vol->eba_tbl[lnum] = pnum; ubi_eba_atomic_leb_change()
1080 struct ubi_volume *vol; ubi_eba_copy_leb() local
1103 vol = ubi->volumes[idx]; ubi_eba_copy_leb()
1105 if (!vol) { ubi_eba_copy_leb()
1137 if (vol->eba_tbl[lnum] != from) { ubi_eba_copy_leb()
1139 vol_id, lnum, from, vol->eba_tbl[lnum]); ubi_eba_copy_leb()
1250 ubi_assert(vol->eba_tbl[lnum] == from); ubi_eba_copy_leb()
1252 vol->eba_tbl[lnum] = to; ubi_eba_copy_leb()
1319 struct ubi_volume *vol; self_check_eba() local
1336 vol = ubi->volumes[i]; self_check_eba()
1337 if (!vol) self_check_eba()
1340 scan_eba[i] = kmalloc(vol->reserved_pebs * sizeof(**scan_eba), self_check_eba()
1347 fm_eba[i] = kmalloc(vol->reserved_pebs * sizeof(**fm_eba), self_check_eba()
1354 for (j = 0; j < vol->reserved_pebs; j++) self_check_eba()
1371 for (j = 0; j < vol->reserved_pebs; j++) { self_check_eba()
1378 vol->vol_id, i, fm_eba[i][j], self_check_eba()
1411 struct ubi_volume *vol; ubi_eba_init() local
1425 vol = ubi->volumes[i]; ubi_eba_init()
1426 if (!vol) ubi_eba_init()
1431 vol->eba_tbl = kmalloc(vol->reserved_pebs * sizeof(int), ubi_eba_init()
1433 if (!vol->eba_tbl) { ubi_eba_init()
1438 for (j = 0; j < vol->reserved_pebs; j++) ubi_eba_init()
1439 vol->eba_tbl[j] = UBI_LEB_UNMAPPED; ubi_eba_init()
1446 if (aeb->lnum >= vol->reserved_pebs) ubi_eba_init()
1453 vol->eba_tbl[aeb->lnum] = aeb->pnum; ubi_eba_init()
H A Dubi.h354 * @vol: reference to the corresponding volume description object
359 struct ubi_volume *vol; member in struct:ubi_volume_desc
424 * @vol->readers, @vol->writers, @vol->exclusive,
425 * @vol->metaonly, @vol->ref_count, @vol->mapping and
426 * @vol->eba_tbl.
807 int ubi_add_volume(struct ubi_device *ubi, struct ubi_volume *vol);
808 void ubi_free_volume(struct ubi_device *ubi, struct ubi_volume *vol);
811 int ubi_start_update(struct ubi_device *ubi, struct ubi_volume *vol,
813 int ubi_more_update_data(struct ubi_device *ubi, struct ubi_volume *vol,
815 int ubi_start_leb_change(struct ubi_device *ubi, struct ubi_volume *vol,
817 int ubi_more_leb_change_data(struct ubi_device *ubi, struct ubi_volume *vol,
829 int ubi_eba_unmap_leb(struct ubi_device *ubi, struct ubi_volume *vol,
831 int ubi_eba_read_leb(struct ubi_device *ubi, struct ubi_volume *vol, int lnum,
833 int ubi_eba_read_leb_sg(struct ubi_device *ubi, struct ubi_volume *vol,
836 int ubi_eba_write_leb(struct ubi_device *ubi, struct ubi_volume *vol, int lnum,
838 int ubi_eba_write_leb_st(struct ubi_device *ubi, struct ubi_volume *vol,
840 int ubi_eba_atomic_leb_change(struct ubi_device *ubi, struct ubi_volume *vol,
890 int ubi_volume_notify(struct ubi_device *ubi, struct ubi_volume *vol,
899 void ubi_do_get_volume_info(struct ubi_device *ubi, struct ubi_volume *vol,
H A Dfastmap.c320 dbg_bld("vol %i: AEB %i's PEB %i is the newer", update_vol()
331 dbg_bld("vol %i: AEB %i's PEB %i is old, dropping it", update_vol()
738 ubi_err(ubi, "bad fastmap vol header magic: 0x%x, expected: 0x%x", ubi_attach_fastmap()
794 dbg_bld("inserting PEB:%i (LEB %i) to vol %i", ubi_attach_fastmap()
1092 struct ubi_volume *vol; ubi_write_fastmap() local
1238 vol = ubi->volumes[i];
1240 if (!vol)
1250 fvh->vol_id = cpu_to_be32(vol->vol_id);
1251 fvh->vol_type = vol->vol_type;
1252 fvh->used_ebs = cpu_to_be32(vol->used_ebs);
1253 fvh->data_pad = cpu_to_be32(vol->data_pad);
1254 fvh->last_eb_bytes = cpu_to_be32(vol->last_eb_bytes);
1256 ubi_assert(vol->vol_type == UBI_DYNAMIC_VOLUME ||
1257 vol->vol_type == UBI_STATIC_VOLUME);
1260 fm_pos += sizeof(*feba) + (sizeof(__be32) * vol->reserved_pebs);
1263 for (j = 0; j < vol->reserved_pebs; j++)
1264 feba->pnum[j] = cpu_to_be32(vol->eba_tbl[j]);
H A Dbuild.c149 * @vol: volume description object of the changed volume
156 int ubi_volume_notify(struct ubi_device *ubi, struct ubi_volume *vol, int ntype) ubi_volume_notify() argument
162 ubi_do_get_volume_info(ubi, vol, &nt.vi); ubi_volume_notify()
568 * Note, since this function un-registers UBI volume device objects (@vol->dev),
809 struct ubi_volume *vol = ubi->volumes[vol_id]; autoresize() local
810 int err, old_reserved_pebs = vol->reserved_pebs; autoresize()
837 desc.vol = vol; autoresize()
849 vol_id, vol->name, old_reserved_pebs, vol->reserved_pebs); autoresize()
H A Ddebug.h56 void ubi_dump_vol_info(const struct ubi_volume *vol);
H A Dgluebi.c410 * if te volume @vol is dynamic, and changes MTD device size if the
H A Dblock.c573 /* No ubi num, name must be a vol device path */ open_volume_desc()
/linux-4.1.27/fs/ntfs/
H A Dsuper.c96 * @vol: ntfs volume
99 * Parse the recognized options in @opt for the ntfs volume described by @vol.
101 static bool parse_options(ntfs_volume *vol, char *opt) parse_options() argument
206 ntfs_warning(vol->sb, "Ignoring obsolete option %s.", parse_options()
210 ntfs_warning(vol->sb, "Option iocharset is " parse_options()
221 ntfs_error(vol->sb, "NLS character set " parse_options()
225 ntfs_error(vol->sb, "NLS character set %s not " parse_options()
234 ntfs_warning(vol->sb, "Option utf8 is no longer " parse_options()
248 ntfs_error(vol->sb, "Unrecognized mount option %s.", p); parse_options()
261 ntfs_warning(vol->sb, "Sloppy option given. Ignoring " parse_options()
266 ntfs_error(vol->sb, "Invalid errors option argument " parse_options()
272 if (vol->nls_map && vol->nls_map != nls_map) { parse_options()
273 ntfs_error(vol->sb, "Cannot change NLS character set " parse_options()
276 } /* else (!vol->nls_map) */ parse_options()
278 vol->nls_map = nls_map; parse_options()
280 if (!vol->nls_map) { parse_options()
281 vol->nls_map = load_nls_default(); parse_options()
282 if (!vol->nls_map) { parse_options()
283 ntfs_error(vol->sb, "Failed to load default " parse_options()
288 vol->nls_map->charset); parse_options()
292 if (vol->mft_zone_multiplier && vol->mft_zone_multiplier != parse_options()
294 ntfs_error(vol->sb, "Cannot change mft_zone_multiplier " parse_options()
299 ntfs_error(vol->sb, "Invalid mft_zone_multiplier. " parse_options()
303 vol->mft_zone_multiplier = mft_zone_multiplier; parse_options()
305 if (!vol->mft_zone_multiplier) parse_options()
306 vol->mft_zone_multiplier = 1; parse_options()
308 vol->on_errors = on_errors; parse_options()
309 if (!vol->on_errors || vol->on_errors == ON_ERRORS_RECOVER) parse_options()
310 vol->on_errors |= ON_ERRORS_CONTINUE; parse_options()
312 vol->uid = uid; parse_options()
314 vol->gid = gid; parse_options()
316 vol->fmask = fmask; parse_options()
318 vol->dmask = dmask; parse_options()
321 NVolSetShowSystemFiles(vol); parse_options()
323 NVolClearShowSystemFiles(vol); parse_options()
327 NVolSetCaseSensitive(vol); parse_options()
329 NVolClearCaseSensitive(vol); parse_options()
333 NVolClearSparseEnabled(vol); parse_options()
335 if (!NVolSparseEnabled(vol) && parse_options()
336 vol->major_ver && vol->major_ver < 3) parse_options()
337 ntfs_warning(vol->sb, "Not enabling sparse " parse_options()
340 "version 3.0).", vol->major_ver, parse_options()
341 vol->minor_ver); parse_options()
343 NVolSetSparseEnabled(vol); parse_options()
348 ntfs_error(vol->sb, "The %s option requires an argument.", p); parse_options()
351 ntfs_error(vol->sb, "The %s option requires a boolean argument.", p); parse_options()
354 ntfs_error(vol->sb, "Invalid %s option argument: %s", p, ov); parse_options()
362 * @vol: ntfs volume on which to modify the flags
368 * Replace the volume information flags on the volume @vol with the value
375 static int ntfs_write_volume_flags(ntfs_volume *vol, const VOLUME_FLAGS flags) ntfs_write_volume_flags() argument
377 ntfs_inode *ni = NTFS_I(vol->vol_ino); ntfs_write_volume_flags()
384 le16_to_cpu(vol->vol_flags), le16_to_cpu(flags)); ntfs_write_volume_flags()
385 if (vol->vol_flags == flags) ntfs_write_volume_flags()
404 vol->vol_flags = vi->flags = flags; ntfs_write_volume_flags()
417 ntfs_error(vol->sb, "Failed with error code %i.", -err); ntfs_write_volume_flags()
423 * @vol: ntfs volume on which to modify the flags
426 * Set the bits in @flags in the volume information flags on the volume @vol.
430 static inline int ntfs_set_volume_flags(ntfs_volume *vol, VOLUME_FLAGS flags) ntfs_set_volume_flags() argument
433 return ntfs_write_volume_flags(vol, vol->vol_flags | flags); ntfs_set_volume_flags()
438 * @vol: ntfs volume on which to modify the flags
441 * Clear the bits in @flags in the volume information flags on the volume @vol.
445 static inline int ntfs_clear_volume_flags(ntfs_volume *vol, VOLUME_FLAGS flags) ntfs_clear_volume_flags() argument
448 flags = vol->vol_flags & cpu_to_le16(~le16_to_cpu(flags)); ntfs_clear_volume_flags()
449 return ntfs_write_volume_flags(vol, flags); ntfs_clear_volume_flags()
468 ntfs_volume *vol = NTFS_SB(sb); ntfs_remount() local
494 if (NVolErrors(vol)) { ntfs_remount()
499 if (vol->vol_flags & VOLUME_IS_DIRTY) { ntfs_remount()
503 if (vol->vol_flags & VOLUME_MODIFIED_BY_CHKDSK) { ntfs_remount()
508 if (vol->vol_flags & VOLUME_MUST_MOUNT_RO_MASK) { ntfs_remount()
511 (unsigned)le16_to_cpu(vol->vol_flags), ntfs_remount()
515 if (ntfs_set_volume_flags(vol, VOLUME_IS_DIRTY)) { ntfs_remount()
524 if ((vol->major_ver > 1)) { ntfs_remount()
525 if (ntfs_set_volume_flags(vol, VOLUME_MOUNTED_ON_NT4)) { ntfs_remount()
528 NVolSetErrors(vol); ntfs_remount()
533 if (!ntfs_empty_logfile(vol->logfile_ino)) { ntfs_remount()
536 NVolSetErrors(vol); ntfs_remount()
539 if (!ntfs_mark_quotas_out_of_date(vol)) { ntfs_remount()
542 NVolSetErrors(vol); ntfs_remount()
545 if (!ntfs_stamp_usnjrnl(vol)) { ntfs_remount()
548 NVolSetErrors(vol); ntfs_remount()
553 if (!NVolErrors(vol)) { ntfs_remount()
554 if (ntfs_clear_volume_flags(vol, VOLUME_IS_DIRTY)) ntfs_remount()
564 if (!parse_options(vol, opt)) ntfs_remount()
759 * parse_ntfs_boot_sector - parse the boot sector and store the data in @vol
760 * @vol: volume structure to initialise with data from boot sector
764 * the ntfs super block @vol. Return 'true' on success and 'false' on error.
766 static bool parse_ntfs_boot_sector(ntfs_volume *vol, const NTFS_BOOT_SECTOR *b) parse_ntfs_boot_sector() argument
772 vol->sector_size = le16_to_cpu(b->bpb.bytes_per_sector); parse_ntfs_boot_sector()
773 vol->sector_size_bits = ffs(vol->sector_size) - 1; parse_ntfs_boot_sector()
774 ntfs_debug("vol->sector_size = %i (0x%x)", vol->sector_size, parse_ntfs_boot_sector()
775 vol->sector_size); parse_ntfs_boot_sector()
776 ntfs_debug("vol->sector_size_bits = %i (0x%x)", vol->sector_size_bits, parse_ntfs_boot_sector()
777 vol->sector_size_bits); parse_ntfs_boot_sector()
778 if (vol->sector_size < vol->sb->s_blocksize) { parse_ntfs_boot_sector()
779 ntfs_error(vol->sb, "Sector size (%i) is smaller than the " parse_ntfs_boot_sector()
781 "supported. Sorry.", vol->sector_size, parse_ntfs_boot_sector()
782 vol->sb->s_blocksize); parse_ntfs_boot_sector()
791 vol->cluster_size = vol->sector_size << sectors_per_cluster_bits; parse_ntfs_boot_sector()
792 vol->cluster_size_mask = vol->cluster_size - 1; parse_ntfs_boot_sector()
793 vol->cluster_size_bits = ffs(vol->cluster_size) - 1; parse_ntfs_boot_sector()
794 ntfs_debug("vol->cluster_size = %i (0x%x)", vol->cluster_size, parse_ntfs_boot_sector()
795 vol->cluster_size); parse_ntfs_boot_sector()
796 ntfs_debug("vol->cluster_size_mask = 0x%x", vol->cluster_size_mask); parse_ntfs_boot_sector()
797 ntfs_debug("vol->cluster_size_bits = %i", vol->cluster_size_bits); parse_ntfs_boot_sector()
798 if (vol->cluster_size < vol->sector_size) { parse_ntfs_boot_sector()
799 ntfs_error(vol->sb, "Cluster size (%i) is smaller than the " parse_ntfs_boot_sector()
801 "Sorry.", vol->cluster_size, vol->sector_size); parse_ntfs_boot_sector()
808 vol->mft_record_size = vol->cluster_size << parse_ntfs_boot_sector()
816 vol->mft_record_size = 1 << -clusters_per_mft_record; parse_ntfs_boot_sector()
817 vol->mft_record_size_mask = vol->mft_record_size - 1; parse_ntfs_boot_sector()
818 vol->mft_record_size_bits = ffs(vol->mft_record_size) - 1; parse_ntfs_boot_sector()
819 ntfs_debug("vol->mft_record_size = %i (0x%x)", vol->mft_record_size, parse_ntfs_boot_sector()
820 vol->mft_record_size); parse_ntfs_boot_sector()
821 ntfs_debug("vol->mft_record_size_mask = 0x%x", parse_ntfs_boot_sector()
822 vol->mft_record_size_mask); parse_ntfs_boot_sector()
823 ntfs_debug("vol->mft_record_size_bits = %i (0x%x)", parse_ntfs_boot_sector()
824 vol->mft_record_size_bits, vol->mft_record_size_bits); parse_ntfs_boot_sector()
829 if (vol->mft_record_size > PAGE_CACHE_SIZE) { parse_ntfs_boot_sector()
830 ntfs_error(vol->sb, "Mft record size (%i) exceeds the " parse_ntfs_boot_sector()
833 vol->mft_record_size, PAGE_CACHE_SIZE); parse_ntfs_boot_sector()
837 if (vol->mft_record_size < vol->sector_size) { parse_ntfs_boot_sector()
838 ntfs_error(vol->sb, "Mft record size (%i) is smaller than the " parse_ntfs_boot_sector()
840 "Sorry.", vol->mft_record_size, parse_ntfs_boot_sector()
841 vol->sector_size); parse_ntfs_boot_sector()
848 vol->index_record_size = vol->cluster_size << parse_ntfs_boot_sector()
857 vol->index_record_size = 1 << -clusters_per_index_record; parse_ntfs_boot_sector()
858 vol->index_record_size_mask = vol->index_record_size - 1; parse_ntfs_boot_sector()
859 vol->index_record_size_bits = ffs(vol->index_record_size) - 1; parse_ntfs_boot_sector()
860 ntfs_debug("vol->index_record_size = %i (0x%x)", parse_ntfs_boot_sector()
861 vol->index_record_size, vol->index_record_size); parse_ntfs_boot_sector()
862 ntfs_debug("vol->index_record_size_mask = 0x%x", parse_ntfs_boot_sector()
863 vol->index_record_size_mask); parse_ntfs_boot_sector()
864 ntfs_debug("vol->index_record_size_bits = %i (0x%x)", parse_ntfs_boot_sector()
865 vol->index_record_size_bits, parse_ntfs_boot_sector()
866 vol->index_record_size_bits); parse_ntfs_boot_sector()
868 if (vol->index_record_size < vol->sector_size) { parse_ntfs_boot_sector()
869 ntfs_error(vol->sb, "Index record size (%i) is smaller than " parse_ntfs_boot_sector()
871 "supported. Sorry.", vol->index_record_size, parse_ntfs_boot_sector()
872 vol->sector_size); parse_ntfs_boot_sector()
882 ntfs_error(vol->sb, "Cannot handle 64-bit clusters. Sorry."); parse_ntfs_boot_sector()
885 vol->nr_clusters = ll; parse_ntfs_boot_sector()
886 ntfs_debug("vol->nr_clusters = 0x%llx", (long long)vol->nr_clusters); parse_ntfs_boot_sector()
893 if ((ll << vol->cluster_size_bits) >= (1ULL << 41)) { parse_ntfs_boot_sector()
894 ntfs_error(vol->sb, "Volume size (%lluTiB) is too " parse_ntfs_boot_sector()
898 vol->cluster_size_bits)); parse_ntfs_boot_sector()
903 if (ll >= vol->nr_clusters) { parse_ntfs_boot_sector()
904 ntfs_error(vol->sb, "MFT LCN (%lli, 0x%llx) is beyond end of " parse_ntfs_boot_sector()
909 vol->mft_lcn = ll; parse_ntfs_boot_sector()
910 ntfs_debug("vol->mft_lcn = 0x%llx", (long long)vol->mft_lcn); parse_ntfs_boot_sector()
912 if (ll >= vol->nr_clusters) { parse_ntfs_boot_sector()
913 ntfs_error(vol->sb, "MFTMirr LCN (%lli, 0x%llx) is beyond end " parse_ntfs_boot_sector()
918 vol->mftmirr_lcn = ll; parse_ntfs_boot_sector()
919 ntfs_debug("vol->mftmirr_lcn = 0x%llx", (long long)vol->mftmirr_lcn); parse_ntfs_boot_sector()
929 if (vol->cluster_size <= (4 << vol->mft_record_size_bits)) parse_ntfs_boot_sector()
930 vol->mftmirr_size = 4; parse_ntfs_boot_sector()
932 vol->mftmirr_size = vol->cluster_size >> parse_ntfs_boot_sector()
933 vol->mft_record_size_bits; parse_ntfs_boot_sector()
934 ntfs_debug("vol->mftmirr_size = %i", vol->mftmirr_size); parse_ntfs_boot_sector()
936 vol->serial_no = le64_to_cpu(b->volume_serial_number); parse_ntfs_boot_sector()
937 ntfs_debug("vol->serial_no = 0x%llx", parse_ntfs_boot_sector()
938 (unsigned long long)vol->serial_no); parse_ntfs_boot_sector()
944 * @vol: volume structure for which to setup the allocators
948 static void ntfs_setup_allocators(ntfs_volume *vol) ntfs_setup_allocators() argument
954 ntfs_debug("vol->mft_zone_multiplier = 0x%x", ntfs_setup_allocators()
955 vol->mft_zone_multiplier); ntfs_setup_allocators()
958 mft_zone_size = vol->nr_clusters; ntfs_setup_allocators()
959 switch (vol->mft_zone_multiplier) { /* % of volume size in clusters */ ntfs_setup_allocators()
976 vol->mft_zone_start = vol->mft_zone_pos = vol->mft_lcn; ntfs_setup_allocators()
977 ntfs_debug("vol->mft_zone_pos = 0x%llx", ntfs_setup_allocators()
978 (unsigned long long)vol->mft_zone_pos); ntfs_setup_allocators()
988 mft_lcn = (8192 + 2 * vol->cluster_size - 1) / vol->cluster_size; ntfs_setup_allocators()
989 if (mft_lcn * vol->cluster_size < 16 * 1024) ntfs_setup_allocators()
990 mft_lcn = (16 * 1024 + vol->cluster_size - 1) / ntfs_setup_allocators()
991 vol->cluster_size; ntfs_setup_allocators()
992 if (vol->mft_zone_start <= mft_lcn) ntfs_setup_allocators()
993 vol->mft_zone_start = 0; ntfs_setup_allocators()
994 ntfs_debug("vol->mft_zone_start = 0x%llx", ntfs_setup_allocators()
995 (unsigned long long)vol->mft_zone_start); ntfs_setup_allocators()
1001 vol->mft_zone_end = vol->mft_lcn + mft_zone_size; ntfs_setup_allocators()
1002 while (vol->mft_zone_end >= vol->nr_clusters) { ntfs_setup_allocators()
1004 vol->mft_zone_end = vol->mft_lcn + mft_zone_size; ntfs_setup_allocators()
1006 ntfs_debug("vol->mft_zone_end = 0x%llx", ntfs_setup_allocators()
1007 (unsigned long long)vol->mft_zone_end); ntfs_setup_allocators()
1012 vol->data1_zone_pos = vol->mft_zone_end; ntfs_setup_allocators()
1013 ntfs_debug("vol->data1_zone_pos = 0x%llx", ntfs_setup_allocators()
1014 (unsigned long long)vol->data1_zone_pos); ntfs_setup_allocators()
1015 vol->data2_zone_pos = 0; ntfs_setup_allocators()
1016 ntfs_debug("vol->data2_zone_pos = 0x%llx", ntfs_setup_allocators()
1017 (unsigned long long)vol->data2_zone_pos); ntfs_setup_allocators()
1020 vol->mft_data_pos = 24; ntfs_setup_allocators()
1021 ntfs_debug("vol->mft_data_pos = 0x%llx", ntfs_setup_allocators()
1022 (unsigned long long)vol->mft_data_pos); ntfs_setup_allocators()
1030 * @vol: ntfs super block describing device whose mft mirror to load
1034 static bool load_and_init_mft_mirror(ntfs_volume *vol) load_and_init_mft_mirror() argument
1041 tmp_ino = ntfs_iget(vol->sb, FILE_MFTMirr); load_and_init_mft_mirror()
1070 tmp_ni->itype.index.block_size = vol->mft_record_size; load_and_init_mft_mirror()
1071 tmp_ni->itype.index.block_size_bits = vol->mft_record_size_bits; load_and_init_mft_mirror()
1072 vol->mftmirr_ino = tmp_ino; load_and_init_mft_mirror()
1079 * @vol: ntfs super block describing device whose mft mirror to check
1087 static bool check_mft_mirror(ntfs_volume *vol) check_mft_mirror() argument
1089 struct super_block *sb = vol->sb; check_mft_mirror()
1099 mrecs_per_page = PAGE_CACHE_SIZE / vol->mft_record_size; check_mft_mirror()
1101 BUG_ON(!vol->mftmirr_size); check_mft_mirror()
1115 mft_page = ntfs_map_page(vol->mft_ino->i_mapping, check_mft_mirror()
1123 mirr_page = ntfs_map_page(vol->mftmirr_ino->i_mapping, check_mft_mirror()
1158 bytes > vol->mft_record_size || check_mft_mirror()
1162 bytes > vol->mft_record_size || check_mft_mirror()
1164 bytes = vol->mft_record_size; check_mft_mirror()
1172 kmft += vol->mft_record_size; check_mft_mirror()
1173 kmirr += vol->mft_record_size; check_mft_mirror()
1174 } while (++i < vol->mftmirr_size); check_mft_mirror()
1181 rl2[0].lcn = vol->mftmirr_lcn; check_mft_mirror()
1182 rl2[0].length = (vol->mftmirr_size * vol->mft_record_size + check_mft_mirror()
1183 vol->cluster_size - 1) / vol->cluster_size; check_mft_mirror()
1191 mirr_ni = NTFS_I(vol->mftmirr_ino); check_mft_mirror()
1212 * @vol: ntfs super block describing device whose logfile to load
1216 static bool load_and_check_logfile(ntfs_volume *vol, load_and_check_logfile() argument
1222 tmp_ino = ntfs_iget(vol->sb, FILE_LogFile); load_and_check_logfile()
1235 vol->logfile_ino = tmp_ino; load_and_check_logfile()
1244 * @vol: ntfs super block of device to check
1246 * Check if Windows is hibernated on the ntfs volume @vol. This is done by
1266 static int check_windows_hibernation_status(ntfs_volume *vol) check_windows_hibernation_status() argument
1287 mutex_lock(&vol->root_ino->i_mutex); check_windows_hibernation_status()
1288 mref = ntfs_lookup_inode_by_name(NTFS_I(vol->root_ino), hiberfil, 12, check_windows_hibernation_status()
1290 mutex_unlock(&vol->root_ino->i_mutex); check_windows_hibernation_status()
1300 ntfs_error(vol->sb, "Failed to find inode number for " check_windows_hibernation_status()
1307 vi = ntfs_iget(vol->sb, MREF(mref)); check_windows_hibernation_status()
1311 ntfs_error(vol->sb, "Failed to load hiberfil.sys."); check_windows_hibernation_status()
1322 ntfs_error(vol->sb, "Failed to read from hiberfil.sys."); check_windows_hibernation_status()
1358 * @vol: ntfs super block describing device whose quota file to load
1361 * leave vol->quota_ino as NULL and return success.
1363 static bool load_and_init_quota(ntfs_volume *vol) load_and_init_quota() argument
1380 mutex_lock(&vol->extend_ino->i_mutex); load_and_init_quota()
1381 mref = ntfs_lookup_inode_by_name(NTFS_I(vol->extend_ino), Quota, 6, load_and_init_quota()
1383 mutex_unlock(&vol->extend_ino->i_mutex); load_and_init_quota()
1396 NVolSetQuotaOutOfDate(vol); load_and_init_quota()
1400 ntfs_error(vol->sb, "Failed to find inode number for $Quota."); load_and_init_quota()
1406 tmp_ino = ntfs_iget(vol->sb, MREF(mref)); load_and_init_quota()
1410 ntfs_error(vol->sb, "Failed to load $Quota."); load_and_init_quota()
1413 vol->quota_ino = tmp_ino; load_and_init_quota()
1415 tmp_ino = ntfs_index_iget(vol->quota_ino, Q, 2); load_and_init_quota()
1417 ntfs_error(vol->sb, "Failed to load $Quota/$Q index."); load_and_init_quota()
1420 vol->quota_q_ino = tmp_ino; load_and_init_quota()
1427 * @vol: ntfs super block describing device whose usnjrnl file to load
1439 static bool load_and_init_usnjrnl(ntfs_volume *vol) load_and_init_usnjrnl() argument
1463 mutex_lock(&vol->extend_ino->i_mutex); load_and_init_usnjrnl()
1464 mref = ntfs_lookup_inode_by_name(NTFS_I(vol->extend_ino), UsnJrnl, 8, load_and_init_usnjrnl()
1466 mutex_unlock(&vol->extend_ino->i_mutex); load_and_init_usnjrnl()
1480 NVolSetUsnJrnlStamped(vol); load_and_init_usnjrnl()
1484 ntfs_error(vol->sb, "Failed to find inode number for " load_and_init_usnjrnl()
1491 tmp_ino = ntfs_iget(vol->sb, MREF(mref)); load_and_init_usnjrnl()
1495 ntfs_error(vol->sb, "Failed to load $UsnJrnl."); load_and_init_usnjrnl()
1498 vol->usnjrnl_ino = tmp_ino; load_and_init_usnjrnl()
1503 if (unlikely(vol->vol_flags & VOLUME_DELETE_USN_UNDERWAY)) { load_and_init_usnjrnl()
1510 tmp_ino = ntfs_attr_iget(vol->usnjrnl_ino, AT_DATA, Max, 4); load_and_init_usnjrnl()
1512 ntfs_error(vol->sb, "Failed to load $UsnJrnl/$DATA/$Max " load_and_init_usnjrnl()
1516 vol->usnjrnl_max_ino = tmp_ino; load_and_init_usnjrnl()
1518 ntfs_error(vol->sb, "Found corrupt $UsnJrnl/$DATA/$Max " load_and_init_usnjrnl()
1525 tmp_ino = ntfs_attr_iget(vol->usnjrnl_ino, AT_DATA, J, 2); load_and_init_usnjrnl()
1527 ntfs_error(vol->sb, "Failed to load $UsnJrnl/$DATA/$J " load_and_init_usnjrnl()
1531 vol->usnjrnl_j_ino = tmp_ino; load_and_init_usnjrnl()
1533 tmp_ni = NTFS_I(vol->usnjrnl_j_ino); load_and_init_usnjrnl()
1535 ntfs_error(vol->sb, "$UsnJrnl/$DATA/$J attribute is resident " load_and_init_usnjrnl()
1540 page = ntfs_map_page(vol->usnjrnl_max_ino->i_mapping, 0); load_and_init_usnjrnl()
1542 ntfs_error(vol->sb, "Failed to read from $UsnJrnl/$DATA/$Max " load_and_init_usnjrnl()
1550 ntfs_error(vol->sb, "Allocation delta (0x%llx) exceeds " load_and_init_usnjrnl()
1562 i_size_read(vol->usnjrnl_j_ino))) { load_and_init_usnjrnl()
1564 i_size_read(vol->usnjrnl_j_ino))) { load_and_init_usnjrnl()
1573 ntfs_error(vol->sb, "$UsnJrnl has lowest valid usn (0x%llx) " load_and_init_usnjrnl()
1577 i_size_read(vol->usnjrnl_j_ino)); load_and_init_usnjrnl()
1588 * @vol: ntfs super block describing device whose attrdef to load
1592 static bool load_and_init_attrdef(ntfs_volume *vol) load_and_init_attrdef() argument
1595 struct super_block *sb = vol->sb; load_and_init_attrdef()
1602 /* Read attrdef table and setup vol->attrdef and vol->attrdef_size. */ load_and_init_attrdef()
1614 vol->attrdef = (ATTR_DEF*)ntfs_malloc_nofs(i_size); load_and_init_attrdef()
1615 if (!vol->attrdef) load_and_init_attrdef()
1626 memcpy((u8*)vol->attrdef + (index++ << PAGE_CACHE_SHIFT), load_and_init_attrdef()
1635 vol->attrdef_size = i_size; load_and_init_attrdef()
1640 ntfs_free(vol->attrdef); load_and_init_attrdef()
1641 vol->attrdef = NULL; load_and_init_attrdef()
1653 * @vol: ntfs super block describing device whose upcase to load
1657 static bool load_and_init_upcase(ntfs_volume *vol) load_and_init_upcase() argument
1660 struct super_block *sb = vol->sb; load_and_init_upcase()
1668 /* Read upcase table and setup vol->upcase and vol->upcase_len. */ load_and_init_upcase()
1683 vol->upcase = (ntfschar*)ntfs_malloc_nofs(i_size); load_and_init_upcase()
1684 if (!vol->upcase) load_and_init_upcase()
1695 memcpy((char*)vol->upcase + (index++ << PAGE_CACHE_SHIFT), load_and_init_upcase()
1704 vol->upcase_len = i_size >> UCHAR_T_SIZE_BITS; load_and_init_upcase()
1716 if (max > vol->upcase_len) load_and_init_upcase()
1717 max = vol->upcase_len; load_and_init_upcase()
1719 if (vol->upcase[i] != default_upcase[i]) load_and_init_upcase()
1722 ntfs_free(vol->upcase); load_and_init_upcase()
1723 vol->upcase = default_upcase; load_and_init_upcase()
1724 vol->upcase_len = max; load_and_init_upcase()
1737 ntfs_free(vol->upcase); load_and_init_upcase()
1738 vol->upcase = NULL; load_and_init_upcase()
1742 vol->upcase = default_upcase; load_and_init_upcase()
1743 vol->upcase_len = default_upcase_len; load_and_init_upcase()
1765 * @vol: ntfs super block describing device whose system files to load
1768 * the ntfs super block @vol.
1772 static bool load_system_files(ntfs_volume *vol) load_system_files() argument
1774 struct super_block *sb = vol->sb; load_system_files()
1786 if (!load_and_init_mft_mirror(vol) || !check_mft_mirror(vol)) { load_system_files()
1793 if (!(vol->on_errors & (ON_ERRORS_REMOUNT_RO | load_system_files()
1798 !vol->mftmirr_ino ? es1 : es2, load_system_files()
1804 !vol->mftmirr_ino ? es1 : es2, es3); load_system_files()
1808 !vol->mftmirr_ino ? es1 : es2, es3); load_system_files()
1810 NVolSetErrors(vol); load_system_files()
1814 vol->mftbmp_ino = ntfs_attr_iget(vol->mft_ino, AT_BITMAP, NULL, 0); load_system_files()
1815 if (IS_ERR(vol->mftbmp_ino)) { load_system_files()
1819 lockdep_set_class(&NTFS_I(vol->mftbmp_ino)->runlist.lock, load_system_files()
1821 lockdep_set_class(&NTFS_I(vol->mftbmp_ino)->mrec_lock, load_system_files()
1823 /* Read upcase table and setup @vol->upcase and @vol->upcase_len. */ load_system_files()
1824 if (!load_and_init_upcase(vol)) load_system_files()
1828 * Read attribute definitions table and setup @vol->attrdef and load_system_files()
1829 * @vol->attrdef_size. load_system_files()
1831 if (!load_and_init_attrdef(vol)) load_system_files()
1839 vol->lcnbmp_ino = ntfs_iget(sb, FILE_Bitmap); load_system_files()
1840 if (IS_ERR(vol->lcnbmp_ino) || is_bad_inode(vol->lcnbmp_ino)) { load_system_files()
1841 if (!IS_ERR(vol->lcnbmp_ino)) load_system_files()
1842 iput(vol->lcnbmp_ino); load_system_files()
1845 lockdep_set_class(&NTFS_I(vol->lcnbmp_ino)->runlist.lock, load_system_files()
1847 lockdep_set_class(&NTFS_I(vol->lcnbmp_ino)->mrec_lock, load_system_files()
1850 NInoSetSparseDisabled(NTFS_I(vol->lcnbmp_ino)); load_system_files()
1851 if ((vol->nr_clusters + 7) >> 3 > i_size_read(vol->lcnbmp_ino)) { load_system_files()
1852 iput(vol->lcnbmp_ino); load_system_files()
1861 vol->vol_ino = ntfs_iget(sb, FILE_Volume); load_system_files()
1862 if (IS_ERR(vol->vol_ino) || is_bad_inode(vol->vol_ino)) { load_system_files()
1863 if (!IS_ERR(vol->vol_ino)) load_system_files()
1864 iput(vol->vol_ino); load_system_files()
1869 m = map_mft_record(NTFS_I(vol->vol_ino)); load_system_files()
1872 iput(vol->vol_ino); load_system_files()
1875 if (!(ctx = ntfs_attr_get_search_ctx(NTFS_I(vol->vol_ino), m))) { load_system_files()
1884 unmap_mft_record(NTFS_I(vol->vol_ino)); load_system_files()
1895 vol->vol_flags = vi->flags; load_system_files()
1896 vol->major_ver = vi->major_ver; load_system_files()
1897 vol->minor_ver = vi->minor_ver; load_system_files()
1899 unmap_mft_record(NTFS_I(vol->vol_ino)); load_system_files()
1900 pr_info("volume version %i.%i.\n", vol->major_ver, load_system_files()
1901 vol->minor_ver); load_system_files()
1902 if (vol->major_ver < 3 && NVolSparseEnabled(vol)) { load_system_files()
1903 ntfs_warning(vol->sb, "Disabling sparse support due to NTFS " load_system_files()
1905 "3.0).", vol->major_ver, vol->minor_ver); load_system_files()
1906 NVolClearSparseEnabled(vol); load_system_files()
1910 if (vol->vol_flags & VOLUME_MUST_MOUNT_RO_MASK) { load_system_files()
1919 if (vol->vol_flags & VOLUME_IS_DIRTY) load_system_files()
1921 else if (vol->vol_flags & VOLUME_MODIFIED_BY_CHKDSK) { load_system_files()
1928 (unsigned)le16_to_cpu(vol->vol_flags)); load_system_files()
1932 if (!(vol->on_errors & (ON_ERRORS_REMOUNT_RO | load_system_files()
1955 if (!load_and_check_logfile(vol, &rp) || load_system_files()
1956 !ntfs_is_logfile_clean(vol->logfile_ino, rp)) { load_system_files()
1962 es1 = !vol->logfile_ino ? es1a : es1b; load_system_files()
1965 if (!(vol->on_errors & (ON_ERRORS_REMOUNT_RO | load_system_files()
1971 if (vol->logfile_ino) { load_system_files()
1983 NVolSetErrors(vol); load_system_files()
1988 vol->root_ino = ntfs_iget(sb, FILE_root); load_system_files()
1989 if (IS_ERR(vol->root_ino) || is_bad_inode(vol->root_ino)) { load_system_files()
1990 if (!IS_ERR(vol->root_ino)) load_system_files()
1991 iput(vol->root_ino); load_system_files()
2003 err = check_windows_hibernation_status(vol); load_system_files()
2014 if (!(vol->on_errors & (ON_ERRORS_REMOUNT_RO | load_system_files()
2028 NVolSetErrors(vol); load_system_files()
2032 ntfs_set_volume_flags(vol, VOLUME_IS_DIRTY)) { load_system_files()
2038 if (!(vol->on_errors & (ON_ERRORS_REMOUNT_RO | load_system_files()
2059 if (!(sb->s_flags & MS_RDONLY) && (vol->major_ver > 1) && load_system_files()
2060 ntfs_set_volume_flags(vol, VOLUME_MOUNTED_ON_NT4)) { load_system_files()
2065 if (!(vol->on_errors & (ON_ERRORS_REMOUNT_RO | load_system_files()
2074 NVolSetErrors(vol); load_system_files()
2079 !ntfs_empty_logfile(vol->logfile_ino)) { load_system_files()
2084 if (!(vol->on_errors & (ON_ERRORS_REMOUNT_RO | load_system_files()
2093 NVolSetErrors(vol); load_system_files()
2097 if (unlikely(vol->major_ver < 3)) load_system_files()
2101 vol->secure_ino = ntfs_iget(sb, FILE_Secure); load_system_files()
2102 if (IS_ERR(vol->secure_ino) || is_bad_inode(vol->secure_ino)) { load_system_files()
2103 if (!IS_ERR(vol->secure_ino)) load_system_files()
2104 iput(vol->secure_ino); load_system_files()
2110 vol->extend_ino = ntfs_iget(sb, FILE_Extend); load_system_files()
2111 if (IS_ERR(vol->extend_ino) || is_bad_inode(vol->extend_ino)) { load_system_files()
2112 if (!IS_ERR(vol->extend_ino)) load_system_files()
2113 iput(vol->extend_ino); load_system_files()
2119 if (!load_and_init_quota(vol)) { load_system_files()
2125 if (!(vol->on_errors & (ON_ERRORS_REMOUNT_RO | load_system_files()
2139 NVolSetErrors(vol); load_system_files()
2143 !ntfs_mark_quotas_out_of_date(vol)) { load_system_files()
2148 if (!(vol->on_errors & (ON_ERRORS_REMOUNT_RO | load_system_files()
2157 NVolSetErrors(vol); load_system_files()
2163 if (!load_and_init_usnjrnl(vol)) { load_system_files()
2169 if (!(vol->on_errors & (ON_ERRORS_REMOUNT_RO | load_system_files()
2183 NVolSetErrors(vol); load_system_files()
2186 if (!(sb->s_flags & MS_RDONLY) && !ntfs_stamp_usnjrnl(vol)) { load_system_files()
2192 if (!(vol->on_errors & (ON_ERRORS_REMOUNT_RO | load_system_files()
2201 NVolSetErrors(vol); load_system_files()
2207 if (vol->usnjrnl_j_ino) load_system_files()
2208 iput(vol->usnjrnl_j_ino); load_system_files()
2209 if (vol->usnjrnl_max_ino) load_system_files()
2210 iput(vol->usnjrnl_max_ino); load_system_files()
2211 if (vol->usnjrnl_ino) load_system_files()
2212 iput(vol->usnjrnl_ino); load_system_files()
2214 if (vol->quota_q_ino) load_system_files()
2215 iput(vol->quota_q_ino); load_system_files()
2216 if (vol->quota_ino) load_system_files()
2217 iput(vol->quota_ino); load_system_files()
2218 iput(vol->extend_ino); load_system_files()
2221 iput(vol->secure_ino); load_system_files()
2223 iput(vol->root_ino); load_system_files()
2226 if (vol->logfile_ino) load_system_files()
2227 iput(vol->logfile_ino); load_system_files()
2230 iput(vol->vol_ino); load_system_files()
2232 iput(vol->lcnbmp_ino); load_system_files()
2234 vol->attrdef_size = 0; load_system_files()
2235 if (vol->attrdef) { load_system_files()
2236 ntfs_free(vol->attrdef); load_system_files()
2237 vol->attrdef = NULL; load_system_files()
2242 vol->upcase_len = 0; load_system_files()
2244 if (vol->upcase == default_upcase) { load_system_files()
2246 vol->upcase = NULL; load_system_files()
2249 if (vol->upcase) { load_system_files()
2250 ntfs_free(vol->upcase); load_system_files()
2251 vol->upcase = NULL; load_system_files()
2254 iput(vol->mftbmp_ino); load_system_files()
2257 if (vol->mftmirr_ino) load_system_files()
2258 iput(vol->mftmirr_ino); load_system_files()
2274 ntfs_volume *vol = NTFS_SB(sb); ntfs_put_super() local
2283 ntfs_commit_inode(vol->vol_ino); ntfs_put_super()
2286 if (vol->major_ver >= 3) { ntfs_put_super()
2287 if (vol->usnjrnl_j_ino) ntfs_put_super()
2288 ntfs_commit_inode(vol->usnjrnl_j_ino); ntfs_put_super()
2289 if (vol->usnjrnl_max_ino) ntfs_put_super()
2290 ntfs_commit_inode(vol->usnjrnl_max_ino); ntfs_put_super()
2291 if (vol->usnjrnl_ino) ntfs_put_super()
2292 ntfs_commit_inode(vol->usnjrnl_ino); ntfs_put_super()
2293 if (vol->quota_q_ino) ntfs_put_super()
2294 ntfs_commit_inode(vol->quota_q_ino); ntfs_put_super()
2295 if (vol->quota_ino) ntfs_put_super()
2296 ntfs_commit_inode(vol->quota_ino); ntfs_put_super()
2297 if (vol->extend_ino) ntfs_put_super()
2298 ntfs_commit_inode(vol->extend_ino); ntfs_put_super()
2299 if (vol->secure_ino) ntfs_put_super()
2300 ntfs_commit_inode(vol->secure_ino); ntfs_put_super()
2303 ntfs_commit_inode(vol->root_ino); ntfs_put_super()
2305 down_write(&vol->lcnbmp_lock); ntfs_put_super()
2306 ntfs_commit_inode(vol->lcnbmp_ino); ntfs_put_super()
2307 up_write(&vol->lcnbmp_lock); ntfs_put_super()
2309 down_write(&vol->mftbmp_lock); ntfs_put_super()
2310 ntfs_commit_inode(vol->mftbmp_ino); ntfs_put_super()
2311 up_write(&vol->mftbmp_lock); ntfs_put_super()
2313 if (vol->logfile_ino) ntfs_put_super()
2314 ntfs_commit_inode(vol->logfile_ino); ntfs_put_super()
2316 if (vol->mftmirr_ino) ntfs_put_super()
2317 ntfs_commit_inode(vol->mftmirr_ino); ntfs_put_super()
2318 ntfs_commit_inode(vol->mft_ino); ntfs_put_super()
2325 if (!NVolErrors(vol)) { ntfs_put_super()
2326 if (ntfs_clear_volume_flags(vol, VOLUME_IS_DIRTY)) ntfs_put_super()
2330 ntfs_commit_inode(vol->vol_ino); ntfs_put_super()
2331 ntfs_commit_inode(vol->root_ino); ntfs_put_super()
2332 if (vol->mftmirr_ino) ntfs_put_super()
2333 ntfs_commit_inode(vol->mftmirr_ino); ntfs_put_super()
2334 ntfs_commit_inode(vol->mft_ino); ntfs_put_super()
2342 iput(vol->vol_ino); ntfs_put_super()
2343 vol->vol_ino = NULL; ntfs_put_super()
2346 if (vol->major_ver >= 3) { ntfs_put_super()
2348 if (vol->usnjrnl_j_ino) { ntfs_put_super()
2349 iput(vol->usnjrnl_j_ino); ntfs_put_super()
2350 vol->usnjrnl_j_ino = NULL; ntfs_put_super()
2352 if (vol->usnjrnl_max_ino) { ntfs_put_super()
2353 iput(vol->usnjrnl_max_ino); ntfs_put_super()
2354 vol->usnjrnl_max_ino = NULL; ntfs_put_super()
2356 if (vol->usnjrnl_ino) { ntfs_put_super()
2357 iput(vol->usnjrnl_ino); ntfs_put_super()
2358 vol->usnjrnl_ino = NULL; ntfs_put_super()
2360 if (vol->quota_q_ino) { ntfs_put_super()
2361 iput(vol->quota_q_ino); ntfs_put_super()
2362 vol->quota_q_ino = NULL; ntfs_put_super()
2364 if (vol->quota_ino) { ntfs_put_super()
2365 iput(vol->quota_ino); ntfs_put_super()
2366 vol->quota_ino = NULL; ntfs_put_super()
2369 if (vol->extend_ino) { ntfs_put_super()
2370 iput(vol->extend_ino); ntfs_put_super()
2371 vol->extend_ino = NULL; ntfs_put_super()
2373 if (vol->secure_ino) { ntfs_put_super()
2374 iput(vol->secure_ino); ntfs_put_super()
2375 vol->secure_ino = NULL; ntfs_put_super()
2379 iput(vol->root_ino); ntfs_put_super()
2380 vol->root_ino = NULL; ntfs_put_super()
2382 down_write(&vol->lcnbmp_lock); ntfs_put_super()
2383 iput(vol->lcnbmp_ino); ntfs_put_super()
2384 vol->lcnbmp_ino = NULL; ntfs_put_super()
2385 up_write(&vol->lcnbmp_lock); ntfs_put_super()
2387 down_write(&vol->mftbmp_lock); ntfs_put_super()
2388 iput(vol->mftbmp_ino); ntfs_put_super()
2389 vol->mftbmp_ino = NULL; ntfs_put_super()
2390 up_write(&vol->mftbmp_lock); ntfs_put_super()
2393 if (vol->logfile_ino) { ntfs_put_super()
2394 iput(vol->logfile_ino); ntfs_put_super()
2395 vol->logfile_ino = NULL; ntfs_put_super()
2397 if (vol->mftmirr_ino) { ntfs_put_super()
2399 ntfs_commit_inode(vol->mftmirr_ino); ntfs_put_super()
2400 ntfs_commit_inode(vol->mft_ino); ntfs_put_super()
2401 iput(vol->mftmirr_ino); ntfs_put_super()
2402 vol->mftmirr_ino = NULL; ntfs_put_super()
2409 ntfs_commit_inode(vol->mft_ino); ntfs_put_super()
2410 write_inode_now(vol->mft_ino, 1); ntfs_put_super()
2413 iput(vol->mft_ino); ntfs_put_super()
2414 vol->mft_ino = NULL; ntfs_put_super()
2417 vol->attrdef_size = 0; ntfs_put_super()
2418 if (vol->attrdef) { ntfs_put_super()
2419 ntfs_free(vol->attrdef); ntfs_put_super()
2420 vol->attrdef = NULL; ntfs_put_super()
2422 vol->upcase_len = 0; ntfs_put_super()
2428 if (vol->upcase == default_upcase) { ntfs_put_super()
2430 vol->upcase = NULL; ntfs_put_super()
2436 if (vol->cluster_size <= 4096 && !--ntfs_nr_compression_users) ntfs_put_super()
2439 if (vol->upcase) { ntfs_put_super()
2440 ntfs_free(vol->upcase); ntfs_put_super()
2441 vol->upcase = NULL; ntfs_put_super()
2444 unload_nls(vol->nls_map); ntfs_put_super()
2447 kfree(vol); ntfs_put_super()
2452 * @vol: ntfs volume for which to obtain free cluster count
2454 * Calculate the number of free clusters on the mounted NTFS volume @vol. We
2469 static s64 get_nr_free_clusters(ntfs_volume *vol) get_nr_free_clusters() argument
2471 s64 nr_free = vol->nr_clusters; get_nr_free_clusters()
2472 struct address_space *mapping = vol->lcnbmp_ino->i_mapping; get_nr_free_clusters()
2478 down_read(&vol->lcnbmp_lock); get_nr_free_clusters()
2484 max_index = (((vol->nr_clusters + 7) >> 3) + PAGE_CACHE_SIZE - 1) >> get_nr_free_clusters()
2522 if (vol->nr_clusters & 63) get_nr_free_clusters()
2523 nr_free += 64 - (vol->nr_clusters & 63); get_nr_free_clusters()
2524 up_read(&vol->lcnbmp_lock); get_nr_free_clusters()
2534 * @vol: ntfs volume for which to obtain free inode count
2539 * volume @vol. We actually calculate the number of mft records in use instead
2549 static unsigned long __get_nr_free_mft_records(ntfs_volume *vol, __get_nr_free_mft_records() argument
2552 struct address_space *mapping = vol->mftbmp_ino->i_mapping; __get_nr_free_mft_records()
2619 ntfs_volume *vol = NTFS_SB(sb); ntfs_statfs() local
2620 ntfs_inode *mft_ni = NTFS_I(vol->mft_ino); ntfs_statfs()
2634 sfs->f_blocks = vol->nr_clusters << vol->cluster_size_bits >> ntfs_statfs()
2637 size = get_nr_free_clusters(vol) << vol->cluster_size_bits >> ntfs_statfs()
2644 down_read(&vol->mftbmp_lock); ntfs_statfs()
2646 size = i_size_read(vol->mft_ino) >> vol->mft_record_size_bits; ntfs_statfs()
2652 max_index = ((((mft_ni->initialized_size >> vol->mft_record_size_bits) ntfs_statfs()
2658 sfs->f_ffree = __get_nr_free_mft_records(vol, size, max_index); ntfs_statfs()
2659 up_read(&vol->mftbmp_lock); ntfs_statfs()
2670 sfs->f_fsid.val[0] = vol->serial_no & 0xffffffff; ntfs_statfs()
2671 sfs->f_fsid.val[1] = (vol->serial_no >> 32) & 0xffffffff; ntfs_statfs()
2723 ntfs_volume *vol; ntfs_fill_super() local
2745 vol = NTFS_SB(sb); ntfs_fill_super()
2746 if (!vol) { ntfs_fill_super()
2754 *vol = (ntfs_volume) { ntfs_fill_super()
2765 init_rwsem(&vol->mftbmp_lock); ntfs_fill_super()
2766 init_rwsem(&vol->lcnbmp_lock); ntfs_fill_super()
2769 NVolSetSparseEnabled(vol); ntfs_fill_super()
2772 if (!parse_options(vol, (char*)opt)) ntfs_fill_super()
2805 vol->nr_blocks = i_size_read(sb->s_bdev->bd_inode) >> ntfs_fill_super()
2817 result = parse_ntfs_boot_sector(vol, (NTFS_BOOT_SECTOR*)bh->b_data); ntfs_fill_super()
2834 if (vol->sector_size > blocksize) { ntfs_fill_super()
2835 blocksize = sb_set_blocksize(sb, vol->sector_size); ntfs_fill_super()
2836 if (blocksize != vol->sector_size) { ntfs_fill_super()
2840 vol->sector_size); ntfs_fill_super()
2844 vol->nr_blocks = i_size_read(sb->s_bdev->bd_inode) >> ntfs_fill_super()
2851 ntfs_setup_allocators(vol); ntfs_fill_super()
2891 if (vol->cluster_size <= 4096 && !ntfs_nr_compression_users++) { ntfs_fill_super()
2918 if (!load_system_files(vol)) { ntfs_fill_super()
2924 ihold(vol->root_ino); ntfs_fill_super()
2925 if ((sb->s_root = d_make_root(vol->root_ino))) { ntfs_fill_super()
2943 iput(vol->vol_ino); ntfs_fill_super()
2944 vol->vol_ino = NULL; ntfs_fill_super()
2946 if (vol->major_ver >= 3) { ntfs_fill_super()
2948 if (vol->usnjrnl_j_ino) { ntfs_fill_super()
2949 iput(vol->usnjrnl_j_ino); ntfs_fill_super()
2950 vol->usnjrnl_j_ino = NULL; ntfs_fill_super()
2952 if (vol->usnjrnl_max_ino) { ntfs_fill_super()
2953 iput(vol->usnjrnl_max_ino); ntfs_fill_super()
2954 vol->usnjrnl_max_ino = NULL; ntfs_fill_super()
2956 if (vol->usnjrnl_ino) { ntfs_fill_super()
2957 iput(vol->usnjrnl_ino); ntfs_fill_super()
2958 vol->usnjrnl_ino = NULL; ntfs_fill_super()
2960 if (vol->quota_q_ino) { ntfs_fill_super()
2961 iput(vol->quota_q_ino); ntfs_fill_super()
2962 vol->quota_q_ino = NULL; ntfs_fill_super()
2964 if (vol->quota_ino) { ntfs_fill_super()
2965 iput(vol->quota_ino); ntfs_fill_super()
2966 vol->quota_ino = NULL; ntfs_fill_super()
2969 if (vol->extend_ino) { ntfs_fill_super()
2970 iput(vol->extend_ino); ntfs_fill_super()
2971 vol->extend_ino = NULL; ntfs_fill_super()
2973 if (vol->secure_ino) { ntfs_fill_super()
2974 iput(vol->secure_ino); ntfs_fill_super()
2975 vol->secure_ino = NULL; ntfs_fill_super()
2978 iput(vol->root_ino); ntfs_fill_super()
2979 vol->root_ino = NULL; ntfs_fill_super()
2980 iput(vol->lcnbmp_ino); ntfs_fill_super()
2981 vol->lcnbmp_ino = NULL; ntfs_fill_super()
2982 iput(vol->mftbmp_ino); ntfs_fill_super()
2983 vol->mftbmp_ino = NULL; ntfs_fill_super()
2985 if (vol->logfile_ino) { ntfs_fill_super()
2986 iput(vol->logfile_ino); ntfs_fill_super()
2987 vol->logfile_ino = NULL; ntfs_fill_super()
2989 if (vol->mftmirr_ino) { ntfs_fill_super()
2990 iput(vol->mftmirr_ino); ntfs_fill_super()
2991 vol->mftmirr_ino = NULL; ntfs_fill_super()
2995 vol->attrdef_size = 0; ntfs_fill_super()
2996 if (vol->attrdef) { ntfs_fill_super()
2997 ntfs_free(vol->attrdef); ntfs_fill_super()
2998 vol->attrdef = NULL; ntfs_fill_super()
3000 vol->upcase_len = 0; ntfs_fill_super()
3002 if (vol->upcase == default_upcase) { ntfs_fill_super()
3004 vol->upcase = NULL; ntfs_fill_super()
3007 if (vol->upcase) { ntfs_fill_super()
3008 ntfs_free(vol->upcase); ntfs_fill_super()
3009 vol->upcase = NULL; ntfs_fill_super()
3011 if (vol->nls_map) { ntfs_fill_super()
3012 unload_nls(vol->nls_map); ntfs_fill_super()
3013 vol->nls_map = NULL; ntfs_fill_super()
3026 if (vol->cluster_size <= 4096 && !--ntfs_nr_compression_users) ntfs_fill_super()
3031 if (vol->mft_ino && vol->mft_ino != tmp_ino) ntfs_fill_super()
3032 iput(vol->mft_ino); ntfs_fill_super()
3033 vol->mft_ino = NULL; ntfs_fill_super()
3037 kfree(vol); ntfs_fill_super()
H A Dlcnalloc.c38 * @vol: mounted ntfs volume on which to free the clusters
41 * Free all the clusters described by the runlist @rl on the volume @vol. In
50 int ntfs_cluster_free_from_rl_nolock(ntfs_volume *vol, ntfs_cluster_free_from_rl_nolock() argument
53 struct inode *lcnbmp_vi = vol->lcnbmp_ino; ntfs_cluster_free_from_rl_nolock()
74 * @vol: mounted ntfs volume on which to allocate the clusters
83 * @vol. @zone is either DATA_ZONE for allocation of normal clusters or
146 runlist_element *ntfs_cluster_alloc(ntfs_volume *vol, const VCN start_vcn, ntfs_cluster_alloc() argument
168 BUG_ON(!vol); ntfs_cluster_alloc()
169 lcnbmp_vi = vol->lcnbmp_ino; ntfs_cluster_alloc()
181 down_write(&vol->lcnbmp_lock); ntfs_cluster_alloc()
203 zone_start = vol->data1_zone_pos; ntfs_cluster_alloc()
205 zone_start = vol->mft_zone_pos; ntfs_cluster_alloc()
213 } else if (zone == DATA_ZONE && zone_start >= vol->mft_zone_start && ntfs_cluster_alloc()
214 zone_start < vol->mft_zone_end) { ntfs_cluster_alloc()
215 zone_start = vol->mft_zone_end; ntfs_cluster_alloc()
221 } else if (zone == MFT_ZONE && (zone_start < vol->mft_zone_start || ntfs_cluster_alloc()
222 zone_start >= vol->mft_zone_end)) { ntfs_cluster_alloc()
223 zone_start = vol->mft_lcn; ntfs_cluster_alloc()
224 if (!vol->mft_zone_end) ntfs_cluster_alloc()
233 zone_end = vol->mft_zone_end; ntfs_cluster_alloc()
238 if (zone_start >= vol->mft_zone_end) { ntfs_cluster_alloc()
239 zone_end = vol->nr_clusters; ntfs_cluster_alloc()
242 zone_end = vol->mft_zone_start; ntfs_cluster_alloc()
289 ntfs_error(vol->sb, "Failed to map page."); ntfs_cluster_alloc()
346 ntfs_error(vol->sb, "Failed to " ntfs_cluster_alloc()
430 "vol->mft_zone_pos " ntfs_cluster_alloc()
433 vol->mft_zone_pos); ntfs_cluster_alloc()
434 if (tc >= vol->mft_zone_end) { ntfs_cluster_alloc()
435 vol->mft_zone_pos = ntfs_cluster_alloc()
436 vol->mft_lcn; ntfs_cluster_alloc()
437 if (!vol->mft_zone_end) ntfs_cluster_alloc()
438 vol->mft_zone_pos = 0; ntfs_cluster_alloc()
440 vol->mft_zone_pos || ntfs_cluster_alloc()
441 tc > vol->mft_zone_pos) ntfs_cluster_alloc()
442 && tc >= vol->mft_lcn) ntfs_cluster_alloc()
443 vol->mft_zone_pos = tc; ntfs_cluster_alloc()
445 "vol->mft_zone_pos " ntfs_cluster_alloc()
448 vol->mft_zone_pos); ntfs_cluster_alloc()
452 "vol->data1_zone_pos " ntfs_cluster_alloc()
455 vol->data1_zone_pos); ntfs_cluster_alloc()
456 if (tc >= vol->nr_clusters) ntfs_cluster_alloc()
457 vol->data1_zone_pos = ntfs_cluster_alloc()
458 vol->mft_zone_end; ntfs_cluster_alloc()
460 vol->data1_zone_pos || ntfs_cluster_alloc()
461 tc > vol->data1_zone_pos) ntfs_cluster_alloc()
462 && tc >= vol->mft_zone_end) ntfs_cluster_alloc()
463 vol->data1_zone_pos = tc; ntfs_cluster_alloc()
465 "vol->data1_zone_pos " ntfs_cluster_alloc()
468 vol->data1_zone_pos); ntfs_cluster_alloc()
472 "vol->data2_zone_pos " ntfs_cluster_alloc()
475 vol->data2_zone_pos); ntfs_cluster_alloc()
476 if (tc >= vol->mft_zone_start) ntfs_cluster_alloc()
477 vol->data2_zone_pos = 0; ntfs_cluster_alloc()
479 vol->data2_zone_pos || ntfs_cluster_alloc()
480 tc > vol->data2_zone_pos) ntfs_cluster_alloc()
481 vol->data2_zone_pos = tc; ntfs_cluster_alloc()
483 "vol->data2_zone_pos " ntfs_cluster_alloc()
486 vol->data2_zone_pos); ntfs_cluster_alloc()
519 zone_start = vol->mft_zone_start; ntfs_cluster_alloc()
522 zone_start = vol->mft_zone_end; ntfs_cluster_alloc()
561 "vol->mft_zone_pos " ntfs_cluster_alloc()
564 vol->mft_zone_pos); ntfs_cluster_alloc()
567 if (tc >= vol->mft_zone_end) { ntfs_cluster_alloc()
568 vol->mft_zone_pos = ntfs_cluster_alloc()
569 vol->mft_lcn; ntfs_cluster_alloc()
570 if (!vol->mft_zone_end) ntfs_cluster_alloc()
571 vol->mft_zone_pos = 0; ntfs_cluster_alloc()
573 vol->mft_zone_pos || ntfs_cluster_alloc()
574 tc > vol->mft_zone_pos) ntfs_cluster_alloc()
575 && tc >= vol->mft_lcn) ntfs_cluster_alloc()
576 vol->mft_zone_pos = tc; ntfs_cluster_alloc()
578 "vol->mft_zone_pos " ntfs_cluster_alloc()
581 vol->mft_zone_pos); ntfs_cluster_alloc()
586 vol->data1_zone_pos; ntfs_cluster_alloc()
587 zone_end = vol->nr_clusters; ntfs_cluster_alloc()
588 if (zone_start == vol->mft_zone_end) ntfs_cluster_alloc()
591 vol->data1_zone_pos = zone_start = ntfs_cluster_alloc()
592 vol->mft_zone_end; ntfs_cluster_alloc()
604 "vol->data1_zone_pos " ntfs_cluster_alloc()
607 vol->data1_zone_pos); ntfs_cluster_alloc()
610 if (tc >= vol->nr_clusters) ntfs_cluster_alloc()
611 vol->data1_zone_pos = ntfs_cluster_alloc()
612 vol->mft_zone_end; ntfs_cluster_alloc()
614 vol->data1_zone_pos || ntfs_cluster_alloc()
615 tc > vol->data1_zone_pos) ntfs_cluster_alloc()
616 && tc >= vol->mft_zone_end) ntfs_cluster_alloc()
617 vol->data1_zone_pos = tc; ntfs_cluster_alloc()
619 "vol->data1_zone_pos " ntfs_cluster_alloc()
622 vol->data1_zone_pos); ntfs_cluster_alloc()
627 vol->data2_zone_pos; ntfs_cluster_alloc()
628 zone_end = vol->mft_zone_start; ntfs_cluster_alloc()
632 vol->data2_zone_pos = zone_start = ntfs_cluster_alloc()
645 "vol->data2_zone_pos " ntfs_cluster_alloc()
648 vol->data2_zone_pos); ntfs_cluster_alloc()
651 if (tc >= vol->mft_zone_start) ntfs_cluster_alloc()
652 vol->data2_zone_pos = 0; ntfs_cluster_alloc()
654 vol->data2_zone_pos || ntfs_cluster_alloc()
655 tc > vol->data2_zone_pos) ntfs_cluster_alloc()
656 vol->data2_zone_pos = tc; ntfs_cluster_alloc()
658 "vol->data2_zone_pos " ntfs_cluster_alloc()
661 vol->data2_zone_pos); ntfs_cluster_alloc()
690 mft_zone_size = vol->mft_zone_end - vol->mft_zone_start; ntfs_cluster_alloc()
691 ntfs_debug("vol->mft_zone_start 0x%llx, vol->mft_zone_end " ntfs_cluster_alloc()
693 (unsigned long long)vol->mft_zone_start, ntfs_cluster_alloc()
694 (unsigned long long)vol->mft_zone_end, ntfs_cluster_alloc()
703 zone_end = vol->mft_zone_end; ntfs_cluster_alloc()
706 vol->mft_zone_end = vol->mft_zone_start + mft_zone_size; ntfs_cluster_alloc()
708 vol->data2_zone_pos = vol->mft_zone_start = ntfs_cluster_alloc()
709 vol->mft_zone_end = 0; ntfs_cluster_alloc()
710 if (vol->mft_zone_pos >= vol->mft_zone_end) { ntfs_cluster_alloc()
711 vol->mft_zone_pos = vol->mft_lcn; ntfs_cluster_alloc()
712 if (!vol->mft_zone_end) ntfs_cluster_alloc()
713 vol->mft_zone_pos = 0; ntfs_cluster_alloc()
716 vol->data1_zone_pos = vol->mft_zone_end; ntfs_cluster_alloc()
721 "vol->mft_zone_start 0x%llx, " ntfs_cluster_alloc()
722 "vol->mft_zone_end 0x%llx, " ntfs_cluster_alloc()
723 "vol->mft_zone_pos 0x%llx, search_zone 2, " ntfs_cluster_alloc()
725 "zone_end 0x%llx, vol->data1_zone_pos 0x%llx, " ntfs_cluster_alloc()
728 (unsigned long long)vol->mft_zone_start, ntfs_cluster_alloc()
729 (unsigned long long)vol->mft_zone_end, ntfs_cluster_alloc()
730 (unsigned long long)vol->mft_zone_pos, ntfs_cluster_alloc()
733 (unsigned long long)vol->data1_zone_pos); ntfs_cluster_alloc()
754 up_write(&vol->lcnbmp_lock); ntfs_cluster_alloc()
758 ntfs_error(vol->sb, "Failed to allocate clusters, aborting " ntfs_cluster_alloc()
772 err2 = ntfs_cluster_free_from_rl_nolock(vol, rl); ntfs_cluster_alloc()
774 ntfs_error(vol->sb, "Failed to rollback (error %i). " ntfs_cluster_alloc()
777 NVolSetErrors(vol); ntfs_cluster_alloc()
784 (long long)vol->data1_zone_pos); ntfs_cluster_alloc()
785 up_write(&vol->lcnbmp_lock); ntfs_cluster_alloc()
853 ntfs_volume *vol; __ntfs_cluster_free() local
863 vol = ni->vol; __ntfs_cluster_free()
864 lcnbmp_vi = vol->lcnbmp_ino; __ntfs_cluster_free()
876 down_write(&vol->lcnbmp_lock); __ntfs_cluster_free()
883 ntfs_error(vol->sb, "Failed to find first runlist " __ntfs_cluster_free()
891 ntfs_error(vol->sb, "First runlist element has " __ntfs_cluster_free()
910 ntfs_error(vol->sb, "Failed to clear first run " __ntfs_cluster_free()
938 ntfs_error(vol->sb, "Failed to map " __ntfs_cluster_free()
947 ntfs_error(vol->sb, "Runlist element " __ntfs_cluster_free()
967 ntfs_error(vol->sb, "Failed to clear " __ntfs_cluster_free()
982 up_write(&vol->lcnbmp_lock); __ntfs_cluster_free()
994 up_write(&vol->lcnbmp_lock); __ntfs_cluster_free()
1004 ntfs_error(vol->sb, "Failed to rollback (error %i). Leaving " __ntfs_cluster_free()
1007 NVolSetErrors(vol); __ntfs_cluster_free()
1009 up_write(&vol->lcnbmp_lock); __ntfs_cluster_free()
1010 ntfs_error(vol->sb, "Aborting (error %i).", err); __ntfs_cluster_free()
H A Dquota.c32 * @vol: ntfs volume on which to mark the quotas out of date
34 * Mark the quotas out of date on the ntfs volume @vol and return 'true' on
37 bool ntfs_mark_quotas_out_of_date(ntfs_volume *vol) ntfs_mark_quotas_out_of_date() argument
45 if (NVolQuotaOutOfDate(vol)) ntfs_mark_quotas_out_of_date()
47 if (!vol->quota_ino || !vol->quota_q_ino) { ntfs_mark_quotas_out_of_date()
48 ntfs_error(vol->sb, "Quota inodes are not open."); ntfs_mark_quotas_out_of_date()
51 mutex_lock(&vol->quota_q_ino->i_mutex); ntfs_mark_quotas_out_of_date()
52 ictx = ntfs_index_ctx_get(NTFS_I(vol->quota_q_ino)); ntfs_mark_quotas_out_of_date()
54 ntfs_error(vol->sb, "Failed to get index context."); ntfs_mark_quotas_out_of_date()
60 ntfs_error(vol->sb, "Quota defaults entry is not " ntfs_mark_quotas_out_of_date()
63 ntfs_error(vol->sb, "Lookup of quota defaults entry " ntfs_mark_quotas_out_of_date()
68 ntfs_error(vol->sb, "Quota defaults entry size is invalid. " ntfs_mark_quotas_out_of_date()
74 ntfs_error(vol->sb, "Quota defaults entry version 0x%x is not " ntfs_mark_quotas_out_of_date()
101 mutex_unlock(&vol->quota_q_ino->i_mutex); ntfs_mark_quotas_out_of_date()
106 NVolSetQuotaOutOfDate(vol); ntfs_mark_quotas_out_of_date()
113 mutex_unlock(&vol->quota_q_ino->i_mutex); ntfs_mark_quotas_out_of_date()
H A Dusnjrnl.c39 * @vol: ntfs volume on which to stamp the transaction log
41 * Stamp the transaction log ($UsnJrnl) on the ntfs volume @vol and return
47 bool ntfs_stamp_usnjrnl(ntfs_volume *vol) ntfs_stamp_usnjrnl() argument
50 if (likely(!NVolUsnJrnlStamped(vol))) { ntfs_stamp_usnjrnl()
55 page = ntfs_map_page(vol->usnjrnl_max_ino->i_mapping, 0); ntfs_stamp_usnjrnl()
57 ntfs_error(vol->sb, "Failed to read from " ntfs_stamp_usnjrnl()
70 i_size_read(vol->usnjrnl_j_ino)); ntfs_stamp_usnjrnl()
72 cpu_to_sle64(i_size_read(vol->usnjrnl_j_ino)); ntfs_stamp_usnjrnl()
78 NVolSetUsnJrnlStamped(vol); ntfs_stamp_usnjrnl()
H A Dmft.c50 ntfs_volume *vol = ni->vol; map_mft_record_page() local
51 struct inode *mft_vi = vol->mft_ino; map_mft_record_page()
63 index = (u64)ni->mft_no << vol->mft_record_size_bits >> map_mft_record_page()
65 ofs = (ni->mft_no << vol->mft_record_size_bits) & ~PAGE_CACHE_MASK; map_mft_record_page()
74 vol->mft_record_size) { map_mft_record_page()
76 ntfs_error(vol->sb, "Attempt to read mft record 0x%lx, " map_mft_record_page()
93 ntfs_error(vol->sb, "Mft record 0x%lx is corrupt. " map_mft_record_page()
97 NVolSetErrors(vol); map_mft_record_page()
173 ntfs_error(ni->vol->sb, "Failed with error code %lu.", -PTR_ERR(m)); map_mft_record()
293 ntfs_error(base_ni->vol->sb, "Found stale extent mft " map_extent_mft_record()
299 ntfs_error(base_ni->vol->sb, "Failed to map extent " map_extent_mft_record()
304 ni = ntfs_new_extent_inode(base_ni->vol->sb, mft_no); map_extent_mft_record()
310 ni->vol = base_ni->vol; map_extent_mft_record()
324 ntfs_error(base_ni->vol->sb, "Found stale extent mft " map_extent_mft_record()
337 ntfs_error(base_ni->vol->sb, "Failed to allocate " map_extent_mft_record()
418 * @vol: ntfs volume on which the mft record to synchronize resides
423 * number @mft_no to the mft mirror ($MFTMirr) of the ntfs volume @vol,
438 static int ntfs_sync_mft_mirror_umount(ntfs_volume *vol, ntfs_sync_mft_mirror_umount() argument
441 BUG_ON(vol->mftmirr_ino); ntfs_sync_mft_mirror_umount()
442 ntfs_error(vol->sb, "Umount time mft mirror syncing is not " ntfs_sync_mft_mirror_umount()
449 * @vol: ntfs volume on which the mft record to synchronize resides
455 * number @mft_no to the mft mirror ($MFTMirr) of the ntfs volume @vol.
458 * in the ntfs volume @vol.
465 int ntfs_sync_mft_mirror(ntfs_volume *vol, const unsigned long mft_no, ntfs_sync_mft_mirror() argument
469 unsigned int blocksize = vol->sb->s_blocksize; ntfs_sync_mft_mirror()
470 int max_bhs = vol->mft_record_size / blocksize; ntfs_sync_mft_mirror()
477 unsigned char blocksize_bits = vol->sb->s_blocksize_bits; ntfs_sync_mft_mirror()
481 if (unlikely(!vol->mftmirr_ino)) { ntfs_sync_mft_mirror()
483 err = ntfs_sync_mft_mirror_umount(vol, mft_no, m); ntfs_sync_mft_mirror()
489 page = ntfs_map_page(vol->mftmirr_ino->i_mapping, mft_no >> ntfs_sync_mft_mirror()
490 (PAGE_CACHE_SHIFT - vol->mft_record_size_bits)); ntfs_sync_mft_mirror()
492 ntfs_error(vol->sb, "Failed to map mft mirror page."); ntfs_sync_mft_mirror()
500 page_ofs = (mft_no << vol->mft_record_size_bits) & ~PAGE_CACHE_MASK; ntfs_sync_mft_mirror()
504 memcpy(kmirr, m, vol->mft_record_size); ntfs_sync_mft_mirror()
524 m_end = m_start + vol->mft_record_size; ntfs_sync_mft_mirror()
538 bh->b_bdev = vol->sb->s_bdev; ntfs_sync_mft_mirror()
540 vcn = ((VCN)mft_no << vol->mft_record_size_bits) + ntfs_sync_mft_mirror()
542 vcn_ofs = vcn & vol->cluster_size_mask; ntfs_sync_mft_mirror()
543 vcn >>= vol->cluster_size_bits; ntfs_sync_mft_mirror()
545 down_read(&NTFS_I(vol->mftmirr_ino)-> ntfs_sync_mft_mirror()
547 rl = NTFS_I(vol->mftmirr_ino)->runlist.rl; ntfs_sync_mft_mirror()
562 vol->cluster_size_bits) + ntfs_sync_mft_mirror()
567 ntfs_error(vol->sb, "Cannot write mft mirror " ntfs_sync_mft_mirror()
583 up_read(&NTFS_I(vol->mftmirr_ino)->runlist.lock); ntfs_sync_mft_mirror()
626 ntfs_error(vol->sb, "I/O error while writing mft mirror " ntfs_sync_mft_mirror()
629 ntfs_error(vol->sb, "Failed to synchronize $MFTMirr (error " ntfs_sync_mft_mirror()
633 NVolSetErrors(vol); ntfs_sync_mft_mirror()
671 ntfs_volume *vol = ni->vol; write_mft_record_nolock() local
673 unsigned int blocksize = vol->sb->s_blocksize; write_mft_record_nolock()
674 unsigned char blocksize_bits = vol->sb->s_blocksize_bits; write_mft_record_nolock()
675 int max_bhs = vol->mft_record_size / blocksize; write_mft_record_nolock()
700 m_end = m_start + vol->mft_record_size; write_mft_record_nolock()
727 bh->b_bdev = vol->sb->s_bdev; write_mft_record_nolock()
729 vcn = ((VCN)ni->mft_no << vol->mft_record_size_bits) + write_mft_record_nolock()
731 vcn_ofs = vcn & vol->cluster_size_mask; write_mft_record_nolock()
732 vcn >>= vol->cluster_size_bits; write_mft_record_nolock()
734 down_read(&NTFS_I(vol->mft_ino)->runlist.lock); write_mft_record_nolock()
735 rl = NTFS_I(vol->mft_ino)->runlist.rl; write_mft_record_nolock()
746 vol->cluster_size_bits) + write_mft_record_nolock()
751 ntfs_error(vol->sb, "Cannot write mft record " write_mft_record_nolock()
766 up_read(&NTFS_I(vol->mft_ino)->runlist.lock); write_mft_record_nolock()
772 err = pre_write_mst_fixup((NTFS_RECORD*)m, vol->mft_record_size); write_mft_record_nolock()
774 ntfs_error(vol->sb, "Failed to apply mst fixups!"); write_mft_record_nolock()
791 if (!sync && ni->mft_no < vol->mftmirr_size) write_mft_record_nolock()
792 ntfs_sync_mft_mirror(vol, ni->mft_no, m, sync); write_mft_record_nolock()
809 if (sync && ni->mft_no < vol->mftmirr_size) write_mft_record_nolock()
810 ntfs_sync_mft_mirror(vol, ni->mft_no, m, sync); write_mft_record_nolock()
816 ntfs_error(vol->sb, "I/O error while writing mft record " write_mft_record_nolock()
837 ntfs_error(vol->sb, "Not enough memory to write mft record. " write_mft_record_nolock()
842 NVolSetErrors(vol); write_mft_record_nolock()
848 * @vol: [IN] ntfs volume on which the mft record to check resides
854 * @mft_no belonging to the ntfs volume @vol may be written out. If necessary
925 bool ntfs_may_write_mft_record(ntfs_volume *vol, const unsigned long mft_no, ntfs_may_write_mft_record() argument
928 struct super_block *sb = vol->sb; ntfs_may_write_mft_record()
929 struct inode *mft_vi = vol->mft_ino; ntfs_may_write_mft_record()
1114 * @vol: volume on which to search for a free mft record
1118 * @vol.
1129 * Locking: Caller must hold vol->mftbmp_lock for writing.
1131 static int ntfs_mft_bitmap_find_and_alloc_free_rec_nolock(ntfs_volume *vol, ntfs_mft_bitmap_find_and_alloc_free_rec_nolock() argument
1144 mftbmp_mapping = vol->mftbmp_ino->i_mapping; ntfs_mft_bitmap_find_and_alloc_free_rec_nolock()
1149 read_lock_irqsave(&NTFS_I(vol->mft_ino)->size_lock, flags); ntfs_mft_bitmap_find_and_alloc_free_rec_nolock()
1150 pass_end = NTFS_I(vol->mft_ino)->allocated_size >> ntfs_mft_bitmap_find_and_alloc_free_rec_nolock()
1151 vol->mft_record_size_bits; ntfs_mft_bitmap_find_and_alloc_free_rec_nolock()
1152 read_unlock_irqrestore(&NTFS_I(vol->mft_ino)->size_lock, flags); ntfs_mft_bitmap_find_and_alloc_free_rec_nolock()
1153 read_lock_irqsave(&NTFS_I(vol->mftbmp_ino)->size_lock, flags); ntfs_mft_bitmap_find_and_alloc_free_rec_nolock()
1154 ll = NTFS_I(vol->mftbmp_ino)->initialized_size << 3; ntfs_mft_bitmap_find_and_alloc_free_rec_nolock()
1155 read_unlock_irqrestore(&NTFS_I(vol->mftbmp_ino)->size_lock, flags); ntfs_mft_bitmap_find_and_alloc_free_rec_nolock()
1160 data_pos = vol->mft_data_pos; ntfs_mft_bitmap_find_and_alloc_free_rec_nolock()
1195 ntfs_error(vol->sb, "Failed to read mft " ntfs_mft_bitmap_find_and_alloc_free_rec_nolock()
1263 * @vol: volume on which to extend the mft bitmap attribute
1265 * Extend the mft bitmap attribute on the ntfs volume @vol by one cluster.
1272 * Locking: - Caller must hold vol->mftbmp_lock for writing.
1273 * - This function takes NTFS_I(vol->mftbmp_ino)->runlist.lock for
1275 * - This function takes vol->lcnbmp_lock for writing and releases it
1278 static int ntfs_mft_bitmap_extend_allocation_nolock(ntfs_volume *vol) ntfs_mft_bitmap_extend_allocation_nolock() argument
1299 mft_ni = NTFS_I(vol->mft_ino); ntfs_mft_bitmap_extend_allocation_nolock()
1300 mftbmp_ni = NTFS_I(vol->mftbmp_ino); ntfs_mft_bitmap_extend_allocation_nolock()
1310 (ll - 1) >> vol->cluster_size_bits, NULL); ntfs_mft_bitmap_extend_allocation_nolock()
1313 ntfs_error(vol->sb, "Failed to determine last allocated " ntfs_mft_bitmap_extend_allocation_nolock()
1330 page = ntfs_map_page(vol->lcnbmp_ino->i_mapping, ntfs_mft_bitmap_extend_allocation_nolock()
1334 ntfs_error(vol->sb, "Failed to read from lcn bitmap."); ntfs_mft_bitmap_extend_allocation_nolock()
1339 down_write(&vol->lcnbmp_lock); ntfs_mft_bitmap_extend_allocation_nolock()
1345 up_write(&vol->lcnbmp_lock); ntfs_mft_bitmap_extend_allocation_nolock()
1353 up_write(&vol->lcnbmp_lock); ntfs_mft_bitmap_extend_allocation_nolock()
1356 rl2 = ntfs_cluster_alloc(vol, rl[1].vcn, 1, lcn, DATA_ZONE, ntfs_mft_bitmap_extend_allocation_nolock()
1360 ntfs_error(vol->sb, "Failed to allocate a cluster for " ntfs_mft_bitmap_extend_allocation_nolock()
1367 ntfs_error(vol->sb, "Failed to merge runlists for mft " ntfs_mft_bitmap_extend_allocation_nolock()
1369 if (ntfs_cluster_free_from_rl(vol, rl2)) { ntfs_mft_bitmap_extend_allocation_nolock()
1370 ntfs_error(vol->sb, "Failed to deallocate " ntfs_mft_bitmap_extend_allocation_nolock()
1372 NVolSetErrors(vol); ntfs_mft_bitmap_extend_allocation_nolock()
1390 ntfs_error(vol->sb, "Failed to map mft record."); ntfs_mft_bitmap_extend_allocation_nolock()
1396 ntfs_error(vol->sb, "Failed to get search context."); ntfs_mft_bitmap_extend_allocation_nolock()
1404 ntfs_error(vol->sb, "Failed to find last attribute extent of " ntfs_mft_bitmap_extend_allocation_nolock()
1420 mp_size = ntfs_get_size_for_mapping_pairs(vol, rl2, ll, -1); ntfs_mft_bitmap_extend_allocation_nolock()
1422 ntfs_error(vol->sb, "Get size for mapping pairs failed for " ntfs_mft_bitmap_extend_allocation_nolock()
1435 ntfs_error(vol->sb, "Failed to resize attribute " ntfs_mft_bitmap_extend_allocation_nolock()
1444 ntfs_error(vol->sb, "Not enough space in this mft record to " ntfs_mft_bitmap_extend_allocation_nolock()
1452 ret = ntfs_mapping_pairs_build(vol, (u8*)a + ntfs_mft_bitmap_extend_allocation_nolock()
1456 ntfs_error(vol->sb, "Failed to build mapping pairs array for " ntfs_mft_bitmap_extend_allocation_nolock()
1478 ntfs_error(vol->sb, "Failed to find first attribute " ntfs_mft_bitmap_extend_allocation_nolock()
1485 mftbmp_ni->allocated_size += vol->cluster_size; ntfs_mft_bitmap_extend_allocation_nolock()
1502 ntfs_error(vol->sb, "Failed to find last attribute extent of " ntfs_mft_bitmap_extend_allocation_nolock()
1505 mftbmp_ni->allocated_size += vol->cluster_size; ntfs_mft_bitmap_extend_allocation_nolock()
1514 NVolSetErrors(vol); ntfs_mft_bitmap_extend_allocation_nolock()
1531 down_write(&vol->lcnbmp_lock); ntfs_mft_bitmap_extend_allocation_nolock()
1532 if (ntfs_bitmap_clear_bit(vol->lcnbmp_ino, lcn)) { ntfs_mft_bitmap_extend_allocation_nolock()
1533 ntfs_error(vol->sb, "Failed to free allocated cluster.%s", es); ntfs_mft_bitmap_extend_allocation_nolock()
1534 NVolSetErrors(vol); ntfs_mft_bitmap_extend_allocation_nolock()
1536 up_write(&vol->lcnbmp_lock); ntfs_mft_bitmap_extend_allocation_nolock()
1538 if (ntfs_mapping_pairs_build(vol, (u8*)a + le16_to_cpu( ntfs_mft_bitmap_extend_allocation_nolock()
1543 ntfs_error(vol->sb, "Failed to restore mapping pairs " ntfs_mft_bitmap_extend_allocation_nolock()
1545 NVolSetErrors(vol); ntfs_mft_bitmap_extend_allocation_nolock()
1548 ntfs_error(vol->sb, "Failed to restore attribute " ntfs_mft_bitmap_extend_allocation_nolock()
1550 NVolSetErrors(vol); ntfs_mft_bitmap_extend_allocation_nolock()
1565 * @vol: volume on which to extend the mft bitmap attribute
1568 * volume @vol by 8 bytes.
1575 * Locking: Caller must hold vol->mftbmp_lock for writing.
1577 static int ntfs_mft_bitmap_extend_initialized_nolock(ntfs_volume *vol) ntfs_mft_bitmap_extend_initialized_nolock() argument
1589 mft_ni = NTFS_I(vol->mft_ino); ntfs_mft_bitmap_extend_initialized_nolock()
1590 mftbmp_vi = vol->mftbmp_ino; ntfs_mft_bitmap_extend_initialized_nolock()
1595 ntfs_error(vol->sb, "Failed to map mft record."); ntfs_mft_bitmap_extend_initialized_nolock()
1600 ntfs_error(vol->sb, "Failed to get search context."); ntfs_mft_bitmap_extend_initialized_nolock()
1607 ntfs_error(vol->sb, "Failed to find first attribute extent of " ntfs_mft_bitmap_extend_initialized_nolock()
1643 ntfs_error(vol->sb, "Failed to write to mft bitmap."); ntfs_mft_bitmap_extend_initialized_nolock()
1647 ntfs_error(vol->sb, "Failed to map mft record.%s", es); ntfs_mft_bitmap_extend_initialized_nolock()
1648 NVolSetErrors(vol); ntfs_mft_bitmap_extend_initialized_nolock()
1653 ntfs_error(vol->sb, "Failed to get search context.%s", es); ntfs_mft_bitmap_extend_initialized_nolock()
1654 NVolSetErrors(vol); ntfs_mft_bitmap_extend_initialized_nolock()
1659 ntfs_error(vol->sb, "Failed to find first attribute extent of " ntfs_mft_bitmap_extend_initialized_nolock()
1661 NVolSetErrors(vol); ntfs_mft_bitmap_extend_initialized_nolock()
1697 * @vol: volume on which to extend the mft data attribute
1699 * Extend the mft data attribute on the ntfs volume @vol by 16 mft records
1708 * Locking: - Caller must hold vol->mftbmp_lock for writing.
1709 * - This function takes NTFS_I(vol->mft_ino)->runlist.lock for
1711 * - This function calls functions which take vol->lcnbmp_lock for
1714 static int ntfs_mft_data_extend_allocation_nolock(ntfs_volume *vol) ntfs_mft_data_extend_allocation_nolock() argument
1730 mft_ni = NTFS_I(vol->mft_ino); ntfs_mft_data_extend_allocation_nolock()
1741 (ll - 1) >> vol->cluster_size_bits, NULL); ntfs_mft_data_extend_allocation_nolock()
1744 ntfs_error(vol->sb, "Failed to determine last allocated " ntfs_mft_data_extend_allocation_nolock()
1755 min_nr = vol->mft_record_size >> vol->cluster_size_bits; ntfs_mft_data_extend_allocation_nolock()
1759 nr = vol->mft_record_size << 4 >> vol->cluster_size_bits; ntfs_mft_data_extend_allocation_nolock()
1766 if (unlikely((ll + (nr << vol->cluster_size_bits)) >> ntfs_mft_data_extend_allocation_nolock()
1767 vol->mft_record_size_bits >= (1ll << 32))) { ntfs_mft_data_extend_allocation_nolock()
1769 if (unlikely((ll + (nr << vol->cluster_size_bits)) >> ntfs_mft_data_extend_allocation_nolock()
1770 vol->mft_record_size_bits >= (1ll << 32))) { ntfs_mft_data_extend_allocation_nolock()
1771 ntfs_warning(vol->sb, "Cannot allocate mft record " ntfs_mft_data_extend_allocation_nolock()
1782 rl2 = ntfs_cluster_alloc(vol, old_last_vcn, nr, lcn, MFT_ZONE, ntfs_mft_data_extend_allocation_nolock()
1787 ntfs_error(vol->sb, "Failed to allocate the minimal " ntfs_mft_data_extend_allocation_nolock()
1805 ntfs_error(vol->sb, "Failed to merge runlists for mft data " ntfs_mft_data_extend_allocation_nolock()
1807 if (ntfs_cluster_free_from_rl(vol, rl2)) { ntfs_mft_data_extend_allocation_nolock()
1808 ntfs_error(vol->sb, "Failed to deallocate clusters " ntfs_mft_data_extend_allocation_nolock()
1810 NVolSetErrors(vol); ntfs_mft_data_extend_allocation_nolock()
1823 ntfs_error(vol->sb, "Failed to map mft record."); ntfs_mft_data_extend_allocation_nolock()
1829 ntfs_error(vol->sb, "Failed to get search context."); ntfs_mft_data_extend_allocation_nolock()
1836 ntfs_error(vol->sb, "Failed to find last attribute extent of " ntfs_mft_data_extend_allocation_nolock()
1852 mp_size = ntfs_get_size_for_mapping_pairs(vol, rl2, ll, -1); ntfs_mft_data_extend_allocation_nolock()
1854 ntfs_error(vol->sb, "Get size for mapping pairs failed for " ntfs_mft_data_extend_allocation_nolock()
1867 ntfs_error(vol->sb, "Failed to resize attribute " ntfs_mft_data_extend_allocation_nolock()
1881 ntfs_error(vol->sb, "Not enough space in this mft record to " ntfs_mft_data_extend_allocation_nolock()
1889 ret = ntfs_mapping_pairs_build(vol, (u8*)a + ntfs_mft_data_extend_allocation_nolock()
1893 ntfs_error(vol->sb, "Failed to build mapping pairs array of " ntfs_mft_data_extend_allocation_nolock()
1917 ntfs_error(vol->sb, "Failed to find first attribute " ntfs_mft_data_extend_allocation_nolock()
1924 mft_ni->allocated_size += nr << vol->cluster_size_bits; ntfs_mft_data_extend_allocation_nolock()
1940 ntfs_error(vol->sb, "Failed to find last attribute extent of " ntfs_mft_data_extend_allocation_nolock()
1943 mft_ni->allocated_size += nr << vol->cluster_size_bits; ntfs_mft_data_extend_allocation_nolock()
1952 NVolSetErrors(vol); ntfs_mft_data_extend_allocation_nolock()
1959 ntfs_error(vol->sb, "Failed to free clusters from mft data " ntfs_mft_data_extend_allocation_nolock()
1961 NVolSetErrors(vol); ntfs_mft_data_extend_allocation_nolock()
1964 if (ntfs_rl_truncate_nolock(vol, &mft_ni->runlist, old_last_vcn)) { ntfs_mft_data_extend_allocation_nolock()
1965 ntfs_error(vol->sb, "Failed to truncate mft data attribute " ntfs_mft_data_extend_allocation_nolock()
1967 NVolSetErrors(vol); ntfs_mft_data_extend_allocation_nolock()
1970 if (ntfs_mapping_pairs_build(vol, (u8*)a + le16_to_cpu( ntfs_mft_data_extend_allocation_nolock()
1975 ntfs_error(vol->sb, "Failed to restore mapping pairs " ntfs_mft_data_extend_allocation_nolock()
1977 NVolSetErrors(vol); ntfs_mft_data_extend_allocation_nolock()
1980 ntfs_error(vol->sb, "Failed to restore attribute " ntfs_mft_data_extend_allocation_nolock()
1982 NVolSetErrors(vol); ntfs_mft_data_extend_allocation_nolock()
1987 ntfs_error(vol->sb, "Failed to restore attribute search " ntfs_mft_data_extend_allocation_nolock()
1989 NVolSetErrors(vol); ntfs_mft_data_extend_allocation_nolock()
2001 * @vol: volume to which the mft record will belong
2003 * @m: destination buffer of size >= @vol->mft_record_size bytes
2006 * the buffer @m. The volume @vol is needed because the mft record structure
2012 static int ntfs_mft_record_layout(const ntfs_volume *vol, const s64 mft_no, ntfs_mft_record_layout() argument
2019 ntfs_error(vol->sb, "Mft record number 0x%llx exceeds " ntfs_mft_record_layout()
2024 memset(m, 0, vol->mft_record_size); ntfs_mft_record_layout()
2026 if (vol->major_ver < 3 || (vol->major_ver == 3 && !vol->minor_ver)) ntfs_mft_record_layout()
2038 if (vol->mft_record_size >= NTFS_BLOCK_SIZE) ntfs_mft_record_layout()
2039 m->usa_count = cpu_to_le16(vol->mft_record_size / ntfs_mft_record_layout()
2043 ntfs_warning(vol->sb, "Sector size is bigger than mft record " ntfs_mft_record_layout()
2069 m->bytes_allocated = cpu_to_le32(vol->mft_record_size); ntfs_mft_record_layout()
2082 * @vol: volume on which to format the mft record
2091 static int ntfs_mft_record_format(const ntfs_volume *vol, const s64 mft_no) ntfs_mft_record_format() argument
2094 struct inode *mft_vi = vol->mft_ino; ntfs_mft_record_format()
2106 index = mft_no << vol->mft_record_size_bits >> PAGE_CACHE_SHIFT; ntfs_mft_record_format()
2107 ofs = (mft_no << vol->mft_record_size_bits) & ~PAGE_CACHE_MASK; ntfs_mft_record_format()
2112 if (unlikely(index > end_index || ofs + vol->mft_record_size >= ntfs_mft_record_format()
2114 ntfs_error(vol->sb, "Tried to format non-existing mft " ntfs_mft_record_format()
2122 ntfs_error(vol->sb, "Failed to map page containing mft record " ntfs_mft_record_format()
2130 err = ntfs_mft_record_layout(vol, mft_no, m); ntfs_mft_record_format()
2132 ntfs_error(vol->sb, "Failed to layout mft record 0x%llx.", ntfs_mft_record_format()
2155 * @vol: [IN] volume on which to allocate the mft record
2160 * Allocate an mft record in $MFT/$DATA of an open ntfs volume @vol.
2243 ntfs_inode *ntfs_mft_record_alloc(ntfs_volume *vol, const int mode, ntfs_mft_record_alloc() argument
2276 mft_ni = NTFS_I(vol->mft_ino); ntfs_mft_record_alloc()
2277 mftbmp_ni = NTFS_I(vol->mftbmp_ino); ntfs_mft_record_alloc()
2278 down_write(&vol->mftbmp_lock); ntfs_mft_record_alloc()
2279 bit = ntfs_mft_bitmap_find_and_alloc_free_rec_nolock(vol, base_ni); ntfs_mft_record_alloc()
2286 up_write(&vol->mftbmp_lock); ntfs_mft_record_alloc()
2298 ll = mft_ni->initialized_size >> vol->mft_record_size_bits; ntfs_mft_record_alloc()
2326 (long long)i_size_read(vol->mftbmp_ino), ntfs_mft_record_alloc()
2332 err = ntfs_mft_bitmap_extend_allocation_nolock(vol); ntfs_mft_record_alloc()
2334 up_write(&vol->mftbmp_lock); ntfs_mft_record_alloc()
2343 (long long)i_size_read(vol->mftbmp_ino), ntfs_mft_record_alloc()
2353 err = ntfs_mft_bitmap_extend_initialized_nolock(vol); ntfs_mft_record_alloc()
2355 up_write(&vol->mftbmp_lock); ntfs_mft_record_alloc()
2364 (long long)i_size_read(vol->mftbmp_ino), ntfs_mft_record_alloc()
2372 err = ntfs_bitmap_set_bit(vol->mftbmp_ino, bit); ntfs_mft_record_alloc()
2374 ntfs_error(vol->sb, "Failed to allocate bit in mft bitmap."); ntfs_mft_record_alloc()
2375 up_write(&vol->mftbmp_lock); ntfs_mft_record_alloc()
2388 ll = (bit + 1) << vol->mft_record_size_bits; ntfs_mft_record_alloc()
2408 (long long)i_size_read(vol->mft_ino), ntfs_mft_record_alloc()
2412 err = ntfs_mft_data_extend_allocation_nolock(vol); ntfs_mft_record_alloc()
2414 ntfs_error(vol->sb, "Failed to extend mft data " ntfs_mft_record_alloc()
2423 (long long)i_size_read(vol->mft_ino), ntfs_mft_record_alloc()
2436 old_data_size = vol->mft_ino->i_size; ntfs_mft_record_alloc()
2441 vol->mft_record_size; ntfs_mft_record_alloc()
2442 mft_no = mft_ni->initialized_size >> vol->mft_record_size_bits; ntfs_mft_record_alloc()
2443 if (new_initialized_size > i_size_read(vol->mft_ino)) ntfs_mft_record_alloc()
2444 i_size_write(vol->mft_ino, new_initialized_size); ntfs_mft_record_alloc()
2448 err = ntfs_mft_record_format(vol, mft_no); ntfs_mft_record_alloc()
2450 ntfs_error(vol->sb, "Failed to format mft record."); ntfs_mft_record_alloc()
2461 ntfs_error(vol->sb, "Failed to map mft record."); ntfs_mft_record_alloc()
2467 ntfs_error(vol->sb, "Failed to get search context."); ntfs_mft_record_alloc()
2475 ntfs_error(vol->sb, "Failed to find first attribute extent of " ntfs_mft_record_alloc()
2486 cpu_to_sle64(i_size_read(vol->mft_ino)); ntfs_mft_record_alloc()
2498 (long long)i_size_read(vol->mft_ino), ntfs_mft_record_alloc()
2500 BUG_ON(i_size_read(vol->mft_ino) > mft_ni->allocated_size); ntfs_mft_record_alloc()
2501 BUG_ON(mft_ni->initialized_size > i_size_read(vol->mft_ino)); ntfs_mft_record_alloc()
2513 up_write(&vol->mftbmp_lock); ntfs_mft_record_alloc()
2518 index = bit << vol->mft_record_size_bits >> PAGE_CACHE_SHIFT; ntfs_mft_record_alloc()
2519 ofs = (bit << vol->mft_record_size_bits) & ~PAGE_CACHE_MASK; ntfs_mft_record_alloc()
2521 page = ntfs_map_page(vol->mft_ino->i_mapping, index); ntfs_mft_record_alloc()
2523 ntfs_error(vol->sb, "Failed to map page containing allocated " ntfs_mft_record_alloc()
2537 ntfs_error(vol->sb, "Mft record 0x%llx was marked " ntfs_mft_record_alloc()
2546 NVolSetErrors(vol); ntfs_mft_record_alloc()
2558 err = ntfs_mft_record_layout(vol, bit, m); ntfs_mft_record_alloc()
2560 ntfs_error(vol->sb, "Failed to layout allocated mft " ntfs_mft_record_alloc()
2595 ntfs_error(vol->sb, "Failed to map allocated extent " ntfs_mft_record_alloc()
2629 vi = new_inode(vol->sb); ntfs_mft_record_alloc()
2651 vi->i_uid = vol->uid; ntfs_mft_record_alloc()
2652 vi->i_gid = vol->gid; ntfs_mft_record_alloc()
2663 vi->i_mode &= ~vol->dmask; ntfs_mft_record_alloc()
2673 if (vol->cluster_size <= ni->itype.index.block_size) { ntfs_mft_record_alloc()
2674 ni->itype.index.vcn_size = vol->cluster_size; ntfs_mft_record_alloc()
2676 vol->cluster_size_bits; ntfs_mft_record_alloc()
2678 ni->itype.index.vcn_size = vol->sector_size; ntfs_mft_record_alloc()
2680 vol->sector_size_bits; ntfs_mft_record_alloc()
2684 vi->i_mode &= ~vol->fmask; ntfs_mft_record_alloc()
2730 vol->mft_data_pos = bit + 1; ntfs_mft_record_alloc()
2743 i_size_write(vol->mft_ino, old_data_size); ntfs_mft_record_alloc()
2747 down_write(&vol->mftbmp_lock); ntfs_mft_record_alloc()
2749 if (ntfs_bitmap_clear_bit(vol->mftbmp_ino, bit)) { ntfs_mft_record_alloc()
2750 ntfs_error(vol->sb, "Failed to clear bit in mft bitmap.%s", es); ntfs_mft_record_alloc()
2751 NVolSetErrors(vol); ntfs_mft_record_alloc()
2753 up_write(&vol->mftbmp_lock); ntfs_mft_record_alloc()
2757 ntfs_warning(vol->sb, "Cannot allocate mft record because the maximum " ntfs_mft_record_alloc()
2759 up_write(&vol->mftbmp_lock); ntfs_mft_record_alloc()
2787 ntfs_volume *vol = ni->vol; ntfs_extent_mft_record_free() local
2810 ntfs_error(vol->sb, "Tried to free busy extent inode 0x%lx, " ntfs_extent_mft_record_free()
2833 ntfs_error(vol->sb, "Extent inode 0x%lx is not attached to " ntfs_extent_mft_record_free()
2864 ntfs_error(vol->sb, "Failed to write mft record 0x%lx, not " ntfs_extent_mft_record_free()
2874 down_write(&vol->mftbmp_lock); ntfs_extent_mft_record_free()
2875 err = ntfs_bitmap_clear_bit(vol->mftbmp_ino, mft_no); ntfs_extent_mft_record_free()
2876 up_write(&vol->mftbmp_lock); ntfs_extent_mft_record_free()
2883 ntfs_error(vol->sb, "Failed to clear bit in mft bitmap.%s", es); ntfs_extent_mft_record_free()
2884 NVolSetErrors(vol); ntfs_extent_mft_record_free()
2896 ntfs_error(vol->sb, "Failed to allocate internal " ntfs_extent_mft_record_free()
2899 NVolSetErrors(vol); ntfs_extent_mft_record_free()
H A Dcollate.c26 static int ntfs_collate_binary(ntfs_volume *vol, ntfs_collate_binary() argument
44 static int ntfs_collate_ntofs_ulong(ntfs_volume *vol, ntfs_collate_ntofs_ulong() argument
87 * @vol: ntfs volume to which the data items belong
101 int ntfs_collate(ntfs_volume *vol, COLLATION_RULE cr, ntfs_collate() argument
115 return ntfs_do_collate0x0[i](vol, data1, data1_len, ntfs_collate()
120 return ntfs_do_collate0x1[i](vol, data1, data1_len, ntfs_collate()
H A Drunlist.h76 extern runlist_element *ntfs_mapping_pairs_decompress(const ntfs_volume *vol,
86 extern int ntfs_get_size_for_mapping_pairs(const ntfs_volume *vol,
90 extern int ntfs_mapping_pairs_build(const ntfs_volume *vol, s8 *dst,
94 extern int ntfs_rl_truncate_nolock(const ntfs_volume *vol,
97 int ntfs_rl_punch_nolock(const ntfs_volume *vol, runlist *const runlist,
H A Dlcnalloc.h43 extern runlist_element *ntfs_cluster_alloc(ntfs_volume *vol,
113 extern int ntfs_cluster_free_from_rl_nolock(ntfs_volume *vol,
118 * @vol: mounted ntfs volume on which to free the clusters
121 * Free all the clusters described by the runlist @rl on the volume @vol. In
132 static inline int ntfs_cluster_free_from_rl(ntfs_volume *vol, ntfs_cluster_free_from_rl() argument
137 down_write(&vol->lcnbmp_lock); ntfs_cluster_free_from_rl()
138 ret = ntfs_cluster_free_from_rl_nolock(vol, rl); ntfs_cluster_free_from_rl()
139 up_write(&vol->lcnbmp_lock); ntfs_cluster_free_from_rl()
H A Ddir.c83 ntfs_volume *vol = dir_ni->vol; ntfs_lookup_inode_by_name() local
84 struct super_block *sb = vol->sb; ntfs_lookup_inode_by_name()
159 CASE_SENSITIVE, vol->upcase, vol->upcase_len)) { ntfs_lookup_inode_by_name()
204 if (!NVolCaseSensitive(vol) && ntfs_lookup_inode_by_name()
209 IGNORE_CASE, vol->upcase, vol->upcase_len)) { ntfs_lookup_inode_by_name()
250 IGNORE_CASE, vol->upcase, vol->upcase_len); ntfs_lookup_inode_by_name()
269 CASE_SENSITIVE, vol->upcase, vol->upcase_len); ntfs_lookup_inode_by_name()
419 CASE_SENSITIVE, vol->upcase, vol->upcase_len)) { ntfs_lookup_inode_by_name()
464 if (!NVolCaseSensitive(vol) && ntfs_lookup_inode_by_name()
469 IGNORE_CASE, vol->upcase, vol->upcase_len)) { ntfs_lookup_inode_by_name()
512 IGNORE_CASE, vol->upcase, vol->upcase_len); ntfs_lookup_inode_by_name()
531 CASE_SENSITIVE, vol->upcase, vol->upcase_len); ntfs_lookup_inode_by_name()
561 if (old_vcn << vol->cluster_size_bits >> ntfs_lookup_inode_by_name()
563 vol->cluster_size_bits >> ntfs_lookup_inode_by_name()
636 ntfs_volume *vol = dir_ni->vol;
637 struct super_block *sb = vol->sb;
721 vol->upcase, vol->upcase_len)) {
735 IGNORE_CASE, vol->upcase, vol->upcase_len);
754 CASE_SENSITIVE, vol->upcase, vol->upcase_len);
908 vol->upcase, vol->upcase_len)) {
922 IGNORE_CASE, vol->upcase, vol->upcase_len);
941 CASE_SENSITIVE, vol->upcase, vol->upcase_len);
970 if (old_vcn << vol->cluster_size_bits >>
972 vol->cluster_size_bits >>
1006 * @vol: current ntfs volume
1025 static inline int ntfs_filldir(ntfs_volume *vol, ntfs_filldir() argument
1044 !NVolShowSystemFiles(vol)) { ntfs_filldir()
1048 name_len = ntfs_ucstonls(vol, (ntfschar*)&ie->key.file_name.file_name, ntfs_filldir()
1052 ntfs_warning(vol->sb, "Skipping unrepresentable inode 0x%llx.", ntfs_filldir()
1106 ntfs_volume *vol = NTFS_SB(sb); ntfs_readdir() local
1123 if (actor->pos >= i_size + vol->mft_record_size) ntfs_readdir()
1140 if (actor->pos >= vol->mft_record_size) ntfs_readdir()
1213 rc = ntfs_filldir(vol, ndir, NULL, ie, name, actor); ntfs_readdir()
1226 actor->pos = vol->mft_record_size; ntfs_readdir()
1231 ia_pos = (s64)actor->pos - vol->mft_record_size; ntfs_readdir()
1396 vol->mft_record_size; ntfs_readdir()
1403 rc = ntfs_filldir(vol, ndir, ia_page, ie, name, actor); ntfs_readdir()
1422 actor->pos = i_size + vol->mft_record_size; ntfs_readdir()
H A Dattrib.c123 ni->vol->cluster_size_bits; ntfs_map_runlist_nolock()
187 rl = ntfs_mapping_pairs_decompress(ni->vol, a, ni->runlist.rl); ntfs_map_runlist_nolock()
402 ntfs_error(ni->vol->sb, "Failed with error code %lli.", ntfs_attr_vcn_to_lcn_nolock()
528 ntfs_error(ni->vol->sb, "Failed with error code %i.", err); ntfs_attr_find_vcn_nolock()
594 ntfs_volume *vol = ctx->ntfs_ino->vol; ntfs_attr_find() local
595 ntfschar *upcase = vol->upcase; ntfs_attr_find()
596 u32 upcase_len = vol->upcase_len; ntfs_attr_find()
689 ntfs_error(vol->sb, "Inode is corrupt. Run chkdsk."); ntfs_attr_find()
690 NVolSetErrors(vol); ntfs_attr_find()
696 * @vol: ntfs volume from which to read
710 int load_attribute_list(ntfs_volume *vol, runlist *runlist, u8 *al_start, load_attribute_list() argument
725 if (!vol || !runlist || !al || size <= 0 || initialized_size < 0 || load_attribute_list()
732 sb = vol->sb; load_attribute_list()
754 block = lcn << vol->cluster_size_bits >> block_size_bits; load_attribute_list()
756 max_block = block + (rl->length << vol->cluster_size_bits >> load_attribute_list()
863 ntfs_volume *vol; ntfs_external_attr_find() local
884 vol = base_ni->vol; ntfs_external_attr_find()
929 name_len, ic, vol->upcase, vol->upcase_len)) { ntfs_external_attr_find()
934 vol->upcase, vol->upcase_len); ntfs_external_attr_find()
954 vol->upcase, vol->upcase_len); ntfs_external_attr_find()
979 vol->upcase, vol->upcase_len)) ntfs_external_attr_find()
983 ntfs_error(vol->sb, "Found stale mft " ntfs_external_attr_find()
1005 ntfs_error(vol->sb, "Failed to map " ntfs_external_attr_find()
1064 vol->upcase, vol->upcase_len)) ntfs_external_attr_find()
1085 ntfs_error(vol->sb, "Base inode 0x%lx contains corrupt " ntfs_external_attr_find()
1098 NVolSetErrors(vol); ntfs_external_attr_find()
1298 * @vol: ntfs volume to which the attribute belongs
1306 static ATTR_DEF *ntfs_attr_find_in_attrdef(const ntfs_volume *vol, ntfs_attr_find_in_attrdef() argument
1311 BUG_ON(!vol->attrdef); ntfs_attr_find_in_attrdef()
1313 for (ad = vol->attrdef; (u8*)ad - (u8*)vol->attrdef < ntfs_attr_find_in_attrdef()
1314 vol->attrdef_size && ad->type; ++ad) { ntfs_attr_find_in_attrdef()
1332 * @vol: ntfs volume to which the attribute belongs
1337 * ntfs volume @vol. This information is obtained from $AttrDef system file.
1342 int ntfs_attr_size_bounds_check(const ntfs_volume *vol, const ATTR_TYPE type, ntfs_attr_size_bounds_check() argument
1355 ad = ntfs_attr_find_in_attrdef(vol, type); ntfs_attr_size_bounds_check()
1369 * @vol: ntfs volume to which the attribute belongs
1372 * Check whether the attribute of @type on the ntfs volume @vol is allowed to
1378 int ntfs_attr_can_be_non_resident(const ntfs_volume *vol, const ATTR_TYPE type) ntfs_attr_can_be_non_resident() argument
1383 ad = ntfs_attr_find_in_attrdef(vol, type); ntfs_attr_can_be_non_resident()
1394 * @vol: ntfs volume to which the attribute belongs
1397 * Check whether the attribute of @type on the ntfs volume @vol is allowed to
1410 int ntfs_attr_can_be_resident(const ntfs_volume *vol, const ATTR_TYPE type) ntfs_attr_can_be_resident() argument
1539 ntfs_volume *vol = ni->vol; ntfs_attr_make_non_resident() local
1553 err = ntfs_attr_can_be_non_resident(vol, ni->type); ntfs_attr_make_non_resident()
1573 new_size = (data_size + vol->cluster_size - 1) & ntfs_attr_make_non_resident()
1574 ~(vol->cluster_size - 1); ntfs_attr_make_non_resident()
1585 rl = ntfs_cluster_alloc(vol, 0, new_size >> ntfs_attr_make_non_resident()
1586 vol->cluster_size_bits, -1, DATA_ZONE, true); ntfs_attr_make_non_resident()
1591 vol->cluster_size_bits) > 1 ? "s" : "", ntfs_attr_make_non_resident()
1600 mp_size = ntfs_get_size_for_mapping_pairs(vol, rl, 0, -1); ntfs_attr_make_non_resident()
1687 vol->cluster_size_bits); ntfs_attr_make_non_resident()
1697 if (NInoCompressed(ni) || vol->major_ver < 3) ntfs_attr_make_non_resident()
1704 err = ntfs_mapping_pairs_build(vol, (u8*)a + mp_ofs, ntfs_attr_make_non_resident()
1720 vol->cluster_size_bits); ntfs_attr_make_non_resident()
1782 ntfs_error(vol->sb, "Failed to undo partial resident " ntfs_attr_make_non_resident()
1828 if (ntfs_cluster_free_from_rl(vol, rl) < 0) { ntfs_attr_make_non_resident()
1829 ntfs_error(vol->sb, "Failed to release allocated " ntfs_attr_make_non_resident()
1833 NVolSetErrors(vol); ntfs_attr_make_non_resident()
1910 ntfs_volume *vol = ni->vol; ntfs_attr_extend_allocation() local
1942 start &= ~(s64)vol->cluster_size_mask; ntfs_attr_extend_allocation()
1943 new_alloc_size = (new_alloc_size + vol->cluster_size - 1) & ntfs_attr_extend_allocation()
1944 ~(s64)vol->cluster_size_mask; ntfs_attr_extend_allocation()
1948 err = ntfs_attr_size_bounds_check(vol, ni->type, new_alloc_size); ntfs_attr_extend_allocation()
1956 ntfs_error(vol->sb, "Cannot extend allocation " ntfs_attr_extend_allocation()
1965 ntfs_error(vol->sb, "Cannot extend allocation " ntfs_attr_extend_allocation()
2011 vcn = NInoNonResident(ni) ? allocated_size >> vol->cluster_size_bits : ntfs_attr_extend_allocation()
2050 if (new_alloc_size < vol->mft_record_size && ntfs_attr_extend_allocation()
2095 ntfs_error(vol->sb, "Cannot extend allocation of " ntfs_attr_extend_allocation()
2111 ntfs_error(vol->sb, "Not enough space in the mft " ntfs_attr_extend_allocation()
2116 ntfs_error(vol->sb, "This attribute type may not be " ntfs_attr_extend_allocation()
2165 !NVolSparseEnabled(vol) || NInoSparseDisabled(ni)) ntfs_attr_extend_allocation()
2184 rl = ntfs_mapping_pairs_decompress(vol, a, ni->runlist.rl); ntfs_attr_extend_allocation()
2188 ntfs_error(vol->sb, "Cannot extend allocation " ntfs_attr_extend_allocation()
2219 rl2 = ntfs_cluster_alloc(vol, allocated_size >> vol->cluster_size_bits, ntfs_attr_extend_allocation()
2221 vol->cluster_size_bits, (rl && (rl->lcn >= 0)) ? ntfs_attr_extend_allocation()
2226 ntfs_error(vol->sb, "Cannot extend allocation of " ntfs_attr_extend_allocation()
2239 ntfs_error(vol->sb, "Cannot extend allocation of " ntfs_attr_extend_allocation()
2246 if (ntfs_cluster_free_from_rl(vol, rl2)) { ntfs_attr_extend_allocation()
2247 ntfs_error(vol->sb, "Failed to release allocated " ntfs_attr_extend_allocation()
2251 NVolSetErrors(vol); ntfs_attr_extend_allocation()
2258 allocated_size) >> vol->cluster_size_bits); ntfs_attr_extend_allocation()
2267 mp_size = ntfs_get_size_for_mapping_pairs(vol, rl2, ll, -1); ntfs_attr_extend_allocation()
2271 ntfs_error(vol->sb, "Cannot extend allocation of " ntfs_attr_extend_allocation()
2293 ntfs_error(vol->sb, "Not enough space in the mft " ntfs_attr_extend_allocation()
2302 err = ntfs_mapping_pairs_build(vol, (u8*)a + ntfs_attr_extend_allocation()
2307 ntfs_error(vol->sb, "Cannot extend allocation of " ntfs_attr_extend_allocation()
2317 vol->cluster_size_bits) - 1); ntfs_attr_extend_allocation()
2377 ntfs_error(vol->sb, "Cannot complete extension of allocation " ntfs_attr_extend_allocation()
2386 allocated_size >> vol->cluster_size_bits, NULL, 0, ntfs_attr_extend_allocation()
2388 ntfs_error(vol->sb, "Failed to find last attribute extent of " ntfs_attr_extend_allocation()
2412 NVolSetErrors(vol); ntfs_attr_extend_allocation()
2416 (allocated_size >> vol->cluster_size_bits) - 1); ntfs_attr_extend_allocation()
2418 ll = allocated_size >> vol->cluster_size_bits; ntfs_attr_extend_allocation()
2420 ntfs_error(vol->sb, "Failed to release allocated cluster(s) " ntfs_attr_extend_allocation()
2423 NVolSetErrors(vol); ntfs_attr_extend_allocation()
2433 if (ntfs_rl_truncate_nolock(vol, &ni->runlist, ll) || IS_ERR(m)) { ntfs_attr_extend_allocation()
2434 ntfs_error(vol->sb, "Failed to %s in error code path. Run " ntfs_attr_extend_allocation()
2438 NVolSetErrors(vol); ntfs_attr_extend_allocation()
2441 ntfs_error(vol->sb, "Failed to restore attribute " ntfs_attr_extend_allocation()
2444 NVolSetErrors(vol); ntfs_attr_extend_allocation()
2446 if (ntfs_mapping_pairs_build(vol, (u8*)a + le16_to_cpu( ntfs_attr_extend_allocation()
2452 ntfs_error(vol->sb, "Failed to restore " ntfs_attr_extend_allocation()
2456 NVolSetErrors(vol); ntfs_attr_extend_allocation()
2495 ntfs_volume *vol = ni->vol; ntfs_attr_set() local
2523 ntfs_error(vol->sb, "Request exceeds end of attribute."); ntfs_attr_set()
2531 ntfs_error(vol->sb, "Failed to read first partial " ntfs_attr_set()
2559 ntfs_error(vol->sb, "Insufficient memory to grab " ntfs_attr_set()
2596 ntfs_error(vol->sb, "Failed to read last partial page " ntfs_attr_set()
H A Daops.c106 ntfs_error(ni->vol->sb, "Buffer I/O error, logical block " ntfs_end_buffer_async_read()
192 ntfs_volume *vol; ntfs_read_block() local
203 vol = ni->vol; ntfs_read_block()
208 blocksize = vol->sb->s_blocksize; ntfs_read_block()
209 blocksize_bits = vol->sb->s_blocksize_bits; ntfs_read_block()
256 bh->b_bdev = vol->sb->s_bdev; ntfs_read_block()
263 vol->cluster_size_bits; ntfs_read_block()
265 vol->cluster_size_mask; ntfs_read_block()
281 bh->b_blocknr = ((lcn << vol->cluster_size_bits) ntfs_read_block()
323 ntfs_error(vol->sb, "Failed to read from inode 0x%lx, " ntfs_read_block()
559 ntfs_volume *vol; ntfs_write_block() local
570 vol = ni->vol; ntfs_write_block()
577 blocksize = vol->sb->s_blocksize; ntfs_write_block()
578 blocksize_bits = vol->sb->s_blocksize_bits; ntfs_write_block()
584 ntfs_warning(vol->sb, "Error allocating page " ntfs_write_block()
701 ntfs_error(vol->sb, "Writing beyond initialized size " ntfs_write_block()
716 bh->b_bdev = vol->sb->s_bdev; ntfs_write_block()
720 vcn_ofs = vcn & vol->cluster_size_mask; ntfs_write_block()
721 vcn >>= vol->cluster_size_bits; ntfs_write_block()
737 bh->b_blocknr = ((lcn << vol->cluster_size_bits) + ntfs_write_block()
768 ntfs_error(vol->sb, "Writing into sparse regions is " ntfs_write_block()
804 ntfs_error(vol->sb, "Failed to write to inode 0x%lx, " ntfs_write_block()
859 ntfs_warning(vol->sb, "Error allocating memory. " ntfs_write_block()
925 ntfs_volume *vol = ni->vol; ntfs_write_mst_block() local
950 bh_size = vol->sb->s_blocksize; ntfs_write_mst_block()
951 bh_size_bits = vol->sb->s_blocksize_bits; ntfs_write_mst_block()
1023 bh->b_bdev = vol->sb->s_bdev; ntfs_write_mst_block()
1026 vcn_ofs = vcn & vol->cluster_size_mask; ntfs_write_mst_block()
1027 vcn >>= vol->cluster_size_bits; ntfs_write_mst_block()
1044 vol->cluster_size_bits) + ntfs_write_mst_block()
1076 ntfs_error(vol->sb, "Cannot write ntfs record " ntfs_write_mst_block()
1084 vol->mft_record_size_bits, ntfs_write_mst_block()
1140 if (!ntfs_may_write_mft_record(vol, mft_no, ntfs_write_mst_block()
1171 ntfs_error(vol->sb, "Failed to apply mst fixups " ntfs_write_mst_block()
1218 ntfs_error(vol->sb, "I/O error while writing ntfs " ntfs_write_mst_block()
1254 if (mft_no < vol->mftmirr_size) ntfs_write_mst_block()
1255 ntfs_sync_mft_mirror(vol, mft_no, ntfs_write_mst_block()
1305 NVolSetErrors(vol); ntfs_write_mst_block()
1528 NVolSetErrors(ni->vol); ntfs_writepage()
1570 ntfs_volume *vol = ni->vol; ntfs_bmap() local
1577 ntfs_error(vol->sb, "BMAP does not make sense for %s " ntfs_bmap()
1587 blocksize = vol->sb->s_blocksize; ntfs_bmap()
1588 blocksize_bits = vol->sb->s_blocksize_bits; ntfs_bmap()
1601 cluster_size_shift = vol->cluster_size_bits; ntfs_bmap()
1623 ntfs_error(vol->sb, "Not enough memory to complete " ntfs_bmap()
1628 ntfs_error(vol->sb, "Failed to complete mapping for " ntfs_bmap()
1645 delta = ofs & vol->cluster_size_mask; ntfs_bmap()
1651 ntfs_error(vol->sb, "Physical block 0x%llx is too " ntfs_bmap()
H A Dunistr.c238 * @vol: ntfs volume which we are working with
259 int ntfs_nlstoucs(const ntfs_volume *vol, const char *ins, ntfs_nlstoucs() argument
262 struct nls_table *nls = vol->nls_map; ntfs_nlstoucs()
289 ntfs_error(vol->sb, "Failed to allocate buffer for converted " ntfs_nlstoucs()
293 ntfs_error(vol->sb, "Received NULL pointer."); ntfs_nlstoucs()
298 ntfs_error(vol->sb, "Name using character set %s contains " ntfs_nlstoucs()
303 ntfs_error(vol->sb, "Name is too long (maximum length for a " ntfs_nlstoucs()
313 * @vol: ntfs volume which we are working with
336 int ntfs_ucstonls(const ntfs_volume *vol, const ntfschar *ins, ntfs_ucstonls() argument
339 struct nls_table *nls = vol->nls_map; ntfs_ucstonls()
384 ntfs_error(vol->sb, "Received NULL pointer."); ntfs_ucstonls()
387 ntfs_error(vol->sb, "Unicode name contains characters that cannot be " ntfs_ucstonls()
396 ntfs_error(vol->sb, "Failed to allocate name!"); ntfs_ucstonls()
H A Dinode.c400 ni->vol = NTFS_SB(sb); __ntfs_init_inode()
483 ntfs_error(ctx->ntfs_ino->vol->sb, "Corrupt file name " ntfs_is_extended_system_file()
488 ntfs_error(ctx->ntfs_ino->vol->sb, "Non-resident file " ntfs_is_extended_system_file()
493 ntfs_error(ctx->ntfs_ino->vol->sb, "File name with " ntfs_is_extended_system_file()
499 ntfs_error(ctx->ntfs_ino->vol->sb, "Unindexed file " ntfs_is_extended_system_file()
515 ntfs_error(ctx->ntfs_ino->vol->sb, "Inode hard link count " ntfs_is_extended_system_file()
551 ntfs_volume *vol = NTFS_SB(vi->i_sb); ntfs_read_locked_inode() local
570 vi->i_uid = vol->uid; ntfs_read_locked_inode()
571 vi->i_gid = vol->gid; ntfs_read_locked_inode()
633 vi->i_mode &= ~vol->dmask; ntfs_read_locked_inode()
640 vi->i_mode &= ~vol->fmask; ntfs_read_locked_inode()
747 ni->attr_list_rl.rl = ntfs_mapping_pairs_decompress(vol, ntfs_read_locked_inode()
757 if ((err = load_attribute_list(vol, &ni->attr_list_rl, ntfs_read_locked_inode()
769 (u8*)ctx->mrec + vol->mft_record_size) { ntfs_read_locked_inode()
809 ntfs_error(vol->sb, "$INDEX_ROOT attribute is not " ntfs_read_locked_inode()
816 ntfs_error(vol->sb, "$INDEX_ROOT attribute name is " ntfs_read_locked_inode()
841 if (ir_end > (u8*)ctx->mrec + vol->mft_record_size) { ntfs_read_locked_inode()
892 if (vol->cluster_size <= ni->itype.index.block_size) { ntfs_read_locked_inode()
893 ni->itype.index.vcn_size = vol->cluster_size; ntfs_read_locked_inode()
894 ni->itype.index.vcn_size_bits = vol->cluster_size_bits; ntfs_read_locked_inode()
896 ni->itype.index.vcn_size = vol->sector_size; ntfs_read_locked_inode()
897 ni->itype.index.vcn_size_bits = vol->sector_size_bits; ntfs_read_locked_inode()
946 ntfs_error(vol->sb, "$INDEX_ALLOCATION attribute name " ntfs_read_locked_inode()
1061 if (vol->cluster_size > 4096) { ntfs_read_locked_inode()
1068 vol->cluster_size); ntfs_read_locked_inode()
1109 vol->cluster_size_bits); ntfs_read_locked_inode()
1196 ntfs_error(vol->sb, "Failed with error code %i. Marking corrupt " ntfs_read_locked_inode()
1200 NVolSetErrors(vol); ntfs_read_locked_inode()
1228 ntfs_volume *vol = NTFS_SB(vi->i_sb); ntfs_read_locked_attr_inode() local
1284 if (vol->cluster_size > 4096) { ntfs_read_locked_attr_inode()
1289 vol->cluster_size); ntfs_read_locked_attr_inode()
1344 ntfs_error(vol->sb, "Attribute name is placed after " ntfs_read_locked_attr_inode()
1373 ntfs_error(vol->sb, "Attribute name is placed after " ntfs_read_locked_attr_inode()
1392 vol->cluster_size_bits); ntfs_read_locked_attr_inode()
1448 ntfs_error(vol->sb, "Failed with error code %i while reading attribute " ntfs_read_locked_attr_inode()
1455 NVolSetErrors(vol); ntfs_read_locked_attr_inode()
1495 ntfs_volume *vol = NTFS_SB(vi->i_sb); ntfs_read_locked_index_inode() local
1543 ntfs_error(vol->sb, "$INDEX_ROOT attribute is not resident."); ntfs_read_locked_index_inode()
1549 ntfs_error(vol->sb, "$INDEX_ROOT attribute name is placed " ntfs_read_locked_index_inode()
1565 if (ir_end > (u8*)ctx->mrec + vol->mft_record_size) { ntfs_read_locked_index_inode()
1604 if (vol->cluster_size <= ni->itype.index.block_size) { ntfs_read_locked_index_inode()
1605 ni->itype.index.vcn_size = vol->cluster_size; ntfs_read_locked_index_inode()
1606 ni->itype.index.vcn_size_bits = vol->cluster_size_bits; ntfs_read_locked_index_inode()
1608 ni->itype.index.vcn_size = vol->sector_size; ntfs_read_locked_index_inode()
1609 ni->itype.index.vcn_size_bits = vol->sector_size_bits; ntfs_read_locked_index_inode()
1649 ntfs_error(vol->sb, "$INDEX_ALLOCATION attribute name is " ntfs_read_locked_index_inode()
1736 NVolSetErrors(vol); ntfs_read_locked_index_inode()
1780 ntfs_volume *vol = NTFS_SB(sb); ntfs_read_inode_mount() local
1807 ni->itype.index.block_size = vol->mft_record_size; ntfs_read_inode_mount()
1808 ni->itype.index.block_size_bits = vol->mft_record_size_bits; ntfs_read_inode_mount()
1811 vol->mft_ino = vi; ntfs_read_inode_mount()
1814 if (vol->mft_record_size > 64 * 1024) { ntfs_read_inode_mount()
1816 vol->mft_record_size); ntfs_read_inode_mount()
1819 i = vol->mft_record_size; ntfs_read_inode_mount()
1829 block = vol->mft_lcn << vol->cluster_size_bits >> ntfs_read_inode_mount()
1831 nr_blocks = vol->mft_record_size >> sb->s_blocksize_bits; ntfs_read_inode_mount()
1848 if (post_read_mst_fixup((NTFS_RECORD*)m, vol->mft_record_size)) { ntfs_read_inode_mount()
1921 ni->attr_list_rl.rl = ntfs_mapping_pairs_decompress(vol, ntfs_read_inode_mount()
1932 if ((err = load_attribute_list(vol, &ni->attr_list_rl, ntfs_read_inode_mount()
1946 (u8*)ctx->mrec + vol->mft_record_size) { ntfs_read_inode_mount()
2052 nrl = ntfs_mapping_pairs_decompress(vol, a, ni->runlist.rl); ntfs_read_inode_mount()
2073 >> vol->cluster_size_bits; ntfs_read_inode_mount()
2085 if ((vi->i_size >> vol->mft_record_size_bits) >= ntfs_read_inode_mount()
2236 ntfs_error(ni->vol->sb, "Clearing dirty extent inode! " ntfs_clear_extent_inode()
2314 ntfs_volume *vol = NTFS_SB(root->d_sb); ntfs_show_options() local
2317 seq_printf(sf, ",uid=%i", from_kuid_munged(&init_user_ns, vol->uid)); ntfs_show_options()
2318 seq_printf(sf, ",gid=%i", from_kgid_munged(&init_user_ns, vol->gid)); ntfs_show_options()
2319 if (vol->fmask == vol->dmask) ntfs_show_options()
2320 seq_printf(sf, ",umask=0%o", vol->fmask); ntfs_show_options()
2322 seq_printf(sf, ",fmask=0%o", vol->fmask); ntfs_show_options()
2323 seq_printf(sf, ",dmask=0%o", vol->dmask); ntfs_show_options()
2325 seq_printf(sf, ",nls=%s", vol->nls_map->charset); ntfs_show_options()
2326 if (NVolCaseSensitive(vol)) ntfs_show_options()
2328 if (NVolShowSystemFiles(vol)) ntfs_show_options()
2330 if (!NVolSparseEnabled(vol)) ntfs_show_options()
2333 if (on_errors_arr[i].val & vol->on_errors) ntfs_show_options()
2336 seq_printf(sf, ",mft_zone_multiplier=%i", vol->mft_zone_multiplier); ntfs_show_options()
2369 ntfs_volume *vol = ni->vol; ntfs_truncate() local
2433 new_alloc_size = (new_size + vol->cluster_size - 1) & ntfs_truncate()
2434 ~(s64)vol->cluster_size_mask; ntfs_truncate()
2466 err = ntfs_attr_size_bounds_check(vol, ni->type, new_size); ntfs_truncate()
2469 ntfs_error(vol->sb, "Truncate would cause the " ntfs_truncate()
2479 ntfs_error(vol->sb, "Inode 0x%lx has unknown " ntfs_truncate()
2503 if (new_size < vol->mft_record_size && ntfs_truncate()
2571 ntfs_error(vol->sb, "Cannot truncate inode 0x%lx, attribute " ntfs_truncate()
2582 ntfs_error(vol->sb, "Not enough space in the mft record/on " ntfs_truncate()
2586 ntfs_error(vol->sb, "This attribute type may not be " ntfs_truncate()
2624 old_alloc_size >> vol->cluster_size_bits > ntfs_truncate()
2630 ntfs_error(vol->sb, "Cannot truncate inode 0x%lx, " ntfs_truncate()
2705 vol->cluster_size_bits, -1, ctx); ntfs_truncate()
2709 ntfs_error(vol->sb, "Failed to release cluster(s) (error code " ntfs_truncate()
2712 NVolSetErrors(vol); ntfs_truncate()
2716 err = ntfs_rl_truncate_nolock(vol, &ni->runlist, ntfs_truncate()
2717 new_alloc_size >> vol->cluster_size_bits); ntfs_truncate()
2725 ntfs_error(vol->sb, "Failed to %s (error code %li).%s", ntfs_truncate()
2734 mp_size = ntfs_get_size_for_mapping_pairs(vol, ni->runlist.rl, 0, -1); ntfs_truncate()
2736 ntfs_error(vol->sb, "Cannot shrink allocation of inode 0x%lx, " ntfs_truncate()
2756 err = ntfs_mapping_pairs_build(vol, (u8*)a + ntfs_truncate()
2760 ntfs_error(vol->sb, "Cannot shrink allocation of inode 0x%lx, " ntfs_truncate()
2770 vol->cluster_size_bits) - 1); ntfs_truncate()
2777 vol->cluster_size_bits; ntfs_truncate()
2838 NVolSetErrors(vol); ntfs_truncate()
2854 NVolSetErrors(vol); ntfs_truncate()
3106 NVolSetErrors(ni->vol); __ntfs_write_inode()
H A Dattrib.h78 extern int load_attribute_list(ntfs_volume *vol, runlist *rl, u8 *al_start,
95 extern int ntfs_attr_size_bounds_check(const ntfs_volume *vol,
97 extern int ntfs_attr_can_be_non_resident(const ntfs_volume *vol,
99 extern int ntfs_attr_can_be_resident(const ntfs_volume *vol,
H A Dfile.c341 ntfs_volume *vol = ni->vol; ntfs_prepare_file_for_write() local
395 end = (pos + iov_iter_count(from) + vol->cluster_size_mask) & ntfs_prepare_file_for_write()
396 ~(u64)vol->cluster_size_mask; ntfs_prepare_file_for_write()
593 ntfs_volume *vol; ntfs_prepare_pages_for_non_resident_write() local
617 vol = ni->vol; ntfs_prepare_pages_for_non_resident_write()
622 blocksize = vol->sb->s_blocksize; ntfs_prepare_pages_for_non_resident_write()
623 blocksize_bits = vol->sb->s_blocksize_bits; ntfs_prepare_pages_for_non_resident_write()
645 cpos = pos >> vol->cluster_size_bits; ntfs_prepare_pages_for_non_resident_write()
647 cend = (end + vol->cluster_size - 1) >> vol->cluster_size_bits; ntfs_prepare_pages_for_non_resident_write()
666 bh_cpos = bh_pos >> vol->cluster_size_bits; ntfs_prepare_pages_for_non_resident_write()
667 bh_cofs = bh_pos & vol->cluster_size_mask; ntfs_prepare_pages_for_non_resident_write()
710 bh->b_bdev = vol->sb->s_bdev; ntfs_prepare_pages_for_non_resident_write()
724 (cdelta << (vol->cluster_size_bits - ntfs_prepare_pages_for_non_resident_write()
861 lcn_block = lcn << (vol->cluster_size_bits - ntfs_prepare_pages_for_non_resident_write()
923 ntfs_error(vol->sb, "Failed to write to inode 0x%lx, " ntfs_prepare_pages_for_non_resident_write()
931 vol->cluster_size_mask, ntfs_prepare_pages_for_non_resident_write()
944 if (unlikely(vol->cluster_size < PAGE_CACHE_SIZE)) { ntfs_prepare_pages_for_non_resident_write()
945 bh_cend = (bh_end + vol->cluster_size - 1) >> ntfs_prepare_pages_for_non_resident_write()
946 vol->cluster_size_bits; ntfs_prepare_pages_for_non_resident_write()
995 rl2 = ntfs_cluster_alloc(vol, bh_cpos, 1, lcn, DATA_ZONE, ntfs_prepare_pages_for_non_resident_write()
1009 if (ntfs_cluster_free_from_rl(vol, rl2)) { ntfs_prepare_pages_for_non_resident_write()
1010 ntfs_error(vol->sb, "Failed to release " ntfs_prepare_pages_for_non_resident_write()
1014 NVolSetErrors(vol); ntfs_prepare_pages_for_non_resident_write()
1069 vol->cluster_size_bits) - 1; ntfs_prepare_pages_for_non_resident_write()
1074 mp_size = ntfs_get_size_for_mapping_pairs(vol, rl2, vcn, ntfs_prepare_pages_for_non_resident_write()
1104 ntfs_error(vol->sb, "Not enough space in the mft " ntfs_prepare_pages_for_non_resident_write()
1116 err = ntfs_mapping_pairs_build(vol, (u8*)a + le16_to_cpu( ntfs_prepare_pages_for_non_resident_write()
1120 ntfs_error(vol->sb, "Cannot fill hole in inode 0x%lx, " ntfs_prepare_pages_for_non_resident_write()
1157 ni->itype.compressed.size += vol->cluster_size; ntfs_prepare_pages_for_non_resident_write()
1175 lcn_block = lcn << (vol->cluster_size_bits - blocksize_bits); ntfs_prepare_pages_for_non_resident_write()
1245 ntfs_error(vol->sb, "Failed to find required " ntfs_prepare_pages_for_non_resident_write()
1250 ni->itype.compressed.size += vol->cluster_size; ntfs_prepare_pages_for_non_resident_write()
1259 NVolSetErrors(vol); ntfs_prepare_pages_for_non_resident_write()
1276 if (ntfs_rl_punch_nolock(vol, &ni->runlist, bh_cpos, 1)) { ntfs_prepare_pages_for_non_resident_write()
1277 ntfs_error(vol->sb, "Failed to punch hole into " ntfs_prepare_pages_for_non_resident_write()
1281 NVolSetErrors(vol); ntfs_prepare_pages_for_non_resident_write()
1289 down_write(&vol->lcnbmp_lock); ntfs_prepare_pages_for_non_resident_write()
1290 if (ntfs_bitmap_clear_bit(vol->lcnbmp_ino, lcn)) { ntfs_prepare_pages_for_non_resident_write()
1291 ntfs_error(vol->sb, "Failed to release " ntfs_prepare_pages_for_non_resident_write()
1295 NVolSetErrors(vol); ntfs_prepare_pages_for_non_resident_write()
1297 up_write(&vol->lcnbmp_lock); ntfs_prepare_pages_for_non_resident_write()
1308 ntfs_error(vol->sb, "Failed to restore attribute " ntfs_prepare_pages_for_non_resident_write()
1311 NVolSetErrors(vol); ntfs_prepare_pages_for_non_resident_write()
1313 if (ntfs_mapping_pairs_build(vol, (u8*)a + ntfs_prepare_pages_for_non_resident_write()
1319 ntfs_error(vol->sb, "Failed to restore " ntfs_prepare_pages_for_non_resident_write()
1323 NVolSetErrors(vol); ntfs_prepare_pages_for_non_resident_write()
1346 end = bh_cpos << vol->cluster_size_bits; ntfs_prepare_pages_for_non_resident_write()
1370 ntfs_error(vol->sb, "Failed. Returning error code %i.", err); ntfs_prepare_pages_for_non_resident_write()
1513 NVolSetErrors(ni->vol); ntfs_commit_pages_after_non_resident_write()
1685 NVolSetErrors(ni->vol); ntfs_commit_pages_after_write()
1750 ntfs_volume *vol = ni->vol; ntfs_perform_write() local
1776 ntfs_error(vol->sb, "Cannot perform write to inode " ntfs_perform_write()
1789 if (vol->cluster_size > PAGE_CACHE_SIZE && NInoNonResident(ni)) ntfs_perform_write()
1790 nr_pages = vol->cluster_size >> PAGE_CACHE_SHIFT; ntfs_perform_write()
1803 vcn = pos >> vol->cluster_size_bits; ntfs_perform_write()
1813 vol->cluster_size_bits, false); ntfs_perform_write()
1820 ntfs_error(vol->sb, "Cannot " ntfs_perform_write()
1833 vol->cluster_size_mask) ntfs_perform_write()
1835 bytes = vol->cluster_size - (pos & ntfs_perform_write()
1836 vol->cluster_size_mask); ntfs_perform_write()
H A Dquota.h31 extern bool ntfs_mark_quotas_out_of_date(ntfs_volume *vol);
H A Dvolume.h156 static inline int NVol##flag(ntfs_volume *vol) \
158 return test_bit(NV_##flag, &(vol)->flags); \
160 static inline void NVolSet##flag(ntfs_volume *vol) \
162 set_bit(NV_##flag, &(vol)->flags); \
164 static inline void NVolClear##flag(ntfs_volume *vol) \
166 clear_bit(NV_##flag, &(vol)->flags); \
H A Dcompress.c488 ntfs_volume *vol = ni->vol; ntfs_read_compressed_block() local
489 struct super_block *sb = vol->sb; ntfs_read_compressed_block()
502 vol->cluster_size_bits; ntfs_read_compressed_block()
508 & ~cb_size_mask) >> vol->cluster_size_bits; ntfs_read_compressed_block()
510 unsigned int nr_cbs = (end_vcn - start_vcn) << vol->cluster_size_bits ntfs_read_compressed_block()
518 vol->cluster_size_bits >> PAGE_CACHE_SHIFT; ntfs_read_compressed_block()
544 ntfs_error(vol->sb, "Failed to allocate internal buffers."); ntfs_read_compressed_block()
552 offset = start_vcn << vol->cluster_size_bits >> PAGE_CACHE_SHIFT; ntfs_read_compressed_block()
650 block = lcn << vol->cluster_size_bits >> block_size_bits; ntfs_read_compressed_block()
652 max_block = block + (vol->cluster_size >> block_size_bits); ntfs_read_compressed_block()
697 ntfs_warning(vol->sb, "Buffer is unlocked but not " ntfs_read_compressed_block()
705 ntfs_warning(vol->sb, "Buffer is now uptodate. Good."); ntfs_read_compressed_block()
875 ntfs_error(vol->sb, "ntfs_decompress() failed in inode " ntfs_read_compressed_block()
909 ntfs_error(vol->sb, "Still have pages left! " ntfs_read_compressed_block()
934 ntfs_error(vol->sb, "IO error while reading compressed data."); ntfs_read_compressed_block()
941 ntfs_error(vol->sb, "ntfs_map_runlist() failed. Cannot read " ntfs_read_compressed_block()
947 ntfs_error(vol->sb, "ntfs_rl_vcn_to_lcn() failed. Cannot read " ntfs_read_compressed_block()
953 ntfs_error(vol->sb, "getblk() failed. Cannot read compression block."); ntfs_read_compressed_block()
H A Dlogfile.c488 ntfs_volume *vol = NTFS_SB(log_vi->i_sb); ntfs_check_logfile() local
500 if (NVolLogFileEmpty(vol)) ntfs_check_logfile()
530 ntfs_error(vol->sb, "$LogFile is too small."); ntfs_check_logfile()
548 ntfs_error(vol->sb, "Error mapping $LogFile " ntfs_check_logfile()
616 NVolSetLogFileEmpty(vol); ntfs_check_logfile()
623 ntfs_error(vol->sb, "Did not find any restart pages in " ntfs_check_logfile()
681 ntfs_volume *vol = NTFS_SB(log_vi->i_sb); ntfs_is_logfile_clean() local
686 if (NVolLogFileEmpty(vol)) { ntfs_is_logfile_clean()
693 ntfs_error(vol->sb, "Restart page buffer is invalid. This is " ntfs_is_logfile_clean()
730 ntfs_volume *vol = log_ni->vol; ntfs_empty_logfile() local
731 struct super_block *sb = vol->sb; ntfs_empty_logfile()
739 if (NVolLogFileEmpty(vol)) { ntfs_empty_logfile()
754 end_vcn = (log_ni->initialized_size + vol->cluster_size_mask) >> ntfs_empty_logfile()
755 vol->cluster_size_bits; ntfs_empty_logfile()
794 block = lcn << vol->cluster_size_bits >> block_size_bits; ntfs_empty_logfile()
798 end_block = (lcn + len) << vol->cluster_size_bits >> ntfs_empty_logfile()
845 NVolSetLogFileEmpty(vol); ntfs_empty_logfile()
854 NVolSetErrors(vol); ntfs_empty_logfile()
H A Dmft.h79 extern int ntfs_sync_mft_mirror(ntfs_volume *vol, const unsigned long mft_no,
114 extern bool ntfs_may_write_mft_record(ntfs_volume *vol,
118 extern ntfs_inode *ntfs_mft_record_alloc(ntfs_volume *vol, const int mode,
H A Dnamei.c106 ntfs_volume *vol = NTFS_SB(dir_ino->i_sb); ntfs_lookup() local
117 uname_len = ntfs_nlstoucs(vol, dent->d_name.name, dent->d_name.len, ntfs_lookup()
121 ntfs_error(vol->sb, "Failed to convert name to " ntfs_lookup()
131 dent_inode = ntfs_iget(vol->sb, dent_ino); ntfs_lookup()
148 ntfs_error(vol->sb, "Found stale reference to inode " ntfs_lookup()
157 ntfs_error(vol->sb, "ntfs_iget(0x%lx) failed with " ntfs_lookup()
172 ntfs_error(vol->sb, "ntfs_lookup_ino_by_name() failed with error " ntfs_lookup()
187 nls_name.len = (unsigned)ntfs_ucstonls(vol, ntfs_lookup()
218 ntfs_error(vol->sb, "Inode corrupt: No WIN32 " ntfs_lookup()
241 nls_name.len = (unsigned)ntfs_ucstonls(vol, ntfs_lookup()
263 ntfs_error(vol->sb, "Illegal file name attribute. Run chkdsk."); ntfs_lookup()
271 ntfs_error(vol->sb, "Failed, returning error code %i.", err); ntfs_lookup()
H A Dcollate.h46 extern int ntfs_collate(ntfs_volume *vol, COLLATION_RULE cr,
H A Drunlist.c723 * @vol: ntfs volume on which the attribute resides
749 runlist_element *ntfs_mapping_pairs_decompress(const ntfs_volume *vol, ntfs_mapping_pairs_decompress() argument
767 ntfs_error(vol->sb, "Invalid arguments."); ntfs_mapping_pairs_decompress()
779 ntfs_error(vol->sb, "Corrupt attribute."); ntfs_mapping_pairs_decompress()
833 ntfs_error(vol->sb, "Missing length entry in mapping " ntfs_mapping_pairs_decompress()
842 ntfs_error(vol->sb, "Invalid length in mapping pairs " ntfs_mapping_pairs_decompress()
878 if (vol->major_ver < 3) { ntfs_mapping_pairs_decompress()
880 ntfs_error(vol->sb, "lcn delta == -1"); ntfs_mapping_pairs_decompress()
882 ntfs_error(vol->sb, "lcn == -1"); ntfs_mapping_pairs_decompress()
887 ntfs_error(vol->sb, "Invalid LCN < -1 in " ntfs_mapping_pairs_decompress()
908 ntfs_error(vol->sb, "Corrupt mapping pairs array in " ntfs_mapping_pairs_decompress()
918 vol->cluster_size - 1) >> ntfs_mapping_pairs_decompress()
919 vol->cluster_size_bits) - 1; ntfs_mapping_pairs_decompress()
944 ntfs_error(vol->sb, "Corrupt attribute. " ntfs_mapping_pairs_decompress()
971 ntfs_error(vol->sb, "Failed to merge runlists."); ntfs_mapping_pairs_decompress()
974 ntfs_error(vol->sb, "Corrupt attribute."); ntfs_mapping_pairs_decompress()
1104 * @vol: ntfs volume (needed for the ntfs version)
1131 int ntfs_get_size_for_mapping_pairs(const ntfs_volume *vol, ntfs_get_size_for_mapping_pairs() argument
1183 if (likely(rl->lcn >= 0 || vol->major_ver < 3)) { ntfs_get_size_for_mapping_pairs()
1218 if (likely(rl->lcn >= 0 || vol->major_ver < 3)) { ntfs_get_size_for_mapping_pairs()
1287 * @vol: ntfs volume (needed for the ntfs version)
1323 int ntfs_mapping_pairs_build(const ntfs_volume *vol, s8 *dst, ntfs_mapping_pairs_build() argument
1390 if (likely(rl->lcn >= 0 || vol->major_ver < 3)) { ntfs_mapping_pairs_build()
1441 if (likely(rl->lcn >= 0 || vol->major_ver < 3)) { ntfs_mapping_pairs_build()
1477 * @vol: ntfs volume (needed for error output)
1499 int ntfs_rl_truncate_nolock(const ntfs_volume *vol, runlist *const runlist, ntfs_rl_truncate_nolock() argument
1523 ntfs_error(vol->sb, "Not enough memory to allocate " ntfs_rl_truncate_nolock()
1572 ntfs_warning(vol->sb, "Failed to shrink " ntfs_rl_truncate_nolock()
1596 ntfs_error(vol->sb, "Failed to expand runlist " ntfs_rl_truncate_nolock()
1625 * @vol: ntfs volume (needed for error output)
1644 int ntfs_rl_punch_nolock(const ntfs_volume *vol, runlist *const runlist, ntfs_rl_punch_nolock() argument
1730 ntfs_warning(vol->sb, "Failed to shrink " ntfs_rl_punch_nolock()
1903 ntfs_error(vol->sb, "Not enough memory to extend runlist buffer."); ntfs_rl_punch_nolock()
H A Dntfs.h127 extern int ntfs_nlstoucs(const ntfs_volume *vol, const char *ins,
129 extern int ntfs_ucstonls(const ntfs_volume *vol, const ntfschar *ins,
H A Dindex.c124 ntfs_volume *vol = idx_ni->vol; ntfs_index_lookup() local
125 struct super_block *sb = vol->sb; ntfs_index_lookup()
227 rc = ntfs_collate(vol, idx_ni->itype.index.collation_rule, key, ntfs_index_lookup()
390 rc = ntfs_collate(vol, idx_ni->itype.index.collation_rule, key, ntfs_index_lookup()
429 if (old_vcn << vol->cluster_size_bits >> ntfs_index_lookup()
431 vol->cluster_size_bits >> ntfs_index_lookup()
H A Dusnjrnl.h201 extern bool ntfs_stamp_usnjrnl(ntfs_volume *vol);
H A Dinode.h56 ntfs_volume *vol; /* Pointer to the ntfs volume of this inode. */ member in struct:_ntfs_inode
/linux-4.1.27/sound/soc/codecs/
H A Dalc5632.h22 /* speaker output vol 2 2 */
23 /* line output vol 4 2 */
24 /* HP output vol 4 0 4 */
25 #define ALC5632_SPK_OUT_VOL 0x02 /* spe out vol */
27 #define ALC5632_HP_OUT_VOL 0x04 /* hp out vol */
28 #define ALC5632_AUX_OUT_VOL 0x06 /* aux out vol */
29 #define ALC5632_PHONE_IN_VOL 0x08 /* phone in vol */
30 #define ALC5632_LINE_IN_VOL 0x0A /* line in vol */
31 #define ALC5632_STEREO_DAC_IN_VOL 0x0C /* stereo dac in vol */
32 #define ALC5632_MIC_VOL 0x0E /* mic in vol */
53 #define ALC5632_VOICE_DAC_VOL 0x18 /* voice dac vol */
H A Dalc5623.h21 /* speaker output vol 2 2 */
22 /* line output vol 4 2 */
23 /* HP output vol 4 0 4 */
H A Dwm8974.c198 /* AUX Input boost vol */
202 /* Mic Input boost vol */
H A Dsgtl5000.c307 * | R channel vol | L channel vol |
360 * | R channel vol | L channel vol |
H A Dwm8983.c43 { 0x0C, 0x00FF }, /* R12 - Right DAC digital vol */
103 [0x0C] = { 0x0000, 0x01FF }, /* R12 - Right DAC digital vol */
147 /* vol/gain update regs */
981 /* set the vol/gain update bits */ wm8983_probe()
H A Dcs42l51.c495 * - vol changes immediate cs42l51_codec_probe()
H A Dmax98088.c264 int vol; member in struct:__anon14587
546 return max98088_access[reg].vol; max98088_volatile_register()
H A Dwm8983.h345 * R12 (0x0C) - Right DAC digital vol
H A Dwm8985.c55 { 12, 0x00FF }, /* R12 - Right DAC digital vol */
H A Dwm8985.h348 * R12 (0x0C) - Right DAC digital vol
/linux-4.1.27/sound/ppc/
H A Dawacs.c153 int vol[2]; snd_pmac_awacs_get_volume() local
156 vol[0] = (chip->awacs_reg[reg] >> lshift) & 0xf; snd_pmac_awacs_get_volume()
157 vol[1] = chip->awacs_reg[reg] & 0xf; snd_pmac_awacs_get_volume()
160 vol[0] = 0x0f - vol[0]; snd_pmac_awacs_get_volume()
161 vol[1] = 0x0f - vol[1]; snd_pmac_awacs_get_volume()
163 ucontrol->value.integer.value[0] = vol[0]; snd_pmac_awacs_get_volume()
164 ucontrol->value.integer.value[1] = vol[1]; snd_pmac_awacs_get_volume()
177 unsigned int vol[2]; snd_pmac_awacs_put_volume() local
179 vol[0] = ucontrol->value.integer.value[0]; snd_pmac_awacs_put_volume()
180 vol[1] = ucontrol->value.integer.value[1]; snd_pmac_awacs_put_volume()
181 if (vol[0] > 0x0f || vol[1] > 0x0f) snd_pmac_awacs_put_volume()
184 vol[0] = 0x0f - vol[0]; snd_pmac_awacs_put_volume()
185 vol[1] = 0x0f - vol[1]; snd_pmac_awacs_put_volume()
187 vol[0] &= 0x0f; snd_pmac_awacs_put_volume()
188 vol[1] &= 0x0f; snd_pmac_awacs_put_volume()
192 val |= vol[0] << lshift; snd_pmac_awacs_put_volume()
193 val |= vol[1]; snd_pmac_awacs_put_volume()
291 * vol = 0 - 31 (attenuation), 32 = mute bit, stereo
309 static void awacs_amp_set_master(struct awacs_amp *amp, int vol) awacs_amp_set_master() argument
311 amp->amp_master = vol; awacs_amp_set_master()
312 if (vol <= 79) awacs_amp_set_master()
313 vol = 32 + (79 - vol); awacs_amp_set_master()
315 vol = 32 - (vol - 79); awacs_amp_set_master()
316 awacs_set_cuda(1, vol); awacs_amp_set_master()
360 int vol[2]; snd_pmac_awacs_put_volume_amp() local
363 vol[0] = (31 - (ucontrol->value.integer.value[0] & 31)) snd_pmac_awacs_put_volume_amp()
365 vol[1] = (31 - (ucontrol->value.integer.value[1] & 31)) snd_pmac_awacs_put_volume_amp()
367 return awacs_amp_set_vol(amp, index, vol[0], vol[1], 1); snd_pmac_awacs_put_volume_amp()
389 int vol[2]; snd_pmac_awacs_put_switch_amp() local
392 vol[0] = (ucontrol->value.integer.value[0] ? 0 : 32) snd_pmac_awacs_put_switch_amp()
394 vol[1] = (ucontrol->value.integer.value[1] ? 0 : 32) snd_pmac_awacs_put_switch_amp()
396 return awacs_amp_set_vol(amp, index, vol[0], vol[1], 1); snd_pmac_awacs_put_switch_amp()
808 int vol[2]; toggle_amp_mute() local
809 vol[0] = amp->amp_vol[index][0] & 31; toggle_amp_mute()
810 vol[1] = amp->amp_vol[index][1] & 31; toggle_amp_mute()
812 vol[0] |= 32; toggle_amp_mute()
813 vol[1] |= 32; toggle_amp_mute()
815 return awacs_amp_set_vol(amp, index, vol[0], vol[1], 1); toggle_amp_mute()
884 int err, vol; snd_pmac_awacs_init() local
902 // vol = (~nvram_read_byte(0x1308) & 7) << 1; snd_pmac_awacs_init()
903 // vol = ((pmac_xpram_read( 8 ) & 7 ) << 1 ); snd_pmac_awacs_init()
904 vol = 0x0f; /* no, on alsa, muted as default */ snd_pmac_awacs_init()
905 vol = vol + (vol << 6); snd_pmac_awacs_init()
906 chip->awacs_reg[2] = vol; snd_pmac_awacs_init()
907 chip->awacs_reg[4] = vol; snd_pmac_awacs_init()
909 /* FIXME: screamer has loopthru vol control */ snd_pmac_awacs_init()
910 chip->awacs_reg[5] = vol; snd_pmac_awacs_init()
911 /* FIXME: maybe should be vol << 3 for PCMCIA speaker */ snd_pmac_awacs_init()
928 /* mute and zero vol */ snd_pmac_awacs_init()
H A Dtumbler.c282 unsigned int vol[2]; tumbler_put_master_volume() local
285 vol[0] = ucontrol->value.integer.value[0]; tumbler_put_master_volume()
286 vol[1] = ucontrol->value.integer.value[1]; tumbler_put_master_volume()
287 if (vol[0] >= ARRAY_SIZE(master_volume_table) || tumbler_put_master_volume()
288 vol[1] >= ARRAY_SIZE(master_volume_table)) tumbler_put_master_volume()
290 change = mix->master_vol[0] != vol[0] || tumbler_put_master_volume()
291 mix->master_vol[1] != vol[1]; tumbler_put_master_volume()
293 mix->master_vol[0] = vol[0]; tumbler_put_master_volume()
294 mix->master_vol[1] = vol[1]; tumbler_put_master_volume()
502 unsigned int vol; tumbler_set_mono_volume() local
508 vol = mix->mono_vol[info->index]; tumbler_set_mono_volume()
509 if (vol >= info->max) tumbler_set_mono_volume()
510 vol = info->max - 1; tumbler_set_mono_volume()
511 vol = info->table[vol]; tumbler_set_mono_volume()
513 block[i] = (vol >> ((info->bytes - i - 1) * 8)) & 0xff; tumbler_set_mono_volume()
553 unsigned int vol; tumbler_put_mono() local
558 vol = ucontrol->value.integer.value[0]; tumbler_put_mono()
559 if (vol >= info->max) tumbler_put_mono()
561 change = mix->mono_vol[info->index] != vol; tumbler_put_mono()
563 mix->mono_vol[info->index] = vol; tumbler_put_mono()
637 int i, j, vol; snapper_set_mix_vol1() local
640 vol = mix->mix_vol[idx][ch]; snapper_set_mix_vol1()
641 if (vol >= ARRAY_SIZE(mixer_volume_table)) { snapper_set_mix_vol1()
642 vol = ARRAY_SIZE(mixer_volume_table) - 1; snapper_set_mix_vol1()
643 mix->mix_vol[idx][ch] = vol; snapper_set_mix_vol1()
647 vol = mix->mix_vol[i][ch]; snapper_set_mix_vol1()
648 vol = mixer_volume_table[vol]; snapper_set_mix_vol1()
650 block[i * 3 + j] = (vol >> ((2 - j) * 8)) & 0xff; snapper_set_mix_vol1()
699 unsigned int vol[2]; snapper_put_mix() local
704 vol[0] = ucontrol->value.integer.value[0]; snapper_put_mix()
705 vol[1] = ucontrol->value.integer.value[1]; snapper_put_mix()
706 if (vol[0] >= ARRAY_SIZE(mixer_volume_table) || snapper_put_mix()
707 vol[1] >= ARRAY_SIZE(mixer_volume_table)) snapper_put_mix()
709 change = mix->mix_vol[idx][0] != vol[0] || snapper_put_mix()
710 mix->mix_vol[idx][1] != vol[1]; snapper_put_mix()
712 mix->mix_vol[idx][0] = vol[0]; snapper_put_mix()
713 mix->mix_vol[idx][1] = vol[1]; snapper_put_mix()
H A Ddaca.c151 unsigned int vol[2]; daca_put_volume() local
156 vol[0] = ucontrol->value.integer.value[0]; daca_put_volume()
157 vol[1] = ucontrol->value.integer.value[1]; daca_put_volume()
158 if (vol[0] > DACA_VOL_MAX || vol[1] > DACA_VOL_MAX) daca_put_volume()
160 change = mix->left_vol != vol[0] || daca_put_volume()
161 mix->right_vol != vol[1]; daca_put_volume()
163 mix->left_vol = vol[0]; daca_put_volume()
164 mix->right_vol = vol[1]; daca_put_volume()
/linux-4.1.27/fs/cifs/
H A Dconnect.c1028 struct smb_vol *vol) cifs_parse_security_flavors()
1037 vol->sectype = Unspecified; cifs_parse_security_flavors()
1038 vol->sign = false; cifs_parse_security_flavors()
1045 vol->sign = true; cifs_parse_security_flavors()
1048 vol->sectype = Kerberos; cifs_parse_security_flavors()
1051 vol->sign = true; cifs_parse_security_flavors()
1054 vol->sectype = RawNTLMSSP; cifs_parse_security_flavors()
1057 vol->sign = true; cifs_parse_security_flavors()
1060 vol->sectype = NTLM; cifs_parse_security_flavors()
1063 vol->sign = true; cifs_parse_security_flavors()
1066 vol->sectype = NTLMv2; cifs_parse_security_flavors()
1070 vol->sectype = LANMAN; cifs_parse_security_flavors()
1074 vol->nullauth = 1; cifs_parse_security_flavors()
1085 cifs_parse_cache_flavor(char *value, struct smb_vol *vol) cifs_parse_cache_flavor() argument
1091 vol->direct_io = false; cifs_parse_cache_flavor()
1092 vol->strict_io = false; cifs_parse_cache_flavor()
1095 vol->direct_io = false; cifs_parse_cache_flavor()
1096 vol->strict_io = true; cifs_parse_cache_flavor()
1099 vol->direct_io = true; cifs_parse_cache_flavor()
1100 vol->strict_io = false; cifs_parse_cache_flavor()
1110 cifs_parse_smb_version(char *value, struct smb_vol *vol) cifs_parse_smb_version() argument
1116 vol->ops = &smb1_operations; cifs_parse_smb_version()
1117 vol->vals = &smb1_values; cifs_parse_smb_version()
1121 vol->ops = &smb20_operations; cifs_parse_smb_version()
1122 vol->vals = &smb20_values; cifs_parse_smb_version()
1125 vol->ops = &smb21_operations; cifs_parse_smb_version()
1126 vol->vals = &smb21_values; cifs_parse_smb_version()
1129 vol->ops = &smb30_operations; cifs_parse_smb_version()
1130 vol->vals = &smb30_values; cifs_parse_smb_version()
1133 vol->ops = &smb30_operations; /* currently identical with 3.0 */ cifs_parse_smb_version()
1134 vol->vals = &smb302_values; cifs_parse_smb_version()
1145 * Parse a devname into substrings and populate the vol->UNC and vol->prepath
1149 cifs_parse_devname(const char *devname, struct smb_vol *vol) cifs_parse_devname() argument
1173 vol->UNC = kstrndup(devname, pos - devname, GFP_KERNEL); cifs_parse_devname()
1174 if (!vol->UNC) cifs_parse_devname()
1177 convert_delimiter(vol->UNC, '\\'); cifs_parse_devname()
1183 vol->prepath = kstrdup(pos, GFP_KERNEL); cifs_parse_devname()
1184 if (!vol->prepath) cifs_parse_devname()
1192 struct smb_vol *vol) cifs_parse_mount_options()
1210 struct sockaddr *dstaddr = (struct sockaddr *)&vol->dstaddr; cifs_parse_mount_options()
1217 memset(vol, 0, sizeof(*vol)); cifs_parse_mount_options()
1224 memset(vol->source_rfc1001_name, 0x20, RFC1001_NAME_LEN); cifs_parse_mount_options()
1226 vol->source_rfc1001_name[i] = toupper(nodename[i]); cifs_parse_mount_options()
1228 vol->source_rfc1001_name[RFC1001_NAME_LEN] = 0; cifs_parse_mount_options()
1231 vol->target_rfc1001_name[0] = 0; cifs_parse_mount_options()
1232 vol->cred_uid = current_uid(); cifs_parse_mount_options()
1233 vol->linux_uid = current_uid(); cifs_parse_mount_options()
1234 vol->linux_gid = current_gid(); cifs_parse_mount_options()
1242 vol->remap = true; cifs_parse_mount_options()
1245 vol->dir_mode = vol->file_mode = S_IRUGO | S_IXUGO | S_IWUSR; cifs_parse_mount_options()
1247 /* vol->retry default is 0 (i.e. "soft" limited retry not hard retry) */ cifs_parse_mount_options()
1249 vol->posix_paths = 1; cifs_parse_mount_options()
1251 vol->server_ino = 1; cifs_parse_mount_options()
1254 vol->strict_io = true; cifs_parse_mount_options()
1256 vol->actimeo = CIFS_DEF_ACTIMEO; cifs_parse_mount_options()
1259 vol->ops = &smb1_operations; cifs_parse_mount_options()
1260 vol->vals = &smb1_values; cifs_parse_mount_options()
1280 vol->backupuid_specified = false; /* no backup intent for a user */ cifs_parse_mount_options()
1281 vol->backupgid_specified = false; /* no backup intent for a group */ cifs_parse_mount_options()
1283 switch (cifs_parse_devname(devname, vol)) { cifs_parse_mount_options()
1315 vol->no_xattr = 0; cifs_parse_mount_options()
1318 vol->no_xattr = 1; cifs_parse_mount_options()
1333 vol->noblocksnd = 1; cifs_parse_mount_options()
1336 vol->noautotune = 1; cifs_parse_mount_options()
1339 vol->retry = 1; cifs_parse_mount_options()
1342 vol->retry = 0; cifs_parse_mount_options()
1345 vol->noperm = 0; cifs_parse_mount_options()
1348 vol->noperm = 1; cifs_parse_mount_options()
1351 vol->sfu_remap = true; cifs_parse_mount_options()
1352 vol->remap = false; /* disable SFM mapping */ cifs_parse_mount_options()
1355 vol->sfu_remap = false; cifs_parse_mount_options()
1358 vol->remap = true; cifs_parse_mount_options()
1359 vol->sfu_remap = false; /* disable SFU mapping */ cifs_parse_mount_options()
1362 vol->remap = false; cifs_parse_mount_options()
1365 vol->sfu_emul = 1; cifs_parse_mount_options()
1368 vol->sfu_emul = 0; cifs_parse_mount_options()
1371 vol->nodfs = 1; cifs_parse_mount_options()
1374 vol->posix_paths = 1; cifs_parse_mount_options()
1377 vol->posix_paths = 0; cifs_parse_mount_options()
1380 vol->no_linux_ext = 1; cifs_parse_mount_options()
1383 vol->nocase = 1; cifs_parse_mount_options()
1386 vol->nobrl = 0; cifs_parse_mount_options()
1389 vol->nobrl = 1; cifs_parse_mount_options()
1395 if (vol->file_mode == cifs_parse_mount_options()
1397 vol->file_mode = S_IALLUGO; cifs_parse_mount_options()
1400 vol->mand_lock = 1; cifs_parse_mount_options()
1403 vol->setuids = 1; cifs_parse_mount_options()
1406 vol->setuids = 0; cifs_parse_mount_options()
1409 vol->dynperm = true; cifs_parse_mount_options()
1412 vol->dynperm = false; cifs_parse_mount_options()
1415 vol->retry = 0; cifs_parse_mount_options()
1418 vol->retry = 1; cifs_parse_mount_options()
1421 vol->intr = 0; cifs_parse_mount_options()
1424 vol->intr = 1; cifs_parse_mount_options()
1427 vol->nostrictsync = 1; cifs_parse_mount_options()
1430 vol->nostrictsync = 0; cifs_parse_mount_options()
1433 vol->server_ino = 1; cifs_parse_mount_options()
1436 vol->server_ino = 0; cifs_parse_mount_options()
1439 vol->rwpidforward = 1; cifs_parse_mount_options()
1442 vol->cifs_acl = 1; cifs_parse_mount_options()
1445 vol->cifs_acl = 0; cifs_parse_mount_options()
1448 vol->no_psx_acl = 0; cifs_parse_mount_options()
1451 vol->no_psx_acl = 1; cifs_parse_mount_options()
1454 vol->local_lease = 1; cifs_parse_mount_options()
1457 vol->sign = true; cifs_parse_mount_options()
1463 * vol->secFlg |= CIFSSEC_MUST_SEAL; cifs_parse_mount_options()
1465 vol->seal = 1; cifs_parse_mount_options()
1475 vol->fsc = true; cifs_parse_mount_options()
1478 vol->mfsymlinks = true; cifs_parse_mount_options()
1481 vol->multiuser = true; cifs_parse_mount_options()
1487 vol->nosharesock = true; cifs_parse_mount_options()
1492 if (get_option_uid(args, &vol->backupuid)) { cifs_parse_mount_options()
1497 vol->backupuid_specified = true; cifs_parse_mount_options()
1500 if (get_option_gid(args, &vol->backupgid)) { cifs_parse_mount_options()
1505 vol->backupgid_specified = true; cifs_parse_mount_options()
1508 if (get_option_uid(args, &vol->linux_uid)) { cifs_parse_mount_options()
1516 if (get_option_uid(args, &vol->cred_uid)) { cifs_parse_mount_options()
1523 if (get_option_gid(args, &vol->linux_gid)) { cifs_parse_mount_options()
1536 vol->file_mode = option; cifs_parse_mount_options()
1544 vol->dir_mode = option; cifs_parse_mount_options()
1561 vol->rsize = option; cifs_parse_mount_options()
1569 vol->wsize = option; cifs_parse_mount_options()
1577 vol->actimeo = HZ * option; cifs_parse_mount_options()
1578 if (vol->actimeo > CIFS_MAX_ACTIMEO) { cifs_parse_mount_options()
1588 vol->nullauth = 1; cifs_parse_mount_options()
1589 vol->username = NULL; cifs_parse_mount_options()
1602 kfree(vol->username); cifs_parse_mount_options()
1603 vol->username = kstrdup(string, GFP_KERNEL); cifs_parse_mount_options()
1604 if (!vol->username) cifs_parse_mount_options()
1621 kfree(vol->password); cifs_parse_mount_options()
1622 vol->password = NULL; cifs_parse_mount_options()
1659 kfree(vol->password); cifs_parse_mount_options()
1662 vol->password = kzalloc(temp_len+1, GFP_KERNEL); cifs_parse_mount_options()
1663 if (vol->password == NULL) { cifs_parse_mount_options()
1669 vol->password[j] = value[i]; cifs_parse_mount_options()
1675 vol->password[j] = '\0'; cifs_parse_mount_options()
1704 kfree(vol->domainname); cifs_parse_mount_options()
1705 vol->domainname = kstrdup(string, GFP_KERNEL); cifs_parse_mount_options()
1706 if (!vol->domainname) { cifs_parse_mount_options()
1718 (struct sockaddr *)&vol->srcaddr, cifs_parse_mount_options()
1736 kfree(vol->iocharset); cifs_parse_mount_options()
1737 vol->iocharset = kstrdup(string, cifs_parse_mount_options()
1739 if (!vol->iocharset) { cifs_parse_mount_options()
1754 memset(vol->source_rfc1001_name, 0x20, cifs_parse_mount_options()
1765 vol->source_rfc1001_name[i] = string[i]; cifs_parse_mount_options()
1780 memset(vol->target_rfc1001_name, 0x20, cifs_parse_mount_options()
1792 vol->target_rfc1001_name[i] = string[i]; cifs_parse_mount_options()
1816 if (cifs_parse_smb_version(string, vol) != 0) cifs_parse_mount_options()
1824 if (cifs_parse_security_flavors(string, vol) != 0) cifs_parse_mount_options()
1832 if (cifs_parse_cache_flavor(string, vol) != 0) cifs_parse_mount_options()
1856 if (vol->multiuser) { cifs_parse_mount_options()
1861 if (!vol->UNC) { cifs_parse_mount_options()
1867 if (!strchr(vol->UNC + 3, '\\')) { cifs_parse_mount_options()
1874 if (!cifs_convert_address(dstaddr, &vol->UNC[2], cifs_parse_mount_options()
1875 strlen(&vol->UNC[2]))) { cifs_parse_mount_options()
1885 vol->override_uid = override_uid; cifs_parse_mount_options()
1890 vol->override_gid = override_gid; cifs_parse_mount_options()
2004 match_security(struct TCP_Server_Info *server, struct smb_vol *vol) match_security() argument
2007 * The select_sectype function should either return the vol->sectype match_security()
2011 if (select_sectype(server, vol->sectype) == Unspecified) match_security()
2019 if (vol->sign && !server->sign) match_security()
2025 static int match_server(struct TCP_Server_Info *server, struct smb_vol *vol) match_server() argument
2027 struct sockaddr *addr = (struct sockaddr *)&vol->dstaddr; match_server()
2029 if (vol->nosharesock) match_server()
2032 if ((server->vals != vol->vals) || (server->ops != vol->ops)) match_server()
2039 (struct sockaddr *)&vol->srcaddr)) match_server()
2045 if (!match_security(server, vol)) match_server()
2052 cifs_find_tcp_session(struct smb_vol *vol) cifs_find_tcp_session() argument
2058 if (!match_server(server, vol)) cifs_find_tcp_session()
2216 static int match_session(struct cifs_ses *ses, struct smb_vol *vol) match_session() argument
2218 if (vol->sectype != Unspecified && match_session()
2219 vol->sectype != ses->sectype) match_session()
2224 if (!uid_eq(vol->cred_uid, ses->cred_uid)) match_session()
2230 if (!vol->nullauth) match_session()
2237 vol->username ? vol->username : "", match_session()
2240 if ((vol->username && strlen(vol->username) != 0) && match_session()
2243 vol->password ? vol->password : "", match_session()
2251 cifs_find_smb_ses(struct TCP_Server_Info *server, struct smb_vol *vol) cifs_find_smb_ses() argument
2259 if (!match_session(ses, vol)) cifs_find_smb_ses()
2314 cifs_set_cifscreds(struct smb_vol *vol, struct cifs_ses *ses) cifs_set_cifscreds() argument
2391 vol->username = kstrndup(payload, len, GFP_KERNEL); cifs_set_cifscreds()
2392 if (!vol->username) { cifs_set_cifscreds()
2398 cifs_dbg(FYI, "%s: username=%s\n", __func__, vol->username); cifs_set_cifscreds()
2404 kfree(vol->username); cifs_set_cifscreds()
2405 vol->username = NULL; cifs_set_cifscreds()
2410 vol->password = kstrndup(delim, len, GFP_KERNEL); cifs_set_cifscreds()
2411 if (!vol->password) { cifs_set_cifscreds()
2415 kfree(vol->username); cifs_set_cifscreds()
2416 vol->username = NULL; cifs_set_cifscreds()
2430 cifs_set_cifscreds(struct smb_vol *vol __attribute__((unused)), cifs_set_cifscreds()
2755 volume_info = mnt_data->vol; cifs_match_super()
3297 build_unc_path_to_root(const struct smb_vol *vol, build_unc_path_to_root() argument
3301 unsigned int pplen = vol->prepath ? strlen(vol->prepath) + 1 : 0; build_unc_path_to_root()
3302 unsigned int unc_len = strnlen(vol->UNC, MAX_TREE_SIZE + 1); build_unc_path_to_root()
3308 strncpy(full_path, vol->UNC, unc_len); build_unc_path_to_root()
3313 strncpy(pos + 1, vol->prepath, pplen); build_unc_path_to_root()
3887 cifs_set_vol_auth(struct smb_vol *vol, struct cifs_ses *ses) cifs_set_vol_auth() argument
3889 vol->sectype = ses->sectype; cifs_set_vol_auth()
3892 if (vol->sectype == Kerberos) cifs_set_vol_auth()
3895 return cifs_set_cifscreds(vol, ses); cifs_set_vol_auth()
1027 cifs_parse_security_flavors(char *value, struct smb_vol *vol) cifs_parse_security_flavors() argument
1191 cifs_parse_mount_options(const char *mountdata, const char *devname, struct smb_vol *vol) cifs_parse_mount_options() argument
H A Ddir.c49 cifs_build_path_to_root(struct smb_vol *vol, struct cifs_sb_info *cifs_sb, cifs_build_path_to_root() argument
52 int pplen = vol->prepath ? strlen(vol->prepath) + 1 : 0; cifs_build_path_to_root()
74 strncpy(full_path + dfsplen + 1, vol->prepath, pplen); cifs_build_path_to_root()
H A Dcifsfs.c592 cifs_get_root(struct smb_vol *vol, struct super_block *sb) cifs_get_root() argument
600 full_path = cifs_build_path_to_root(vol, cifs_sb, cifs_get_root()
693 mnt_data.vol = volume_info; cifs_do_mount()
H A Dcifsproto.h66 extern char *cifs_build_path_to_root(struct smb_vol *vol,
279 struct smb_vol *vol);
H A Dcifsglob.h517 struct smb_vol *vol; member in struct:cifs_mnt_data
/linux-4.1.27/drivers/media/radio/
H A Dradio-typhoon.c110 static int typhoon_s_mute_volume(struct radio_isa_card *isa, bool mute, int vol) typhoon_s_mute_volume() argument
115 vol = 0; typhoon_s_mute_volume()
116 vol >>= 14; /* Map 16 bit to 2 bit */ typhoon_s_mute_volume()
117 vol &= 3; typhoon_s_mute_volume()
118 outb_p(vol / 2, isa->io); /* Set the volume, high bit. */ typhoon_s_mute_volume()
119 outb_p(vol % 2, isa->io + 2); /* Set the volume, low bit. */ typhoon_s_mute_volume()
121 if (vol == 0 && !ty->muted) { typhoon_s_mute_volume()
125 if (vol && ty->muted) { typhoon_s_mute_volume()
H A Dradio-aimslab.c117 static int rtrack_s_mute_volume(struct radio_isa_card *isa, bool mute, int vol) rtrack_s_mute_volume() argument
126 if (vol == 0) { /* volume = 0 means mute the card */ rtrack_s_mute_volume()
129 } else if (curvol < vol) { rtrack_s_mute_volume()
131 for (; curvol < vol; curvol++) rtrack_s_mute_volume()
133 } else if (curvol > vol) { rtrack_s_mute_volume()
135 for (; curvol > vol; curvol--) rtrack_s_mute_volume()
139 rt->curvol = vol; rtrack_s_mute_volume()
H A Dradio-terratec.c61 static int terratec_s_mute_volume(struct radio_isa_card *isa, bool mute, int vol) terratec_s_mute_volume() argument
66 vol = 0; terratec_s_mute_volume()
67 vol = vol + (vol * 32); /* change both channels */ terratec_s_mute_volume()
69 if (vol & (0x80 >> i)) terratec_s_mute_volume()
H A Dradio-aztech.c109 static int aztech_s_mute_volume(struct radio_isa_card *isa, bool mute, int vol) aztech_s_mute_volume() argument
114 vol = 0; aztech_s_mute_volume()
115 az->curvol = (vol & 1) + ((vol & 2) << 1); aztech_s_mute_volume()
H A Dradio-zoltrix.c86 static int zoltrix_s_mute_volume(struct radio_isa_card *isa, bool mute, int vol) zoltrix_s_mute_volume() argument
90 zol->curvol = vol; zoltrix_s_mute_volume()
92 if (mute || vol == 0) { zoltrix_s_mute_volume()
99 outb(vol - 1, isa->io); zoltrix_s_mute_volume()
H A Dradio-trust.c119 static int trust_s_mute_volume(struct radio_isa_card *isa, bool mute, int vol) trust_s_mute_volume() argument
125 write_i2c(tr, 2, TDA7318_ADDR, vol ^ 0x1f); trust_s_mute_volume()
H A Dradio-rtrack2.c96 static int rtrack2_s_mute_volume(struct radio_isa_card *isa, bool mute, int vol) rtrack2_s_mute_volume() argument
H A Dradio-gemtek.c217 static int gemtek_s_mute_volume(struct radio_isa_card *isa, bool mute, int vol) gemtek_s_mute_volume() argument
H A Dradio-wl1273.c735 dev_dbg(dev, "%s: Set vol: %d.\n", __func__, wl1273_fm_set_mode()
/linux-4.1.27/sound/pci/ice1712/
H A Dphase.c61 unsigned short vol[8]; member in struct:phase28_spec
178 [ICE_EEP2_I2S] = 0xf0, /* vol, 96k, 24bit */
195 [ICE_EEP2_I2S] = 0xfc, /* vol, 96k, 24bit, 192k */
280 unsigned short vol, unsigned short master) wm_set_vol()
284 if ((master & WM_VOL_MUTE) || (vol & WM_VOL_MUTE)) wm_set_vol()
287 nvol = 127 - wm_vol[(((vol & ~WM_VOL_MUTE) * wm_set_vol()
363 unsigned int vol = ucontrol->value.integer.value[ch]; wm_master_vol_put() local
364 if (vol > WM_VOL_MAX) wm_master_vol_put()
366 vol |= spec->master[ch] & WM_VOL_MUTE; wm_master_vol_put()
367 if (vol != spec->master[ch]) { wm_master_vol_put()
369 spec->master[ch] = vol; wm_master_vol_put()
372 spec->vol[dac + ch], wm_master_vol_put()
468 spec->vol[i] = WM_VOL_MUTE; phase28_init()
469 wm_set_vol(ice, i, spec->vol[i], spec->master[i % 2]); phase28_init()
500 spec->vol[ofs+i] & ~WM_VOL_MUTE; wm_vol_get()
516 unsigned int vol; wm_vol_put() local
517 vol = ucontrol->value.integer.value[i]; wm_vol_put()
518 if (vol > 0x7f) wm_vol_put()
520 vol |= spec->vol[ofs+i] & WM_VOL_MUTE; wm_vol_put()
521 if (vol != spec->vol[ofs+i]) { wm_vol_put()
522 spec->vol[ofs+i] = vol; wm_vol_put()
524 wm_set_vol(ice, idx, spec->vol[ofs+i], wm_vol_put()
557 (spec->vol[ofs+i] & WM_VOL_MUTE) ? 0 : 1; wm_mute_get()
573 int val = (spec->vol[ofs + i] & WM_VOL_MUTE) ? 0 : 1; wm_mute_put()
575 spec->vol[ofs + i] &= ~WM_VOL_MUTE; wm_mute_put()
576 spec->vol[ofs + i] |= wm_mute_put()
579 wm_set_vol(ice, ofs + i, spec->vol[ofs + i], wm_mute_put()
625 spec->vol[dac + i], wm_master_mute_put()
279 wm_set_vol(struct snd_ice1712 *ice, unsigned int index, unsigned short vol, unsigned short master) wm_set_vol() argument
H A Dse.c39 } vol[8]; member in struct:se_spec
464 uc->value.integer.value[0] = spec->vol[n].ch1; se200pci_cont_volume_get()
465 uc->value.integer.value[1] = spec->vol[n].ch2; se200pci_cont_volume_get()
475 uc->value.integer.value[0] = spec->vol[n].ch1; se200pci_cont_boolean_get()
485 uc->value.enumerated.item[0] = spec->vol[n].ch1; se200pci_cont_enum_get()
496 spec->vol[n].ch1, se200pci_cont_update()
497 spec->vol[n].ch2); se200pci_cont_update()
502 spec->vol[n].ch1, se200pci_cont_update()
503 spec->vol[n].ch2); se200pci_cont_update()
508 spec->vol[n].ch1, se200pci_cont_update()
509 spec->vol[n].ch2); se200pci_cont_update()
514 spec->vol[n].ch1); se200pci_cont_update()
518 se200pci_WM8776_set_agc(ice, spec->vol[n].ch1); se200pci_cont_update()
522 se200pci_WM8776_set_afl(ice, spec->vol[n].ch1); se200pci_cont_update()
542 if (spec->vol[n].ch1 != vol1) { se200pci_cont_volume_put()
543 spec->vol[n].ch1 = vol1; se200pci_cont_volume_put()
546 if (spec->vol[n].ch2 != vol2) { se200pci_cont_volume_put()
547 spec->vol[n].ch2 = vol2; se200pci_cont_volume_put()
565 if (spec->vol[n].ch1 != vol1) { se200pci_cont_boolean_put()
566 spec->vol[n].ch1 = vol1; se200pci_cont_boolean_put()
584 if (spec->vol[n].ch1 != vol1) { se200pci_cont_enum_put()
585 spec->vol[n].ch1 = vol1; se200pci_cont_enum_put()
H A Dprodigy_hifi.c44 unsigned short vol[8]; member in struct:prodigy_hifi_spec
273 ucontrol->value.integer.value[i] = spec->vol[i]; ak4396_dac_vol_get()
287 if (ucontrol->value.integer.value[i] != spec->vol[i]) { ak4396_dac_vol_put()
288 spec->vol[i] = ucontrol->value.integer.value[i]; ak4396_dac_vol_put()
290 spec->vol[i] & 0xff); ak4396_dac_vol_put()
346 unsigned short vol, unsigned short master) wm_set_vol()
350 if ((master & WM_VOL_MUTE) || (vol & WM_VOL_MUTE)) wm_set_vol()
353 nvol = (((vol & ~WM_VOL_MUTE) * (master & ~WM_VOL_MUTE)) / 128) wm_set_vol()
363 unsigned short vol, unsigned short master) wm8766_set_vol()
367 if ((master & WM_VOL_MUTE) || (vol & WM_VOL_MUTE)) wm8766_set_vol()
370 nvol = (((vol & ~WM_VOL_MUTE) * (master & ~WM_VOL_MUTE)) / 128) wm8766_set_vol()
402 spec->vol[2 + i] & ~WM_VOL_MUTE; wm_dac_vol_get()
414 if (ucontrol->value.integer.value[i] != spec->vol[2 + i]) { wm_dac_vol_put()
416 spec->vol[2 + i] &= WM_VOL_MUTE; wm_dac_vol_put()
417 spec->vol[2 + i] |= ucontrol->value.integer.value[i]; wm_dac_vol_put()
418 wm_set_vol(ice, idx, spec->vol[2 + i], spec->master[i]); wm_dac_vol_put()
451 ucontrol->value.integer.value[i] = spec->vol[ofs + i]; wm8766_vol_get()
466 if (ucontrol->value.integer.value[i] != spec->vol[ofs + i]) { wm8766_vol_put()
468 spec->vol[ofs + i] &= WM_VOL_MUTE; wm8766_vol_put()
469 spec->vol[ofs + i] |= ucontrol->value.integer.value[i]; wm8766_vol_put()
471 spec->vol[ofs + i], spec->master[i]); wm8766_vol_put()
517 spec->vol[2 + ch], spec->master[ch]); wm_master_vol_put()
520 spec->vol[0 + ch], spec->master[ch]); wm_master_vol_put()
523 spec->vol[4 + ch], spec->master[ch]); wm_master_vol_put()
526 spec->vol[6 + ch], spec->master[ch]); wm_master_vol_put()
1104 ak4396_write(ice, AK4396_LCH_ATT + i, spec->vol[i] & 0xff); prodigy_hd2_resume()
1150 0xfc, /* I2S: vol, 96k, 24bit, 192k */
1166 0xfc, /* I2S: vol, 96k, 24bit, 192k */
1182 0xfc, /* I2S: vol, 96k, 24bit, 192k */
345 wm_set_vol(struct snd_ice1712 *ice, unsigned int index, unsigned short vol, unsigned short master) wm_set_vol() argument
362 wm8766_set_vol(struct snd_ice1712 *ice, unsigned int index, unsigned short vol, unsigned short master) wm8766_set_vol() argument
H A Daureon.c67 unsigned short vol[8]; member in struct:aureon_spec
373 unsigned short vol; aureon_ac97_vol_get() local
377 vol = aureon_ac97_read(ice, kcontrol->private_value & 0x7F); aureon_ac97_vol_get()
378 ucontrol->value.integer.value[0] = 0x1F - (vol & 0x1F); aureon_ac97_vol_get()
380 ucontrol->value.integer.value[1] = 0x1F - ((vol >> 8) & 0x1F); aureon_ac97_vol_get()
696 static void wm_set_vol(struct snd_ice1712 *ice, unsigned int index, unsigned short vol, unsigned short master) wm_set_vol() argument
700 if ((master & WM_VOL_MUTE) || (vol & WM_VOL_MUTE)) { wm_set_vol()
703 nvol = ((vol % WM_VOL_CNT) * (master % WM_VOL_CNT)) / wm_set_vol()
775 unsigned int vol = ucontrol->value.integer.value[ch]; wm_master_vol_put() local
776 if (vol > WM_VOL_MAX) wm_master_vol_put()
777 vol = WM_VOL_MAX; wm_master_vol_put()
778 vol |= spec->master[ch] & WM_VOL_MUTE; wm_master_vol_put()
779 if (vol != spec->master[ch]) { wm_master_vol_put()
781 spec->master[ch] = vol; wm_master_vol_put()
784 spec->vol[dac + ch], wm_master_vol_put()
816 spec->vol[ofs+i] & ~WM_VOL_MUTE; wm_vol_get()
831 unsigned int vol = ucontrol->value.integer.value[i]; wm_vol_put() local
832 if (vol > WM_VOL_MAX) wm_vol_put()
833 vol = WM_VOL_MAX; wm_vol_put()
834 vol |= spec->vol[ofs+i] & WM_VOL_MUTE; wm_vol_put()
835 if (vol != spec->vol[ofs+i]) { wm_vol_put()
836 spec->vol[ofs+i] = vol; wm_vol_put()
838 wm_set_vol(ice, idx, spec->vol[ofs + i], wm_vol_put()
870 (spec->vol[ofs + i] & WM_VOL_MUTE) ? 0 : 1; wm_mute_get()
885 int val = (spec->vol[ofs + i] & WM_VOL_MUTE) ? 0 : 1; wm_mute_put()
887 spec->vol[ofs + i] &= ~WM_VOL_MUTE; wm_mute_put()
888 spec->vol[ofs + i] |= wm_mute_put()
890 wm_set_vol(ice, ofs + i, spec->vol[ofs + i], wm_mute_put()
933 spec->vol[dac + i], wm_master_mute_put()
1046 unsigned short vol; wm_adc_vol_get() local
1051 vol = wm_get(ice, idx) & 0x1f; wm_adc_vol_get()
1052 ucontrol->value.integer.value[i] = vol; wm_adc_vol_get()
2092 wm_set_vol(ice, i, spec->vol[i], spec->master[i % 2]); aureon_resume()
2132 spec->vol[i] = WM_VOL_MUTE; aureon_init()
2133 wm_set_vol(ice, i, spec->vol[i], spec->master[i % 2]); aureon_init()
2153 [ICE_EEP2_I2S] = 0xfc, /* vol, 96k, 24bit, 192k */
2169 [ICE_EEP2_I2S] = 0xfc, /* vol, 96k, 24bit, 192k */
2188 [ICE_EEP2_I2S] = 0xfc, /* vol, 96k, 24bit, 192k */
2204 [ICE_EEP2_I2S] = 0xfc, /* vol, 96k, 24bit, 192k */
H A Dmaya44.c175 struct maya_vol_info *vol = &vol_info[idx]; maya_vol_info() local
180 uinfo->value.integer.max = vol->maxval; maya_vol_info()
206 struct maya_vol_info *vol = &vol_info[idx]; maya_vol_put() local
213 if (val > vol->maxval) maya_vol_put()
214 val = vol->maxval; maya_vol_put()
218 data = vol->mute; maya_vol_put()
220 data = (val - 1) + vol->offset; maya_vol_put()
221 data |= vol->update; maya_vol_put()
222 changed |= wm8776_write_bits(chip->ice, wm, vol->regs[ch], maya_vol_put()
223 vol->mask | vol->update, data); maya_vol_put()
224 if (vol->mux_bits[ch]) maya_vol_put()
226 vol->mux_bits[ch], maya_vol_put()
227 val ? 0 : vol->mux_bits[ch]); maya_vol_put()
735 /* vol, 96k, 24bit, 192k */
H A Dwtm.c210 unsigned char vol; stac9460_dac_vol_get() local
220 vol = stac9460_get(ice, idx) & 0x7f; stac9460_dac_vol_get()
222 vol = stac9460_2_get(ice, idx - 6) & 0x7f; stac9460_dac_vol_get()
223 ucontrol->value.integer.value[0] = 0x7f - vol; stac9460_dac_vol_get()
345 unsigned char vol; stac9460_adc_vol_get() local
351 vol = stac9460_get(ice, reg) & 0x0f; stac9460_adc_vol_get()
352 ucontrol->value.integer.value[i] = 0x0f - vol; stac9460_adc_vol_get()
357 vol = stac9460_2_get(ice, reg) & 0x0f; stac9460_adc_vol_get()
358 ucontrol->value.integer.value[i] = 0x0f - vol; stac9460_adc_vol_get()
620 [ICE_EEP2_I2S] = 0xf8, /* I2S: vol; 96k, 24bit, 192k */
H A Dprodigy192.c160 unsigned char vol; stac9460_dac_vol_get() local
166 vol = stac9460_get(ice, idx) & 0x7f; stac9460_dac_vol_get()
167 ucontrol->value.integer.value[0] = 0x7f - vol; stac9460_dac_vol_get()
252 unsigned char vol; stac9460_adc_vol_get() local
256 vol = stac9460_get(ice, reg) & 0x0f; stac9460_adc_vol_get()
257 ucontrol->value.integer.value[i] = 0x0f - vol; stac9460_adc_vol_get()
777 [ICE_EEP2_I2S] = 0xf8, /* vol, 96k, 24bit, 192k */
H A Dice1712.c1292 unsigned int vol = ice->pro_volumes[index]; snd_ice1712_update_volume() local
1295 val |= (vol & 0x8000) == 0 ? (96 - (vol & 0x7f)) : 0x7f; snd_ice1712_update_volume()
1296 val |= ((vol & 0x80000000) == 0 ? (96 - ((vol >> 16) & 0x7f)) : 0x7f) << 8; snd_ice1712_update_volume()
H A Djuli.c673 [ICE_EEP2_I2S] = 0xf8, /* vol, 96k, 24bit, 192k */
H A Dpontis.c804 [ICE_EEP2_I2S] = 0xf8, /* vol, 96k, 24bit, 192k */
/linux-4.1.27/drivers/media/rc/keymaps/
H A Drc-apac-viewcomp.c37 { 0x1f, KEY_VOLUMEDOWN }, /* vol up */
38 { 0x1b, KEY_VOLUMEUP }, /* vol down */
H A Drc-dm1105-nec.c35 { 0x1a, KEY_VOLUMEUP}, /* vol+ */
36 { 0x0e, KEY_VOLUMEDOWN}, /* vol- */
H A Drc-pixelview-002t.c37 { 0x866b10, KEY_VOLUMEUP }, /* vol + */
38 { 0x866b0c, KEY_VOLUMEDOWN }, /* vol - */
H A Drc-pixelview-mk12.c45 { 0x866b1f, KEY_VOLUMEUP }, /* vol + */
46 { 0x866b17, KEY_VOLUMEDOWN }, /* vol - */
H A Drc-pixelview.c48 { 0x16, KEY_VOLUMEUP }, /* vol down */
49 { 0x14, KEY_VOLUMEDOWN }, /* vol up */
H A Drc-tbs-nec.c33 { 0x93, KEY_VOLUMEUP}, /* vol+ */
34 { 0x8c, KEY_VOLUMEDOWN}, /* vol- */
/linux-4.1.27/drivers/media/i2c/
H A Dcs5345.c117 int vol = cs5345_read(sd, 0x08) & 0x3f; cs5345_log_status() local
121 if (vol >= 32) cs5345_log_status()
122 vol = vol - 64; cs5345_log_status()
123 v4l2_info(sd, "Volume: %d dB\n", vol); cs5345_log_status()
H A Dwm8775.c60 struct v4l2_ctrl *vol; member in struct:wm8775_state
99 u16 volume = (u16)state->vol->val; wm8775_set_audio()
135 if (!v4l2_ctrl_g_ctrl(state->vol)) wm8775_s_routing()
243 state->vol = v4l2_ctrl_new_std(&state->hdl, &wm8775_ctrl_ops, wm8775_probe()
/linux-4.1.27/sound/isa/gus/
H A Dgus_volume.c30 unsigned short snd_gf1_lvol_to_gvol_raw(unsigned int vol) snd_gf1_lvol_to_gvol_raw() argument
34 if (vol > 65535) snd_gf1_lvol_to_gvol_raw()
35 vol = 65535; snd_gf1_lvol_to_gvol_raw()
36 tmp = vol; snd_gf1_lvol_to_gvol_raw()
47 m = vol - (1 << e); snd_gf1_lvol_to_gvol_raw()
H A Dgus_pcm.c115 unsigned short vol; snd_gf1_pcm_trigger_up() local
147 vol = !voice ? gus->gf1.pcm_volume_level_left : gus->gf1.pcm_volume_level_right; snd_gf1_pcm_trigger_up()
158 snd_gf1_write8(gus, SNDRV_GF1_VB_VOLUME_END, vol >> 8); snd_gf1_pcm_trigger_up()
274 unsigned short vol; snd_gf1_pcm_interrupt_volume() local
292 vol = !cvoice ? gus->gf1.pcm_volume_level_left : gus->gf1.pcm_volume_level_right; snd_gf1_pcm_interrupt_volume()
295 snd_gf1_write16(gus, SNDRV_GF1_VW_VOLUME, vol); snd_gf1_pcm_interrupt_volume()
774 unsigned short val1, val2, vol; snd_gf1_pcm_volume_put() local
801 vol = pvoice == pcmp->pvoices[0] ? gus->gf1.pcm_volume_level_left : gus->gf1.pcm_volume_level_right; snd_gf1_pcm_volume_put()
802 snd_gf1_write16(gus, SNDRV_GF1_VW_VOLUME, vol); snd_gf1_pcm_volume_put()
/linux-4.1.27/sound/pci/asihpi/
H A Dhpicmn.c355 phr->u.c.an_log_value[0] = pC->u.vol.an_log[0]; hpi_check_control_cache_single()
356 phr->u.c.an_log_value[1] = pC->u.vol.an_log[1]; hpi_check_control_cache_single()
358 if (pC->u.vol.flags & HPI_VOLUME_FLAG_HAS_MUTE) { hpi_check_control_cache_single()
359 if (pC->u.vol.flags & HPI_VOLUME_FLAG_MUTED) hpi_check_control_cache_single()
570 pC->u.vol.an_log[0] = phr->u.c.an_log_value[0]; hpi_cmn_control_cache_sync_to_msg_single()
571 pC->u.vol.an_log[1] = phr->u.c.an_log_value[1]; hpi_cmn_control_cache_sync_to_msg_single()
574 pC->u.vol.flags |= HPI_VOLUME_FLAG_MUTED; hpi_cmn_control_cache_sync_to_msg_single()
576 pC->u.vol.flags &= ~HPI_VOLUME_FLAG_MUTED; hpi_cmn_control_cache_sync_to_msg_single()
593 pC->u.vol.an_log[0] = phr->u.c.an_log_value[0]; hpi_cmn_control_cache_sync_to_msg_single()
594 pC->u.vol.an_log[1] = phr->u.c.an_log_value[1]; hpi_cmn_control_cache_sync_to_msg_single()
H A Dhpi_internal.h1352 struct hpi_control_cache_vol vol; member in union:hpi_control_cache_single::__anon14432
/linux-4.1.27/fs/afs/
H A Dsuper.c73 { afs_opt_vol, "vol=%s" },
359 struct afs_volume *vol; afs_mount() local
394 vol = afs_volume_lookup(&params); afs_mount()
395 if (IS_ERR(vol)) { afs_mount()
396 ret = PTR_ERR(vol); afs_mount()
404 afs_put_volume(vol); afs_mount()
407 as->volume = vol; afs_mount()
413 afs_put_volume(vol); afs_mount()
431 afs_put_volume(vol); afs_mount()
H A Dafs_vl.h63 unsigned num_servers; /* num servers that hold instances of this vol */
H A Dafs.h81 afs_volid_t type_vids[5]; /* volume ID's for possible types for this vol */
/linux-4.1.27/sound/synth/emux/
H A Demux_synth.c756 int vol; calc_volume() local
767 vol = (vp->velocity * main_vol * expression_vol) / (127*127); calc_volume()
768 vol = vol * vp->reg.amplitude / 127; calc_volume()
770 LIMITVALUE(vol, 0, 127); calc_volume()
773 vol = snd_sf_vol_table[vol]; calc_volume()
779 vol = voltab1[main_vol] + voltab2[vp->velocity]; calc_volume()
780 vol = (vol * 8) / 3; calc_volume()
781 vol += vp->reg.attenuation; calc_volume()
782 vol += ((0x100 - vol) * expressiontab[expression_vol])/128; calc_volume()
787 vol += snd_sf_vol_table[master_vol]; calc_volume()
788 vol += port->volume_atten; calc_volume()
793 vol += fx->val[EMUX_FX_ATTEN]; calc_volume()
797 LIMITVALUE(vol, 0, 255); calc_volume()
798 if (vp->avol == vol) calc_volume()
801 vp->avol = vol; calc_volume()
H A Demux_proc.c73 snd_iprintf(buf, "vol delay=%x, atkhld=%x, dcysus=%x, rel=%x\n", snd_emux_proc_info_read()
H A Demux_effect.c75 {PARM_SIGN_HI, -128, 127, parm_offset(tremfrq), SNDRV_EMUX_UPDATE_TREMFREQ}, /* lfo1 vol */
/linux-4.1.27/sound/core/
H A Dvmaster.c154 int err, ch, vol; slave_put_val() local
169 vol = ucontrol->value.integer.value[ch]; slave_put_val()
170 vol += slave->master->val - slave->master->info.max_val; slave_put_val()
171 if (vol < slave->info.min_val) slave_put_val()
172 vol = slave->info.min_val; slave_put_val()
173 else if (vol > slave->info.max_val) slave_put_val()
174 vol = slave->info.max_val; slave_put_val()
175 ucontrol->value.integer.value[ch] = vol; slave_put_val()
/linux-4.1.27/sound/sh/
H A Daica.c366 channel->vol = dreamcastcard->master_volume; snd_aicapcm_pcm_open()
517 ucontrol->value.integer.value[0] = dreamcastcard->channel->vol; aica_pcmvolume_get()
525 unsigned int vol; aica_pcmvolume_put() local
529 vol = ucontrol->value.integer.value[0]; aica_pcmvolume_put()
530 if (vol > 0xff) aica_pcmvolume_put()
532 if (unlikely(dreamcastcard->channel->vol == vol)) aica_pcmvolume_put()
534 dreamcastcard->channel->vol = ucontrol->value.integer.value[0]; aica_pcmvolume_put()
H A Daica.h65 uint32_t vol; /* Volume 0-255 */ member in struct:aica_channel
/linux-4.1.27/drivers/media/pci/cx88/
H A Dcx88-alsa.c651 int vol = 0x3f - (cx_read(AUD_VOL_CTL) & 0x3f), snd_cx88_volume_get() local
654 value->value.integer.value[(bal & 0x40) ? 0 : 1] = vol; snd_cx88_volume_get()
655 vol -= (bal & 0x3f); snd_cx88_volume_get()
656 value->value.integer.value[(bal & 0x40) ? 1 : 0] = vol < 0 ? 0 : vol; snd_cx88_volume_get()
751 u32 vol; snd_cx88_switch_put() local
754 vol = cx_read(AUD_VOL_CTL); snd_cx88_switch_put()
755 if (value->value.integer.value[0] != !(vol & bit)) { snd_cx88_switch_put()
756 vol ^= bit; snd_cx88_switch_put()
757 cx_swrite(SHADOW_AUD_VOL_CTL, AUD_VOL_CTL, vol); snd_cx88_switch_put()
760 wm8775_s_ctrl(core, V4L2_CID_AUDIO_MUTE, 0 != (vol & bit)); snd_cx88_switch_put()
H A Dcx88-tvaudio.c980 "[status=0x%x,ctl=0x%x,vol=0x%x]\n", cx88_set_stereo()
/linux-4.1.27/drivers/media/pci/bt8xx/
H A Dbttv-audio-hook.c18 int bits_out, loops, vol, data; winview_volume() local
21 vol = 32 - ((volume>>11)); winview_volume()
23 bits_out = (PT2254_DBS_IN_2>>(vol%5)); winview_volume()
25 bits_out |= (PT2254_DBS_IN_10>>(vol/5)); winview_volume()
/linux-4.1.27/drivers/regulator/
H A Danatop-regulator.c218 ret = of_property_read_u32(np, "anatop-vol-bit-width", anatop_regulator_probe()
221 dev_err(dev, "no anatop-vol-bit-width property set\n"); anatop_regulator_probe()
224 ret = of_property_read_u32(np, "anatop-vol-bit-shift", anatop_regulator_probe()
227 dev_err(dev, "no anatop-vol-bit-shift property set\n"); anatop_regulator_probe()
/linux-4.1.27/sound/usb/usx2y/
H A Dusbus428ctldefs.h91 struct usX2Y_volume vol; member in union:us428_p4out::__anon14744
H A Dusbusx2y.c244 usb_sndbulkpipe(usX2Y->dev, 0x04), &p4out->val.vol, i_usX2Y_In04Int()
/linux-4.1.27/include/linux/
H A Defs_vh.h36 struct volume_directory vh_vd[NVDIR]; /* other vol hdr contents */
H A Dhash.h46 * (See Knuth vol 3, section 6.4, exercise 9.)
/linux-4.1.27/sound/pci/au88x0/
H A Dau88x0_pcm.c558 ucontrol->value.integer.value[i] = p->vol[i]; snd_vortex_pcm_vol_get()
568 unsigned char vol; snd_vortex_pcm_vol_put() local
574 if (p->vol[i] != ucontrol->value.integer.value[i]) { snd_vortex_pcm_vol_put()
575 p->vol[i] = ucontrol->value.integer.value[i]; snd_vortex_pcm_vol_put()
589 vol = p->vol[i]; snd_vortex_pcm_vol_put()
591 vortex->mixplayb[i], mixin, vol); snd_vortex_pcm_vol_put()
H A Dau88x0_synth.c337 static void vortex_wt_SetVolume(vortex_t * vortex, int wt, int vol[])
340 int ecx = vol[1], eax = vol[0];
344 voice->parm0 |= (vol[0] & 0xff) << 0x10;
346 voice->parm1 |= (vol[1] & 0xff) << 0x10;
H A Dau88x0.h113 int vol[4]; member in struct:pcm_vol
270 unsigned char vol);
272 unsigned char vol);
H A Dau88x0_core.c121 int channel, int *vol)
134 *vol = a;
138 static unsigned int vortex_mix_boost6db(unsigned char vol)
140 return (vol + 8); /* WOW! what a complex function! */
181 unsigned char vol) vortex_mix_setvolumebyte()
184 hwwrite(vortex->mmio, VORTEX_MIX_VOL_A + (mix << 2), vol); vortex_mix_setvolumebyte()
187 if ((temp != 0x80) || (vol == 0x80)) vortex_mix_setvolumebyte()
190 hwwrite(vortex->mmio, VORTEX_MIX_VOL_B + (mix << 2), vol); vortex_mix_setvolumebyte()
195 int mixin, unsigned char vol) vortex_mix_setinputvolumebyte()
200 VORTEX_MIX_INVOL_A + (((mix << 5) + mixin) << 2), vol); vortex_mix_setinputvolumebyte()
205 if ((temp != 0x80) || (vol == 0x80)) vortex_mix_setinputvolumebyte()
209 VORTEX_MIX_INVOL_B + (((mix << 5) + mixin) << 2), vol); vortex_mix_setinputvolumebyte()
2261 p->vol[i] = 0; vortex_adb_allocroute()
180 vortex_mix_setvolumebyte(vortex_t * vortex, unsigned char mix, unsigned char vol) vortex_mix_setvolumebyte() argument
194 vortex_mix_setinputvolumebyte(vortex_t * vortex, unsigned char mix, int mixin, unsigned char vol) vortex_mix_setinputvolumebyte() argument
/linux-4.1.27/drivers/media/usb/tm6000/
H A Dtm6000-core.c781 static void tm6010_set_volume_sif(struct tm6000_core *dev, int vol) tm6010_set_volume_sif() argument
785 vol_reg = vol & 0x0F; tm6010_set_volume_sif()
787 if (vol < 0) tm6010_set_volume_sif()
794 static void tm6010_set_volume_adc(struct tm6000_core *dev, int vol) tm6010_set_volume_adc() argument
798 vol_reg = (vol + 0x10) & 0x1f; tm6010_set_volume_adc()
809 void tm6000_set_volume(struct tm6000_core *dev, int vol) tm6000_set_volume() argument
815 vol += 8; /* Offset to 0 dB */ tm6000_set_volume()
823 tm6010_set_volume_sif(dev, vol); tm6000_set_volume()
831 tm6010_set_volume_adc(dev, vol); tm6000_set_volume()
H A Dtm6000.h336 void tm6000_set_volume(struct tm6000_core *dev, int vol);
/linux-4.1.27/drivers/media/i2c/cx25840/
H A Dcx25840-audio.c483 int vol; set_volume() local
486 vol = volume >> 9; set_volume()
491 if (vol <= 23) { set_volume()
492 vol = 0; set_volume()
494 vol -= 23; set_volume()
498 cx25840_write(client, 0x8d4, 228 - (vol * 2)); set_volume()
/linux-4.1.27/sound/pci/
H A Drme96.c238 u16 vol[2]; /* cached volume of analog output */ member in struct:rme96
529 snd_rme96_write_SPI(rme96, (rme96->vol[0] << 2) | 0x0); snd_rme96_apply_dac_volume()
530 snd_rme96_write_SPI(rme96, (rme96->vol[1] << 2) | 0x2); snd_rme96_apply_dac_volume()
532 snd_rme96_write_SPI(rme96, (rme96->vol[0] & 0x3FF) | 0x000); snd_rme96_apply_dac_volume()
533 snd_rme96_write_SPI(rme96, (rme96->vol[1] & 0x3FF) | 0x400); snd_rme96_apply_dac_volume()
1702 rme96->vol[0] = rme96->vol[1] = 0; snd_rme96_create()
1846 snd_iprintf(buffer, " volume left: %u\n", rme96->vol[0]); snd_rme96_proc_read()
1847 snd_iprintf(buffer, " volume right: %u\n", rme96->vol[1]); snd_rme96_proc_read()
2222 u->value.integer.value[0] = rme96->vol[0]; snd_rme96_dac_volume_get()
2223 u->value.integer.value[1] = rme96->vol[1]; snd_rme96_dac_volume_get()
2234 unsigned int vol, maxvol; snd_rme96_dac_volume_put() local
2241 vol = u->value.integer.value[0]; snd_rme96_dac_volume_put()
2242 if (vol != rme96->vol[0] && vol <= maxvol) { snd_rme96_dac_volume_put()
2243 rme96->vol[0] = vol; snd_rme96_dac_volume_put()
2246 vol = u->value.integer.value[1]; snd_rme96_dac_volume_put()
2247 if (vol != rme96->vol[1] && vol <= maxvol) { snd_rme96_dac_volume_put()
2248 rme96->vol[1] = vol; snd_rme96_dac_volume_put()
H A Dsonicvibes.c644 int vol, oleft, oright, mleft, mright; snd_sonicvibes_interrupt() local
648 vol = udreg & 0x3f; snd_sonicvibes_interrupt()
650 vol = -vol; snd_sonicvibes_interrupt()
655 oleft += vol; snd_sonicvibes_interrupt()
660 oright += vol; snd_sonicvibes_interrupt()
H A Dazt3328.c970 "get: %02x is %04x -> vol %02lx|%02lx (shift %02d|%02d, mask %02x, inv. %d, stereo %d)\n", snd_azf3328_get_mixer()
2690 master vol was restored. Thus master vol needs an extra restore. */ snd_azf3328_resume_ac97()
/linux-4.1.27/block/partitions/
H A Dibm.c21 struct vtoc_volume_label_cdl vol; member in union:label_t
113 strncpy(type, label->vol.vollbl, 4); find_label()
114 strncpy(name, label->vol.volid, 6); find_label()
154 blk = cchhb2blk(&label->vol.vtoc, geo) + 1; find_vol1_partitions()
/linux-4.1.27/include/trace/events/
H A Dhswadsp.h208 TP_printk("stream %d hw id %d mixer %d peak 0x%x:0x%x vol 0x%x,0x%x",
236 TP_printk("mixer id %d peak 0x%x:0x%x vol 0x%x,0x%x",
348 TP_printk("stream %d chan 0x%x vol %d duration %llu type %d",
/linux-4.1.27/drivers/media/pci/cx18/
H A Dcx18-av-audio.c348 int vol = volume >> 9; set_volume() local
352 if (vol <= 23) set_volume()
353 vol = 0; set_volume()
355 vol -= 23; set_volume()
358 cx18_av_write(cx, 0x8d4, 228 - (vol * 2)); set_volume()
H A Dcx18-av-core.c256 /* Bottom out at -96 dB, v4l2 vol range 0x2e00-0x2fff */ cx18_av_initialize()
260 /* Top out at + 8 dB, v4l2 vol range 0xfe00-0xffff */ cx18_av_initialize()
/linux-4.1.27/sound/oss/
H A Dswarm_cs4297a.c294 unsigned short vol[10]; member in struct:cs4297a_state::__anon14378
376 // Value of array member is index into s->mix.vol[] cs_printioctl()
1168 // Value of array member is index into s->mix.vol[] mixer_ioctl()
1310 return put_user(s->mix.vol[vidx - 1], (int *) arg); mixer_ioctl()
1346 l = 100; // Max soundcard.h vol is 100. mixer_ioctl()
1351 rl = attentbl[(10 * l) / 100]; // Convert 0-100 vol to 63-0 atten. mixer_ioctl()
1373 s->mix.vol[8] = ((unsigned int) r << 8) | l; mixer_ioctl()
1375 s->mix.vol[8] = val; mixer_ioctl()
1377 return put_user(s->mix.vol[8], (int *) arg); mixer_ioctl()
1403 s->mix.vol[6] = l << 8; mixer_ioctl()
1405 s->mix.vol[6] = val; mixer_ioctl()
1407 return put_user(s->mix.vol[6], (int *) arg); mixer_ioctl()
1429 s->mix.vol[7] = ((unsigned int) r << 8) | l; mixer_ioctl()
1431 s->mix.vol[7] = val; mixer_ioctl()
1433 return put_user(s->mix.vol[7], (int *) arg); mixer_ioctl()
1459 s->mix.vol[5] = val << 8; mixer_ioctl()
1461 s->mix.vol[5] = val; mixer_ioctl()
1463 return put_user(s->mix.vol[5], (int *) arg); mixer_ioctl()
1484 rl = 63 - rl; // Convert vol to attenuation. mixer_ioctl()
1490 rr = 63 - rr; // Convert vol to attenuation. mixer_ioctl()
1494 s->mix.vol[4] = (r << 8) | l; mixer_ioctl()
1496 s->mix.vol[4] = val; mixer_ioctl()
1498 return put_user(s->mix.vol[4], (int *) arg); mixer_ioctl()
1535 s->mix.vol[vidx - 1] = ((unsigned int) r << 8) | l; mixer_ioctl()
1537 s->mix.vol[vidx - 1] = val; mixer_ioctl()
1539 return put_user(s->mix.vol[vidx - 1], (int *) arg); mixer_ioctl()
2607 int vol;
2718 val = initvol[i].vol; cs4297a_init()
H A Dvidc.c81 static unsigned int vidc_audio_volume_l; /* left PCM vol, 0 - 65536 */
82 static unsigned int vidc_audio_volume_r; /* right PCM vol, 0 - 65536 */
112 /*printk("VIDC: PCM vol %05X %05X\n", vidc_audio_volume_l, vidc_audio_volume_r);*/ vidc_mixer_set()
H A Dpss.c422 int vol = ((0x8000*volume)/100L); set_synth_volume() local
424 pss_write(devc, vol); set_synth_volume()
426 pss_write(devc, vol); set_synth_volume()
431 int vol = (int)(((0xfd - 0xf0) * level)/100L) + 0xf0; set_bass() local
433 pss_write(devc, vol | 0x0200); set_bass()
438 int vol = (((0xfd - 0xf0) * level)/100L) + 0xf0; set_treble() local
440 pss_write(devc, vol | 0x0300); set_treble()
H A Dmsnd_pinnacle.c472 case SOUND_MIXER_SYNTH: /* synth vol (dsp mix) */ mixer_set()
473 case SOUND_MIXER_PCM: /* pcm vol (dsp mix) */ mixer_set()
H A Dwaveartist.c120 unsigned int use_slider :1;/* use slider setting for o/p vol */
H A Dsb_ess.c1646 * es1688 has 4 bits master vol. ess_mixer_init()
/linux-4.1.27/sound/soc/sh/
H A Dsiu_dai.c371 u32 vol; siu_dai_get_volume() local
378 vol = port_info->playback.volume; siu_dai_get_volume()
379 ucontrol->value.integer.value[0] = vol & 0xffff; siu_dai_get_volume()
380 ucontrol->value.integer.value[1] = vol >> 16 & 0xffff; siu_dai_get_volume()
384 vol = port_info->capture.volume; siu_dai_get_volume()
385 ucontrol->value.integer.value[0] = vol & 0xffff; siu_dai_get_volume()
386 ucontrol->value.integer.value[1] = vol >> 16 & 0xffff; siu_dai_get_volume()
/linux-4.1.27/drivers/media/pci/ttpci/
H A Dav7110_av.c285 int err, vol, val, balance = 0; av7110_set_volume() local
312 vol = (volleft > volright) ? volleft : volright; av7110_set_volume()
313 val = (vol * 0x73 / 255) << 8; av7110_set_volume()
314 if (vol > 0) av7110_set_volume()
315 balance = ((volright - volleft) * 127) / vol; av7110_set_volume()
322 vol = (volleft > volright) ? volleft : volright; av7110_set_volume()
323 val = (vol * 0x73 / 255) << 8; av7110_set_volume()
324 if (vol > 0) av7110_set_volume()
325 balance = ((volright - volleft) * 127) / vol; av7110_set_volume()
/linux-4.1.27/drivers/pinctrl/freescale/
H A Dpinctrl-mxs.c259 u8 ma, vol, pull, bank, shift; mxs_pinconf_group_set() local
269 vol = CONFIG_TO_VOL(config); mxs_pinconf_group_set()
287 /* vol */ mxs_pinconf_group_set()
290 if (vol) mxs_pinconf_group_set()
/linux-4.1.27/drivers/block/drbd/
H A Ddrbd_strings.c94 [-SS_O_VOL_PEER_PRI] = "Other vol primary on peer not allowed by config",
/linux-4.1.27/sound/pci/pcxhr/
H A Dpcxhr_mixer.c55 int err, vol; pcxhr_update_analog_audio_level() local
65 vol = chip->analog_playback_volume[channel]; pcxhr_update_analog_audio_level()
67 vol = PCXHR_LINE_PLAYBACK_LEVEL_MIN; pcxhr_update_analog_audio_level()
69 rmh.cmd[2] = PCXHR_LINE_PLAYBACK_LEVEL_MAX - vol; pcxhr_update_analog_audio_level()
395 int vol = ucontrol->value.integer.value[i]; pcxhr_pcm_vol_put() local
396 if (vol < PCXHR_DIGITAL_LEVEL_MIN || pcxhr_pcm_vol_put()
397 vol > PCXHR_DIGITAL_LEVEL_MAX) pcxhr_pcm_vol_put()
399 if (stored_volume[i] != vol) { pcxhr_pcm_vol_put()
400 stored_volume[i] = vol; pcxhr_pcm_vol_put()
H A Dpcxhr_mix22.c569 int vol; hr222_update_analog_audio_level() local
571 vol = chip->analog_playback_volume[channel]; hr222_update_analog_audio_level()
573 vol = HR222_LINE_PLAYBACK_LEVEL_MIN; hr222_update_analog_audio_level()
574 return hr222_set_hw_playback_level(chip->mgr, channel, vol); hr222_update_analog_audio_level()
/linux-4.1.27/fs/affs/
H A Dsuper.c275 char *vol = match_strdup(&args[0]); parse_options() local
276 if (!vol) parse_options()
278 strlcpy(volume, vol, 32); parse_options()
279 kfree(vol); parse_options()
/linux-4.1.27/sound/pci/emu10k1/
H A Demufx.c1289 #define A_ADD_VOLUME_IN(var,vol,input) \ _snd_emu10k1_audigy_init_efx()
1290 A_OP(icode, &ptr, iMAC0, A_GPR(var), A_GPR(var), A_GPR(vol), A_EXTIN(input)) _snd_emu10k1_audigy_init_efx()
1766 static void _volume(struct snd_emu10k1_fx8010_code *icode, u32 *ptr, u32 dst, u32 src, u32 vol) _volume() argument
1768 OP(icode, ptr, iMAC0, dst, C_00000000, src, vol); _volume()
1769 OP(icode, ptr, iANDXOR, C_00000000, vol, C_ffffffff, C_7fffffff); _volume()
1773 static void _volume_add(struct snd_emu10k1_fx8010_code *icode, u32 *ptr, u32 dst, u32 src, u32 vol) _volume_add() argument
1775 OP(icode, ptr, iANDXOR, C_00000000, vol, C_ffffffff, C_7fffffff); _volume_add()
1779 OP(icode, ptr, iMAC0, dst, dst, src, vol); _volume_add()
1781 static void _volume_out(struct snd_emu10k1_fx8010_code *icode, u32 *ptr, u32 dst, u32 src, u32 vol) _volume_out() argument
1783 OP(icode, ptr, iANDXOR, C_00000000, vol, C_ffffffff, C_7fffffff); _volume_out()
1787 OP(icode, ptr, iMAC0, dst, C_00000000, src, vol); _volume_out()
1790 #define VOLUME(icode, ptr, dst, src, vol) \
1791 _volume(icode, ptr, GPR(dst), GPR(src), GPR(vol))
1792 #define VOLUME_IN(icode, ptr, dst, src, vol) \
1793 _volume(icode, ptr, GPR(dst), EXTIN(src), GPR(vol))
1794 #define VOLUME_ADD(icode, ptr, dst, src, vol) \
1795 _volume_add(icode, ptr, GPR(dst), GPR(src), GPR(vol))
1796 #define VOLUME_ADDIN(icode, ptr, dst, src, vol) \
1797 _volume_add(icode, ptr, GPR(dst), EXTIN(src), GPR(vol))
1798 #define VOLUME_OUT(icode, ptr, dst, src, vol) \
1799 _volume_out(icode, ptr, EXTOUT(dst), GPR(src), GPR(vol))
/linux-4.1.27/drivers/media/usb/em28xx/
H A Dem28xx-audio.c525 dprintk("%sleft vol %d, right vol %d (0x%04x) to ac97 volume control 0x%04x\n", em28xx_vol_put()
558 dprintk("%sleft vol %d, right vol %d (0x%04x) from ac97 volume control 0x%04x\n", em28xx_vol_get()
601 dprintk("%sleft vol %d, right vol %d (0x%04x) to ac97 volume control 0x%04x\n", em28xx_vol_put_mute()
639 dprintk("%sleft vol %d, right vol %d (0x%04x) from ac97 volume control 0x%04x\n", em28xx_vol_get_mute()
H A Dem28xx-core.c466 int vol; em28xx_audio_analog_set() local
473 vol = (0x1f - dev->volume) | ((0x1f - dev->volume) << 8); em28xx_audio_analog_set()
477 vol |= 0x8000; em28xx_audio_analog_set()
483 vol); em28xx_audio_analog_set()
/linux-4.1.27/sound/isa/cs423x/
H A Dcs4236_lib.c669 static inline int snd_cs4236_mixer_master_digital_invert_volume(int vol) snd_cs4236_mixer_master_digital_invert_volume() argument
671 return (vol < 64) ? 63 - vol : 64 + (71 - vol); snd_cs4236_mixer_master_digital_invert_volume()
713 static inline int snd_cs4235_mixer_output_accu_get_volume(int vol) snd_cs4235_mixer_output_accu_get_volume() argument
715 switch ((vol >> 5) & 3) { snd_cs4235_mixer_output_accu_get_volume()
724 static inline int snd_cs4235_mixer_output_accu_set_volume(int vol) snd_cs4235_mixer_output_accu_set_volume() argument
726 switch (vol & 3) { snd_cs4235_mixer_output_accu_set_volume()
/linux-4.1.27/sound/isa/msnd/
H A Dmsnd_pinnacle_mixer.c232 case MSND_MIXER_SYNTH: /* synth vol (dsp mix) */ snd_msndmix_set()
233 case MSND_MIXER_PCM: /* pcm vol (dsp mix) */ snd_msndmix_set()
/linux-4.1.27/drivers/staging/speakup/
H A Dspeakup_acntsa.c60 __ATTR(vol, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
H A Dspeakup_audptr.c64 __ATTR(vol, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
H A Dspeakup_bns.c57 __ATTR(vol, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
H A Dspeakup_dummy.c59 __ATTR(vol, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
H A Dspeakup_ltlk.c69 __ATTR(vol, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
H A Dspeakup_spkout.c63 __ATTR(vol, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
H A Dspeakup_txprt.c57 __ATTR(vol, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
H A Dspeakup_acntpc.c75 __ATTR(vol, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
H A Dspeakup_apollo.c68 __ATTR(vol, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
H A Dspeakup_decext.c86 __ATTR(vol, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
H A Dspeakup_dectlk.c85 __ATTR(vol, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
H A Dspeakup_soft.c80 __ATTR(vol, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
H A Dvarhandlers.c39 { "vol", VOL, VAR_NUM, NULL, NULL },
H A Dspeakup_dtlk.c86 __ATTR(vol, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
H A Dspeakup_decpc.c179 __ATTR(vol, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
H A Dkobjects.c663 spk_reset_default_value("vol", synth->default_vol, spk_var_store()
/linux-4.1.27/sound/mips/
H A Dsgio2audio.c175 int vol; sgio2audio_gain_get() local
177 vol = ad1843_get_gain(&chip->ad1843, (int)kcontrol->private_value); sgio2audio_gain_get()
179 ucontrol->value.integer.value[0] = (vol >> 8) & 0xFF; sgio2audio_gain_get()
180 ucontrol->value.integer.value[1] = vol & 0xFF; sgio2audio_gain_get()
H A Dhal2.c93 struct hal2_vol_regs *vol_regs; /* HAL2 vol registers */
/linux-4.1.27/sound/pci/mixart/
H A Dmixart_mixer.c879 int vol = ucontrol->value.integer.value[i]; mixart_pcm_vol_put() local
880 if (vol < MIXART_DIGITAL_LEVEL_MIN || mixart_pcm_vol_put()
881 vol > MIXART_DIGITAL_LEVEL_MAX) mixart_pcm_vol_put()
883 if (stored_volume[i] != vol) { mixart_pcm_vol_put()
884 stored_volume[i] = vol; mixart_pcm_vol_put()
/linux-4.1.27/drivers/mfd/
H A Dwm8350-regmap.c24 u16 vol; /* Mask of volatile bits */ member in struct:wm8350_reg_access
307 return wm8350_reg_io_map[reg].vol; wm8350_volatile()
/linux-4.1.27/drivers/edac/
H A Die31200_edac.c22 * http://www.intel.com/content/dam/www/public/us/en/documents/datasheets/xeon-e3-1200v3-vol-2-datasheet.pdf
23 * http://www.intel.com/content/www/us/en/processors/xeon/xeon-e3-1200-family-vol-2-datasheet.html
H A Dsb_edac.c2009 * According with Table 15-9 of the Intel Architecture spec vol 3A, sbridge_mce_output_error()
/linux-4.1.27/fs/btrfs/
H A Dsuper.c1961 struct btrfs_ioctl_vol_args *vol; btrfs_control_ioctl() local
1968 vol = memdup_user((void __user *)arg, sizeof(*vol)); btrfs_control_ioctl()
1969 if (IS_ERR(vol)) btrfs_control_ioctl()
1970 return PTR_ERR(vol); btrfs_control_ioctl()
1974 ret = btrfs_scan_one_device(vol->name, FMODE_READ, btrfs_control_ioctl()
1978 ret = btrfs_scan_one_device(vol->name, FMODE_READ, btrfs_control_ioctl()
1986 kfree(vol); btrfs_control_ioctl()
/linux-4.1.27/sound/sparc/
H A Ddbri.c2286 unsigned int vol[2]; snd_cs4215_put_volume() local
2289 vol[0] = ucontrol->value.integer.value[0]; snd_cs4215_put_volume()
2290 vol[1] = ucontrol->value.integer.value[1]; snd_cs4215_put_volume()
2292 if (vol[0] > DBRI_MAX_VOLUME || vol[1] > DBRI_MAX_VOLUME) snd_cs4215_put_volume()
2295 if (vol[0] > DBRI_MAX_GAIN || vol[1] > DBRI_MAX_GAIN) snd_cs4215_put_volume()
2299 if (info->left_gain != vol[0]) { snd_cs4215_put_volume()
2300 info->left_gain = vol[0]; snd_cs4215_put_volume()
2303 if (info->right_gain != vol[1]) { snd_cs4215_put_volume()
2304 info->right_gain = vol[1]; snd_cs4215_put_volume()
/linux-4.1.27/drivers/cpufreq/
H A Dimx6q-cpufreq.c241 * voltage like <freq-kHz vol-uV>. imx6q_cpufreq_probe()
/linux-4.1.27/arch/x86/power/
H A Dcpu.c152 tss.type = 0x9; /* The available 64-bit TSS (see AMD vol 2, pg 91 */ fix_processor_context()
/linux-4.1.27/fs/ncpfs/
H A Dncplib_kernel.h113 int ncp_dirhandle_alloc(struct ncp_server *, __u8 vol, __le32 dirent, __u8 *dirhandle);
H A Ddir.c708 ncp_dbg(1, "found vol: %s\n", info.volume_name); ncp_read_volume_list()
712 ncp_dbg(1, "could not lookup vol %s\n", ncp_read_volume_list()
H A Dinode.c721 ncp_dbg(1, "root vol=%d\n", NCP_FINFO(root_inode)->volNumber); ncp_fill_super()
H A Dncplib_kernel.c597 ncp_dbg(1, "looking up vol %s\n", volname); ncp_get_volume_root()
/linux-4.1.27/fs/efs/
H A Dsuper.c52 {0x06, "SGI vol"},
/linux-4.1.27/include/uapi/linux/
H A Dsoundcard.h801 #define SOUND_DEVICE_NAMES {"vol", "bass", "treble", "synth", "pcm", "speaker", "line", \
1140 #define SEQ_START_NOTE(dev, chn, note, vol) \
1141 _CHN_VOICE(dev, MIDI_NOTEON, chn, note, vol)
1143 #define SEQ_STOP_NOTE(dev, chn, note, vol) \
1144 _CHN_VOICE(dev, MIDI_NOTEOFF, chn, note, vol)
/linux-4.1.27/sound/pci/trident/
H A Dtrident_main.c975 voice->Vol = mix->vol; snd_trident_playback_prepare()
1486 voice->Vol = mix->vol; snd_trident_spdif_prepare()
2674 ucontrol->value.integer.value[0] = 1023 - mix->vol; snd_trident_pcm_vol_control_get()
2676 ucontrol->value.integer.value[0] = 255 - (mix->vol>>2); snd_trident_pcm_vol_control_get()
2695 change = val != mix->vol; snd_trident_pcm_vol_control_put()
2696 mix->vol = val; snd_trident_pcm_vol_control_put()
2929 tmix->vol = T4D_DEFAULT_PCM_VOL; snd_trident_pcm_mixer_build()
3650 tmix->vol = T4D_DEFAULT_PCM_VOL; snd_trident_create()
H A Dtrident.h348 unsigned short vol; /* front volume */ member in struct:snd_trident_pcm_mixer
/linux-4.1.27/drivers/pnp/
H A Dquirks.c385 * https://www-ssl.intel.com/content/www/us/en/processors/core/4th-gen-core-family-desktop-vol-2-datasheet quirk_intel_mch()
/linux-4.1.27/drivers/isdn/hardware/mISDN/
H A Dw6692.c551 u16 *vol = (u16 *)skb->data;
559 if (*vol > 7)
561 val = *vol & 7;
/linux-4.1.27/sound/isa/sb/
H A Demu8000_callback.c440 /* set all mod/vol envelope shape to minimum */ snd_emu8000_tweak_voice()
/linux-4.1.27/sound/pci/hda/
H A Dhda_generic.c1159 /* if the primary channel vol/mute is shared with HP volume, get_line_out_pfx()
1171 /* if the primary channel vol/mute is shared with spk volume, get_line_out_pfx()
3660 /* return the vol ctl when used first in the imux list */ get_first_cap_ctl()
3736 int vol, sw; create_capture_mixers() local
3738 vol = sw = 0; create_capture_mixers()
3745 if (!vol) create_capture_mixers()
3746 vol = path->ctls[NID_PATH_VOL_CTL]; create_capture_mixers()
3747 else if (vol != path->ctls[NID_PATH_VOL_CTL]) { create_capture_mixers()
3749 if (!same_amp_caps(codec, vol, create_capture_mixers()
3766 err = create_single_cap_vol_ctl(codec, n, vol, sw, create_capture_mixers()
3769 err = create_bind_cap_vol_ctl(codec, n, vol, sw); create_capture_mixers()
H A Dpatch_cirrus.c958 unsigned int vol = ucontrol->value.integer.value[0]; cs421x_boost_vol_put() local
964 coef |= (vol & 0x0003); cs421x_boost_vol_put()
/linux-4.1.27/drivers/isdn/mISDN/
H A Ddsp_core.c400 printk(KERN_DEBUG "%s: change tx vol to %d\n", dsp_control_req()
417 printk(KERN_DEBUG "%s: change rx vol to %d\n", dsp_control_req()
/linux-4.1.27/drivers/scsi/aacraid/
H A Daachba.c622 (le32_to_cpu(dresp->mnt[0].vol) != CT_NONE) && _aac_probe_container2()
638 fsa_dev_ptr->type = le32_to_cpu(dresp->mnt[0].vol); _aac_probe_container2()
668 (le32_to_cpu(dresp->mnt[0].vol) != CT_NONE)) { _aac_probe_container1()
895 /* last six chars reserved for vol type */ setinqstr()
908 /* last six chars reserved for vol type */ setinqstr()
H A Daacraid.h1775 __le32 vol; /* substrate structure */ member in struct:aac_mntent
/linux-4.1.27/fs/ubifs/
H A Dsuper.c1908 int dev, vol; open_ubi() local
1935 vol = simple_strtoul(endptr + 1, &endptr, 0); open_ubi()
1938 return ubi_open_volume(dev, vol, mode); open_ubi()
/linux-4.1.27/include/sound/
H A Dgus.h574 unsigned short snd_gf1_lvol_to_gvol_raw(unsigned int vol);
/linux-4.1.27/arch/powerpc/net/
H A Dbpf_jit_comp.c99 /* Restore any saved non-vol registers */ bpf_jit_build_epilogue()
/linux-4.1.27/mm/
H A Dslob.c306 * Knuth vol 1, sec 2.5, pg 449) */ list_for_each_entry()
/linux-4.1.27/sound/core/seq/
H A Dseq_midi_emul.c500 * master vol: XX=0x00, YY=0x04, ZZ=0-127 sysex()
/linux-4.1.27/sound/isa/
H A Dcmi8330.c145 0x0, /* 18 - vol */
/linux-4.1.27/fs/udf/
H A Dsuper.c37 * vol descs. rewrote option handling based on isofs
1489 udf_debug("Parsing Logical vol part %d type %d id=%s\n", udf_load_logicalvol()
/linux-4.1.27/drivers/platform/x86/
H A Dthinkpad_acpi.c2442 /* repeated vol up/down keypress at end of scale ? */ hotkey_compare_and_issue_event()
6745 TPACPI_VOL_CAP_VOLMUTE, /* Output vol and mute */
6905 static int __volume_set_volume_ec(const u8 vol) __volume_set_volume_ec() argument
6910 if (vol > TP_EC_VOLUME_MAX) __volume_set_volume_ec()
6920 n = (s & ~TP_EC_AUDIO_LVL_MSK) | vol; __volume_set_volume_ec()
6984 static int volume_alsa_set_volume(const u8 vol) volume_alsa_set_volume() argument
6987 "ALSA: trying to set volume level to %hu\n", vol); volume_alsa_set_volume()
6988 return __volume_set_volume_ec(vol); volume_alsa_set_volume()
H A Dintel_ips.c56 * - CDI 403777, 403778 - Auburndale EDS vol 1 & 2
/linux-4.1.27/arch/x86/mm/
H A Dpat.c260 * SDM vol 3a
/linux-4.1.27/drivers/base/power/
H A Dopp.c863 * voltage like <freq-kHz vol-uV>. of_init_opp_table()
/linux-4.1.27/arch/m68k/ifpsp060/src/
H A Dilsp.S270 # Art of Computer Programming, vol II, Seminumerical Algorithms. #
/linux-4.1.27/drivers/media/rc/
H A Dimon.c1845 /* iMON Knob, no display, iMON IR + vol knob */ imon_get_ffdc_type()
1856 /* iMON VFD, no IR (does have vol knob tho) */ imon_get_ffdc_type()
/linux-4.1.27/drivers/gpu/drm/i915/
H A Dintel_ringbuffer.c2355 * Bspec vol 1c.5 - video engine command streamer: gen6_bsd_ring_flush()
2468 * Bspec vol 1c.3 - blitter engine command streamer: gen6_ring_flush()
/linux-4.1.27/drivers/base/regmap/
H A Dregmap.c2285 bool vol = regmap_volatile_range(map, reg, val_count); regmap_bulk_read() local
2290 if (map->bus && map->format.parse_inplace && (vol || map->cache_type == REGCACHE_NONE)) { regmap_bulk_read()
/linux-4.1.27/fs/gfs2/
H A Dlock_dlm.c42 * Reference: TCP/IP Illustrated, vol 2, p. 831,832
/linux-4.1.27/arch/x86/kernel/apic/
H A Dapic.c1821 /* see sw-dev-man vol 3, chapter 7.4.13.5 */ __smp_spurious_interrupt()
/linux-4.1.27/fs/ocfs2/
H A Dsuper.c2152 mlog(ML_ERROR, "unable to alloc vol label\n"); ocfs2_initialize_super()
/linux-4.1.27/sound/pci/ca0106/
H A Dca0106_main.c1542 /* SPDIF IN Volume, 0x70 = (vol & 0x3f) | 0x40 */ ca0106_init_chip()

Completed in 4490 milliseconds

12