struct direct -> struct lfs_direct
struct dirtemplate -> struct lfs_dirtemplate struct odirtemplate -> struct lfs_odirtemplate DT_* -> LFS_DT_*
This commit is contained in:
parent
4260cc072b
commit
4b157546cf
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: dir.c,v 1.28 2013/06/08 02:11:11 dholland Exp $ */
|
||||
/* $NetBSD: dir.c,v 1.29 2013/06/08 02:12:56 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1986, 1993
|
||||
|
@ -55,23 +55,23 @@
|
|||
|
||||
const char *lfname = "lost+found";
|
||||
int lfmode = 01700;
|
||||
struct dirtemplate emptydir = {
|
||||
struct lfs_dirtemplate emptydir = {
|
||||
.dot_ino = 0,
|
||||
.dot_reclen = DIRBLKSIZ,
|
||||
};
|
||||
struct dirtemplate dirhead = {
|
||||
struct lfs_dirtemplate dirhead = {
|
||||
.dot_ino = 0,
|
||||
.dot_reclen = 12,
|
||||
.dot_type = DT_DIR,
|
||||
.dot_type = LFS_DT_DIR,
|
||||
.dot_namlen = 1,
|
||||
.dot_name = ".",
|
||||
.dotdot_ino = 0,
|
||||
.dotdot_reclen = DIRBLKSIZ - 12,
|
||||
.dotdot_type = DT_DIR,
|
||||
.dotdot_type = LFS_DT_DIR,
|
||||
.dotdot_namlen = 2,
|
||||
.dotdot_name = ".."
|
||||
};
|
||||
struct odirtemplate odirhead = {
|
||||
struct lfs_odirtemplate odirhead = {
|
||||
.dot_ino = 0,
|
||||
.dot_reclen = 12,
|
||||
.dot_namlen = 1,
|
||||
|
@ -84,7 +84,7 @@ struct odirtemplate odirhead = {
|
|||
|
||||
static int expanddir(struct uvnode *, struct ulfs1_dinode *, char *);
|
||||
static void freedir(ino_t, ino_t);
|
||||
static struct direct *fsck_readdir(struct uvnode *, struct inodesc *);
|
||||
static struct lfs_direct *fsck_readdir(struct uvnode *, struct inodesc *);
|
||||
static int lftempname(char *, ino_t);
|
||||
static int mkentry(struct inodesc *);
|
||||
static int chgino(struct inodesc *);
|
||||
|
@ -131,7 +131,7 @@ propagate(void)
|
|||
int
|
||||
dirscan(struct inodesc *idesc)
|
||||
{
|
||||
struct direct *dp;
|
||||
struct lfs_direct *dp;
|
||||
struct ubuf *bp;
|
||||
int dsize, n;
|
||||
long blksiz;
|
||||
|
@ -155,7 +155,7 @@ dirscan(struct inodesc *idesc)
|
|||
dp = fsck_readdir(vp, idesc)) {
|
||||
dsize = dp->d_reclen;
|
||||
memcpy(dbuf, dp, (size_t) dsize);
|
||||
idesc->id_dirp = (struct direct *) dbuf;
|
||||
idesc->id_dirp = (struct lfs_direct *) dbuf;
|
||||
if ((n = (*idesc->id_func) (idesc)) & ALTERED) {
|
||||
bread(vp, idesc->id_lblkno, blksiz, NOCRED, 0, &bp);
|
||||
memcpy(bp->b_data + idesc->id_loc - dsize, dbuf,
|
||||
|
@ -172,10 +172,10 @@ dirscan(struct inodesc *idesc)
|
|||
/*
|
||||
* get next entry in a directory.
|
||||
*/
|
||||
static struct direct *
|
||||
static struct lfs_direct *
|
||||
fsck_readdir(struct uvnode *vp, struct inodesc *idesc)
|
||||
{
|
||||
struct direct *dp, *ndp;
|
||||
struct lfs_direct *dp, *ndp;
|
||||
struct ubuf *bp;
|
||||
long size, blksiz, fix, dploc;
|
||||
|
||||
|
@ -183,7 +183,7 @@ fsck_readdir(struct uvnode *vp, struct inodesc *idesc)
|
|||
bread(vp, idesc->id_lblkno, blksiz, NOCRED, 0, &bp);
|
||||
if (idesc->id_loc % DIRBLKSIZ == 0 && idesc->id_filesize > 0 &&
|
||||
idesc->id_loc < blksiz) {
|
||||
dp = (struct direct *) (bp->b_data + idesc->id_loc);
|
||||
dp = (struct lfs_direct *) (bp->b_data + idesc->id_loc);
|
||||
if (dircheck(idesc, dp))
|
||||
goto dpok;
|
||||
brelse(bp, 0);
|
||||
|
@ -191,7 +191,7 @@ fsck_readdir(struct uvnode *vp, struct inodesc *idesc)
|
|||
return (0);
|
||||
fix = dofix(idesc, "DIRECTORY CORRUPTED");
|
||||
bread(vp, idesc->id_lblkno, blksiz, NOCRED, 0, &bp);
|
||||
dp = (struct direct *) (bp->b_data + idesc->id_loc);
|
||||
dp = (struct lfs_direct *) (bp->b_data + idesc->id_loc);
|
||||
dp->d_reclen = DIRBLKSIZ;
|
||||
dp->d_ino = 0;
|
||||
dp->d_type = 0;
|
||||
|
@ -211,14 +211,14 @@ dpok:
|
|||
return NULL;
|
||||
}
|
||||
dploc = idesc->id_loc;
|
||||
dp = (struct direct *) (bp->b_data + dploc);
|
||||
dp = (struct lfs_direct *) (bp->b_data + dploc);
|
||||
idesc->id_loc += dp->d_reclen;
|
||||
idesc->id_filesize -= dp->d_reclen;
|
||||
if ((idesc->id_loc % DIRBLKSIZ) == 0) {
|
||||
brelse(bp, 0);
|
||||
return dp;
|
||||
}
|
||||
ndp = (struct direct *) (bp->b_data + idesc->id_loc);
|
||||
ndp = (struct lfs_direct *) (bp->b_data + idesc->id_loc);
|
||||
if (idesc->id_loc < blksiz && idesc->id_filesize > 0 &&
|
||||
dircheck(idesc, ndp) == 0) {
|
||||
brelse(bp, 0);
|
||||
|
@ -229,7 +229,7 @@ dpok:
|
|||
return 0;
|
||||
fix = dofix(idesc, "DIRECTORY CORRUPTED");
|
||||
bread(vp, idesc->id_lblkno, blksiz, NOCRED, 0, &bp);
|
||||
dp = (struct direct *) (bp->b_data + dploc);
|
||||
dp = (struct lfs_direct *) (bp->b_data + dploc);
|
||||
dp->d_reclen += size;
|
||||
if (fix)
|
||||
VOP_BWRITE(bp);
|
||||
|
@ -246,7 +246,7 @@ dpok:
|
|||
* This is a superset of the checks made in the kernel.
|
||||
*/
|
||||
int
|
||||
dircheck(struct inodesc *idesc, struct direct *dp)
|
||||
dircheck(struct inodesc *idesc, struct lfs_direct *dp)
|
||||
{
|
||||
int size;
|
||||
char *cp;
|
||||
|
@ -358,8 +358,8 @@ adjust(struct inodesc *idesc, short lcnt)
|
|||
static int
|
||||
mkentry(struct inodesc *idesc)
|
||||
{
|
||||
struct direct *dirp = idesc->id_dirp;
|
||||
struct direct newent;
|
||||
struct lfs_direct *dirp = idesc->id_dirp;
|
||||
struct lfs_direct newent;
|
||||
int newlen, oldlen;
|
||||
|
||||
newent.d_namlen = strlen(idesc->id_name);
|
||||
|
@ -372,7 +372,7 @@ mkentry(struct inodesc *idesc)
|
|||
return (KEEPON);
|
||||
newent.d_reclen = dirp->d_reclen - oldlen;
|
||||
dirp->d_reclen = oldlen;
|
||||
dirp = (struct direct *) (((char *) dirp) + oldlen);
|
||||
dirp = (struct lfs_direct *) (((char *) dirp) + oldlen);
|
||||
dirp->d_ino = idesc->id_parent; /* ino to be entered is in id_parent */
|
||||
dirp->d_reclen = newent.d_reclen;
|
||||
dirp->d_type = typemap[idesc->id_parent];
|
||||
|
@ -384,7 +384,7 @@ mkentry(struct inodesc *idesc)
|
|||
static int
|
||||
chgino(struct inodesc *idesc)
|
||||
{
|
||||
struct direct *dirp = idesc->id_dirp;
|
||||
struct lfs_direct *dirp = idesc->id_dirp;
|
||||
|
||||
if (memcmp(dirp->d_name, idesc->id_name, (int) dirp->d_namlen + 1))
|
||||
return (KEEPON);
|
||||
|
@ -619,7 +619,7 @@ allocdir(ino_t parent, ino_t request, int mode)
|
|||
char *cp;
|
||||
struct ulfs1_dinode *dp;
|
||||
struct ubuf *bp;
|
||||
struct dirtemplate *dirp;
|
||||
struct lfs_dirtemplate *dirp;
|
||||
struct uvnode *vp;
|
||||
|
||||
ino = allocino(request, LFS_IFDIR | mode);
|
||||
|
@ -634,7 +634,7 @@ allocdir(ino_t parent, ino_t request, int mode)
|
|||
freeino(ino);
|
||||
return (0);
|
||||
}
|
||||
memcpy(bp->b_data, dirp, sizeof(struct dirtemplate));
|
||||
memcpy(bp->b_data, dirp, sizeof(struct lfs_dirtemplate));
|
||||
for (cp = &bp->b_data[DIRBLKSIZ];
|
||||
cp < &bp->b_data[fs->lfs_fsize];
|
||||
cp += DIRBLKSIZ)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: extern.h,v 1.10 2013/06/06 00:52:50 dholland Exp $ */
|
||||
/* $NetBSD: extern.h,v 1.11 2013/06/08 02:12:56 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994 James A. Jegers
|
||||
|
@ -36,7 +36,7 @@ int chkrange(daddr_t, int);
|
|||
void ckfini(int);
|
||||
int ckinode(struct ulfs1_dinode *, struct inodesc *);
|
||||
void clri(struct inodesc *, const char *, int);
|
||||
int dircheck(struct inodesc *, struct direct *);
|
||||
int dircheck(struct inodesc *, struct lfs_direct *);
|
||||
void direrror(ino_t, const char *);
|
||||
int dirscan(struct inodesc *);
|
||||
int dofix(struct inodesc *, const char *);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: fsck.h,v 1.19 2013/06/06 00:52:50 dholland Exp $ */
|
||||
/* $NetBSD: fsck.h,v 1.20 2013/06/08 02:12:56 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997 The NetBSD Foundation, Inc.
|
||||
|
@ -131,7 +131,7 @@ struct inodesc {
|
|||
quad_t id_filesize; /* for DATA nodes, the size of the directory */
|
||||
int id_loc; /* for DATA nodes, current location in dir */
|
||||
int id_entryno; /* for DATA nodes, current entry number */
|
||||
struct direct *id_dirp; /* for DATA nodes, ptr to current entry */
|
||||
struct lfs_direct *id_dirp; /* for DATA nodes, ptr to current entry */
|
||||
const char *id_name; /* for DATA nodes, name to find or enter */
|
||||
char id_type; /* type of descriptor, DATA or ADDR */
|
||||
};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: inode.c,v 1.47 2013/06/08 02:11:11 dholland Exp $ */
|
||||
/* $NetBSD: inode.c,v 1.48 2013/06/08 02:12:56 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -486,7 +486,7 @@ clearinode(ino_t inumber)
|
|||
int
|
||||
findname(struct inodesc * idesc)
|
||||
{
|
||||
struct direct *dirp = idesc->id_dirp;
|
||||
struct lfs_direct *dirp = idesc->id_dirp;
|
||||
size_t len;
|
||||
char *buf;
|
||||
|
||||
|
@ -505,7 +505,7 @@ findname(struct inodesc * idesc)
|
|||
int
|
||||
findino(struct inodesc * idesc)
|
||||
{
|
||||
struct direct *dirp = idesc->id_dirp;
|
||||
struct lfs_direct *dirp = idesc->id_dirp;
|
||||
|
||||
if (dirp->d_ino == 0)
|
||||
return (KEEPON);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pass2.c,v 1.20 2013/06/08 02:11:11 dholland Exp $ */
|
||||
/* $NetBSD: pass2.c,v 1.21 2013/06/08 02:12:56 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1986, 1993
|
||||
|
@ -52,7 +52,7 @@
|
|||
#include "fsutil.h"
|
||||
#include "extern.h"
|
||||
|
||||
#define MINDIRSIZE (sizeof (struct dirtemplate))
|
||||
#define MINDIRSIZE (sizeof (struct lfs_dirtemplate))
|
||||
|
||||
static int pass2check(struct inodesc *);
|
||||
static int blksort(const void *, const void *);
|
||||
|
@ -115,7 +115,7 @@ pass2(void)
|
|||
errx(EEXIT, "BAD STATE %d FOR ROOT INODE\n", statemap[ULFS_ROOTINO]);
|
||||
}
|
||||
statemap[ULFS_WINO] = FSTATE;
|
||||
typemap[ULFS_WINO] = DT_WHT;
|
||||
typemap[ULFS_WINO] = LFS_DT_WHT;
|
||||
/*
|
||||
* Sort the directory list into disk block order.
|
||||
*/
|
||||
|
@ -201,12 +201,12 @@ pass2(void)
|
|||
static int
|
||||
pass2check(struct inodesc * idesc)
|
||||
{
|
||||
struct direct *dirp = idesc->id_dirp;
|
||||
struct lfs_direct *dirp = idesc->id_dirp;
|
||||
struct inoinfo *inp;
|
||||
int n, entrysize, ret = 0;
|
||||
struct ulfs1_dinode *dp;
|
||||
const char *errmsg;
|
||||
struct direct proto;
|
||||
struct lfs_direct proto;
|
||||
char namebuf[MAXPATHLEN + 1];
|
||||
char pathbuf[MAXPATHLEN + 1];
|
||||
|
||||
|
@ -222,9 +222,9 @@ pass2check(struct inodesc * idesc)
|
|||
if (reply("FIX") == 1)
|
||||
ret |= ALTERED;
|
||||
}
|
||||
if (dirp->d_type != DT_DIR) {
|
||||
if (dirp->d_type != LFS_DT_DIR) {
|
||||
direrror(idesc->id_number, "BAD TYPE VALUE FOR '.'");
|
||||
dirp->d_type = DT_DIR;
|
||||
dirp->d_type = LFS_DT_DIR;
|
||||
if (reply("FIX") == 1)
|
||||
ret |= ALTERED;
|
||||
}
|
||||
|
@ -232,7 +232,7 @@ pass2check(struct inodesc * idesc)
|
|||
}
|
||||
direrror(idesc->id_number, "MISSING '.'");
|
||||
proto.d_ino = idesc->id_number;
|
||||
proto.d_type = DT_DIR;
|
||||
proto.d_type = LFS_DT_DIR;
|
||||
proto.d_namlen = 1;
|
||||
(void) strlcpy(proto.d_name, ".", sizeof(proto.d_name));
|
||||
entrysize = DIRSIZ(0, &proto, 0);
|
||||
|
@ -252,7 +252,7 @@ pass2check(struct inodesc * idesc)
|
|||
memcpy(dirp, &proto, (size_t) entrysize);
|
||||
idesc->id_entryno++;
|
||||
lncntp[dirp->d_ino]--;
|
||||
dirp = (struct direct *) ((char *) (dirp) + entrysize);
|
||||
dirp = (struct lfs_direct *) ((char *) (dirp) + entrysize);
|
||||
memset(dirp, 0, (size_t) n);
|
||||
dirp->d_reclen = n;
|
||||
if (reply("FIX") == 1)
|
||||
|
@ -263,7 +263,7 @@ chk1:
|
|||
goto chk2;
|
||||
inp = getinoinfo(idesc->id_number);
|
||||
proto.d_ino = inp->i_parent;
|
||||
proto.d_type = DT_DIR;
|
||||
proto.d_type = LFS_DT_DIR;
|
||||
proto.d_namlen = 2;
|
||||
(void) strlcpy(proto.d_name, "..", sizeof(proto.d_name));
|
||||
entrysize = DIRSIZ(0, &proto, 0);
|
||||
|
@ -275,15 +275,15 @@ chk1:
|
|||
dirp->d_reclen = n;
|
||||
idesc->id_entryno++;
|
||||
lncntp[dirp->d_ino]--;
|
||||
dirp = (struct direct *) ((char *) (dirp) + n);
|
||||
dirp = (struct lfs_direct *) ((char *) (dirp) + n);
|
||||
memset(dirp, 0, (size_t) proto.d_reclen);
|
||||
dirp->d_reclen = proto.d_reclen;
|
||||
}
|
||||
if (dirp->d_ino != 0 && strcmp(dirp->d_name, "..") == 0) {
|
||||
inp->i_dotdot = dirp->d_ino;
|
||||
if (dirp->d_type != DT_DIR) {
|
||||
if (dirp->d_type != LFS_DT_DIR) {
|
||||
direrror(idesc->id_number, "BAD TYPE VALUE FOR '..'");
|
||||
dirp->d_type = DT_DIR;
|
||||
dirp->d_type = LFS_DT_DIR;
|
||||
if (reply("FIX") == 1)
|
||||
ret |= ALTERED;
|
||||
}
|
||||
|
@ -341,18 +341,18 @@ chk2:
|
|||
n = reply("REMOVE");
|
||||
} else if (dirp->d_ino == LFS_IFILE_INUM &&
|
||||
idesc->id_number == ULFS_ROOTINO) {
|
||||
if (dirp->d_type != DT_REG) {
|
||||
if (dirp->d_type != LFS_DT_REG) {
|
||||
fileerror(idesc->id_number, dirp->d_ino,
|
||||
"BAD TYPE FOR IFILE");
|
||||
dirp->d_type = DT_REG;
|
||||
dirp->d_type = LFS_DT_REG;
|
||||
if (reply("FIX") == 1)
|
||||
ret |= ALTERED;
|
||||
}
|
||||
} else if (((dirp->d_ino == ULFS_WINO && (dirp->d_type != DT_WHT)) ||
|
||||
(dirp->d_ino != ULFS_WINO && dirp->d_type == DT_WHT))) {
|
||||
} else if (((dirp->d_ino == ULFS_WINO && (dirp->d_type != LFS_DT_WHT)) ||
|
||||
(dirp->d_ino != ULFS_WINO && dirp->d_type == LFS_DT_WHT))) {
|
||||
fileerror(idesc->id_number, dirp->d_ino, "BAD WHITEOUT ENTRY");
|
||||
dirp->d_ino = ULFS_WINO;
|
||||
dirp->d_type = DT_WHT;
|
||||
dirp->d_type = LFS_DT_WHT;
|
||||
if (reply("FIX") == 1)
|
||||
ret |= ALTERED;
|
||||
} else {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: make_lfs.c,v 1.24 2013/06/08 02:11:11 dholland Exp $ */
|
||||
/* $NetBSD: make_lfs.c,v 1.25 2013/06/08 02:12:56 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2003 The NetBSD Foundation, Inc.
|
||||
|
@ -62,7 +62,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)lfs.c 8.5 (Berkeley) 5/24/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: make_lfs.c,v 1.24 2013/06/08 02:11:11 dholland Exp $");
|
||||
__RCSID("$NetBSD: make_lfs.c,v 1.25 2013/06/08 02:12:56 dholland Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -181,25 +181,25 @@ static struct lfs lfs_default = {
|
|||
|
||||
#define UMASK 0755
|
||||
|
||||
struct direct lfs_root_dir[] = {
|
||||
{ ULFS_ROOTINO, sizeof(struct direct), DT_DIR, 1, "."},
|
||||
{ ULFS_ROOTINO, sizeof(struct direct), DT_DIR, 2, ".."},
|
||||
/* { LFS_IFILE_INUM, sizeof(struct direct), DT_REG, 5, "ifile"}, */
|
||||
struct lfs_direct lfs_root_dir[] = {
|
||||
{ ULFS_ROOTINO, sizeof(struct lfs_direct), LFS_DT_DIR, 1, "."},
|
||||
{ ULFS_ROOTINO, sizeof(struct lfs_direct), LFS_DT_DIR, 2, ".."},
|
||||
/* { LFS_IFILE_INUM, sizeof(struct lfs_direct), LFS_DT_REG, 5, "ifile"}, */
|
||||
#ifdef MAKE_LF_DIR
|
||||
{ LOSTFOUNDINO, sizeof(struct direct), DT_DIR, 10, "lost+found"},
|
||||
{ LOSTFOUNDINO, sizeof(struct lfs_direct), LFS_DT_DIR, 10, "lost+found"},
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifdef MAKE_LF_DIR
|
||||
struct direct lfs_lf_dir[] = {
|
||||
{ LOSTFOUNDINO, sizeof(struct direct), DT_DIR, 1, "." },
|
||||
{ ULFS_ROOTINO, sizeof(struct direct), DT_DIR, 2, ".." },
|
||||
struct lfs_direct lfs_lf_dir[] = {
|
||||
{ LOSTFOUNDINO, sizeof(struct lfs_direct), LFS_DT_DIR, 1, "." },
|
||||
{ ULFS_ROOTINO, sizeof(struct lfs_direct), LFS_DT_DIR, 2, ".." },
|
||||
};
|
||||
#endif
|
||||
|
||||
void pwarn(const char *, ...);
|
||||
static void make_dinode(ino_t, struct ulfs1_dinode *, int, struct lfs *);
|
||||
static void make_dir( void *, struct direct *, int);
|
||||
static void make_dir( void *, struct lfs_direct *, int);
|
||||
static uint64_t maxfilesize(int);
|
||||
|
||||
/*
|
||||
|
@ -280,7 +280,7 @@ make_dinode(ino_t ino, struct ulfs1_dinode *dip, int nfrags, struct lfs *fs)
|
|||
* entries in protodir fir in the first DIRBLKSIZ.
|
||||
*/
|
||||
static void
|
||||
make_dir(void *bufp, struct direct *protodir, int entries)
|
||||
make_dir(void *bufp, struct lfs_direct *protodir, int entries)
|
||||
{
|
||||
char *cp;
|
||||
int i, spcleft;
|
||||
|
@ -696,7 +696,7 @@ make_lfs(int devfd, uint secsize, struct dkwedge_info *dkw, int minfree,
|
|||
roundup(DIRBLKSIZ,fs->lfs_fsize);
|
||||
bread(vp, 0, fs->lfs_fsize, NOCRED, 0, &bp);
|
||||
make_dir(bp->b_data, lfs_root_dir,
|
||||
sizeof(lfs_root_dir) / sizeof(struct direct));
|
||||
sizeof(lfs_root_dir) / sizeof(struct lfs_direct));
|
||||
VOP_BWRITE(bp);
|
||||
|
||||
#ifdef MAKE_LF_DIR
|
||||
|
@ -716,7 +716,7 @@ make_lfs(int devfd, uint secsize, struct dkwedge_info *dkw, int minfree,
|
|||
roundup(DIRBLKSIZ,fs->lfs_fsize);
|
||||
bread(vp, 0, fs->lfs_fsize, NOCRED, 0, &bp);
|
||||
make_dir(bp->b_data, lfs_lf_dir,
|
||||
sizeof(lfs_lf_dir) / sizeof(struct direct));
|
||||
sizeof(lfs_lf_dir) / sizeof(struct lfs_direct));
|
||||
VOP_BWRITE(bp);
|
||||
#endif /* MAKE_LF_DIR */
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ulfs_dinode.h,v 1.7 2013/06/08 02:11:49 dholland Exp $ */
|
||||
/* $NetBSD: ulfs_dinode.h,v 1.8 2013/06/08 02:12:56 dholland Exp $ */
|
||||
/* from NetBSD: dinode.h,v 1.22 2013/01/22 09:39:18 dholland Exp */
|
||||
|
||||
/*
|
||||
|
@ -66,7 +66,7 @@
|
|||
/*
|
||||
* The Whiteout inode# is a dummy non-zero inode number which will
|
||||
* never be allocated to a real file. It is used as a place holder
|
||||
* in the directory entry which has been tagged as a DT_W entry.
|
||||
* in the directory entry which has been tagged as a LFS_DT_WHT entry.
|
||||
* See the comments about ULFS_ROOTINO above.
|
||||
*/
|
||||
#define ULFS_WINO ((ino_t)1)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ulfs_dir.h,v 1.4 2013/06/08 02:04:31 dholland Exp $ */
|
||||
/* $NetBSD: ulfs_dir.h,v 1.5 2013/06/08 02:12:56 dholland Exp $ */
|
||||
/* from NetBSD: dir.h,v 1.21 2009/07/22 04:49:19 dholland Exp */
|
||||
|
||||
/*
|
||||
|
@ -47,7 +47,7 @@
|
|||
*
|
||||
* Each DIRBLKSIZ byte block contains some number of directory entry
|
||||
* structures, which are of variable length. Each directory entry has
|
||||
* a struct direct at the front of it, containing its inode number,
|
||||
* a struct lfs_direct at the front of it, containing its inode number,
|
||||
* the length of the entry, and the length of the name contained in
|
||||
* the entry. These are followed by the name padded to a 4 byte boundary.
|
||||
* All names are guaranteed null terminated.
|
||||
|
@ -70,7 +70,7 @@
|
|||
#define FFS_MAXNAMLEN 255
|
||||
|
||||
#define d_ino d_fileno
|
||||
struct direct {
|
||||
struct lfs_direct {
|
||||
u_int32_t d_fileno; /* inode number of entry */
|
||||
u_int16_t d_reclen; /* length of this record */
|
||||
u_int8_t d_type; /* file type, see below */
|
||||
|
@ -81,15 +81,15 @@ struct direct {
|
|||
/*
|
||||
* File types
|
||||
*/
|
||||
#define DT_UNKNOWN 0
|
||||
#define DT_FIFO 1
|
||||
#define DT_CHR 2
|
||||
#define DT_DIR 4
|
||||
#define DT_BLK 6
|
||||
#define DT_REG 8
|
||||
#define DT_LNK 10
|
||||
#define DT_SOCK 12
|
||||
#define DT_WHT 14
|
||||
#define LFS_DT_UNKNOWN 0
|
||||
#define LFS_DT_FIFO 1
|
||||
#define LFS_DT_CHR 2
|
||||
#define LFS_DT_DIR 4
|
||||
#define LFS_DT_BLK 6
|
||||
#define LFS_DT_REG 8
|
||||
#define LFS_DT_LNK 10
|
||||
#define LFS_DT_SOCK 12
|
||||
#define LFS_DT_WHT 14
|
||||
|
||||
/*
|
||||
* Convert between stat structure types and directory types.
|
||||
|
@ -99,12 +99,12 @@ struct direct {
|
|||
|
||||
/*
|
||||
* The DIRSIZ macro gives the minimum record length which will hold
|
||||
* the directory entry. This requires the amount of space in struct direct
|
||||
* the directory entry. This requires the amount of space in struct lfs_direct
|
||||
* without the d_name field, plus enough space for the name with a terminating
|
||||
* null byte (dp->d_namlen+1), rounded up to a 4 byte boundary.
|
||||
*/
|
||||
#define DIRECTSIZ(namlen) \
|
||||
((sizeof(struct direct) - (FFS_MAXNAMLEN+1)) + (((namlen)+1 + 3) &~ 3))
|
||||
((sizeof(struct lfs_direct) - (FFS_MAXNAMLEN+1)) + (((namlen)+1 + 3) &~ 3))
|
||||
|
||||
#if (BYTE_ORDER == LITTLE_ENDIAN)
|
||||
#define DIRSIZ(oldfmt, dp, needswap) \
|
||||
|
@ -123,7 +123,7 @@ struct direct {
|
|||
* Template for manipulating directories. Should use struct direct's,
|
||||
* but the name field is FFS_MAXNAMLEN - 1, and this just won't do.
|
||||
*/
|
||||
struct dirtemplate {
|
||||
struct lfs_dirtemplate {
|
||||
u_int32_t dot_ino;
|
||||
int16_t dot_reclen;
|
||||
u_int8_t dot_type;
|
||||
|
@ -139,7 +139,7 @@ struct dirtemplate {
|
|||
/*
|
||||
* This is the old format of directories, sanz type element.
|
||||
*/
|
||||
struct odirtemplate {
|
||||
struct lfs_odirtemplate {
|
||||
u_int32_t dot_ino;
|
||||
int16_t dot_reclen;
|
||||
u_int16_t dot_namlen;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ulfs_dirhash.c,v 1.3 2013/06/06 00:48:04 dholland Exp $ */
|
||||
/* $NetBSD: ulfs_dirhash.c,v 1.4 2013/06/08 02:12:56 dholland Exp $ */
|
||||
/* from NetBSD: ufs_dirhash.c,v 1.34 2009/10/05 23:48:08 rmind Exp */
|
||||
|
||||
/*
|
||||
|
@ -29,7 +29,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ulfs_dirhash.c,v 1.3 2013/06/06 00:48:04 dholland Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ulfs_dirhash.c,v 1.4 2013/06/08 02:12:56 dholland Exp $");
|
||||
|
||||
/*
|
||||
* This implements a hash-based lookup scheme for ULFS directories.
|
||||
|
@ -72,7 +72,7 @@ static void ulfsdirhash_adjfree(struct dirhash *dh, doff_t offset, int diff,
|
|||
static void ulfsdirhash_delslot(struct dirhash *dh, int slot);
|
||||
static int ulfsdirhash_findslot(struct dirhash *dh, const char *name,
|
||||
int namelen, doff_t offset);
|
||||
static doff_t ulfsdirhash_getprev(struct direct *dp, doff_t offset,
|
||||
static doff_t ulfsdirhash_getprev(struct lfs_direct *dp, doff_t offset,
|
||||
int dirblksiz);
|
||||
static int ulfsdirhash_recycle(int wanted);
|
||||
|
||||
|
@ -115,7 +115,7 @@ ulfsdirhash_build(struct inode *ip)
|
|||
{
|
||||
struct dirhash *dh;
|
||||
struct buf *bp = NULL;
|
||||
struct direct *ep;
|
||||
struct lfs_direct *ep;
|
||||
struct vnode *vp;
|
||||
doff_t bmask, pos;
|
||||
int dirblocks, i, j, memreqd, nblocks, narrays, nslots, slot;
|
||||
|
@ -226,7 +226,7 @@ ulfsdirhash_build(struct inode *ip)
|
|||
}
|
||||
|
||||
/* Add this entry to the hash. */
|
||||
ep = (struct direct *)((char *)bp->b_data + (pos & bmask));
|
||||
ep = (struct lfs_direct *)((char *)bp->b_data + (pos & bmask));
|
||||
if (ep->d_reclen == 0 || ep->d_reclen >
|
||||
dirblksiz - (pos & (dirblksiz - 1))) {
|
||||
/* Corrupted directory. */
|
||||
|
@ -325,7 +325,7 @@ ulfsdirhash_lookup(struct inode *ip, const char *name, int namelen, doff_t *offp
|
|||
struct buf **bpp, doff_t *prevoffp)
|
||||
{
|
||||
struct dirhash *dh, *dh_next;
|
||||
struct direct *dp;
|
||||
struct lfs_direct *dp;
|
||||
struct vnode *vp;
|
||||
struct buf *bp;
|
||||
doff_t blkoff, bmask, offset, prevoff;
|
||||
|
@ -422,7 +422,7 @@ restart:
|
|||
return (EJUSTRETURN);
|
||||
}
|
||||
}
|
||||
dp = (struct direct *)((char *)bp->b_data + (offset & bmask));
|
||||
dp = (struct lfs_direct *)((char *)bp->b_data + (offset & bmask));
|
||||
if (dp->d_reclen == 0 || dp->d_reclen >
|
||||
dirblksiz - (offset & (dirblksiz - 1))) {
|
||||
/* Corrupted directory. */
|
||||
|
@ -498,7 +498,7 @@ restart:
|
|||
doff_t
|
||||
ulfsdirhash_findfree(struct inode *ip, int slotneeded, int *slotsize)
|
||||
{
|
||||
struct direct *dp;
|
||||
struct lfs_direct *dp;
|
||||
struct dirhash *dh;
|
||||
struct buf *bp;
|
||||
doff_t pos, slotstart;
|
||||
|
@ -544,7 +544,7 @@ ulfsdirhash_findfree(struct inode *ip, int slotneeded, int *slotsize)
|
|||
if (dp->d_ino == 0 || dp->d_reclen > DIRSIZ(0, dp, needswap))
|
||||
break;
|
||||
i += dp->d_reclen;
|
||||
dp = (struct direct *)((char *)dp + dp->d_reclen);
|
||||
dp = (struct lfs_direct *)((char *)dp + dp->d_reclen);
|
||||
}
|
||||
if (i > dirblksiz) {
|
||||
DIRHASH_UNLOCK(dh);
|
||||
|
@ -565,7 +565,7 @@ ulfsdirhash_findfree(struct inode *ip, int slotneeded, int *slotsize)
|
|||
return (-1);
|
||||
}
|
||||
i += dp->d_reclen;
|
||||
dp = (struct direct *)((char *)dp + dp->d_reclen);
|
||||
dp = (struct lfs_direct *)((char *)dp + dp->d_reclen);
|
||||
}
|
||||
if (i > dirblksiz) {
|
||||
DIRHASH_UNLOCK(dh);
|
||||
|
@ -615,11 +615,11 @@ ulfsdirhash_enduseful(struct inode *ip)
|
|||
|
||||
/*
|
||||
* Insert information into the hash about a new directory entry. dirp
|
||||
* points to a struct direct containing the entry, and offset specifies
|
||||
* points to a struct lfs_direct containing the entry, and offset specifies
|
||||
* the offset of this entry.
|
||||
*/
|
||||
void
|
||||
ulfsdirhash_add(struct inode *ip, struct direct *dirp, doff_t offset)
|
||||
ulfsdirhash_add(struct inode *ip, struct lfs_direct *dirp, doff_t offset)
|
||||
{
|
||||
struct dirhash *dh;
|
||||
int slot;
|
||||
|
@ -666,7 +666,7 @@ ulfsdirhash_add(struct inode *ip, struct direct *dirp, doff_t offset)
|
|||
* `offset' within the directory.
|
||||
*/
|
||||
void
|
||||
ulfsdirhash_remove(struct inode *ip, struct direct *dirp, doff_t offset)
|
||||
ulfsdirhash_remove(struct inode *ip, struct lfs_direct *dirp, doff_t offset)
|
||||
{
|
||||
struct dirhash *dh;
|
||||
int slot;
|
||||
|
@ -700,7 +700,7 @@ ulfsdirhash_remove(struct inode *ip, struct direct *dirp, doff_t offset)
|
|||
* when compacting directory blocks.
|
||||
*/
|
||||
void
|
||||
ulfsdirhash_move(struct inode *ip, struct direct *dirp, doff_t oldoff,
|
||||
ulfsdirhash_move(struct inode *ip, struct lfs_direct *dirp, doff_t oldoff,
|
||||
doff_t newoff)
|
||||
{
|
||||
struct dirhash *dh;
|
||||
|
@ -824,7 +824,7 @@ void
|
|||
ulfsdirhash_checkblock(struct inode *ip, char *sbuf, doff_t offset)
|
||||
{
|
||||
struct dirhash *dh;
|
||||
struct direct *dp;
|
||||
struct lfs_direct *dp;
|
||||
int block, ffslot, i, nfree;
|
||||
const int needswap = ULFS_MPNEEDSWAP(ip->i_ump);
|
||||
int dirblksiz = ip->i_ump->um_dirblksiz;
|
||||
|
@ -847,7 +847,7 @@ ulfsdirhash_checkblock(struct inode *ip, char *sbuf, doff_t offset)
|
|||
|
||||
nfree = 0;
|
||||
for (i = 0; i < dirblksiz; i += dp->d_reclen) {
|
||||
dp = (struct direct *)(sbuf + i);
|
||||
dp = (struct lfs_direct *)(sbuf + i);
|
||||
if (dp->d_reclen == 0 || i + dp->d_reclen > dirblksiz)
|
||||
panic("ulfsdirhash_checkblock: bad dir");
|
||||
|
||||
|
@ -1006,9 +1006,9 @@ ulfsdirhash_delslot(struct dirhash *dh, int slot)
|
|||
* other problem occurred.
|
||||
*/
|
||||
static doff_t
|
||||
ulfsdirhash_getprev(struct direct *dirp, doff_t offset, int dirblksiz)
|
||||
ulfsdirhash_getprev(struct lfs_direct *dirp, doff_t offset, int dirblksiz)
|
||||
{
|
||||
struct direct *dp;
|
||||
struct lfs_direct *dp;
|
||||
char *blkbuf;
|
||||
doff_t blkoff, prevoff;
|
||||
int entrypos, i;
|
||||
|
@ -1024,7 +1024,7 @@ ulfsdirhash_getprev(struct direct *dirp, doff_t offset, int dirblksiz)
|
|||
|
||||
/* Scan from the start of the block until we get to the entry. */
|
||||
for (i = 0; i < entrypos; i += dp->d_reclen) {
|
||||
dp = (struct direct *)(blkbuf + i);
|
||||
dp = (struct lfs_direct *)(blkbuf + i);
|
||||
if (dp->d_reclen == 0 || i + dp->d_reclen > entrypos)
|
||||
return (-1); /* Corrupted directory. */
|
||||
prevoff = blkoff + i;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ulfs_dirhash.h,v 1.2 2013/06/06 00:48:04 dholland Exp $ */
|
||||
/* $NetBSD: ulfs_dirhash.h,v 1.3 2013/06/08 02:12:56 dholland Exp $ */
|
||||
/* from NetBSD: dirhash.h,v 1.6 2008/06/04 11:33:19 ad Exp */
|
||||
|
||||
/*
|
||||
|
@ -118,9 +118,9 @@ doff_t ulfsdirhash_enduseful(struct inode *);
|
|||
int ulfsdirhash_lookup(struct inode *, const char *, int, doff_t *,
|
||||
struct buf **, doff_t *);
|
||||
void ulfsdirhash_newblk(struct inode *, doff_t);
|
||||
void ulfsdirhash_add(struct inode *, struct direct *, doff_t);
|
||||
void ulfsdirhash_remove(struct inode *, struct direct *, doff_t);
|
||||
void ulfsdirhash_move(struct inode *, struct direct *, doff_t, doff_t);
|
||||
void ulfsdirhash_add(struct inode *, struct lfs_direct *, doff_t);
|
||||
void ulfsdirhash_remove(struct inode *, struct lfs_direct *, doff_t);
|
||||
void ulfsdirhash_move(struct inode *, struct lfs_direct *, doff_t, doff_t);
|
||||
void ulfsdirhash_dirtrunc(struct inode *, doff_t);
|
||||
void ulfsdirhash_free(struct inode *);
|
||||
void ulfsdirhash_checkblock(struct inode *, char *, doff_t);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ulfs_extern.h,v 1.5 2013/06/06 00:52:14 dholland Exp $ */
|
||||
/* $NetBSD: ulfs_extern.h,v 1.6 2013/06/08 02:12:56 dholland Exp $ */
|
||||
/* from NetBSD: ufs_extern.h,v 1.72 2012/05/09 00:21:18 riastradh Exp */
|
||||
|
||||
/*-
|
||||
|
@ -39,7 +39,6 @@
|
|||
|
||||
struct buf;
|
||||
struct componentname;
|
||||
struct direct;
|
||||
struct disklabel;
|
||||
struct dquot;
|
||||
struct fid;
|
||||
|
@ -49,16 +48,17 @@ struct inode;
|
|||
struct mbuf;
|
||||
struct mount;
|
||||
struct nameidata;
|
||||
struct lfs_direct;
|
||||
struct lwp;
|
||||
struct ulfs_ufid;
|
||||
struct ulfs_args;
|
||||
struct ulfs_lookup_results;
|
||||
struct ulfs_ufid;
|
||||
struct ulfsmount;
|
||||
struct uio;
|
||||
struct vattr;
|
||||
struct vnode;
|
||||
|
||||
extern pool_cache_t ulfs_direct_cache; /* memory pool for directs */
|
||||
extern pool_cache_t ulfs_direct_cache; /* memory pool for lfs_directs */
|
||||
|
||||
__BEGIN_DECLS
|
||||
#define ulfs_abortop genfs_abortop
|
||||
|
@ -124,11 +124,11 @@ int ulfs_balloc_range(struct vnode *, off_t, off_t, kauth_cred_t, int);
|
|||
|
||||
/* ulfs_lookup.c */
|
||||
void ulfs_dirbad(struct inode *, doff_t, const char *);
|
||||
int ulfs_dirbadentry(struct vnode *, struct direct *, int);
|
||||
int ulfs_dirbadentry(struct vnode *, struct lfs_direct *, int);
|
||||
void ulfs_makedirentry(struct inode *, struct componentname *,
|
||||
struct direct *);
|
||||
struct lfs_direct *);
|
||||
int ulfs_direnter(struct vnode *, const struct ulfs_lookup_results *,
|
||||
struct vnode *, struct direct *,
|
||||
struct vnode *, struct lfs_direct *,
|
||||
struct componentname *, struct buf *);
|
||||
int ulfs_dirremove(struct vnode *, const struct ulfs_lookup_results *,
|
||||
struct inode *, int, int);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ulfs_lookup.c,v 1.6 2013/06/06 00:50:51 dholland Exp $ */
|
||||
/* $NetBSD: ulfs_lookup.c,v 1.7 2013/06/08 02:12:56 dholland Exp $ */
|
||||
/* from NetBSD: ufs_lookup.c,v 1.122 2013/01/22 09:39:18 dholland Exp */
|
||||
|
||||
/*
|
||||
|
@ -38,7 +38,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ulfs_lookup.c,v 1.6 2013/06/06 00:50:51 dholland Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ulfs_lookup.c,v 1.7 2013/06/08 02:12:56 dholland Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_lfs.h"
|
||||
|
@ -121,7 +121,7 @@ ulfs_lookup(void *v)
|
|||
struct vnode *vdp = ap->a_dvp; /* vnode for directory being searched */
|
||||
struct inode *dp = VTOI(vdp); /* inode for directory being searched */
|
||||
struct buf *bp; /* a buffer of directory entries */
|
||||
struct direct *ep; /* the current directory entry */
|
||||
struct lfs_direct *ep; /* the current directory entry */
|
||||
int entryoffsetinblock; /* offset of ep in bp's buffer */
|
||||
enum {
|
||||
NONE, /* need to search a slot for our new entry */
|
||||
|
@ -263,7 +263,7 @@ ulfs_lookup(void *v)
|
|||
switch (ulfsdirhash_lookup(dp, cnp->cn_nameptr, cnp->cn_namelen,
|
||||
&results->ulr_offset, &bp, nameiop == DELETE ? &prevoff : NULL)) {
|
||||
case 0:
|
||||
ep = (struct direct *)((char *)bp->b_data +
|
||||
ep = (struct lfs_direct *)((char *)bp->b_data +
|
||||
(results->ulr_offset & bmask));
|
||||
goto foundentry;
|
||||
case ENOENT:
|
||||
|
@ -327,7 +327,7 @@ searchloop:
|
|||
* "lfs_dirchk" to be true.
|
||||
*/
|
||||
KASSERT(bp != NULL);
|
||||
ep = (struct direct *)((char *)bp->b_data + entryoffsetinblock);
|
||||
ep = (struct lfs_direct *)((char *)bp->b_data + entryoffsetinblock);
|
||||
if (ep->d_reclen == 0 ||
|
||||
(lfs_dirchk && ulfs_dirbadentry(vdp, ep, entryoffsetinblock))) {
|
||||
int i;
|
||||
|
@ -398,7 +398,7 @@ foundentry:
|
|||
* Save directory entry's inode number and
|
||||
* reclen, and release directory buffer.
|
||||
*/
|
||||
if (!FSFMT(vdp) && ep->d_type == DT_WHT) {
|
||||
if (!FSFMT(vdp) && ep->d_type == LFS_DT_WHT) {
|
||||
slotstatus = FOUND;
|
||||
slotoffset = results->ulr_offset;
|
||||
slotsize = ulfs_rw16(ep->d_reclen,
|
||||
|
@ -711,7 +711,7 @@ ulfs_dirbad(struct inode *ip, doff_t offset, const char *how)
|
|||
* name must be as long as advertised, and null terminated
|
||||
*/
|
||||
int
|
||||
ulfs_dirbadentry(struct vnode *dp, struct direct *ep, int entryoffsetinblock)
|
||||
ulfs_dirbadentry(struct vnode *dp, struct lfs_direct *ep, int entryoffsetinblock)
|
||||
{
|
||||
int i;
|
||||
int namlen;
|
||||
|
@ -767,7 +767,7 @@ bad:
|
|||
*/
|
||||
void
|
||||
ulfs_makedirentry(struct inode *ip, struct componentname *cnp,
|
||||
struct direct *newdirp)
|
||||
struct lfs_direct *newdirp)
|
||||
{
|
||||
newdirp->d_ino = ip->i_number;
|
||||
newdirp->d_namlen = cnp->cn_namelen;
|
||||
|
@ -810,7 +810,7 @@ ulfs_makedirentry(struct inode *ip, struct componentname *cnp,
|
|||
*/
|
||||
int
|
||||
ulfs_direnter(struct vnode *dvp, const struct ulfs_lookup_results *ulr,
|
||||
struct vnode *tvp, struct direct *dirp,
|
||||
struct vnode *tvp, struct lfs_direct *dirp,
|
||||
struct componentname *cnp, struct buf *newdirbp)
|
||||
{
|
||||
kauth_cred_t cr;
|
||||
|
@ -819,7 +819,7 @@ ulfs_direnter(struct vnode *dvp, const struct ulfs_lookup_results *ulr,
|
|||
struct inode *dp;
|
||||
struct buf *bp;
|
||||
u_int dsize;
|
||||
struct direct *ep, *nep;
|
||||
struct lfs_direct *ep, *nep;
|
||||
int error, ret, blkoff, loc, spacefree;
|
||||
char *dirbuf;
|
||||
struct timespec ts;
|
||||
|
@ -923,17 +923,17 @@ ulfs_direnter(struct vnode *dvp, const struct ulfs_lookup_results *ulr,
|
|||
* arranged that compacting the region ulr_offset to
|
||||
* ulr_offset + ulr_count would yield the space.
|
||||
*/
|
||||
ep = (struct direct *)dirbuf;
|
||||
ep = (struct lfs_direct *)dirbuf;
|
||||
dsize = (ep->d_ino != 0) ? DIRSIZ(FSFMT(dvp), ep, needswap) : 0;
|
||||
spacefree = ulfs_rw16(ep->d_reclen, needswap) - dsize;
|
||||
for (loc = ulfs_rw16(ep->d_reclen, needswap); loc < ulr->ulr_count; ) {
|
||||
uint16_t reclen;
|
||||
|
||||
nep = (struct direct *)(dirbuf + loc);
|
||||
nep = (struct lfs_direct *)(dirbuf + loc);
|
||||
|
||||
/* Trim the existing slot (NB: dsize may be zero). */
|
||||
ep->d_reclen = ulfs_rw16(dsize, needswap);
|
||||
ep = (struct direct *)((char *)ep + dsize);
|
||||
ep = (struct lfs_direct *)((char *)ep + dsize);
|
||||
|
||||
reclen = ulfs_rw16(nep->d_reclen, needswap);
|
||||
loc += reclen;
|
||||
|
@ -981,7 +981,7 @@ ulfs_direnter(struct vnode *dvp, const struct ulfs_lookup_results *ulr,
|
|||
panic("ulfs_direnter: compact2");
|
||||
dirp->d_reclen = spacefree;
|
||||
ep->d_reclen = ulfs_rw16(dsize, needswap);
|
||||
ep = (struct direct *)((char *)ep + dsize);
|
||||
ep = (struct lfs_direct *)((char *)ep + dsize);
|
||||
}
|
||||
dirp->d_reclen = ulfs_rw16(dirp->d_reclen, needswap);
|
||||
dirp->d_ino = ulfs_rw32(dirp->d_ino, needswap);
|
||||
|
@ -1068,7 +1068,7 @@ ulfs_dirremove(struct vnode *dvp, const struct ulfs_lookup_results *ulr,
|
|||
struct inode *ip, int flags, int isrmdir)
|
||||
{
|
||||
struct inode *dp = VTOI(dvp);
|
||||
struct direct *ep;
|
||||
struct lfs_direct *ep;
|
||||
struct buf *bp;
|
||||
int error;
|
||||
#ifdef LFS_EI
|
||||
|
@ -1086,7 +1086,7 @@ ulfs_dirremove(struct vnode *dvp, const struct ulfs_lookup_results *ulr,
|
|||
if (error)
|
||||
return (error);
|
||||
ep->d_ino = ulfs_rw32(ULFS_WINO, needswap);
|
||||
ep->d_type = DT_WHT;
|
||||
ep->d_type = LFS_DT_WHT;
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
@ -1101,7 +1101,7 @@ ulfs_dirremove(struct vnode *dvp, const struct ulfs_lookup_results *ulr,
|
|||
*/
|
||||
if (dp->i_dirhash != NULL)
|
||||
ulfsdirhash_remove(dp, (ulr->ulr_count == 0) ? ep :
|
||||
(struct direct *)((char *)ep +
|
||||
(struct lfs_direct *)((char *)ep +
|
||||
ulfs_rw16(ep->d_reclen, needswap)), ulr->ulr_offset);
|
||||
#endif
|
||||
|
||||
|
@ -1178,7 +1178,7 @@ ulfs_dirrewrite(struct inode *dp, off_t offset,
|
|||
int isrmdir, int iflags)
|
||||
{
|
||||
struct buf *bp;
|
||||
struct direct *ep;
|
||||
struct lfs_direct *ep;
|
||||
struct vnode *vdp = ITOV(dp);
|
||||
int error;
|
||||
|
||||
|
@ -1209,8 +1209,8 @@ ulfs_dirrewrite(struct inode *dp, off_t offset,
|
|||
* Check if a directory is empty or not.
|
||||
* Inode supplied must be locked.
|
||||
*
|
||||
* Using a struct dirtemplate here is not precisely
|
||||
* what we want, but better than using a struct direct.
|
||||
* Using a struct lfs_dirtemplate here is not precisely
|
||||
* what we want, but better than using a struct lfs_direct.
|
||||
*
|
||||
* NB: does not handle corrupted directories.
|
||||
*/
|
||||
|
@ -1218,12 +1218,12 @@ int
|
|||
ulfs_dirempty(struct inode *ip, ino_t parentino, kauth_cred_t cred)
|
||||
{
|
||||
doff_t off;
|
||||
struct dirtemplate dbuf;
|
||||
struct direct *dp = (struct direct *)&dbuf;
|
||||
struct lfs_dirtemplate dbuf;
|
||||
struct lfs_direct *dp = (struct lfs_direct *)&dbuf;
|
||||
int error, namlen;
|
||||
size_t count;
|
||||
const int needswap = ULFS_IPNEEDSWAP(ip);
|
||||
#define MINDIRSIZ (sizeof (struct dirtemplate) / 2)
|
||||
#define MINDIRSIZ (sizeof (struct lfs_dirtemplate) / 2)
|
||||
|
||||
for (off = 0; off < ip->i_size;
|
||||
off += ulfs_rw16(dp->d_reclen, needswap)) {
|
||||
|
@ -1283,7 +1283,7 @@ ulfs_checkpath(struct inode *source, struct inode *target, kauth_cred_t cred)
|
|||
{
|
||||
struct vnode *nextvp, *vp;
|
||||
int error, rootino, namlen;
|
||||
struct dirtemplate dirbuf;
|
||||
struct lfs_dirtemplate dirbuf;
|
||||
const int needswap = ULFS_MPNEEDSWAP(target->i_ump);
|
||||
|
||||
vp = ITOV(target);
|
||||
|
@ -1302,7 +1302,7 @@ ulfs_checkpath(struct inode *source, struct inode *target, kauth_cred_t cred)
|
|||
break;
|
||||
}
|
||||
error = vn_rdwr(UIO_READ, vp, (void *)&dirbuf,
|
||||
sizeof (struct dirtemplate), (off_t)0, UIO_SYSSPACE,
|
||||
sizeof (struct lfs_dirtemplate), (off_t)0, UIO_SYSSPACE,
|
||||
IO_NODELOCKED, cred, NULL, NULL);
|
||||
if (error != 0)
|
||||
break;
|
||||
|
@ -1355,11 +1355,11 @@ out:
|
|||
static int
|
||||
ulfs_readdotdot(struct vnode *vp, int needswap, kauth_cred_t cred, ino_t *result)
|
||||
{
|
||||
struct dirtemplate dirbuf;
|
||||
struct lfs_dirtemplate dirbuf;
|
||||
int namlen, error;
|
||||
|
||||
error = vn_rdwr(UIO_READ, vp, &dirbuf,
|
||||
sizeof (struct dirtemplate), (off_t)0, UIO_SYSSPACE,
|
||||
sizeof (struct lfs_dirtemplate), (off_t)0, UIO_SYSSPACE,
|
||||
IO_NODELOCKED, cred, NULL, NULL);
|
||||
if (error) {
|
||||
return error;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ulfs_rename.c,v 1.4 2013/06/08 02:11:11 dholland Exp $ */
|
||||
/* $NetBSD: ulfs_rename.c,v 1.5 2013/06/08 02:12:56 dholland Exp $ */
|
||||
/* from NetBSD: ufs_rename.c,v 1.6 2013/01/22 09:39:18 dholland Exp */
|
||||
|
||||
/*-
|
||||
|
@ -35,7 +35,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ulfs_rename.c,v 1.4 2013/06/08 02:11:11 dholland Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ulfs_rename.c,v 1.5 2013/06/08 02:12:56 dholland Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/buf.h>
|
||||
|
@ -70,9 +70,9 @@ static bool ulfs_rename_ulr_overlap_p(const struct ulfs_lookup_results *,
|
|||
static int ulfs_rename_recalculate_fulr(struct vnode *,
|
||||
struct ulfs_lookup_results *, const struct ulfs_lookup_results *,
|
||||
const struct componentname *);
|
||||
static int ulfs_direct_namlen(const struct direct *, const struct vnode *);
|
||||
static int ulfs_direct_namlen(const struct lfs_direct *, const struct vnode *);
|
||||
static int ulfs_read_dotdot(struct vnode *, kauth_cred_t, ino_t *);
|
||||
static int ulfs_dirbuf_dotdot_namlen(const struct dirtemplate *,
|
||||
static int ulfs_dirbuf_dotdot_namlen(const struct lfs_dirtemplate *,
|
||||
const struct vnode *);
|
||||
|
||||
static const struct genfs_rename_ops ulfs_genfs_rename_ops;
|
||||
|
@ -271,9 +271,9 @@ ulfs_gro_remove_check_permitted(struct mount *mp, kauth_cred_t cred,
|
|||
*
|
||||
* XXX Copypasta from ulfs_vnops.c. Kill!
|
||||
*/
|
||||
static const struct dirtemplate mastertemplate = {
|
||||
0, 12, DT_DIR, 1, ".",
|
||||
0, DIRBLKSIZ - 12, DT_DIR, 2, ".."
|
||||
static const struct lfs_dirtemplate mastertemplate = {
|
||||
0, 12, LFS_DT_DIR, 1, ".",
|
||||
0, DIRBLKSIZ - 12, LFS_DT_DIR, 2, ".."
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -289,7 +289,7 @@ ulfs_gro_rename(struct mount *mp, kauth_cred_t cred,
|
|||
struct ulfs_lookup_results *fulr = fde;
|
||||
struct ulfs_lookup_results *tulr = tde;
|
||||
bool directory_p, reparent_p;
|
||||
struct direct *newdir;
|
||||
struct lfs_direct *newdir;
|
||||
int error;
|
||||
|
||||
KASSERT(mp != NULL);
|
||||
|
@ -488,7 +488,7 @@ ulfs_gro_rename(struct mount *mp, kauth_cred_t cred,
|
|||
*/
|
||||
if (directory_p && reparent_p) {
|
||||
error = ulfs_dirrewrite(VTOI(fvp), mastertemplate.dot_reclen,
|
||||
VTOI(fdvp), VTOI(tdvp)->i_number, DT_DIR, 0, IN_CHANGE);
|
||||
VTOI(fdvp), VTOI(tdvp)->i_number, LFS_DT_DIR, 0, IN_CHANGE);
|
||||
#if 0 /* XXX This branch was not in ulfs_rename! */
|
||||
if (error)
|
||||
goto whymustithurtsomuch;
|
||||
|
@ -614,7 +614,7 @@ ulfs_rename_recalculate_fulr(struct vnode *dvp,
|
|||
doff_t offset; /* Offset of entry we're examining. */
|
||||
struct buf *bp; /* I/O block we're examining. */
|
||||
char *dirbuf; /* Pointer into directory at search_start. */
|
||||
struct direct *ep; /* Pointer to the entry we're examining. */
|
||||
struct lfs_direct *ep; /* Pointer to the entry we're examining. */
|
||||
/* XXX direct::d_reclen is 16-bit;
|
||||
* ulfs_lookup_results::ulr_reclen is 32-bit. Blah. */
|
||||
uint32_t reclen; /* Length of the entry we're examining. */
|
||||
|
@ -683,7 +683,7 @@ ulfs_rename_recalculate_fulr(struct vnode *dvp,
|
|||
/*
|
||||
* Examine the directory entry at offset.
|
||||
*/
|
||||
ep = (struct direct *)(dirbuf + (offset - search_start));
|
||||
ep = (struct lfs_direct *)(dirbuf + (offset - search_start));
|
||||
reclen = ulfs_rw16(ep->d_reclen, needswap);
|
||||
|
||||
if (ep->d_ino == 0)
|
||||
|
@ -744,7 +744,7 @@ next:
|
|||
* the directory vp.
|
||||
*/
|
||||
static int /* XXX int? uint8_t? */
|
||||
ulfs_direct_namlen(const struct direct *ep, const struct vnode *vp)
|
||||
ulfs_direct_namlen(const struct lfs_direct *ep, const struct vnode *vp)
|
||||
{
|
||||
bool swap;
|
||||
|
||||
|
@ -872,7 +872,7 @@ ulfs_rmdired_p(struct vnode *vp)
|
|||
static int
|
||||
ulfs_read_dotdot(struct vnode *vp, kauth_cred_t cred, ino_t *ino_ret)
|
||||
{
|
||||
struct dirtemplate dirbuf;
|
||||
struct lfs_dirtemplate dirbuf;
|
||||
int error;
|
||||
|
||||
KASSERT(vp != NULL);
|
||||
|
@ -901,7 +901,7 @@ ulfs_read_dotdot(struct vnode *vp, kauth_cred_t cred, ino_t *ino_ret)
|
|||
* necessary.
|
||||
*/
|
||||
static int /* XXX int? uint8_t? */
|
||||
ulfs_dirbuf_dotdot_namlen(const struct dirtemplate *dirbuf,
|
||||
ulfs_dirbuf_dotdot_namlen(const struct lfs_dirtemplate *dirbuf,
|
||||
const struct vnode *vp)
|
||||
{
|
||||
bool swap;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ulfs_vfsops.c,v 1.7 2013/06/06 00:52:14 dholland Exp $ */
|
||||
/* $NetBSD: ulfs_vfsops.c,v 1.8 2013/06/08 02:12:56 dholland Exp $ */
|
||||
/* from NetBSD: ufs_vfsops.c,v 1.52 2013/01/22 09:39:18 dholland Exp */
|
||||
|
||||
/*
|
||||
|
@ -38,7 +38,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ulfs_vfsops.c,v 1.7 2013/06/06 00:52:14 dholland Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ulfs_vfsops.c,v 1.8 2013/06/08 02:12:56 dholland Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_lfs.h"
|
||||
|
@ -244,7 +244,7 @@ ulfs_init(void)
|
|||
if (ulfs_initcount++ > 0)
|
||||
return;
|
||||
|
||||
ulfs_direct_cache = pool_cache_init(sizeof(struct direct), 0, 0, 0,
|
||||
ulfs_direct_cache = pool_cache_init(sizeof(struct lfs_direct), 0, 0, 0,
|
||||
"ulfsdir", NULL, IPL_NONE, NULL, NULL, NULL);
|
||||
|
||||
ulfs_ihashinit();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ulfs_vnops.c,v 1.7 2013/06/08 02:11:11 dholland Exp $ */
|
||||
/* $NetBSD: ulfs_vnops.c,v 1.8 2013/06/08 02:12:56 dholland Exp $ */
|
||||
/* from NetBSD: ufs_vnops.c,v 1.212 2013/03/18 19:35:48 plunky Exp */
|
||||
|
||||
/*-
|
||||
|
@ -67,7 +67,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ulfs_vnops.c,v 1.7 2013/06/08 02:11:11 dholland Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ulfs_vnops.c,v 1.8 2013/06/08 02:12:56 dholland Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_lfs.h"
|
||||
|
@ -118,9 +118,9 @@ static int ulfs_chown(struct vnode *, uid_t, gid_t, kauth_cred_t,
|
|||
/*
|
||||
* A virgin directory (no blushing please).
|
||||
*/
|
||||
static const struct dirtemplate mastertemplate = {
|
||||
0, 12, DT_DIR, 1, ".",
|
||||
0, DIRBLKSIZ - 12, DT_DIR, 2, ".."
|
||||
static const struct lfs_dirtemplate mastertemplate = {
|
||||
0, 12, LFS_DT_DIR, 1, ".",
|
||||
0, DIRBLKSIZ - 12, LFS_DT_DIR, 2, ".."
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -826,7 +826,7 @@ ulfs_link(void *v)
|
|||
struct vnode *vp = ap->a_vp;
|
||||
struct componentname *cnp = ap->a_cnp;
|
||||
struct inode *ip;
|
||||
struct direct *newdir;
|
||||
struct lfs_direct *newdir;
|
||||
int error;
|
||||
struct ulfs_lookup_results *ulr;
|
||||
|
||||
|
@ -900,7 +900,7 @@ ulfs_whiteout(void *v)
|
|||
} */ *ap = v;
|
||||
struct vnode *dvp = ap->a_dvp;
|
||||
struct componentname *cnp = ap->a_cnp;
|
||||
struct direct *newdir;
|
||||
struct lfs_direct *newdir;
|
||||
int error;
|
||||
struct ulfsmount *ump = VFSTOULFS(dvp->v_mount);
|
||||
struct ulfs_lookup_results *ulr;
|
||||
|
@ -934,7 +934,7 @@ ulfs_whiteout(void *v)
|
|||
memcpy(newdir->d_name, cnp->cn_nameptr,
|
||||
(size_t)cnp->cn_namelen);
|
||||
newdir->d_name[cnp->cn_namelen] = '\0';
|
||||
newdir->d_type = DT_WHT;
|
||||
newdir->d_type = LFS_DT_WHT;
|
||||
error = ulfs_direnter(dvp, ulr, NULL, newdir, cnp, NULL);
|
||||
pool_cache_put(ulfs_direct_cache, newdir);
|
||||
break;
|
||||
|
@ -976,8 +976,8 @@ ulfs_mkdir(void *v)
|
|||
struct componentname *cnp = ap->a_cnp;
|
||||
struct inode *ip, *dp = VTOI(dvp);
|
||||
struct buf *bp;
|
||||
struct dirtemplate dirtemplate;
|
||||
struct direct *newdir;
|
||||
struct lfs_dirtemplate dirtemplate;
|
||||
struct lfs_direct *newdir;
|
||||
int error, dmode;
|
||||
struct ulfsmount *ump = dp->i_ump;
|
||||
int dirblksiz = ump->um_dirblksiz;
|
||||
|
@ -1286,7 +1286,7 @@ out:
|
|||
* Vnode op for reading directories.
|
||||
*
|
||||
* This routine handles converting from the on-disk directory format
|
||||
* "struct direct" to the in-memory format "struct dirent" as well as
|
||||
* "struct lfs_direct" to the in-memory format "struct dirent" as well as
|
||||
* byte swapping the entries if necessary.
|
||||
*/
|
||||
int
|
||||
|
@ -1301,7 +1301,7 @@ ulfs_readdir(void *v)
|
|||
int *ncookies;
|
||||
} */ *ap = v;
|
||||
struct vnode *vp = ap->a_vp;
|
||||
struct direct *cdp, *ecdp;
|
||||
struct lfs_direct *cdp, *ecdp;
|
||||
struct dirent *ndp;
|
||||
char *cdbuf, *ndbuf, *endp;
|
||||
struct uio auio, *uio;
|
||||
|
@ -1347,8 +1347,8 @@ ulfs_readdir(void *v)
|
|||
|
||||
rcount -= auio.uio_resid;
|
||||
|
||||
cdp = (struct direct *)(void *)cdbuf;
|
||||
ecdp = (struct direct *)(void *)&cdbuf[rcount];
|
||||
cdp = (struct lfs_direct *)(void *)cdbuf;
|
||||
ecdp = (struct lfs_direct *)(void *)&cdbuf[rcount];
|
||||
|
||||
ndbufsz = count;
|
||||
ndbuf = kmem_alloc(ndbufsz, KM_SLEEP);
|
||||
|
@ -1806,7 +1806,7 @@ ulfs_makeinode(int mode, struct vnode *dvp, const struct ulfs_lookup_results *ul
|
|||
struct vnode **vpp, struct componentname *cnp)
|
||||
{
|
||||
struct inode *ip, *pdir;
|
||||
struct direct *newdir;
|
||||
struct lfs_direct *newdir;
|
||||
struct vnode *tvp;
|
||||
int error;
|
||||
|
||||
|
|
Loading…
Reference in New Issue