Lines Matching defs:filep

33 #include <sys/filep.h>
124 opendir(fileid_t *filep, ino_t inode)
130 filep->fi_offset = 0;
131 filep->fi_blocknum = hdbtodb(inode);
132 filep->fi_count = ISO_SECTOR_SIZE;
135 if ((filep->fi_memp = get_bcache(filep)) == NULL) {
137 if (retval = set_bcache(filep)) {
142 filep->fi_offset = 0;
143 filep->fi_blocknum = hdbtodb(inode);
148 if ((int)(parse_dir(filep, 0, &hsdep)) > 0) {
149 hs_seti(filep, &hsdep, inode);
156 find(fileid_t *filep, char *path)
171 if (opendir(filep, inode = root_ino)) {
186 if ((inode = dlook(filep, path)) != 0) {
189 if (opendir(filep, inode)) {
208 fileid_t *filep = head;
211 while ((filep = filep->fi_forw) != head)
212 if (fd == filep->fi_filedes)
213 return (filep->fi_taken ? filep : 0);
220 dlook(fileid_t *filep, char *path)
222 int dv = filep->fi_devp->di_dcookie;
230 ip = filep->fi_inode;
242 if ((filep->fi_inode = get_icache(dv, in)) != NULL) {
243 filep->fi_offset = 0;
244 filep->fi_blocknum = hdbtodb(in);
249 dirp.fi = filep;
263 hs_seti(filep, hsdep, udp->d_ino);
264 filep->fi_offset = 0;
265 filep->fi_blocknum = hdbtodb(udp->d_ino);
285 register fileid_t *filep;
289 filep = dirp->fi;
290 ip = filep->fi_inode;
298 filep->fi_blocknum = lbn + hdbtodb(ip->i_number);
299 filep->fi_count = ISO_SECTOR_SIZE;
301 if ((filep->fi_memp = get_bcache(filep)) == 0)
302 if (set_bcache(filep))
305 dirp->loc += parse_dir(filep, off, &hsdep);
319 getblock(fileid_t *filep, caddr_t buf, int count, int *rcount)
329 ip = filep->fi_inode;
330 p = filep->fi_memp;
331 if ((signed)filep->fi_count <= 0) {
334 diff = ip->i_size - filep->fi_offset;
341 lbn = hdbtodb(filep->fi_offset >> ISO_SECTOR_SHIFT);
344 filep->fi_blocknum = lbn + hdbtodb(ip->i_number);
346 off = filep->fi_offset & ((1 << ISO_SECTOR_SHIFT) - 1);
348 size = sizeof (filep->fi_buf);
352 filep->fi_count = size;
353 filep->fi_memp = filep->fi_buf;
361 filep->fi_memp = buf;
362 if (diskread(filep)) {
366 filep->fi_count = 0;
372 if (diskread(filep))
382 if (filep->fi_offset - off + size >= ip->i_size)
383 filep->fi_count = diff + off;
384 filep->fi_count -= off;
385 p = &filep->fi_memp[off];
387 filep->fi_memp = p;
407 fileid_t *filep;
410 if (!(filep = find_fp(fd))) {
414 ip = filep->fi_inode;
416 if (filep->fi_offset + count > ip->i_size)
417 count = ip->i_size - filep->fi_offset;
426 if ((j = filep->fi_count) == 0) {
427 getblock(filep, buf, i, &rcount);
430 filep->fi_offset += rcount;
434 bcopy(filep->fi_memp, buf, (unsigned)j);
436 filep->fi_memp += j;
437 filep->fi_offset += j;
438 filep->fi_count -= j;
573 fileid_t *filep;
578 filep = (fileid_t *)bkmem_alloc(sizeof (fileid_t));
579 filep->fi_back = head->fi_back;
580 filep->fi_forw = head;
581 head->fi_back->fi_forw = filep;
582 head->fi_back = filep;
584 filep->fi_filedes = filedes++;
585 filep->fi_taken = 1;
586 filep->fi_path = (char *)bkmem_alloc(strlen(filename) + 1);
587 (void) strcpy(filep->fi_path, filename);
588 filep->fi_devp = devp; /* dev is already "mounted" */
590 filep->fi_inode = 0;
592 inode = find(filep, filename);
596 (void) boot_hsfs_close(filep->fi_filedes);
600 filep->fi_blocknum = hdbtodb(inode);
601 filep->fi_offset = filep->fi_count = 0;
604 printf("open(%s) fd=%d\n", filename, filep->fi_filedes);
605 return (filep->fi_filedes);
615 fileid_t *filep;
618 if (!(filep = find_fp(fd)))
621 ip = filep->fi_inode;
661 fileid_t *filep;
663 if (!(filep = find_fp(fd)))
666 filep->fi_offset = addr;
667 filep->fi_blocknum = addr / DEV_BSIZE;
668 filep->fi_count = 0;
676 fileid_t *filep;
681 if (filep = find_fp(fd)) {
683 bkmem_free(filep->fi_path, strlen(filep->fi_path)+1);
684 filep->fi_blocknum = filep->fi_count = filep->fi_offset = 0;
685 filep->fi_memp = (caddr_t)0;
686 filep->fi_devp = 0;
687 filep->fi_taken = 0;
690 filep->fi_forw->fi_back = filep->fi_back;
691 filep->fi_back->fi_forw = filep->fi_forw;
692 bkmem_free((char *)filep, sizeof (fileid_t));
707 fileid_t *filep = head;
716 while ((filep = filep->fi_forw) != head)
717 if (filep->fi_taken)
718 if (boot_hsfs_close(filep->fi_filedes))
735 parse_dir(fileid_t *filep, int offset, struct hs_direct *hsdep)
737 char *bufp = (char *)(filep->fi_memp + offset);
809 daddr_t save_blocknum = filep->fi_blocknum;
810 daddr_t save_offset = filep->fi_offset;
811 caddr_t save_memp = filep->fi_memp;
812 uint_t save_count = filep->fi_count;
815 print_io_req(filep, "parse_dir(): [I]");
818 filep->fi_blocknum = hdbtodb(ce_lbn);
819 filep->fi_offset = 0;
820 filep->fi_count = ISO_SECTOR_SIZE;
823 print_io_req(filep, "parse_dir(): [0]");
826 if ((filep->fi_memp = get_bcache(filep)) == 0)
827 ret_code = set_bcache(filep);
830 print_io_req(filep, "parse_dir(): [1]");
834 filep->fi_blocknum = save_blocknum;
835 filep->fi_offset = save_offset;
836 filep->fi_memp = save_memp;
837 filep->fi_count = save_count;
842 ce_lbn = parse_susp(filep->fi_memp, &ce_len, hsdep);
844 filep->fi_blocknum = save_blocknum;
845 filep->fi_offset = save_offset;
846 filep->fi_memp = save_memp;
847 filep->fi_count = save_count;
850 print_io_req(filep, "parse_dir(): [2]");
953 hs_seti(fileid_t *filep, struct hs_direct *hsdep, ino_t inode)
956 int dv = filep->fi_devp->di_dcookie;
959 if ((filep->fi_inode = get_icache(dv, inode)) != NULL)
962 filep->fi_inode = (struct inode *)bkmem_alloc(sizeof (struct inode));
963 ip = filep->fi_inode;
979 print_io_req(fileid_t *filep, char *str)
983 filep->fi_offset,
984 filep->fi_blocknum,
985 filep->fi_count,
986 (uint_t)filep->fi_memp);