summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2015-08-08 13:49:04 -0700
committerRobin H. Johnson <robbat2@gentoo.org>2015-08-08 17:38:18 -0700
commit56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch)
tree3f91093cdb475e565ae857f1c5a7fd339e2d781e /sys-fs/copyfs/files/copyfs-1.0-unlink.patch
downloadgentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.bz2
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.zip
proj/gentoo: Initial commit
This commit represents a new era for Gentoo: Storing the gentoo-x86 tree in Git, as converted from CVS. This commit is the start of the NEW history. Any historical data is intended to be grafted onto this point. Creation process: 1. Take final CVS checkout snapshot 2. Remove ALL ChangeLog* files 3. Transform all Manifests to thin 4. Remove empty Manifests 5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$ 5.1. Do not touch files with -kb/-ko keyword flags. Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
Diffstat (limited to 'sys-fs/copyfs/files/copyfs-1.0-unlink.patch')
-rw-r--r--sys-fs/copyfs/files/copyfs-1.0-unlink.patch158
1 files changed, 158 insertions, 0 deletions
diff --git a/sys-fs/copyfs/files/copyfs-1.0-unlink.patch b/sys-fs/copyfs/files/copyfs-1.0-unlink.patch
new file mode 100644
index 000000000000..f4ee28fae148
--- /dev/null
+++ b/sys-fs/copyfs/files/copyfs-1.0-unlink.patch
@@ -0,0 +1,158 @@
+diff -u --recursive copyfs-1.0-orig/cache.c copyfs-1.0/cache.c
+--- copyfs-1.0-orig/cache.c 2004-12-10 13:34:08.000000000 +0000
++++ copyfs-1.0/cache.c 2004-12-18 20:30:17.945445677 +0000
+@@ -94,6 +94,61 @@
+ }
+
+ /*
++ * Remove metadata from the cache
++ */
++void cache_remove_metadata(metadata_t *metadata)
++{
++ version_t * version;
++
++ int atHead = 1;
++ int atTail = 1;
++
++ if (NULL == metadata)
++ return ;
++
++ /* Disconnect it from the list */
++ if (metadata->md_previous)
++ {
++ metadata->md_previous->md_next = metadata->md_next;
++ atHead = 0;
++ }
++
++ if (metadata->md_next)
++ {
++ metadata->md_next->md_previous = metadata->md_previous;
++ atTail = 0;
++ }
++
++ if (atHead)
++ {
++ metadata->md_bucket->b_contents = metadata->md_next;
++ if (metadata->md_next != NULL)
++ metadata->md_next->md_previous = NULL;
++ }
++
++ metadata->md_bucket->b_count--;
++ if (metadata->md_bucket->b_count == 0)
++ metadata->md_bucket->b_contents = NULL;
++
++ version = metadata->md_versions;
++
++ while (NULL != version)
++ {
++ metadata->md_versions = version->v_next;
++ free(version);
++ version = metadata->md_versions;
++ }
++
++ if (metadata->md_vfile != NULL)
++ free (metadata->md_vfile);
++
++ if (metadata->md_vpath != NULL)
++ free (metadata->md_vpath);
++
++ free(metadata);
++}
++
++/*
+ * Clean the older items out of the cache to free space. The goal is to
+ * half the number of items, so that we don't get called constantly.
+ */
+@@ -122,6 +177,7 @@
+ bucket = &cache_hash_table[CACHE_HASH(metadata->md_vfile)];
+ metadata->md_previous = NULL;
+ metadata->md_next = bucket->b_contents;
++ metadata->md_bucket = bucket;
+ if (bucket->b_contents)
+ bucket->b_contents->md_previous = metadata;
+ bucket->b_contents = metadata;
+diff -u --recursive copyfs-1.0-orig/cache.h copyfs-1.0/cache.h
+--- copyfs-1.0-orig/cache.h 2004-12-10 13:34:08.000000000 +0000
++++ copyfs-1.0/cache.h 2004-12-18 20:04:32.072307652 +0000
+@@ -11,6 +11,7 @@
+ void cache_initialize(void);
+ void cache_finalize(void);
+ metadata_t *cache_get_metadata(const char *vpath);
++void cache_remove_metadata(metadata_t *metadata);
+ void cache_add_metadata(metadata_t *metadata);
+ int cache_find_maximal_match(char **array, metadata_t **result);
+
+diff -u --recursive copyfs-1.0-orig/interface.c copyfs-1.0/interface.c
+--- copyfs-1.0-orig/interface.c 2004-12-18 20:04:21.560474299 +0000
++++ copyfs-1.0/interface.c 2004-12-18 20:17:22.367357210 +0000
+@@ -137,6 +137,7 @@
+ file = helper_build_composite("-S", "/", entry->d_name +
+ strlen(METADATA_PREFIX));
+ metadata = rcs_translate_to_metadata(file, rcs_version_path);
++
+ free(file);
+ if (metadata && !metadata->md_deleted)
+ {
+@@ -176,18 +177,42 @@
+ metadata = rcs_translate_to_metadata(path, rcs_version_path);
+ if (!metadata || metadata->md_deleted)
+ return -ENOENT;
+- version = rcs_find_version(metadata, LATEST, LATEST);
+- if (lstat(version->v_rfile, &st_rfile) == -1)
+- return -errno;
+- if (S_ISDIR(st_rfile.st_mode))
+- return -EISDIR;
++
++ /* remove all of the versions that we know about */
++
++ version = metadata->md_versions;
++
++ while (NULL != version)
++ {
++ /* if we can't stat the file, we assume it's already toast */
++
++ if (lstat(version->v_rfile, &st_rfile) == 0)
++ {
++ if (S_ISDIR(st_rfile.st_mode))
++ {
++ return -EISDIR;
++ }
++
++ if (unlink(version->v_rfile) == -1)
++ return -errno;
++ }
++
++ /* move on to the next version */
++ metadata->md_versions = version->v_next;
++ free(version);
++
++ version = metadata->md_versions;
++ }
++
++ /* if we get to here, we've released all the versions */
+ metadata->md_deleted = 1;
+ metafile = create_meta_name(metadata->md_vfile, "metadata");
+- if (write_metadata_file(metafile, metadata) == -1) {
+- free(metafile);
++ if (unlink(metafile) == -1)
+ return -errno;
+- }
+ free(metafile);
++
++ cache_remove_metadata(metadata);
++
+ return 0;
+ }
+
+diff -u --recursive copyfs-1.0-orig/structs.h copyfs-1.0/structs.h
+--- copyfs-1.0-orig/structs.h 2004-12-10 13:34:08.000000000 +0000
++++ copyfs-1.0/structs.h 2004-12-18 20:04:32.073307446 +0000
+@@ -38,6 +38,8 @@
+
+ metadata_t *md_next; /* Next file in bucket */
+ metadata_t *md_previous; /* Previous " */
++
++ bucket_t *md_bucket; /* Our container */
+ };
+
+ struct bucket_t