# dirCache.c File Reference

`#include <assert.h>`
`#include <ubixfs/dirCache.h>`
`#include <ubixfs/ubixfs.h>`
`#include <lib/kmalloc.h>`
`#include <lib/kprintf.h>`
`#include <lib/string.h>`
`#include <ubixos/spinlock.h>`

Include dependency graph for dirCache.c:

Go to the source code of this file.

## Functions

cacheNode * | ubixfs_cacheAdd (struct cacheNode *node, struct cacheNode *newNode)
void | ubixfs_cacheDelete (struct cacheNode **head)
cacheNode * | ubixfs_cacheFind (struct cacheNode *head, char *name)
cacheNode * | ubixfs_cacheNew (const char *name)
static struct directoryEntry * | ubixfs_findName (struct directoryEntry *dirList, uInt32 size, char *name)

## Variables

static spinLock_t | dca_spinLock = SPIN_LOCK_INITIALIZER

## Function Documentation

struct cacheNode* ubixfs_cacheAdd | ( | struct cacheNode * | node,
|  | struct cacheNode * | newNode |
| ) |  |  |

Definition at line 242 of file dirCache.c.

References assert, dca_spinLock, cacheNode::fileListHead, cacheNode::fileListTail, cacheNode::next, NULL, cacheNode::parent, cacheNode::prev, spinLock(), and spinUnlock().

Referenced by ubixfs_cacheFind().

Here is the call graph for this function:

void ubixfs_cacheDelete | ( | struct cacheNode ** | head | ) |

Definition at line 202 of file dirCache.c.

References cacheNode::fileListHead, cacheNode::info, kfree(), cacheNode::name, cacheNode::next, NULL, and ubixfs_cacheDelete().

Referenced by ubixfs_cacheDelete().

Here is the call graph for this function:

struct cacheNode* ubixfs_cacheFind | ( | struct cacheNode * | head,
|  | char * | name |
| ) |  |  |

Definition at line 55 of file dirCache.c.

References assert, cacheNode::attributes, dca_spinLock, dirList, cacheNode::fileListHead, cacheNode::fileListTail, cacheNode::info, cacheNode::name, cacheNode::next, NULL, cacheNode::parent, cacheNode::permissions, cacheNode::present, cacheNode::prev, cacheNode::size, spinLock(), spinUnlock(), cacheNode::startCluster, strcmp(), typeFile, ubixfs_cacheAdd(), ubixfs_cacheFind(), ubixfs_cacheNew(), and ubixfs_findName().

Referenced by openFileUbixFS(), and ubixfs_cacheFind().

Here is the call graph for this function:

struct cacheNode* ubixfs_cacheNew | ( | const char * | name | ) |

Definition at line 185 of file dirCache.c.

References assert, cacheNode::attributes, cacheNode::dirty, cacheNode::fileListHead, cacheNode::fileListTail, cacheNode::info, kmalloc(), cacheNode::name, cacheNode::next, NULL, cacheNode::parent, cacheNode::permissions, cacheNode::present, cacheNode::prev, cacheNode::size, cacheNode::startCluster, strcpy, and strlen.

Referenced by ubixfs_cacheFind(), and ubixfs_initialize().

Here is the call graph for this function:

static struct directoryEntry* ubixfs_findName | ( | struct directoryEntry * | dirList,
|  | uInt32 | size,
|  | char * | name |
| ) |  |  | `[static]`

Definition at line 43 of file dirCache.c.

References dirList, directoryEntry::fileName, NULL, and strcmp().

Referenced by ubixfs_cacheFind().

Here is the call graph for this function:

## Variable Documentation

spinLock_t dca_spinLock = SPIN_LOCK_INITIALIZER`[static]`

Definition at line 39 of file dirCache.c.

Referenced by ubixfs_cacheAdd(), and ubixfs_cacheFind().