"Fossies" - the Fresh Open Source Software Archive

Member "coda-6.9.5/coda-src/librepair/repio.h" (3 Nov 2006, 4218 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 "repio.h" 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 
   20 
   21 
   22 
   23 
   24 
   25 
   26 /* Created:
   27     M. Satyanarayanan
   28     June 1989
   29 
   30 */
   31 
   32 /*  Directory repair data structures and routines   
   33 
   34     A directory repair involves a list of individual repair operations.
   35     This list is constructed on the client and executed on the server.
   36     (In automated resolution, gets constructed on server)
   37     The repair is executed within a transaction at the server.
   38     struct repair defines one step in the repair.
   39     It should really be a union type but this is painful in C.
   40 */
   41    
   42 #define REPAIR_MAX 5  /* Max no of integer parms for a repair entry */
   43 #ifndef MAXNAMELEN
   44 #define MAXNAMELEN 255 /* Max len of pathname component: should this be defined 
   45                           somewhere in /usr/include/sys? */
   46 #endif
   47 
   48 /* Realm of localcache objects should be 0xffffffff */
   49 #ifndef IS_LOCAL
   50 #define IS_LOCAL(realm) (realm == 0xffffffff)
   51 //#define IS_LOCAL(realm) (!strcmp("localhost", realm))
   52 #endif
   53 
   54 struct repair {
   55     unsigned opcode;        /* values defined below */
   56     char name[MAXNAMELEN];      /* overloaded; null-terminated */
   57     char newname[MAXNAMELEN];   /* used only by rename */
   58     unsigned parms[REPAIR_MAX];     /* overloaded */
   59 };
   60 
   61 /* Repair opcodes */
   62 
   63 #define REPAIR_OPBASE 174320    /* random */
   64 
   65 /* Creation: 
   66     repair.name  specifies object name
   67     repair.parms[0..2] specify FID to be associated with this name
   68 */
   69 #define REPAIR_CREATEF  REPAIR_OPBASE+1     /* Create file */
   70 #define REPAIR_CREATED  REPAIR_OPBASE+2     /* Create directory */
   71 #define REPAIR_CREATES  REPAIR_OPBASE+3     /* Create sym link */
   72 #define REPAIR_CREATEL  REPAIR_OPBASE+4     /* Create (hard) link */
   73                 
   74 /* Remove opcodes:
   75     repair.name specifies object name
   76     repair.parms ignored
   77 */
   78 #define REPAIR_REMOVEFSL    REPAIR_OPBASE+5 /* Remove file or (hard) link */
   79 #define REPAIR_REMOVED      REPAIR_OPBASE+6 /* Remove dir */
   80 
   81 /* ACL mods: 
   82     repair.name gives name of user in acl
   83     repair.parms[0] specifies rights
   84 */
   85 /* REPAIR_DELACL is removed; repair.parms[0] = 0 means delete entry */
   86 #define REPAIR_SETACL   REPAIR_OPBASE+7     /* Set rights */
   87 #define REPAIR_SETNACL  REPAIR_OPBASE+8     /* Set negative rights */
   88 
   89 
   90 /* Status mods:
   91     repair.name is ignored
   92     repair.parms[0] gives new value
   93 */
   94 #define REPAIR_SETMODE      REPAIR_OPBASE+9
   95 #define REPAIR_SETOWNER     REPAIR_OPBASE+10  /* Have to be a sys administrator for this */
   96 #define REPAIR_SETMTIME     REPAIR_OPBASE+11
   97 
   98 /* Next replica:
   99     repair.name is the name of the server
  100        repair.parms[0] is a hex number, giving read-write volid of this replica
  101     
  102     Seen only in ASCII input files typed by users
  103 */
  104 #define REPAIR_REPLICA      REPAIR_OPBASE+12
  105 
  106 #define REPAIR_RENAME       REPAIR_OPBASE+13    /* mv object */
  107 
  108 
  109 
  110 /* The structure below is the header for the repairs to be made to one replica.
  111    An array of such structures can describe the repairs to all replicas.
  112    The number of replicas cannot be static, since disconnected operation can
  113    produce one conflicting replica per client.
  114 */
  115    
  116 struct listhdr {
  117     ViceFid replicaFid;     /* unique fid of this replica */
  118     unsigned int repairCount;   /* number of entries in array repairList[] */
  119     struct repair *repairList;  /* pointer to array of repair entries for this replica */
  120 };
  121 
  122 /* I/O routines */
  123 int repair_putdfile(char *fname, int replicaCount, struct listhdr *replicaList);
  124 int repair_getdfile(char *fname, int *replicaCount, struct listhdr **replicaList);
  125 int repair_getdfile(int infd,    int *replicaCount, struct listhdr **replicaList);
  126 int repair_parseline(char *line, struct repair *rs);
  127 int repair_parsefile(char *fname, int *hdcount,  struct listhdr **hdarray);
  128 void repair_printline(struct repair *rs, FILE *ff);
  129 void repair_printfile(char *fname);