"Fossies" - the Fresh Open Source Software Archive

Member "coda-6.9.5/coda-src/volutil/vol-dumpvrdb.cc" (23 May 2003, 1480 Bytes) of package /linux/misc/old/coda-6.9.5.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "vol-dumpvrdb.cc" see the Fossies "Dox" file reference documentation.

    1 /* BLURB gpl
    2 
    3                            Coda File System
    4                               Release 6
    5 
    6           Copyright (c) 1987-2003 Carnegie Mellon University
    7                   Additional copyrights listed below
    8 
    9 This  code  is  distributed "AS IS" without warranty of any kind under
   10 the terms of the GNU General Public Licence Version 2, as shown in the
   11 file  LICENSE.  The  technical and financial  contributors to Coda are
   12 listed in the file CREDITS.
   13 
   14                         Additional copyrights
   15                            none currently
   16 
   17 #*/
   18 
   19 #ifdef __cplusplus
   20 extern "C" {
   21 #endif
   22 
   23 #include <sys/types.h>
   24 #include <sys/stat.h>
   25 #include <fcntl.h>
   26 
   27 #include <volutil.h>
   28 
   29 #ifdef __cplusplus
   30 }
   31 #endif
   32 
   33 #include <util.h>
   34 #include <vrdb.h>
   35 
   36 /* S_VolDumpVRDB: Create a VRList file from the in-memory VRDB data. */
   37 // This routine dumps a text file, VRList. The format should match whatever
   38 // S_VolMakeVRDB expects.
   39 
   40 long S_VolDumpVRDB(RPC2_Handle rpcid, RPC2_String formal_outfile)
   41 {
   42     /* To keep C++ 2.0 happy */
   43     char *outfile = (char *)formal_outfile;
   44     int fd = -1, err = 0;
   45 
   46     LogMsg(9, VolDebugLevel, stdout, "Entering S_VolDumpVRDB; outfile %s",
   47        outfile);
   48     
   49     fd = open(outfile, O_CREAT | O_EXCL | O_WRONLY, 0644);
   50     if (fd == -1) {
   51     LogMsg(0, VolDebugLevel, stdout, 
   52            "S_VolDumpVRDB: unable to open file %s", outfile);
   53     err = VFAIL;
   54     goto Exit;
   55     }
   56 
   57     err = DumpVRDB(fd);
   58 
   59 Exit:
   60     if (fd != -1) close(fd);
   61     return(err ? VFAIL : 0);
   62 }