Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/lib/libsa make 'path' argument to ufs_open 'const char *...
details: https://anonhg.NetBSD.org/src/rev/9bb81b941e4e
branches: trunk
changeset: 550713:9bb81b941e4e
user: dsl <dsl%NetBSD.org@localhost>
date: Mon Aug 18 15:45:27 2003 +0000
description:
make 'path' argument to ufs_open 'const char *' and fix the fallout.
diffstat:
sys/lib/libsa/dosfs.c | 4 +-
sys/lib/libsa/dosfs.h | 9 +---
sys/lib/libsa/lfs.h | 17 +-------
sys/lib/libsa/nfs.c | 25 ++++++-------
sys/lib/libsa/nfs.h | 14 +-----
sys/lib/libsa/nullfs.c | 4 +-
sys/lib/libsa/stand.h | 6 +-
sys/lib/libsa/tftp.c | 6 +-
sys/lib/libsa/tftp.h | 11 +----
sys/lib/libsa/ufs.c | 90 +++++++++++++++++++-----------------------------
sys/lib/libsa/ustarfs.c | 4 +-
sys/lib/libsa/ustarfs.h | 10 +---
12 files changed, 72 insertions(+), 128 deletions(-)
diffs (truncated from 545 to 300 lines):
diff -r 2ab054e663c5 -r 9bb81b941e4e sys/lib/libsa/dosfs.c
--- a/sys/lib/libsa/dosfs.c Mon Aug 18 15:28:25 2003 +0000
+++ b/sys/lib/libsa/dosfs.c Mon Aug 18 15:45:27 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dosfs.c,v 1.6 2003/07/15 13:27:07 scw Exp $ */
+/* $NetBSD: dosfs.c,v 1.7 2003/08/18 15:45:27 dsl Exp $ */
/*
* Copyright (c) 1996, 1998 Robert Nordier
@@ -202,7 +202,7 @@
* Open DOS file
*/
int
-dosfs_open(char *path, struct open_file *fd)
+dosfs_open(const char *path, struct open_file *fd)
{
const struct direntry *de;
DOS_FILE *f;
diff -r 2ab054e663c5 -r 9bb81b941e4e sys/lib/libsa/dosfs.h
--- a/sys/lib/libsa/dosfs.h Mon Aug 18 15:28:25 2003 +0000
+++ b/sys/lib/libsa/dosfs.h Mon Aug 18 15:45:27 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dosfs.h,v 1.1 2000/11/02 00:25:05 thorpej Exp $ */
+/* $NetBSD: dosfs.h,v 1.2 2003/08/18 15:45:27 dsl Exp $ */
/*
* Copyright (c) 1996, 1998 Robert Nordier
@@ -27,9 +27,4 @@
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-int dosfs_open(char *path, struct open_file *);
-int dosfs_close(struct open_file *);
-int dosfs_read(struct open_file *, void *, size_t, size_t *);
-int dosfs_write(struct open_file *, void *, size_t, size_t *);
-off_t dosfs_seek(struct open_file *, off_t, int);
-int dosfs_stat(struct open_file *, struct stat *);
+FS_DEF(dosfs);
diff -r 2ab054e663c5 -r 9bb81b941e4e sys/lib/libsa/lfs.h
--- a/sys/lib/libsa/lfs.h Mon Aug 18 15:28:25 2003 +0000
+++ b/sys/lib/libsa/lfs.h Mon Aug 18 15:45:27 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs.h,v 1.3 2003/08/07 16:32:27 agc Exp $ */
+/* $NetBSD: lfs.h,v 1.4 2003/08/18 15:45:28 dsl Exp $ */
/*-
* Copyright (c) 1993
@@ -31,16 +31,5 @@
* @(#)ufs.h 8.1 (Berkeley) 6/11/93
*/
-int lfsv1_open(char *path, struct open_file *f);
-int lfsv1_close(struct open_file *f);
-int lfsv1_read(struct open_file *f, void *buf, size_t size, size_t *resid);
-int lfsv1_write(struct open_file *f, void *buf, size_t size, size_t *resid);
-off_t lfsv1_seek(struct open_file *f, off_t offset, int where);
-int lfsv1_stat(struct open_file *f, struct stat *sb);
-
-int lfsv2_open(char *path, struct open_file *f);
-int lfsv2_close(struct open_file *f);
-int lfsv2_read(struct open_file *f, void *buf, size_t size, size_t *resid);
-int lfsv2_write(struct open_file *f, void *buf, size_t size, size_t *resid);
-off_t lfsv2_seek(struct open_file *f, off_t offset, int where);
-int lfsv2_stat(struct open_file *f, struct stat *sb);
+FS_DEF(lfsv1);
+FS_DEF(lfsv2);
diff -r 2ab054e663c5 -r 9bb81b941e4e sys/lib/libsa/nfs.c
--- a/sys/lib/libsa/nfs.c Mon Aug 18 15:28:25 2003 +0000
+++ b/sys/lib/libsa/nfs.c Mon Aug 18 15:45:27 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nfs.c,v 1.31 2003/03/18 19:20:09 mycroft Exp $ */
+/* $NetBSD: nfs.c,v 1.32 2003/08/18 15:45:28 dsl Exp $ */
/*-
* Copyright (c) 1993 John Brezak
@@ -112,7 +112,8 @@
struct nfs_iodesc nfs_root_node;
int nfs_getrootfh __P((struct iodesc *, char *, u_char *));
-int nfs_lookupfh __P((struct nfs_iodesc *, char *, struct nfs_iodesc *));
+int nfs_lookupfh __P((struct nfs_iodesc *, const char *, int,
+ struct nfs_iodesc *));
int nfs_readlink __P((struct nfs_iodesc *, char *));
ssize_t nfs_readdata __P((struct nfs_iodesc *, off_t, void *, size_t));
@@ -184,12 +185,13 @@
* Return zero or error number.
*/
int
-nfs_lookupfh(d, name, newfd)
+nfs_lookupfh(d, name, len, newfd)
struct nfs_iodesc *d;
- char *name;
+ const char *name;
+ int len;
struct nfs_iodesc *newfd;
{
- int len, rlen;
+ int rlen;
struct args {
u_char fh[NFS_FHSIZE];
n_long len;
@@ -220,7 +222,6 @@
bzero(args, sizeof(*args));
bcopy(d->fh, args->fh, sizeof(args->fh));
- len = strlen(name);
if (len > sizeof(args->name))
len = sizeof(args->name);
bcopy(name, args->name, len);
@@ -398,13 +399,13 @@
*/
int
nfs_open(path, f)
- char *path;
+ const char *path;
struct open_file *f;
{
struct nfs_iodesc *newfd, *currfd;
- char *cp;
+ const char *cp;
#ifndef NFS_NOSYMLINK
- char *ncp;
+ const char *ncp;
int c;
char namebuf[NFS_MAXPATHLEN + 1];
char linkbuf[NFS_MAXPATHLEN + 1];
@@ -462,12 +463,10 @@
}
cp++;
}
- *cp = '\0';
}
/* lookup a file handle */
- error = nfs_lookupfh(currfd, ncp, newfd);
- *cp = c;
+ error = nfs_lookupfh(currfd, ncp, cp - ncp, newfd);
if (error)
goto out;
@@ -534,7 +533,7 @@
/* XXX: Check for empty path here? */
- error = nfs_lookupfh(&nfs_root_node, cp, currfd);
+ error = nfs_lookupfh(&nfs_root_node, cp, strlen(cp), currfd);
#endif
if (!error) {
f->f_fsdata = (void *)currfd;
diff -r 2ab054e663c5 -r 9bb81b941e4e sys/lib/libsa/nfs.h
--- a/sys/lib/libsa/nfs.h Mon Aug 18 15:28:25 2003 +0000
+++ b/sys/lib/libsa/nfs.h Mon Aug 18 15:45:27 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nfs.h,v 1.6 2003/08/07 16:32:28 agc Exp $ */
+/* $NetBSD: nfs.h,v 1.7 2003/08/18 15:45:28 dsl Exp $ */
/*-
* Copyright (c) 1993
@@ -29,13 +29,5 @@
* SUCH DAMAGE.
*/
-int nfs_open __P((char *path, struct open_file *f));
-int nfs_close __P((struct open_file *f));
-int nfs_read __P((struct open_file *f, void *buf,
- size_t size, size_t *resid));
-int nfs_write __P((struct open_file *f, void *buf,
- size_t size, size_t *resid));
-off_t nfs_seek __P((struct open_file *f, off_t offset, int where));
-int nfs_stat __P((struct open_file *f, struct stat *sb));
-int nfs_mount __P((int, struct in_addr, char *));
-
+FS_DEF(nfs);
+int nfs_mount(int, struct in_addr, char *);
diff -r 2ab054e663c5 -r 9bb81b941e4e sys/lib/libsa/nullfs.c
--- a/sys/lib/libsa/nullfs.c Mon Aug 18 15:28:25 2003 +0000
+++ b/sys/lib/libsa/nullfs.c Mon Aug 18 15:45:27 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nullfs.c,v 1.6 2003/08/07 16:32:29 agc Exp $ */
+/* $NetBSD: nullfs.c,v 1.7 2003/08/18 15:45:28 dsl Exp $ */
/*-
* Copyright (c) 1993
@@ -67,7 +67,7 @@
*/
int
-null_open(char *path, struct open_file *f)
+null_open(const char *path, struct open_file *f)
{
return EIO;
diff -r 2ab054e663c5 -r 9bb81b941e4e sys/lib/libsa/stand.h
--- a/sys/lib/libsa/stand.h Mon Aug 18 15:28:25 2003 +0000
+++ b/sys/lib/libsa/stand.h Mon Aug 18 15:45:27 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: stand.h,v 1.49 2003/08/07 16:32:30 agc Exp $ */
+/* $NetBSD: stand.h,v 1.50 2003/08/18 15:45:29 dsl Exp $ */
/*
* Copyright (c) 1999 Christopher G. Demetriou. All rights reserved.
@@ -90,7 +90,7 @@
struct open_file;
#define FS_DEF(fs) \
- extern int __CONCAT(fs,_open)(char *, struct open_file *); \
+ extern int __CONCAT(fs,_open)(const char *, struct open_file *); \
extern int __CONCAT(fs,_close)(struct open_file *); \
extern int __CONCAT(fs,_read)(struct open_file *, void *, \
size_t, size_t *); \
@@ -105,7 +105,7 @@
*/
#if !defined(LIBSA_SINGLE_FILESYSTEM)
struct fs_ops {
- int (*open)(char *, struct open_file *);
+ int (*open)(const char *, struct open_file *);
int (*close)(struct open_file *);
int (*read)(struct open_file *, void *, size_t, size_t *);
int (*write)(struct open_file *, void *, size_t size, size_t *);
diff -r 2ab054e663c5 -r 9bb81b941e4e sys/lib/libsa/tftp.c
--- a/sys/lib/libsa/tftp.c Mon Aug 18 15:28:25 2003 +0000
+++ b/sys/lib/libsa/tftp.c Mon Aug 18 15:45:27 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tftp.c,v 1.14 2003/03/18 19:20:09 mycroft Exp $ */
+/* $NetBSD: tftp.c,v 1.15 2003/08/18 15:45:29 dsl Exp $ */
/*
* Copyright (c) 1996
@@ -77,7 +77,7 @@
int islastblock; /* flag */
int validsize;
int off;
- char *path; /* saved for re-requests */
+ const char *path; /* saved for re-requests */
struct {
u_char header[HEADER_SIZE];
struct tftphdr t;
@@ -261,7 +261,7 @@
int
tftp_open(path, f)
- char *path;
+ const char *path;
struct open_file *f;
{
struct tftp_handle *tftpfile;
diff -r 2ab054e663c5 -r 9bb81b941e4e sys/lib/libsa/tftp.h
--- a/sys/lib/libsa/tftp.h Mon Aug 18 15:28:25 2003 +0000
+++ b/sys/lib/libsa/tftp.h Mon Aug 18 15:45:27 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tftp.h,v 1.3 2003/08/07 16:32:30 agc Exp $ */
+/* $NetBSD: tftp.h,v 1.4 2003/08/18 15:45:29 dsl Exp $ */
/*
* Copyright (c) 1996
@@ -105,13 +105,6 @@
#define EEXISTS 6 /* file already exists */
#define ENOUSER 7 /* no such user */
-int tftp_open __P((char *path, struct open_file *f));
-int tftp_read __P((struct open_file *f, void *addr,
- size_t size, size_t *resid));
-int tftp_close __P((struct open_file *f));
-int tftp_write __P((struct open_file *f, void *addr,
- size_t size, size_t *resid));
-int tftp_stat __P((struct open_file *f, struct stat *sb));
-off_t tftp_seek __P((struct open_file *f, off_t offset, int where));
+FS_DEF(tftp);
#define IPPORT_TFTP 69
diff -r 2ab054e663c5 -r 9bb81b941e4e sys/lib/libsa/ufs.c
--- a/sys/lib/libsa/ufs.c Mon Aug 18 15:28:25 2003 +0000
+++ b/sys/lib/libsa/ufs.c Mon Aug 18 15:45:27 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ufs.c,v 1.37 2003/08/18 08:00:52 dsl Exp $ */
+/* $NetBSD: ufs.c,v 1.38 2003/08/18 15:45:30 dsl Exp $ */
/*-
* Copyright (c) 1993
@@ -152,15 +152,15 @@
daddr_t f_buf_blkno; /* block number of data block */
};
-static int read_inode(ino_t, struct open_file *);
-static int block_map(struct open_file *, daddr_t, daddr_t *);
-static int buf_read_file(struct open_file *, char **, size_t *);
-static int search_directory(const char *, struct open_file *, ino_t *);
+static int read_inode(ino_t, struct open_file *);
+static int block_map(struct open_file *, daddr_t, daddr_t *);
+static int buf_read_file(struct open_file *, char **, size_t *);
+static int search_directory(const char *, int, struct open_file *, ino_t *);
#ifdef LIBSA_FFSv1
-static void ffs_oldfscompat(struct fs *);
+static void ffs_oldfscompat(struct fs *);
#endif
#ifdef LIBSA_FFSv2
-static int ffs_find_superblock(struct open_file *, struct fs *);
+static int ffs_find_superblock(struct open_file *, struct fs *);
#endif
Home |
Main Index |
Thread Index |
Old Index