=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/rdistd/filesys-os.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- src/usr.bin/rdistd/filesys-os.c 2003/04/05 20:31:58 1.7 +++ src/usr.bin/rdistd/filesys-os.c 2003/05/14 01:34:35 1.8 @@ -1,4 +1,4 @@ -/* $OpenBSD: filesys-os.c,v 1.7 2003/04/05 20:31:58 deraadt Exp $ */ +/* $OpenBSD: filesys-os.c,v 1.8 2003/05/14 01:34:35 millert Exp $ */ /* * Copyright (c) 1983 Regents of the University of California. @@ -33,18 +33,20 @@ * SUCH DAMAGE. */ +#include "defs.h" #ifndef lint #if 0 -static char RCSid[] = -"$From: filesys-os.c,v 6.17 1996/01/17 21:02:45 mcooper Exp mcooper $"; +static char RCSid[] __attribute__((__unused__)) = +"$From: filesys-os.c,v 1.5 1999/08/04 15:57:33 christos Exp $"; #else -static char RCSid[] = -"$OpenBSD: filesys-os.c,v 1.7 2003/04/05 20:31:58 deraadt Exp $"; +static char RCSid[] __attribute__((__unused__)) = +"$OpenBSD: filesys-os.c,v 1.8 2003/05/14 01:34:35 millert Exp $"; #endif -static char sccsid[] = "@(#)filesys-os.c"; +static char sccsid[] __attribute__((__unused__)) = +"@(#)filesys-os.c"; -static char copyright[] = +static char copyright[] __attribute__((__unused__)) = "@(#) Copyright (c) 1983 Regents of the University of California.\n\ All rights reserved.\n"; #endif /* not lint */ @@ -53,16 +55,8 @@ * OS specific file system routines */ -#include "defs.h" -#include "filesys.h" - #if FSI_TYPE == FSI_GETFSSTAT static struct statfs *mnt = NULL; -#if FSTYPENAME -#define f_type_eq(a, b) (! strcmp (((struct statfs *) (a))->f_fstypename, (b))) -#else /* !FSTYPENAME */ -#define f_type_eq(a, b) (((struct statfs *) a)->f_type == (b)) -#endif /* !FSTYPENAME */ #endif /* FSI_GETFSSTAT */ #if FSI_TYPE == FSI_MNTCTL @@ -78,10 +72,8 @@ /* * AIX version of setmountent() */ -FILE *setmountent(file, mode) - /*ARGSUSED*/ - char *file; - char *mode; +FILE * +setmountent(const char *file, const char *mode) { ulong size; @@ -104,10 +96,8 @@ /* * getfsstat() version of get mount info routines. */ -FILE *setmountent(file, mode) - /*ARGSUSED*/ - char *file; - char *mode; +FILE * +setmountent(const char *file, const char *mode) { long size; @@ -137,9 +127,8 @@ /* * Iterate over mount entries */ -mntent_t *getmountent(fptr) - /*ARGSUSED*/ - FILE *fptr; +mntent_t * +getmountent(FILE *fptr) { static mntent_t mntstruct; @@ -172,9 +161,8 @@ /* * getfsstat() version of getmountent() */ -mntent_t *getmountent(fptr) - /*ARGSUSED*/ - FILE *fptr; +mntent_t * +getmountent(FILE *fptr) { static mntent_t mntstruct; static char remote_dev[MAXHOSTNAMELEN+MAXPATHLEN+1]; @@ -192,9 +180,14 @@ if (mnt->f_flags & M_RDONLY) mntstruct.me_flags |= MEFLAG_READONLY; #endif - if (f_type_eq(mnt, MOUNT_NFS)) { - (void) snprintf(remote_dev, sizeof remote_dev, - "%s", mnt->f_mntfromname); + +#ifdef HAVE_FSTYPENAME + if (strcmp(mnt->f_fstypename, "nfs") == 0) +#else + if (mnt->f_type == MOUNT_NFS) +#endif /* HAVE_FSTYPENAME */ + { + strlcpy(remote_dev, mnt->f_mntfromname, sizeof(remote_dev)); mntstruct.me_path = remote_dev; mntstruct.me_type = METYPE_NFS; } else { @@ -213,9 +206,8 @@ /* * Done with iterations */ -void endmountent(fptr) - /*ARGSUSED*/ - FILE *fptr; +void +endmountent(FILE *fptr) { mnt = NULL; @@ -230,10 +222,8 @@ /* * Prepare to iterate over mounted filesystem list */ -FILE *setmountent(file, mode) - /*ARGSUSED*/ - char *file; - char *mode; +FILE * +setmountent(const char *file, const char *mode) { return(fopen(file, mode)); } @@ -241,9 +231,8 @@ /* * Done with iteration */ -void endmountent(fptr) - /*ARGSUSED*/ - FILE *fptr; +void +endmountent(FILE *fptr) { fclose(fptr); } @@ -251,8 +240,8 @@ /* * Iterate over mount entries */ -mntent_t *getmountent(fptr) - FILE *fptr; +mntent_t * +getmountent(FILE *fptr) { static mntent_t me; static struct mnttab mntent; @@ -288,10 +277,8 @@ /* * Prepare to iterate over mounted filesystem list */ -FILE *setmountent(file, mode) - /*ARGSUSED*/ - char *file; - char *mode; +FILE * +setmountent(const char *file, const char *mode) { return(setmntent(file, mode)); } @@ -299,9 +286,8 @@ /* * Done with iteration */ -void endmountent(fptr) - /*ARGSUSED*/ - FILE *fptr; +void +endmountent(FILE *fptr) { endmntent(fptr); } @@ -309,15 +295,15 @@ /* * Iterate over mount entries */ -mntent_t *getmountent(fptr) - FILE *fptr; +mntent_t * +getmountent(FILE *fptr) { static mntent_t me; struct mntent *mntent; bzero((char *)&me, sizeof(mntent_t)); - if (mntent = getmntent(fptr)) { + if ((mntent = getmntent(fptr)) != NULL) { me.me_path = mntent->mnt_dir; me.me_type = mntent->mnt_type; if (mntent->mnt_opts && hasmntopt(mntent, MNTOPT_RO)) @@ -347,18 +333,15 @@ static int startmounts = 0; -FILE *setmountent(file, mode) - /*ARGSUSED*/ - char *file; - char *mode; +FILE * +setmountent(const char *file, const char *mode) { startmounts = 0; - return(stdin); /* XXX - need to return something! */ + return((FILE *) 1); } -void endmountent(fptr) - /*ARGSUSED*/ - FILE *fptr; +void +endmountent(FILE *fptr) { /* NOOP */ } @@ -366,9 +349,8 @@ /* * Iterate over mounted filesystems using getmnt() */ -mntent_t *getmountent(fptr) - /*ARGSUSED*/ - FILE *fptr; +mntent_t * +getmountent(FILE *fptr) { struct fs_data fs_data; static mntent_t me; @@ -394,8 +376,8 @@ /* * Make a new (copy) of a mntent structure. */ -mntent_t *newmountent(old) - mntent_t *old; +mntent_t * +newmountent(const mntent_t *old) { mntent_t *new;