[BACK]Return to filesys-os.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / rdistd

Diff for /src/usr.bin/rdistd/filesys-os.c between version 1.7 and 1.8

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

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8