]> Dogcows Code - chaz/tar/blob - src/read_ffs.c
18164cf9bf98bd46eea13d1e3f343cb72a773647
[chaz/tar] / src / read_ffs.c
1 /* Read files directly from the fast file system
2 Copyright (C) 1992 Free Software Foundation
3
4 This file is part of GNU Tar.
5
6 GNU Tar is free software; you can redistribute it and/or
7 modify it under the terms of the GNU General Public License as
8 published by the Free Software Foundation; either version 2, or (at
9 your option) any later version.
10
11 GNU Tar is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with GNU Tar; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
19
20
21 dev_t lastdev;
22 ino_t lastino;
23
24 struct dinode ino;
25 struct fs fs;
26 off_t offset;
27 int device_fd;
28
29 int *sindir, *dindir, *tindir;
30 int sindirblk, dindirblk, tindirblk;
31
32 read_raw_file (fd, buf, len)
33 int fd;
34 char *buf;
35 int len;
36 {
37 struct stat st;
38 off_t ntoread;
39 int log_blkno, phys_blkno;
40
41 fstat (fd, &st);
42 if (st.st_dev != lastdev)
43 new_device (st.st_dev);
44
45 if (st.st_ino != lastino)
46 new_inode (st.st_ino);
47
48 /* Only read single blocks at a time */
49 if (len > fs.fs_bsize)
50 len = fs.fs_bsize;
51
52 /* Prune to the length of the file */
53 if (offset + len > ino.di_size)
54 len = ino.di_size - offset;
55
56 log_blkno = lblkno (&fs, blkno);
57
This page took 0.035422 seconds and 4 git commands to generate.