constify
This commit is contained in:
parent
b651fb886d
commit
e0dd0ca293
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: dir.c,v 1.15 2005/06/08 19:09:55 perseant Exp $ */
|
||||
/* $NetBSD: dir.c,v 1.16 2005/06/27 02:48:28 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1986, 1993
|
||||
@ -53,7 +53,7 @@
|
||||
#include "fsutil.h"
|
||||
#include "extern.h"
|
||||
|
||||
char *lfname = "lost+found";
|
||||
const char *lfname = "lost+found";
|
||||
int lfmode = 01700;
|
||||
struct dirtemplate emptydir = {0, DIRBLKSIZ};
|
||||
struct dirtemplate dirhead = {
|
||||
@ -483,7 +483,7 @@ linkup(ino_t orphan, ino_t parentdir)
|
||||
* fix an entry in a directory.
|
||||
*/
|
||||
int
|
||||
changeino(ino_t dir, char *name, ino_t newnum)
|
||||
changeino(ino_t dir, const char *name, ino_t newnum)
|
||||
{
|
||||
struct inodesc idesc;
|
||||
|
||||
@ -502,7 +502,7 @@ changeino(ino_t dir, char *name, ino_t newnum)
|
||||
* make an entry in a directory
|
||||
*/
|
||||
int
|
||||
makeentry(ino_t parent, ino_t ino, char *name)
|
||||
makeentry(ino_t parent, ino_t ino, const char *name)
|
||||
{
|
||||
struct ufs1_dinode *dp;
|
||||
struct inodesc idesc;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: extern.h,v 1.7 2004/07/18 20:03:12 yamt Exp $ */
|
||||
/* $NetBSD: extern.h,v 1.8 2005/06/27 02:48:28 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994 James A. Jegers
|
||||
@ -27,20 +27,20 @@
|
||||
void adjust(struct inodesc *, short);
|
||||
int allocblk(long);
|
||||
int allocdir(ino_t, ino_t, int);
|
||||
void blkerror(ino_t, char *, daddr_t);
|
||||
void blkerror(ino_t, const char *, daddr_t);
|
||||
void cacheino(struct ufs1_dinode *, ino_t);
|
||||
int changeino(ino_t, char *, ino_t);
|
||||
int changeino(ino_t, const char *, ino_t);
|
||||
struct fstab;
|
||||
void checkinode(ino_t, struct inodesc *);
|
||||
int chkrange(daddr_t, int);
|
||||
void ckfini(int);
|
||||
int ckinode(struct ufs1_dinode *, struct inodesc *);
|
||||
void clri(struct inodesc *, char *, int);
|
||||
void clri(struct inodesc *, const char *, int);
|
||||
int dircheck(struct inodesc *, struct direct *);
|
||||
void direrror(ino_t, char *);
|
||||
void direrror(ino_t, const char *);
|
||||
int dirscan(struct inodesc *);
|
||||
int dofix(struct inodesc *, char *);
|
||||
void fileerror(ino_t, ino_t, char *);
|
||||
int dofix(struct inodesc *, const char *);
|
||||
void fileerror(ino_t, ino_t, const char *);
|
||||
int findino(struct inodesc *);
|
||||
int findname(struct inodesc *);
|
||||
void flush(int, struct ubufarea *);
|
||||
@ -52,7 +52,7 @@ void getpathname(char *, size_t, ino_t, ino_t);
|
||||
void inocleanup(void);
|
||||
void inodirty(struct inode *);
|
||||
int linkup(ino_t, ino_t);
|
||||
int makeentry(ino_t, ino_t, char *);
|
||||
int makeentry(ino_t, ino_t, const char *);
|
||||
void pass0(void);
|
||||
void pass1(void);
|
||||
void pass1b(void);
|
||||
@ -66,7 +66,7 @@ void pass6(void);
|
||||
int pass6check(struct inodesc *);
|
||||
void pinode(ino_t);
|
||||
void propagate(void);
|
||||
int reply(char *);
|
||||
int reply(const char *);
|
||||
void resetinodebuf(void);
|
||||
int setup(const char *);
|
||||
void catch(int);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: fsck.h,v 1.14 2005/04/11 23:19:24 perseant Exp $ */
|
||||
/* $NetBSD: fsck.h,v 1.15 2005/06/27 02:48:28 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997 The NetBSD Foundation, Inc.
|
||||
@ -137,7 +137,7 @@ struct inodesc {
|
||||
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 */
|
||||
char *id_name; /* for DATA nodes, name to find or enter */
|
||||
const char *id_name; /* for DATA nodes, name to find or enter */
|
||||
char id_type; /* type of descriptor, DATA or ADDR */
|
||||
};
|
||||
/* file types */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: fsck_vars.h,v 1.9 2005/04/14 21:15:59 perseant Exp $ */
|
||||
/* $NetBSD: fsck_vars.h,v 1.10 2005/06/27 02:48:28 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1986, 1993
|
||||
@ -69,7 +69,7 @@ extern char *typemap; /* ptr to inode type table */
|
||||
extern int16_t *lncntp; /* ptr to link count table */
|
||||
|
||||
extern ino_t lfdir; /* lost & found directory inode number */
|
||||
extern char *lfname; /* lost & found directory name */
|
||||
extern const char *lfname; /* lost & found directory name */
|
||||
extern int lfmode; /* lost & found directory creation mode */
|
||||
|
||||
extern daddr_t n_blks; /* number of blocks in use */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: inode.c,v 1.27 2005/06/08 19:09:55 perseant Exp $ */
|
||||
/* $NetBSD: inode.c,v 1.28 2005/06/27 02:48:28 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
|
||||
@ -432,7 +432,7 @@ inodirty(struct inode *ip)
|
||||
}
|
||||
|
||||
void
|
||||
clri(struct inodesc * idesc, char *type, int flag)
|
||||
clri(struct inodesc * idesc, const char *type, int flag)
|
||||
{
|
||||
struct uvnode *vp;
|
||||
|
||||
@ -487,10 +487,18 @@ int
|
||||
findname(struct inodesc * idesc)
|
||||
{
|
||||
struct direct *dirp = idesc->id_dirp;
|
||||
size_t len;
|
||||
char *buf;
|
||||
|
||||
if (dirp->d_ino != idesc->id_parent)
|
||||
return (KEEPON);
|
||||
memcpy(idesc->id_name, dirp->d_name, (size_t) dirp->d_namlen + 1);
|
||||
if ((len = dirp->d_namlen + 1) > MAXPATHLEN) {
|
||||
/* Truncate it but don't overflow the buffer */
|
||||
len = MAXPATHLEN;
|
||||
}
|
||||
/* this is namebuf with utils.h */
|
||||
buf = __UNCONST(idesc->id_name);
|
||||
(void)memcpy(buf, dirp->d_name, len);
|
||||
return (STOP | FOUND);
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: main.c,v 1.24 2005/04/23 20:21:03 perseant Exp $ */
|
||||
/* $NetBSD: main.c,v 1.25 2005/06/27 02:48:28 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1986, 1993
|
||||
@ -52,7 +52,7 @@
|
||||
|
||||
int returntosingle;
|
||||
|
||||
static int argtoi(int, char *, char *, int);
|
||||
static int argtoi(int, const char *, const char *, int);
|
||||
static int checkfilesys(const char *, char *, long, int);
|
||||
static void usage(void);
|
||||
extern void (*panic_func)(int, const char *, va_list);
|
||||
@ -62,7 +62,7 @@ main(int argc, char **argv)
|
||||
{
|
||||
int ch;
|
||||
int ret = 0;
|
||||
char *optstring = "b:dfi:m:npPqy";
|
||||
const char *optstring = "b:dfi:m:npPqy";
|
||||
|
||||
sync();
|
||||
skipclean = 1;
|
||||
@ -142,7 +142,7 @@ main(int argc, char **argv)
|
||||
}
|
||||
|
||||
static int
|
||||
argtoi(int flag, char *req, char *str, int base)
|
||||
argtoi(int flag, const char *req, const char *str, int base)
|
||||
{
|
||||
char *cp;
|
||||
int ret;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pass1.c,v 1.20 2005/02/06 06:13:47 perry Exp $ */
|
||||
/* $NetBSD: pass1.c,v 1.21 2005/06/27 02:48:28 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1986, 1993
|
||||
@ -70,10 +70,10 @@ struct ino_daddr {
|
||||
static int
|
||||
i_d_cmp(const void *va, const void *vb)
|
||||
{
|
||||
struct ino_daddr *a, *b;
|
||||
const struct ino_daddr *a, *b;
|
||||
|
||||
a = *((struct ino_daddr **) va);
|
||||
b = *((struct ino_daddr **) vb);
|
||||
a = *((const struct ino_daddr *const *) va);
|
||||
b = *((const struct ino_daddr *const *) vb);
|
||||
|
||||
if (a->daddr == b->daddr) {
|
||||
return (a->ino - b->ino);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pass2.c,v 1.13 2005/04/11 23:19:24 perseant Exp $ */
|
||||
/* $NetBSD: pass2.c,v 1.14 2005/06/27 02:48:28 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1986, 1993
|
||||
@ -205,7 +205,7 @@ pass2check(struct inodesc * idesc)
|
||||
struct inoinfo *inp;
|
||||
int n, entrysize, ret = 0;
|
||||
struct ufs1_dinode *dp;
|
||||
char *errmsg;
|
||||
const char *errmsg;
|
||||
struct direct proto;
|
||||
char namebuf[MAXPATHLEN + 1];
|
||||
char pathbuf[MAXPATHLEN + 1];
|
||||
@ -436,6 +436,6 @@ again:
|
||||
static int
|
||||
blksort(const void *inpp1, const void *inpp2)
|
||||
{
|
||||
return ((*(struct inoinfo **) inpp1)->i_blks[0] -
|
||||
(*(struct inoinfo **) inpp2)->i_blks[0]);
|
||||
return ((*(const struct inoinfo *const *) inpp1)->i_blks[0] -
|
||||
(*(const struct inoinfo *const *) inpp2)->i_blks[0]);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: utilities.c,v 1.18 2005/02/26 05:45:54 perseant Exp $ */
|
||||
/* $NetBSD: utilities.c,v 1.19 2005/06/27 02:48:28 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1986, 1993
|
||||
@ -84,7 +84,7 @@ ftypeok(struct ufs1_dinode * dp)
|
||||
}
|
||||
|
||||
int
|
||||
reply(char *question)
|
||||
reply(const char *question)
|
||||
{
|
||||
int persevere;
|
||||
char c;
|
||||
@ -270,7 +270,7 @@ voidquit(int n)
|
||||
* determine whether an inode should be fixed.
|
||||
*/
|
||||
int
|
||||
dofix(struct inodesc * idesc, char *msg)
|
||||
dofix(struct inodesc * idesc, const char *msg)
|
||||
{
|
||||
|
||||
switch (idesc->id_fix) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: vars.c,v 1.9 2005/04/14 21:15:59 perseant Exp $ */
|
||||
/* $NetBSD: vars.c,v 1.10 2005/06/27 02:48:28 christos Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
@ -82,7 +82,6 @@ char *typemap; /* ptr to inode type table */
|
||||
int16_t *lncntp; /* ptr to link count table */
|
||||
|
||||
ino_t lfdir; /* lost & found directory inode number */
|
||||
char *lfname; /* lost & found directory name */
|
||||
int lfmode; /* lost & found directory creation mode */
|
||||
|
||||
daddr_t n_blks; /* number of blocks in use */
|
||||
|
Loading…
Reference in New Issue
Block a user