예제 #1
0
파일: fs.c 프로젝트: steinwaywhw/Random
int fs_rm (fs_t *fs, char *pathname) {
	// assert (fs != NULL);
	// assert (pathname != NULL);

	// parent not exists
	int parent = inode_lookup_parent (fs->super_block, pathname);
	if (parent < 0)
		return -1;

	// child not exists
	int child = inode_lookup_full (fs->super_block, pathname);
	if (child < 0)
		return -1;

	// child is non-empty dir
	if (inode_isdir (fs->super_block, child) && !inode_isdir_isempty (fs->super_block, child))
		return -1;

	// child is empty-dir or child is reg file
	return inode_rm (fs->super_block, pathname);
}
예제 #2
0
파일: file.c 프로젝트: gilsho/os2-4
bool
file_is_dir(struct file *file)
{
  return inode_isdir(file->inode);
}
예제 #3
0
파일: fs.c 프로젝트: steinwaywhw/Random
int inode_isdir_isempty (super_block_t *sb, int index) {
	return sb->inodes[index].size == 0 && inode_isdir (sb, index);
}