Home | History | Annotate | Download | only in common

Lines Matching refs:file

60 	struct bfs_file *file;
62 if ((file = alloc(sizeof *file)) == 0)
64 memset(file, 0, sizeof *file);
66 if (bfs_init(&file->bfs) != 0) {
67 dealloc(file, sizeof *file);
71 if (!bfs_file_lookup(file->bfs, name, &file->start, &file->end,
72 &file->size)) {
73 bfs_fini(file->bfs);
74 dealloc(file, sizeof *file);
78 printf("%s: %s %d %d %d\n", __func__, name, file->start,
79 file->end, file->size);
81 f->f_fsdata = file;
89 struct bfs_file *file = f->f_fsdata;
91 bfs_fini(file->bfs);
99 struct bfs_file *file = f->f_fsdata;
103 int cur = file->cur;
105 if (cur + size > file->size)
106 size = file->size - cur;
108 start = file->start + (cur >> DEV_BSHIFT);
109 end = file->start + ((cur + size) >> DEV_BSHIFT);
112 if (!sector_read(0, file->buf, start))
116 memcpy(p, file->buf + DEV_BSIZE - n, size);
119 memcpy(p, file->buf + DEV_BSIZE - n, n);
129 if (!sector_read(0, file->buf, end))
132 memcpy(p, file->buf, n);
135 file->cur += size;
153 struct bfs_file *file = f->f_fsdata;
161 cur = file->cur + offset;
164 cur = file->size + offset;
170 if (cur < 0 || cur >= file->size) {
174 file->cur = cur;
182 struct bfs_file *file = f->f_fsdata;
184 stat->st_size = file->size;