1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16#ifndef __YAFFS_GUTS_H__
17#define __YAFFS_GUTS_H__
18
19#include "yportenv.h"
20
21#define YAFFS_OK 1
22#define YAFFS_FAIL 0
23
24
25
26
27
28
29
30#define YAFFS_MAGIC 0x5941ff53
31
32
33
34
35
36
37
38
39
40
41
42
43
44#define YAFFS_NTNODES_LEVEL0 16
45#define YAFFS_TNODES_LEVEL0_BITS 4
46#define YAFFS_TNODES_LEVEL0_MASK 0xf
47
48#define YAFFS_NTNODES_INTERNAL (YAFFS_NTNODES_LEVEL0 / 2)
49#define YAFFS_TNODES_INTERNAL_BITS (YAFFS_TNODES_LEVEL0_BITS - 1)
50#define YAFFS_TNODES_INTERNAL_MASK 0x7
51#define YAFFS_TNODES_MAX_LEVEL 8
52#define YAFFS_TNODES_MAX_BITS (YAFFS_TNODES_LEVEL0_BITS + \
53 YAFFS_TNODES_INTERNAL_BITS * \
54 YAFFS_TNODES_MAX_LEVEL)
55#define YAFFS_MAX_CHUNK_ID ((1 << YAFFS_TNODES_MAX_BITS) - 1)
56
57
58#define YAFFS_BYTES_PER_SPARE 16
59#define YAFFS_BYTES_PER_CHUNK 512
60#define YAFFS_CHUNK_SIZE_SHIFT 9
61#define YAFFS_CHUNKS_PER_BLOCK 32
62#define YAFFS_BYTES_PER_BLOCK (YAFFS_CHUNKS_PER_BLOCK*YAFFS_BYTES_PER_CHUNK)
63
64#define YAFFS_MIN_YAFFS2_CHUNK_SIZE 1024
65#define YAFFS_MIN_YAFFS2_SPARE_SIZE 32
66
67
68
69#define YAFFS_ALLOCATION_NOBJECTS 100
70#define YAFFS_ALLOCATION_NTNODES 100
71#define YAFFS_ALLOCATION_NLINKS 100
72
73#define YAFFS_NOBJECT_BUCKETS 256
74
75#define YAFFS_OBJECT_SPACE 0x40000
76#define YAFFS_MAX_OBJECT_ID (YAFFS_OBJECT_SPACE - 1)
77
78
79#define YAFFS_SUMMARY_VERSION 1
80#define YAFFS_CHECKPOINT_VERSION 6
81
82#ifdef CONFIG_YAFFS_UNICODE
83#define YAFFS_MAX_NAME_LENGTH 127
84#define YAFFS_MAX_ALIAS_LENGTH 79
85#else
86#define YAFFS_MAX_NAME_LENGTH 255
87#define YAFFS_MAX_ALIAS_LENGTH 159
88#endif
89
90#define YAFFS_SHORT_NAME_LENGTH 15
91
92
93#define YAFFS_OBJECTID_ROOT 1
94#define YAFFS_OBJECTID_LOSTNFOUND 2
95#define YAFFS_OBJECTID_UNLINKED 3
96#define YAFFS_OBJECTID_DELETED 4
97
98
99#define YAFFS_OBJECTID_SUMMARY 0x10
100
101
102#define YAFFS_OBJECTID_CHECKPOINT_DATA 0x20
103#define YAFFS_SEQUENCE_CHECKPOINT_DATA 0x21
104
105#define YAFFS_MAX_SHORT_OP_CACHES 20
106
107#define YAFFS_N_TEMP_BUFFERS 6
108
109
110
111
112
113#define YAFFS_WR_ATTEMPTS (5*64)
114
115
116
117
118
119
120
121
122#define YAFFS_LOWEST_SEQUENCE_NUMBER 0x00001000
123#define YAFFS_HIGHEST_SEQUENCE_NUMBER 0xefffff00
124
125
126#define YAFFS_SEQUENCE_BAD_BLOCK 0xffff0000
127
128
129struct yaffs_cache {
130 struct yaffs_obj *object;
131 int chunk_id;
132 int last_use;
133 int dirty;
134 int n_bytes;
135 int locked;
136 u8 *data;
137};
138
139
140
141
142
143
144struct yaffs_tags {
145 unsigned chunk_id:20;
146 unsigned serial_number:2;
147 unsigned n_bytes_lsb:10;
148 unsigned obj_id:18;
149 unsigned ecc:12;
150 unsigned n_bytes_msb:2;
151};
152
153union yaffs_tags_union {
154 struct yaffs_tags as_tags;
155 u8 as_bytes[8];
156};
157
158
159
160
161enum yaffs_ecc_result {
162 YAFFS_ECC_RESULT_UNKNOWN,
163 YAFFS_ECC_RESULT_NO_ERROR,
164 YAFFS_ECC_RESULT_FIXED,
165 YAFFS_ECC_RESULT_UNFIXED
166};
167
168enum yaffs_obj_type {
169 YAFFS_OBJECT_TYPE_UNKNOWN,
170 YAFFS_OBJECT_TYPE_FILE,
171 YAFFS_OBJECT_TYPE_SYMLINK,
172 YAFFS_OBJECT_TYPE_DIRECTORY,
173 YAFFS_OBJECT_TYPE_HARDLINK,
174 YAFFS_OBJECT_TYPE_SPECIAL
175};
176
177#define YAFFS_OBJECT_TYPE_MAX YAFFS_OBJECT_TYPE_SPECIAL
178
179struct yaffs_ext_tags {
180 unsigned chunk_used;
181 unsigned obj_id;
182 unsigned chunk_id;
183 unsigned n_bytes;
184
185
186 enum yaffs_ecc_result ecc_result;
187 unsigned block_bad;
188
189
190 unsigned is_deleted;
191 unsigned serial_number;
192
193
194 unsigned seq_number;
195
196
197
198 unsigned extra_available;
199 unsigned extra_parent_id;
200 unsigned extra_is_shrink;
201 unsigned extra_shadows;
202
203 enum yaffs_obj_type extra_obj_type;
204
205 loff_t extra_file_size;
206 unsigned extra_equiv_id;
207};
208
209
210struct yaffs_spare {
211 u8 tb0;
212 u8 tb1;
213 u8 tb2;
214 u8 tb3;
215 u8 page_status;
216 u8 block_status;
217 u8 tb4;
218 u8 tb5;
219 u8 ecc1[3];
220 u8 tb6;
221 u8 tb7;
222 u8 ecc2[3];
223};
224
225
226struct yaffs_nand_spare {
227 struct yaffs_spare spare;
228 int eccres1;
229 int eccres2;
230};
231
232
233
234enum yaffs_block_state {
235 YAFFS_BLOCK_STATE_UNKNOWN = 0,
236
237 YAFFS_BLOCK_STATE_SCANNING,
238
239
240 YAFFS_BLOCK_STATE_NEEDS_SCAN,
241
242
243
244
245
246
247
248
249
250
251 YAFFS_BLOCK_STATE_EMPTY,
252
253
254 YAFFS_BLOCK_STATE_ALLOCATING,
255
256
257
258
259
260
261
262
263 YAFFS_BLOCK_STATE_FULL,
264
265
266
267
268
269 YAFFS_BLOCK_STATE_DIRTY,
270
271
272
273
274 YAFFS_BLOCK_STATE_CHECKPOINT,
275
276
277 YAFFS_BLOCK_STATE_COLLECTING,
278
279
280 YAFFS_BLOCK_STATE_DEAD
281
282};
283
284#define YAFFS_NUMBER_OF_BLOCK_STATES (YAFFS_BLOCK_STATE_DEAD + 1)
285
286struct yaffs_block_info {
287
288 int soft_del_pages:10;
289 int pages_in_use:10;
290 unsigned block_state:4;
291
292
293 u32 needs_retiring:1;
294
295 u32 skip_erased_check:1;
296 u32 gc_prioritise:1;
297
298 u32 chunk_error_strikes:3;
299
300 u32 has_summary:1;
301
302 u32 has_shrink_hdr:1;
303 u32 seq_number;
304
305};
306
307
308
309
310struct yaffs_obj_hdr {
311 enum yaffs_obj_type type;
312
313
314 int parent_obj_id;
315 u16 sum_no_longer_used;
316 YCHAR name[YAFFS_MAX_NAME_LENGTH + 1];
317
318
319 u32 yst_mode;
320
321 u32 yst_uid;
322 u32 yst_gid;
323 u32 yst_atime;
324 u32 yst_mtime;
325 u32 yst_ctime;
326
327
328 u32 file_size_low;
329
330
331 int equiv_id;
332
333
334 YCHAR alias[YAFFS_MAX_ALIAS_LENGTH + 1];
335
336 u32 yst_rdev;
337
338 u32 win_ctime[2];
339 u32 win_atime[2];
340 u32 win_mtime[2];
341
342 u32 inband_shadowed_obj_id;
343 u32 inband_is_shrink;
344
345 u32 file_size_high;
346 u32 reserved[1];
347 int shadows_obj;
348
349
350
351 u32 is_shrink;
352
353};
354
355
356
357struct yaffs_tnode {
358 struct yaffs_tnode *internal[YAFFS_NTNODES_INTERNAL];
359};
360
361
362
363
364
365
366
367
368
369struct yaffs_file_var {
370 loff_t file_size;
371 loff_t scanned_size;
372 loff_t shrink_size;
373 int top_level;
374 struct yaffs_tnode *top;
375};
376
377struct yaffs_dir_var {
378 struct list_head children;
379 struct list_head dirty;
380};
381
382struct yaffs_symlink_var {
383 YCHAR *alias;
384};
385
386struct yaffs_hardlink_var {
387 struct yaffs_obj *equiv_obj;
388 u32 equiv_id;
389};
390
391union yaffs_obj_var {
392 struct yaffs_file_var file_variant;
393 struct yaffs_dir_var dir_variant;
394 struct yaffs_symlink_var symlink_variant;
395 struct yaffs_hardlink_var hardlink_variant;
396};
397
398struct yaffs_obj {
399 u8 deleted:1;
400 u8 soft_del:1;
401 u8 unlinked:1;
402 u8 fake:1;
403 u8 rename_allowed:1;
404 u8 unlink_allowed:1;
405 u8 dirty:1;
406 u8 valid:1;
407
408
409
410
411
412 u8 lazy_loaded:1;
413
414
415 u8 defered_free:1;
416
417
418
419
420 u8 being_created:1;
421
422 u8 is_shadowed:1;
423
424
425 u8 xattr_known:1;
426
427 u8 has_xattr:1;
428
429
430 u8 serial;
431 u16 sum;
432
433 struct yaffs_dev *my_dev;
434
435 struct list_head hash_link;
436
437 struct list_head hard_links;
438
439
440
441 struct yaffs_obj *parent;
442 struct list_head siblings;
443
444
445 int hdr_chunk;
446
447 int n_data_chunks;
448
449 u32 obj_id;
450
451 u32 yst_mode;
452
453 YCHAR short_name[YAFFS_SHORT_NAME_LENGTH + 1];
454
455#ifdef CONFIG_YAFFS_WINCE
456 u32 win_ctime[2];
457 u32 win_mtime[2];
458 u32 win_atime[2];
459#else
460 u32 yst_uid;
461 u32 yst_gid;
462 u32 yst_atime;
463 u32 yst_mtime;
464 u32 yst_ctime;
465#endif
466
467 u32 yst_rdev;
468
469 void *my_inode;
470
471 enum yaffs_obj_type variant_type;
472
473 union yaffs_obj_var variant;
474
475};
476
477struct yaffs_obj_bucket {
478 struct list_head list;
479 int count;
480};
481
482
483
484
485
486struct yaffs_checkpt_obj {
487 int struct_type;
488 u32 obj_id;
489 u32 parent_id;
490 int hdr_chunk;
491 enum yaffs_obj_type variant_type:3;
492 u8 deleted:1;
493 u8 soft_del:1;
494 u8 unlinked:1;
495 u8 fake:1;
496 u8 rename_allowed:1;
497 u8 unlink_allowed:1;
498 u8 serial;
499 int n_data_chunks;
500 loff_t size_or_equiv_obj;
501};
502
503
504
505
506
507
508struct yaffs_buffer {
509 u8 *buffer;
510 int in_use;
511};
512
513
514
515struct yaffs_param {
516 const YCHAR *name;
517
518
519
520
521
522
523
524 int inband_tags;
525 u32 total_bytes_per_chunk;
526
527 int chunks_per_block;
528 int spare_bytes_per_chunk;
529 int start_block;
530 int end_block;
531 int n_reserved_blocks;
532
533
534 int n_caches;
535
536
537 int use_nand_ecc;
538
539 int tags_9bytes;
540 int no_tags_ecc;
541
542
543 int is_yaffs2;
544
545 int empty_lost_n_found;
546
547 int refresh_period;
548
549
550 u8 skip_checkpt_rd;
551 u8 skip_checkpt_wr;
552
553 int enable_xattr;
554
555
556
557 int (*write_chunk_fn) (struct yaffs_dev *dev,
558 int nand_chunk, const u8 *data,
559 const struct yaffs_spare *spare);
560 int (*read_chunk_fn) (struct yaffs_dev *dev,
561 int nand_chunk, u8 *data,
562 struct yaffs_spare *spare);
563 int (*erase_fn) (struct yaffs_dev *dev, int flash_block);
564 int (*initialise_flash_fn) (struct yaffs_dev *dev);
565 int (*deinitialise_flash_fn) (struct yaffs_dev *dev);
566
567
568 int (*write_chunk_tags_fn) (struct yaffs_dev *dev,
569 int nand_chunk, const u8 *data,
570 const struct yaffs_ext_tags *tags);
571 int (*read_chunk_tags_fn) (struct yaffs_dev *dev,
572 int nand_chunk, u8 *data,
573 struct yaffs_ext_tags *tags);
574 int (*bad_block_fn) (struct yaffs_dev *dev, int block_no);
575 int (*query_block_fn) (struct yaffs_dev *dev, int block_no,
576 enum yaffs_block_state *state,
577 u32 *seq_number);
578
579
580
581
582
583
584 void (*remove_obj_fn) (struct yaffs_obj *obj);
585
586
587 void (*sb_dirty_fn) (struct yaffs_dev *dev);
588
589
590 unsigned (*gc_control) (struct yaffs_dev *dev);
591
592
593 int use_header_file_size;
594
595 int disable_lazy_load;
596 int wide_tnodes_disabled;
597 int disable_soft_del;
598
599
600 int defered_dir_update;
601
602#ifdef CONFIG_YAFFS_AUTO_UNICODE
603 int auto_unicode;
604#endif
605 int always_check_erased;
606
607 int disable_summary;
608
609 int max_objects;
610
611
612
613};
614
615struct yaffs_dev {
616 struct yaffs_param param;
617
618
619
620 void *os_context;
621 void *driver_context;
622
623 struct list_head dev_list;
624
625
626 int data_bytes_per_chunk;
627
628
629 u16 chunk_grp_bits;
630
631
632 u16 chunk_grp_size;
633
634
635 u32 tnode_width;
636 u32 tnode_mask;
637 u32 tnode_size;
638
639
640 u32 chunk_shift;
641 u32 chunk_div;
642 u32 chunk_mask;
643
644 int is_mounted;
645 int read_only;
646 int is_checkpointed;
647
648
649 int internal_start_block;
650 int internal_end_block;
651 int block_offset;
652 int chunk_offset;
653
654
655 int checkpt_page_seq;
656 int checkpt_byte_count;
657 int checkpt_byte_offs;
658 u8 *checkpt_buffer;
659 int checkpt_open_write;
660 int blocks_in_checkpt;
661 int checkpt_cur_chunk;
662 int checkpt_cur_block;
663 int checkpt_next_block;
664 int *checkpt_block_list;
665 int checkpt_max_blocks;
666 u32 checkpt_sum;
667 u32 checkpt_xor;
668
669 int checkpoint_blocks_required;
670
671
672
673 struct yaffs_block_info *block_info;
674 u8 *chunk_bits;
675 unsigned block_info_alt:1;
676 unsigned chunk_bits_alt:1;
677 int chunk_bit_stride;
678
679
680
681 int n_erased_blocks;
682 int alloc_block;
683 u32 alloc_page;
684 int alloc_block_finder;
685
686
687 void *allocator;
688 int n_obj;
689 int n_tnodes;
690
691 int n_hardlinks;
692
693 struct yaffs_obj_bucket obj_bucket[YAFFS_NOBJECT_BUCKETS];
694 u32 bucket_finder;
695
696 int n_free_chunks;
697
698
699 u32 *gc_cleanup_list;
700 u32 n_clean_ups;
701
702 unsigned has_pending_prioritised_gc;
703
704 unsigned gc_disable;
705 unsigned gc_block_finder;
706 unsigned gc_dirtiest;
707 unsigned gc_pages_in_use;
708 unsigned gc_not_done;
709 unsigned gc_block;
710 unsigned gc_chunk;
711 unsigned gc_skip;
712 struct yaffs_summary_tags *gc_sum_tags;
713
714
715 struct yaffs_obj *root_dir;
716 struct yaffs_obj *lost_n_found;
717
718 int buffered_block;
719 int doing_buffered_block_rewrite;
720
721 struct yaffs_cache *cache;
722 int cache_last_use;
723
724
725 struct yaffs_obj *unlinked_dir;
726
727 struct yaffs_obj *del_dir;
728
729 struct yaffs_obj *unlinked_deletion;
730
731 int n_deleted_files;
732 int n_unlinked_files;
733 int n_bg_deletions;
734
735
736 struct yaffs_buffer temp_buffer[YAFFS_N_TEMP_BUFFERS];
737 int max_temp;
738 int temp_in_use;
739 int unmanaged_buffer_allocs;
740 int unmanaged_buffer_deallocs;
741
742
743 unsigned seq_number;
744
745 unsigned oldest_dirty_seq;
746 unsigned oldest_dirty_block;
747
748
749 int refresh_skip;
750
751
752
753 struct list_head dirty_dirs;
754
755
756 int chunks_per_summary;
757 struct yaffs_summary_tags *sum_tags;
758
759
760 u32 n_page_writes;
761 u32 n_page_reads;
762 u32 n_erasures;
763 u32 n_erase_failures;
764 u32 n_gc_copies;
765 u32 all_gcs;
766 u32 passive_gc_count;
767 u32 oldest_dirty_gc_count;
768 u32 n_gc_blocks;
769 u32 bg_gcs;
770 u32 n_retried_writes;
771 u32 n_retired_blocks;
772 u32 n_ecc_fixed;
773 u32 n_ecc_unfixed;
774 u32 n_tags_ecc_fixed;
775 u32 n_tags_ecc_unfixed;
776 u32 n_deletions;
777 u32 n_unmarked_deletions;
778 u32 refresh_count;
779 u32 cache_hits;
780 u32 tags_used;
781 u32 summary_used;
782
783};
784
785
786
787
788struct yaffs_checkpt_dev {
789 int struct_type;
790 int n_erased_blocks;
791 int alloc_block;
792 u32 alloc_page;
793 int n_free_chunks;
794
795 int n_deleted_files;
796 int n_unlinked_files;
797 int n_bg_deletions;
798
799
800 unsigned seq_number;
801
802
803};
804
805struct yaffs_checkpt_validity {
806 int struct_type;
807 u32 magic;
808 u32 version;
809 u32 head;
810};
811
812struct yaffs_shadow_fixer {
813 int obj_id;
814 int shadowed_id;
815 struct yaffs_shadow_fixer *next;
816};
817
818
819struct yaffs_xattr_mod {
820 int set;
821 const YCHAR *name;
822 const void *data;
823 int size;
824 int flags;
825 int result;
826};
827
828
829
830int yaffs_guts_initialise(struct yaffs_dev *dev);
831void yaffs_deinitialise(struct yaffs_dev *dev);
832
833int yaffs_get_n_free_chunks(struct yaffs_dev *dev);
834
835int yaffs_rename_obj(struct yaffs_obj *old_dir, const YCHAR * old_name,
836 struct yaffs_obj *new_dir, const YCHAR * new_name);
837
838int yaffs_unlinker(struct yaffs_obj *dir, const YCHAR * name);
839int yaffs_del_obj(struct yaffs_obj *obj);
840
841int yaffs_get_obj_name(struct yaffs_obj *obj, YCHAR * name, int buffer_size);
842loff_t yaffs_get_obj_length(struct yaffs_obj *obj);
843int yaffs_get_obj_inode(struct yaffs_obj *obj);
844unsigned yaffs_get_obj_type(struct yaffs_obj *obj);
845int yaffs_get_obj_link_count(struct yaffs_obj *obj);
846
847
848int yaffs_file_rd(struct yaffs_obj *obj, u8 * buffer, loff_t offset,
849 int n_bytes);
850int yaffs_wr_file(struct yaffs_obj *obj, const u8 * buffer, loff_t offset,
851 int n_bytes, int write_trhrough);
852int yaffs_resize_file(struct yaffs_obj *obj, loff_t new_size);
853
854struct yaffs_obj *yaffs_create_file(struct yaffs_obj *parent,
855 const YCHAR *name, u32 mode, u32 uid,
856 u32 gid);
857
858int yaffs_flush_file(struct yaffs_obj *obj, int update_time, int data_sync);
859
860
861void yaffs_flush_whole_cache(struct yaffs_dev *dev);
862
863int yaffs_checkpoint_save(struct yaffs_dev *dev);
864int yaffs_checkpoint_restore(struct yaffs_dev *dev);
865
866
867struct yaffs_obj *yaffs_create_dir(struct yaffs_obj *parent, const YCHAR *name,
868 u32 mode, u32 uid, u32 gid);
869struct yaffs_obj *yaffs_find_by_name(struct yaffs_obj *the_dir,
870 const YCHAR *name);
871struct yaffs_obj *yaffs_find_by_number(struct yaffs_dev *dev, u32 number);
872
873
874struct yaffs_obj *yaffs_link_obj(struct yaffs_obj *parent, const YCHAR *name,
875 struct yaffs_obj *equiv_obj);
876
877struct yaffs_obj *yaffs_get_equivalent_obj(struct yaffs_obj *obj);
878
879
880struct yaffs_obj *yaffs_create_symlink(struct yaffs_obj *parent,
881 const YCHAR *name, u32 mode, u32 uid,
882 u32 gid, const YCHAR *alias);
883YCHAR *yaffs_get_symlink_alias(struct yaffs_obj *obj);
884
885
886struct yaffs_obj *yaffs_create_special(struct yaffs_obj *parent,
887 const YCHAR *name, u32 mode, u32 uid,
888 u32 gid, u32 rdev);
889
890int yaffs_set_xattrib(struct yaffs_obj *obj, const YCHAR *name,
891 const void *value, int size, int flags);
892int yaffs_get_xattrib(struct yaffs_obj *obj, const YCHAR *name, void *value,
893 int size);
894int yaffs_list_xattrib(struct yaffs_obj *obj, char *buffer, int size);
895int yaffs_remove_xattrib(struct yaffs_obj *obj, const YCHAR *name);
896
897
898struct yaffs_obj *yaffs_root(struct yaffs_dev *dev);
899struct yaffs_obj *yaffs_lost_n_found(struct yaffs_dev *dev);
900
901void yaffs_handle_defered_free(struct yaffs_obj *obj);
902
903void yaffs_update_dirty_dirs(struct yaffs_dev *dev);
904
905int yaffs_bg_gc(struct yaffs_dev *dev, unsigned urgency);
906
907
908int yaffs_dump_obj(struct yaffs_obj *obj);
909
910void yaffs_guts_test(struct yaffs_dev *dev);
911
912
913void yaffs_chunk_del(struct yaffs_dev *dev, int chunk_id, int mark_flash,
914 int lyn);
915int yaffs_check_ff(u8 *buffer, int n_bytes);
916void yaffs_handle_chunk_error(struct yaffs_dev *dev,
917 struct yaffs_block_info *bi);
918
919u8 *yaffs_get_temp_buffer(struct yaffs_dev *dev);
920void yaffs_release_temp_buffer(struct yaffs_dev *dev, u8 *buffer);
921
922struct yaffs_obj *yaffs_find_or_create_by_number(struct yaffs_dev *dev,
923 int number,
924 enum yaffs_obj_type type);
925int yaffs_put_chunk_in_file(struct yaffs_obj *in, int inode_chunk,
926 int nand_chunk, int in_scan);
927void yaffs_set_obj_name(struct yaffs_obj *obj, const YCHAR *name);
928void yaffs_set_obj_name_from_oh(struct yaffs_obj *obj,
929 const struct yaffs_obj_hdr *oh);
930void yaffs_add_obj_to_dir(struct yaffs_obj *directory, struct yaffs_obj *obj);
931YCHAR *yaffs_clone_str(const YCHAR *str);
932void yaffs_link_fixup(struct yaffs_dev *dev, struct list_head *hard_list);
933void yaffs_block_became_dirty(struct yaffs_dev *dev, int block_no);
934int yaffs_update_oh(struct yaffs_obj *in, const YCHAR *name,
935 int force, int is_shrink, int shadows,
936 struct yaffs_xattr_mod *xop);
937void yaffs_handle_shadowed_obj(struct yaffs_dev *dev, int obj_id,
938 int backward_scanning);
939int yaffs_check_alloc_available(struct yaffs_dev *dev, int n_chunks);
940struct yaffs_tnode *yaffs_get_tnode(struct yaffs_dev *dev);
941struct yaffs_tnode *yaffs_add_find_tnode_0(struct yaffs_dev *dev,
942 struct yaffs_file_var *file_struct,
943 u32 chunk_id,
944 struct yaffs_tnode *passed_tn);
945
946int yaffs_do_file_wr(struct yaffs_obj *in, const u8 *buffer, loff_t offset,
947 int n_bytes, int write_trhrough);
948void yaffs_resize_file_down(struct yaffs_obj *obj, loff_t new_size);
949void yaffs_skip_rest_of_block(struct yaffs_dev *dev);
950
951int yaffs_count_free_chunks(struct yaffs_dev *dev);
952
953struct yaffs_tnode *yaffs_find_tnode_0(struct yaffs_dev *dev,
954 struct yaffs_file_var *file_struct,
955 u32 chunk_id);
956
957u32 yaffs_get_group_base(struct yaffs_dev *dev, struct yaffs_tnode *tn,
958 unsigned pos);
959
960int yaffs_is_non_empty_dir(struct yaffs_obj *obj);
961
962void yaffs_addr_to_chunk(struct yaffs_dev *dev, loff_t addr,
963 int *chunk_out, u32 *offset_out);
964
965
966
967
968void yaffs_oh_size_load(struct yaffs_obj_hdr *oh, loff_t fsize);
969loff_t yaffs_oh_to_size(struct yaffs_obj_hdr *oh);
970loff_t yaffs_max_file_size(struct yaffs_dev *dev);
971
972
973#endif
974