-/* $NetBSD: ufs.c,v 1.12 1995/09/17 00:49:48 pk Exp $ */
+/* $NetBSD: ufs.c,v 1.13 1995/10/20 00:42:21 cgd Exp $ */
/*-
* Copyright (c) 1993
indirect block at level i */
char *f_blk[NIADDR]; /* buffer for indirect block at
level i */
- u_long f_blksize[NIADDR];
+ size_t f_blksize[NIADDR];
/* size of buffer */
daddr_t f_blkno[NIADDR];/* disk address of block in buffer */
char *f_buf; /* buffer for data block */
- u_int f_buf_size; /* size of data block */
+ size_t f_buf_size; /* size of data block */
daddr_t f_buf_blkno; /* block number of data block */
};
+static int read_inode __P((ino_t, struct open_file *));
+static int block_map __P((struct open_file *, daddr_t, daddr_t *));
+static int buf_read_file __P((struct open_file *, char **, size_t *));
+static int search_directory __P((char *, struct open_file *, ino_t *));
#ifdef COMPAT_UFS
-void ffs_oldfscompat __P((struct fs *));
+static void ffs_oldfscompat __P((struct fs *));
#endif
/*
register struct file *fp = (struct file *)f->f_fsdata;
register struct fs *fs = fp->f_fs;
char *buf;
- u_int rsize;
+ size_t rsize;
int rc;
/*
buf = alloc(fs->fs_bsize);
twiddle();
rc = (f->f_dev->dv_strategy)(f->f_devdata, F_READ,
- fsbtodb(fs, ino_to_fsba(fs, inumber)), fs->fs_bsize, buf, &rsize);
+ fsbtodb(fs, ino_to_fsba(fs, inumber)), fs->fs_bsize,
+ buf, &rsize);
if (rc)
goto out;
if (rsize != fs->fs_bsize) {
}
out:
free(buf, fs->fs_bsize);
- return (rc);
+ return (0);
}
/*
fsbtodb(fp->f_fs, ind_block_num),
fs->fs_bsize,
fp->f_blk[level],
- (u_int *)&fp->f_blksize[level]);
+ &fp->f_blksize[level]);
if (rc)
return (rc);
if (fp->f_blksize[level] != fs->fs_bsize)
buf_read_file(f, buf_p, size_p)
struct open_file *f;
char **buf_p; /* out */
- u_int *size_p; /* out */
+ size_t *size_p; /* out */
{
register struct file *fp = (struct file *)f->f_fsdata;
register struct fs *fs = fp->f_fs;
long off;
register daddr_t file_block;
daddr_t disk_block;
- long block_size;
+ size_t block_size;
int rc;
off = blkoff(fs, fp->f_seekp);
register struct direct *dp;
struct direct *edp;
char *buf;
- u_int buf_size;
+ size_t buf_size;
int namlen, length;
int rc;
struct file *fp;
struct fs *fs;
int rc;
- u_int buf_size;
+ size_t buf_size;
int nlinks = 0;
char namebuf[MAXPATHLEN+1];
char *buf = NULL;
/*
* Read file for symbolic link
*/
- u_int buf_size;
+ size_t buf_size;
daddr_t disk_block;
register struct fs *fs = fp->f_fs;
register struct file *fp = (struct file *)f->f_fsdata;
register size_t csize;
char *buf;
- u_int buf_size;
+ size_t buf_size;
int rc = 0;
register char *addr = start;
*
* XXX - goes away some day.
*/
-void
+static void
ffs_oldfscompat(fs)
struct fs *fs;
{
-/* $NetBSD: ufs.h,v 1.3 1995/09/17 00:49:50 pk Exp $ */
+/* $NetBSD: ufs.h,v 1.5 1995/10/20 01:35:25 cgd Exp $ */
/*-
* Copyright (c) 1993
int ufs_open __P((char *path, struct open_file *f));
int ufs_close __P((struct open_file *f));
int ufs_read __P((struct open_file *f, void *buf,
- u_int size, u_int *resid));
+ size_t size, size_t *resid));
int ufs_write __P((struct open_file *f, void *buf,
- u_int size, u_int *resid));
+ size_t size, size_t *resid));
off_t ufs_seek __P((struct open_file *f, off_t offset, int where));
int ufs_stat __P((struct open_file *f, struct stat *sb));