Changeset 25757 for trunk/Ohana/src/libdvo
- Timestamp:
- Oct 2, 2009, 3:15:42 PM (17 years ago)
- Location:
- trunk/Ohana/src/libdvo
- Files:
-
- 6 edited
- 1 copied
-
doc/locking.txt (copied) (copied from branches/eam_branches/20090715/Ohana/src/libdvo/doc/locking.txt )
-
include/dvo.h (modified) (2 diffs)
-
src/LoadPhotcodes.c (modified) (1 diff)
-
src/coordops.c (modified) (1 diff)
-
src/dvo_catalog.c (modified) (2 diffs)
-
src/dvo_image.c (modified) (1 diff)
-
src/skyregion_io.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/libdvo/include/dvo.h
r24976 r25757 325 325 PhotCodeData *GetPhotcodeTable (void); 326 326 327 int LoadPhotcodes (char *catdir_file, char *master_file );327 int LoadPhotcodes (char *catdir_file, char *master_file, int readwrite); 328 328 int LoadPhotcodesText (char *filename); 329 329 int LoadPhotcodesFITS (char *filename); … … 432 432 SkyTable *SkyTableLoad PROTO((char *filename, int VERBOSE)); 433 433 SkyTable *SkyTableFromGSC PROTO((char *filename, int depth, int VERBOSE)); 434 SkyTable *SkyTableLoadOptimal PROTO((char *catdir, char *SKYFILE, char *GSCFILE, int depth, int VERBOSE));434 SkyTable *SkyTableLoadOptimal PROTO((char *catdir, char *SKYFILE, char *GSCFILE, int readwrite, int depth, int VERBOSE)); 435 435 int SkyTableSetDepth PROTO((SkyTable *sky, int depth)); 436 436 SkyList *SkyRegionByPoint PROTO((SkyTable *table, int depth, double ra, double dec)); -
trunk/Ohana/src/libdvo/src/LoadPhotcodes.c
r12332 r25757 1 1 # include <dvo.h> 2 2 3 int LoadPhotcodes (char *catdir_file, char *master_file ) {3 int LoadPhotcodes (char *catdir_file, char *master_file, int readwrite) { 4 4 5 5 /* first try to load the photcodes from the specified CATDIR location */ 6 6 if (LoadPhotcodesFITS (catdir_file)) return TRUE; 7 7 8 if (!readwrite) { 9 fprintf (stderr, "db is missing a photcode table & access is read-only -- create one with photcode-table -import\n"); 10 return FALSE; 11 } 12 8 13 /* next try to load the photcodes from the master text photcode file */ 9 14 /* automatically (or on demand?) save the text file to the FITS version */ 10 15 if (LoadPhotcodesText (master_file)) { 11 if (!check_file_access (catdir_file, TRUE, TRUE)) return TRUE;12 SavePhotcodesFITS (catdir_file);13 return TRUE;16 if (!check_file_access (catdir_file, TRUE, TRUE, TRUE)) return TRUE; 17 SavePhotcodesFITS (catdir_file); 18 return TRUE; 14 19 } 15 20 -
trunk/Ohana/src/libdvo/src/coordops.c
r19823 r25757 163 163 return (FALSE); 164 164 } 165 if (fabs(alpha) >= 180.0) return (FALSE); 165 166 *ra = alpha + coords[0].crval1; 166 167 *dec = delta + coords[0].crval2; -
trunk/Ohana/src/libdvo/src/dvo_catalog.c
r24748 r25757 180 180 181 181 int Nsecfilt, mode; 182 int BACKUP, READWRITE; 182 183 183 184 mode = DVO_OPEN_NONE; … … 192 193 dvo_catalog_init (catalog, FALSE); 193 194 195 // default access control options: 194 196 catalog[0].lockmode = LCK_XCLD; 195 if (mode == DVO_OPEN_READ) catalog[0].lockmode = LCK_SOFT; 197 BACKUP = TRUE; 198 READWRITE = TRUE; 199 200 // in read-only mode, do not backup or require write access 201 if (mode == DVO_OPEN_READ) { 202 catalog[0].lockmode = LCK_SOFT; 203 BACKUP = FALSE; 204 READWRITE = FALSE; 205 } 196 206 197 // XXX make a backup? always? 198 if (!check_file_access (catalog[0].filename, TRUE, VERBOSE)) { 207 if (!check_file_access (catalog[0].filename, BACKUP, READWRITE, VERBOSE)) { 199 208 if (VERBOSE) fprintf (stderr, "no permission to access %s\n", catalog[0].filename); 200 209 return (FALSE); -
trunk/Ohana/src/libdvo/src/dvo_image.c
r24748 r25757 4 4 int dvo_image_lock (FITS_DB *db, char *filename, double timeout, int lockstate) { 5 5 6 /* lock the image catalog */ 7 if (!check_file_access (filename, FALSE, TRUE)) return (FALSE); 6 int READWRITE; 7 8 // default access control options: 9 READWRITE = TRUE; 10 11 // in read-only mode, do not backup or require write access 12 if (lockstate == LCK_SOFT) { 13 READWRITE = FALSE; 14 } 15 16 // do not perform a backup here 17 if (!check_file_access (filename, FALSE, READWRITE, TRUE)) return (FALSE); 8 18 9 19 db[0].lockstate = lockstate; -
trunk/Ohana/src/libdvo/src/skyregion_io.c
r17000 r25757 84 84 } 85 85 86 SkyTable *SkyTableLoadOptimal (char *catdir, char *skyfile, char *gscfile, int depth, int verbose) {86 SkyTable *SkyTableLoadOptimal (char *catdir, char *skyfile, char *gscfile, int readwrite, int depth, int verbose) { 87 87 88 88 char filename[256]; … … 93 93 sprintf (filename, "%s/SkyTable.fits", catdir); 94 94 if (stat (filename, &filestat)) goto SKYFILE; 95 if (!check_file_access (filename, FALSE, verbose)) goto SKYFILE;95 if (!check_file_access (filename, FALSE, readwrite, verbose)) goto SKYFILE; 96 96 sky = SkyTableLoad (filename, verbose); 97 97 if (sky == NULL) { … … 106 106 if (skyfile[0] != 0) goto GSCFILE; 107 107 if (stat (skyfile, &filestat)) goto GSCFILE; 108 if (!check_file_access (skyfile, FALSE, verbose)) goto GSCFILE;108 if (!check_file_access (skyfile, FALSE, readwrite, verbose)) goto GSCFILE; 109 109 sky = SkyTableLoad (skyfile, verbose); 110 110 if (sky == NULL) { … … 117 117 /* create CATDIR copy */ 118 118 sprintf (filename, "%s/SkyTable.fits", catdir); 119 check_file_access (filename, FALSE, verbose);119 check_file_access (filename, FALSE, readwrite, verbose); 120 120 if (!SkyTableSave (sky, filename)) return NULL; 121 121 … … 134 134 /* create CATDIR copy */ 135 135 sprintf (filename, "%s/SkyTable.fits", catdir); 136 check_file_access (filename, FALSE, verbose);136 check_file_access (filename, FALSE, readwrite, verbose); 137 137 if (!SkyTableSave (sky, filename)) return NULL; 138 138
Note:
See TracChangeset
for help on using the changeset viewer.
