All new accounts created on Gitlab now require administrator approval. If you invite any collaborators, please let Flux staff know so they can approve the accounts.

Commit c32c6b1a authored by Siddharth Aggarwal's avatar Siddharth Aggarwal

*** empty log message ***

parent 3bb2f0de
...@@ -35,6 +35,11 @@ struct shd_modinfo { ...@@ -35,6 +35,11 @@ struct shd_modinfo {
long bufsiz; long bufsiz;
long retsiz; long retsiz;
}; };
struct shd_used_block {
long int key;
long int size;
};
struct shd_readbuf { struct shd_readbuf {
long block_num; long block_num;
...@@ -148,4 +153,5 @@ struct shd_softc { ...@@ -148,4 +153,5 @@ struct shd_softc {
#define SHDSETREBOOTVERSION _IOWR('S', 28, struct shd_ioctl) #define SHDSETREBOOTVERSION _IOWR('S', 28, struct shd_ioctl)
#define SHDGETMODIFIEDRANGES _IOWR('S', 29, struct shd_modinfo) #define SHDGETMODIFIEDRANGES _IOWR('S', 29, struct shd_modinfo)
#define SHDCRASH _IOWR('S', 30, int) #define SHDCRASH _IOWR('S', 30, int)
#define SHDADDUSEDBLOCK _IOWR('S', 31, struct shd_used_block)
...@@ -4,40 +4,6 @@ ...@@ -4,40 +4,6 @@
#define SHD_NO_MEM -1 #define SHD_NO_MEM -1
#define SHD_DISK_FULL -2 #define SHD_DISK_FULL -2
static void TrieNodeInit(TrieNode * node);
static void TrieNodeCleanup(TrieNode * node);
static int extract(char inDepth, TrieKey key);
static void logStructure(TrieNode * current, int tableSize, int isYoungest);
/* Change the leaf property on a TrieNode. */
static void setLeaf(TrieNode * current);
static void clearLeaf(TrieNode * current);
/* Returns 1 if the node is a leaf, 0 otherwise. */
static int isLeaf(TrieNode * current);
static int isBranch(TrieNode * current);
static int roundDownToPow2(int num);
static int sizeToDepth(int num);
static int getBlockSize(TrieKey key, int size);
static int insertWeak(Trie * triePtr, TrieNode * node, TrieKey key,
int maxDepth);
static int insertStrong(Trie * triePtr, TrieNode * node, TrieKey key,
int maxDepth, TrieValue value, OverlapT overlap);
static int addChild(Trie * triePtr, TrieNode * parent, TrieKey key,
int maxDepth, TrieValue value);
static int replace(Trie * triePtr, TrieNode * node, TrieKey key,
int maxDepth, TrieValue value, OverlapT overlap);
static void freeChildren(Trie * triePtr, TrieNode * node, OverlapT overlap);
static int strongOverlap(Trie * triePtr, TrieNode * node, TrieKey key,
int maxDepth, TrieValue value, OverlapT overlap);
static int weakOverlap(Trie * triePtr, TrieNode * node, TrieKey key,
int maxDepth);
static TrieNode * search(TrieNode * node, TrieKey key, int maxDepth);
static TrieNode * pushDown(Trie * triePtr, TrieNode * node);
static void addToList(Trie * triePtr, TrieNode * node);
static void removeFromList(Trie * triePtr, TrieNode * node);
TrieKey getDefaultTrieKey(void) TrieKey getDefaultTrieKey(void)
{ {
return 0; return 0;
...@@ -187,7 +153,7 @@ static int roundDownToPow2(int num) ...@@ -187,7 +153,7 @@ static int roundDownToPow2(int num)
/* This is the number of leading zeroes algorithm from 'Hacker's Delight' /* This is the number of leading zeroes algorithm from 'Hacker's Delight'
I modified it to print the ceiling of the log. */ I modified it to print the ceiling of the log. */
static int sizeToDepth(int num) int sizeToDepth(int num)
{ {
int total = 0; int total = 0;
if (num == 1 || num == 0) if (num == 1 || num == 0)
...@@ -228,7 +194,7 @@ int depthToSize(int num) ...@@ -228,7 +194,7 @@ int depthToSize(int num)
return 1 << (TOTAL_BITS - num); return 1 << (TOTAL_BITS - num);
} }
static int getBlockSize(TrieKey key, int size) int getBlockSize(TrieKey key, int size)
{ {
/* Get the rightmost '1' in the key. */ /* Get the rightmost '1' in the key. */
int biggestKeyBlock = key & (~key + 1); int biggestKeyBlock = key & (~key + 1);
...@@ -564,7 +530,7 @@ static int weakOverlap(Trie * triePtr, TrieNode * node, TrieKey key, ...@@ -564,7 +530,7 @@ static int weakOverlap(Trie * triePtr, TrieNode * node, TrieKey key,
return total; return total;
} }
static TrieNode * search(TrieNode * node, TrieKey key, int maxDepth) TrieNode * search(TrieNode * node, TrieKey key, int maxDepth)
{ {
int index = extract(node->depth, key); int index = extract(node->depth, key);
if (node == 0) if (node == 0)
......
...@@ -159,4 +159,38 @@ void freeAllBlocks(Trie * trie); ...@@ -159,4 +159,38 @@ void freeAllBlocks(Trie * trie);
int depthToSize(int num); int depthToSize(int num);
static void TrieNodeInit(TrieNode * node);
static void TrieNodeCleanup(TrieNode * node);
static int extract(char inDepth, TrieKey key);
static void logStructure(TrieNode * current, int tableSize, int isYoungest);
/* Change the leaf property on a TrieNode. */
static void setLeaf(TrieNode * current);
static void clearLeaf(TrieNode * current);
/* Returns 1 if the node is a leaf, 0 otherwise. */
static int isLeaf(TrieNode * current);
static int isBranch(TrieNode * current);
static int roundDownToPow2(int num);
static int sizeToDepth(int num);
static int getBlockSize(TrieKey key, int size);
static int insertWeak(Trie * triePtr, TrieNode * node, TrieKey key,
int maxDepth);
static int insertStrong(Trie * triePtr, TrieNode * node, TrieKey key,
int maxDepth, TrieValue value, OverlapT overlap);
static int addChild(Trie * triePtr, TrieNode * parent, TrieKey key,
int maxDepth, TrieValue value);
static int replace(Trie * triePtr, TrieNode * node, TrieKey key,
int maxDepth, TrieValue value, OverlapT overlap);
static void freeChildren(Trie * triePtr, TrieNode * node, OverlapT overlap);
static int strongOverlap(Trie * triePtr, TrieNode * node, TrieKey key,
int maxDepth, TrieValue value, OverlapT overlap);
static int weakOverlap(Trie * triePtr, TrieNode * node, TrieKey key,
int maxDepth);
static TrieNode * search(TrieNode * node, TrieKey key, int maxDepth);
static TrieNode * pushDown(Trie * triePtr, TrieNode * node);
static void addToList(Trie * triePtr, TrieNode * node);
static void removeFromList(Trie * triePtr, TrieNode * node);
#endif #endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment