libpuffs: make GCC happy
This commit is contained in:
parent
4d3a0887b4
commit
71634240a0
10 changed files with 45 additions and 35 deletions
|
@ -1,17 +1,23 @@
|
|||
# Makefile for libpuffs
|
||||
# $NetBSD: Makefile,v 1.24 2010/12/06 14:50:34 pooka Exp $
|
||||
#
|
||||
|
||||
LIB= puffs
|
||||
CC= clang
|
||||
SRCS= callcontext.c creds.c null.c pnode.c puffs.c subr.c\
|
||||
table.c link.c misc.c open.c path.c path_puffs.c protect.c\
|
||||
read.c stadir.c time.c utility.c mount.c inode.c
|
||||
INCS= puffs.h puffs_msgif.h
|
||||
INCSDIR= /usr/include
|
||||
MAN= puffs.3 puffs_cc.3 puffs_cred.3 puffs_node.3 \
|
||||
puffs_ops.3 puffs_path.3
|
||||
.include <bsd.own.mk>
|
||||
|
||||
DEFAULT_NR_BUFS= 1024
|
||||
USE_FORT?= no # data-driven bugs?
|
||||
|
||||
CPPFLAGS+= -D_MINIX -D_POSIX_SOURCE -D_POSIX_C_SOURCE -D_NETBSD_SOURCE -DDEFAULT_NR_BUFS=${DEFAULT_NR_BUFS}
|
||||
WARNS= 4
|
||||
|
||||
LIB= puffs
|
||||
|
||||
SRCS= puffs.c callcontext.c creds.c \
|
||||
null.c pnode.c \
|
||||
subr.c \
|
||||
inode.c link.c misc.c mount.c open.c path.c path_puffs.c \
|
||||
protect.c read.c stadir.c time.c utility.c table.c
|
||||
MAN= puffs.3 puffs_cc.3 puffs_cred.3 \
|
||||
puffs_node.3 puffs_ops.3 puffs_path.3
|
||||
INCS= puffs.h puffs_msgif.h
|
||||
INCSDIR= /usr/include
|
||||
LINTFLAGS+=-S -w
|
||||
|
||||
.include <bsd.lib.mk>
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
/* The following are so basic, all the *.c files get them automatically. */
|
||||
#include <minix/config.h> /* MUST be first */
|
||||
#include <minix/ansi.h> /* MUST be second */
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/types.h>
|
||||
#include <minix/const.h>
|
||||
#include <minix/type.h>
|
||||
|
|
|
@ -79,7 +79,7 @@ PUBLIC int fs_link()
|
|||
time_t cur_time;
|
||||
struct puffs_kcn pkcnp;
|
||||
PUFFS_MAKECRED(pcr, &global_kcred);
|
||||
struct puffs_cn pcn = {&pkcnp, (struct puffs_cred *)pcr, {0}};
|
||||
struct puffs_cn pcn = {&pkcnp, (struct puffs_cred *) __UNCONST(pcr), {0,0,0}};
|
||||
|
||||
if (global_pu->pu_ops.puffs_node_link == NULL)
|
||||
return(OK);
|
||||
|
@ -157,7 +157,7 @@ PUBLIC int fs_rdlink()
|
|||
register int r; /* return value */
|
||||
size_t copylen;
|
||||
struct puffs_node *pn;
|
||||
char user_path[PATH_MAX];
|
||||
char path[PATH_MAX];
|
||||
PUFFS_MAKECRED(pcr, &global_kcred);
|
||||
|
||||
copylen = fs_m_in.REQ_MEM_SIZE < UMAX_FILE_POS ?
|
||||
|
@ -174,7 +174,7 @@ PUBLIC int fs_rdlink()
|
|||
if (global_pu->pu_ops.puffs_node_readlink == NULL)
|
||||
return(EINVAL);
|
||||
|
||||
r = global_pu->pu_ops.puffs_node_readlink(global_pu, pn, pcr, user_path,
|
||||
r = global_pu->pu_ops.puffs_node_readlink(global_pu, pn, pcr, path,
|
||||
©len);
|
||||
if (r != OK) {
|
||||
if (r > 0) r = -r;
|
||||
|
@ -182,7 +182,7 @@ PUBLIC int fs_rdlink()
|
|||
}
|
||||
|
||||
r = sys_safecopyto(VFS_PROC_NR, (cp_grant_id_t) fs_m_in.REQ_GRANT,
|
||||
(vir_bytes) 0, (vir_bytes) user_path, (size_t) copylen, D);
|
||||
(vir_bytes) 0, (vir_bytes) path, (size_t) copylen, D);
|
||||
if (r == OK)
|
||||
fs_m_out.RES_NBYTES = copylen;
|
||||
|
||||
|
@ -190,9 +190,6 @@ PUBLIC int fs_rdlink()
|
|||
}
|
||||
|
||||
|
||||
FORWARD _PROTOTYPE( void release_node, (struct puffs_usermount *pu,
|
||||
struct puffs_node *pn ));
|
||||
|
||||
/*===========================================================================*
|
||||
* fs_rename *
|
||||
*===========================================================================*/
|
||||
|
@ -203,10 +200,10 @@ PUBLIC int fs_rename()
|
|||
struct puffs_node *new_dirp, *new_ip; /* ptrs to new dir, file pnodes */
|
||||
struct puffs_kcn pkcnp_src;
|
||||
PUFFS_MAKECRED(pcr_src, &global_kcred);
|
||||
struct puffs_cn pcn_src = {&pkcnp_src, (struct puffs_cred *) pcr_src, {0}};
|
||||
struct puffs_cn pcn_src = {&pkcnp_src, (struct puffs_cred *) __UNCONST(pcr_src), {0,0,0}};
|
||||
struct puffs_kcn pkcnp_dest;
|
||||
PUFFS_MAKECRED(pcr_dest, &global_kcred);
|
||||
struct puffs_cn pcn_targ = {&pkcnp_dest, (struct puffs_cred *) pcr_dest, {0}};
|
||||
struct puffs_cn pcn_targ = {&pkcnp_dest, (struct puffs_cred *) __UNCONST(pcr_dest), {0,0,0}};
|
||||
int r = OK; /* error flag; initially no error */
|
||||
int odir, ndir; /* TRUE iff {old|new} file is dir */
|
||||
int same_pdir; /* TRUE iff parent dirs are the same */
|
||||
|
@ -406,7 +403,7 @@ PUBLIC int fs_unlink()
|
|||
struct puffs_node *pn, *pn_dir;
|
||||
time_t cur_time;
|
||||
struct puffs_kcn pkcnp;
|
||||
struct puffs_cn pcn = {&pkcnp, 0, {0}};
|
||||
struct puffs_cn pcn = {&pkcnp, 0, {0,0,0}};
|
||||
PUFFS_KCREDTOCRED(pcn.pcn_cred, &global_kcred);
|
||||
int len;
|
||||
|
||||
|
|
|
@ -66,7 +66,9 @@ processvattr(const char *path, const struct vattr *va, int regular)
|
|||
if (chown(path, va->va_uid, va->va_gid) == -1)
|
||||
return errno;
|
||||
|
||||
#ifndef __minix
|
||||
if (va->va_mode != (unsigned)PUFFS_VNOVAL)
|
||||
#endif
|
||||
/* FIXME: lchmod */
|
||||
if (chmod(path, va->va_mode) == -1)
|
||||
return errno;
|
||||
|
|
|
@ -25,7 +25,7 @@ PUBLIC int fs_create()
|
|||
struct puffs_newinfo pni;
|
||||
struct puffs_kcn pkcnp;
|
||||
PUFFS_MAKECRED(pcr, &global_kcred);
|
||||
struct puffs_cn pcn = {&pkcnp, (struct puffs_cred *) pcr, {0}};
|
||||
struct puffs_cn pcn = {&pkcnp, (struct puffs_cred *) __UNCONST(pcr), {0,0,0}};
|
||||
struct vattr va;
|
||||
time_t cur_time;
|
||||
int len;
|
||||
|
@ -122,7 +122,7 @@ PUBLIC int fs_mknod()
|
|||
struct puffs_newinfo pni;
|
||||
struct puffs_kcn pkcnp;
|
||||
PUFFS_MAKECRED(pcr, &global_kcred);
|
||||
struct puffs_cn pcn = {&pkcnp, (struct puffs_cred *) pcr, {0}};
|
||||
struct puffs_cn pcn = {&pkcnp, (struct puffs_cred *) __UNCONST(pcr), {0,0,0}};
|
||||
struct vattr va;
|
||||
time_t cur_time;
|
||||
int len;
|
||||
|
@ -205,7 +205,7 @@ PUBLIC int fs_mkdir()
|
|||
struct puffs_newinfo pni;
|
||||
struct puffs_kcn pkcnp;
|
||||
PUFFS_MAKECRED(pcr, &global_kcred);
|
||||
struct puffs_cn pcn = {&pkcnp, (struct puffs_cred *) pcr, {0}};
|
||||
struct puffs_cn pcn = {&pkcnp, (struct puffs_cred *) __UNCONST(pcr), {0,0,0}};
|
||||
struct vattr va;
|
||||
time_t cur_time;
|
||||
int len;
|
||||
|
@ -289,7 +289,7 @@ PUBLIC int fs_slink()
|
|||
struct puffs_newinfo pni;
|
||||
struct puffs_kcn pkcnp;
|
||||
PUFFS_MAKECRED(pcr, &global_kcred);
|
||||
struct puffs_cn pcn = {&pkcnp, (struct puffs_cred *) pcr, {0}};
|
||||
struct puffs_cn pcn = {&pkcnp, (struct puffs_cred *) __UNCONST(pcr), {0,0,0}};
|
||||
struct vattr va;
|
||||
int len;
|
||||
|
||||
|
|
|
@ -372,7 +372,7 @@ int chk_perm; /* check permissions when string is looked up*/
|
|||
|
||||
struct puffs_kcn pkcnp;
|
||||
PUFFS_MAKECRED(pcr, &global_kcred);
|
||||
struct puffs_cn pcn = {&pkcnp, (struct puffs_cred *) pcr, {0}};
|
||||
struct puffs_cn pcn = {&pkcnp, (struct puffs_cred *) __UNCONST(pcr), {0,0,0}};
|
||||
|
||||
enum vtype node_vtype;
|
||||
voff_t size;
|
||||
|
|
|
@ -54,6 +54,7 @@ puffs_path_pcnbuild(struct puffs_usermount *pu, struct puffs_cn *pcn,
|
|||
|
||||
assert(pn_parent->pn_po.po_path != NULL);
|
||||
assert(pu->pu_flags & PUFFS_FLAG_BUILDPATH);
|
||||
pcn_orig = *pcn;
|
||||
|
||||
if (pu->pu_pathtransform) {
|
||||
rv = pu->pu_pathtransform(pu, &pn_parent->pn_po, pcn, &po);
|
||||
|
@ -65,8 +66,6 @@ puffs_path_pcnbuild(struct puffs_usermount *pu, struct puffs_cn *pcn,
|
|||
}
|
||||
|
||||
if (pu->pu_namemod) {
|
||||
/* XXX: gcc complains if I do assignment */
|
||||
memcpy(&pcn_orig, pcn, sizeof(pcn_orig));
|
||||
rv = pu->pu_namemod(pu, &pn_parent->pn_po, pcn);
|
||||
if (rv)
|
||||
return rv;
|
||||
|
|
|
@ -1,12 +1,17 @@
|
|||
#ifndef PUFFS_PROTO_H
|
||||
#define PUFFS_PROTO_H
|
||||
|
||||
struct puffs_usermount;
|
||||
struct puffs_node;
|
||||
|
||||
/* Function prototypes. */
|
||||
|
||||
_PROTOTYPE( int fs_new_driver, (void) );
|
||||
|
||||
/* inode.c */
|
||||
_PROTOTYPE( int fs_putnode, (void) );
|
||||
_PROTOTYPE( void release_node, (struct puffs_usermount *pu,
|
||||
struct puffs_node *pn ) );
|
||||
|
||||
/* device.c */
|
||||
_PROTOTYPE( int dev_open, (endpoint_t driver_e, dev_t dev,
|
||||
|
@ -62,10 +67,10 @@ _PROTOTYPE( int fs_utime, (void) );
|
|||
|
||||
/* utility.c */
|
||||
_PROTOTYPE( int no_sys, (void) );
|
||||
_PROTOTYPE( void mfs_nul_f, (char *file, int line, char *str,
|
||||
_PROTOTYPE( void mfs_nul_f, (const char *file, int line, char *str,
|
||||
unsigned int len, unsigned int maxlen) );
|
||||
_PROTOTYPE( time_t clock_time, (void) );
|
||||
_PROTOTYPE( int update_times, (struct puffs_node *pn, int fl, time_t t) );
|
||||
_PROTOTYPE( void lpuffs_debug, (char *format, ...) );
|
||||
_PROTOTYPE( void lpuffs_debug, (const char *format, ...) );
|
||||
|
||||
#endif /* PUFFS_PROTO_H */
|
||||
|
|
|
@ -32,7 +32,7 @@ PUBLIC int fs_readwrite(void)
|
|||
int r = OK, rw_flag;
|
||||
cp_grant_id_t gid;
|
||||
off_t pos;
|
||||
size_t nrbytes, bytes_left, bytes_done;
|
||||
size_t nrbytes, bytes_left, bytes_done = 0;
|
||||
struct puffs_node *pn;
|
||||
struct vattr va;
|
||||
PUFFS_MAKECRED(pcr, &global_kcred);
|
||||
|
@ -51,7 +51,7 @@ PUBLIC int fs_readwrite(void)
|
|||
if (nrbytes > RW_BUFSIZ)
|
||||
nrbytes = bytes_left = RW_BUFSIZ;
|
||||
|
||||
memset(getdents_buf, '\0', RW_BUFSIZ); /* Avoid leaking any data */
|
||||
memset(getdents_buf, '\0', GETDENTS_BUFSIZ); /* Avoid leaking any data */
|
||||
|
||||
if (rw_flag == READING) {
|
||||
if (global_pu->pu_ops.puffs_node_read == NULL)
|
||||
|
|
|
@ -24,7 +24,7 @@ PUBLIC int no_sys()
|
|||
/*===========================================================================*
|
||||
* mfs_nul *
|
||||
*===========================================================================*/
|
||||
PUBLIC void mfs_nul_f(char *file, int line, char *str, unsigned int len,
|
||||
PUBLIC void mfs_nul_f(const char *file, int line, char *str, unsigned int len,
|
||||
unsigned int maxlen)
|
||||
{
|
||||
if (len < maxlen && str[len-1] != '\0') {
|
||||
|
@ -103,7 +103,7 @@ PUBLIC int update_times(struct puffs_node *pn, int flags, time_t t)
|
|||
/*===========================================================================*
|
||||
* lpuffs_debug *
|
||||
*===========================================================================*/
|
||||
PUBLIC void lpuffs_debug(char *format, ...)
|
||||
PUBLIC void lpuffs_debug(const char *format, ...)
|
||||
{
|
||||
char buffer[256];
|
||||
va_list args;
|
||||
|
|
Loading…
Reference in a new issue