Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Unified Diff: third_party/sqlite/src/src/pager.c

Issue 6990066: Mac TimeMachine File Exclusions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/sqlite/src/ext/fts3/fts3_porter.c ('k') | third_party/sqlite/src/src/sqliteInt.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/sqlite/src/src/pager.c
===================================================================
--- third_party/sqlite/src/src/pager.c (revision 87306)
+++ third_party/sqlite/src/src/pager.c (working copy)
@@ -5130,7 +5130,21 @@
}
}
+#if defined(__APPLE__)
/*
+** Create and return a CFURLRef given a cstring containing the path to a file.
+*/
+static CFURLRef create_cfurl_from_cstring(const char* filePath){
Scott Hess - ex-Googler 2011/06/01 01:12:09 I'm fine with this, but pedantic would be zFilenam
+ CFStringRef urlString = CFStringCreateWithFileSystemRepresentation(
+ kCFAllocatorDefault, filePath);
+ CFURLRef urlRef = CFURLCreateWithFileSystemPath(kCFAllocatorDefault,
+ urlString, kCFURLPOSIXPathStyle, FALSE);
+ CFRelease(urlString);
+ return urlRef;
+}
+#endif
+
+/*
** This function is called at the start of every write transaction.
** There must already be a RESERVED or EXCLUSIVE lock on the database
** file when this routine is called.
@@ -5189,6 +5203,21 @@
#else
rc = sqlite3OsOpen(pVfs, pPager->zJournal, pPager->jfd, flags, 0);
#endif
+#if defined(__APPLE__)
+ /* Set the TimeMachine exclusion metadata for the journal if it has
+ ** been set for the database. */
+ if( rc==SQLITE_OK && pPager->zFilename!=NULL
+ && strlen(pPager->zFilename)>0 ){
+ CFURLRef database = create_cfurl_from_cstring(pPager->zFilename);
+ if( CSBackupIsItemExcluded(database, NULL) ){
+ CFURLRef journal = create_cfurl_from_cstring(pPager->zJournal);
+ /* Ignore errors from the following exclusion call. */
+ CSBackupSetItemExcluded(journal, TRUE, FALSE);
+ CFRelease(journal);
+ }
+ CFRelease(database);
+ }
+#endif
}
assert( rc!=SQLITE_OK || isOpen(pPager->jfd) );
}
« no previous file with comments | « third_party/sqlite/src/ext/fts3/fts3_porter.c ('k') | third_party/sqlite/src/src/sqliteInt.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698