version 1.2, 2011/07/18 21:51:49 |
version 1.3, 2011/07/30 03:51:53 |
Line 247 v7fs_file_deallocate(struct v7fs_self *f |
|
Line 247 v7fs_file_deallocate(struct v7fs_self *f |
|
return error; |
return error; |
|
|
if (v7fs_inode_isdir(&inode)) { |
if (v7fs_inode_isdir(&inode)) { |
/* Check child directory exists. */ |
char filename[V7FS_NAME_MAX + 1]; |
|
v7fs_dirent_filename(filename, name); |
|
/* Check parent */ |
|
if (strncmp(filename, "..", V7FS_NAME_MAX) == 0) { |
|
DPRINTF("can not remove '..'\n"); |
|
return EINVAL; /* t_vnops rename_dotdot */ |
|
} |
|
/* Check empty */ |
if (v7fs_inode_filesize(&inode) != |
if (v7fs_inode_filesize(&inode) != |
sizeof(struct v7fs_dirent) * 2 /*"." + ".."*/) { |
sizeof(struct v7fs_dirent) * 2 /*"." + ".."*/) { |
DPRINTF("file exists.\n"); |
DPRINTF("directory not empty.\n"); |
return EEXIST; |
return ENOTEMPTY;/* t_vnops dir_noempty, rename_dir(6)*/ |
} |
} |
inode.nlink = 0; /* remove this. */ |
inode.nlink = 0; /* remove this. */ |
} else { |
} else { |
/* Decrement reference count. */ |
/* Decrement reference count. */ |
--inode.nlink; /* regular file. */ |
--inode.nlink; /* regular file. */ |
|
DPRINTF("%s nlink=%d\n", name, inode.nlink); |
} |
} |
|
|
|
|