Changeset View
Changeset View
Standalone View
Standalone View
lib/libstand/nandfs.c
Show First 20 Lines • Show All 648 Lines • ▼ Show 20 Lines | nandfs_lookup_path(struct nandfs *fs, const char *path) | ||||
/* Get the root inode */ | /* Get the root inode */ | ||||
node = nandfs_lookup_node(fs, NANDFS_ROOT_INO); | node = nandfs_lookup_node(fs, NANDFS_ROOT_INO); | ||||
inode = NANDFS_ROOT_INO; | inode = NANDFS_ROOT_INO; | ||||
while ((strp = strsep(&lpath, "/")) != NULL) { | while ((strp = strsep(&lpath, "/")) != NULL) { | ||||
if (*strp == '\0') | if (*strp == '\0') | ||||
continue; | continue; | ||||
if ((node->inode->i_mode & IFMT) != IFDIR) { | if ((node->inode->i_mode & NANDFS_IFMT) != NANDFS_IFDIR) { | ||||
nandfs_free_node(node); | nandfs_free_node(node); | ||||
node = NULL; | node = NULL; | ||||
goto out; | goto out; | ||||
} | } | ||||
len = strlen(strp); | len = strlen(strp); | ||||
NANDFS_DEBUG("%s: looking for %s\n", __func__, strp); | NANDFS_DEBUG("%s: looking for %s\n", __func__, strp); | ||||
for (i = 0; i < node->inode->i_blocks; i++) { | for (i = 0; i < node->inode->i_blocks; i++) { | ||||
Show All 39 Lines | while ((strp = strsep(&lpath, "/")) != NULL) { | ||||
if (!done) { | if (!done) { | ||||
node = NULL; | node = NULL; | ||||
goto out; | goto out; | ||||
} | } | ||||
NANDFS_DEBUG("%s: %.*s has mode %o\n", __func__, | NANDFS_DEBUG("%s: %.*s has mode %o\n", __func__, | ||||
dirent->name_len, dirent->name, node->inode->i_mode); | dirent->name_len, dirent->name, node->inode->i_mode); | ||||
if ((node->inode->i_mode & IFMT) == IFLNK) { | if ((node->inode->i_mode & NANDFS_IFMT) == NANDFS_IFLNK) { | ||||
NANDFS_DEBUG("%s: %.*s is symlink\n", | NANDFS_DEBUG("%s: %.*s is symlink\n", | ||||
__func__, dirent->name_len, dirent->name); | __func__, dirent->name_len, dirent->name); | ||||
link_len = node->inode->i_size; | link_len = node->inode->i_size; | ||||
if (++nlinks > MAXSYMLINKS) { | if (++nlinks > MAXSYMLINKS) { | ||||
nandfs_free_node(node); | nandfs_free_node(node); | ||||
node = NULL; | node = NULL; | ||||
goto out; | goto out; | ||||
▲ Show 20 Lines • Show All 340 Lines • Show Last 20 Lines |