* Fixed missing B_FS_IS_READONLY flag in fs_rfsstat(). This fixes bug #4009.
* Fixed many occurences of incorrect operator order, ie. "!flags & FLAG" does not what you might think it does. * Added TODOs to functionally questionable code. I really don't think this file system should actually be used read-write. Deleting files seems to be completely broken. * Fixed mixup of B_MOUNT_READ_ONLY vs. B_FS_IS_READONLY in nspace::flags. * Fixed many, many style issues, that file really was a mess. * Honoured 80 characters per line limit. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30996 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -66,7 +66,7 @@ get_node_type(ntfs_inode* ni, int* _type)
|
|||||||
if (!na)
|
if (!na)
|
||||||
return ENOENT;
|
return ENOENT;
|
||||||
|
|
||||||
if (!ni->flags & FILE_ATTR_HIDDEN) {
|
if (!(ni->flags & FILE_ATTR_HIDDEN)) {
|
||||||
if (na->data_size == 0)
|
if (na->data_size == 0)
|
||||||
*_type = S_IFIFO;
|
*_type = S_IFIFO;
|
||||||
}
|
}
|
||||||
@@ -112,7 +112,7 @@ fs_identify_partition(int fd, partition_data *partition, void **_cookie)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// check boot signature
|
// check boot signature
|
||||||
if (((buf[0x1fe] != 0x55) || (buf[0x1ff] != 0xaa)) && (buf[0x15] == 0xf8))
|
if ((buf[0x1fe] != 0x55 || buf[0x1ff] != 0xaa) && buf[0x15] == 0xf8)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
// check boot signature NTFS
|
// check boot signature NTFS
|
||||||
@@ -122,6 +122,7 @@ fs_identify_partition(int fd, partition_data *partition, void **_cookie)
|
|||||||
// get path for device
|
// get path for device
|
||||||
if (!ioctl(fd, B_GET_PATH_FOR_DEVICE, devpath))
|
if (!ioctl(fd, B_GET_PATH_FOR_DEVICE, devpath))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
// try mount
|
// try mount
|
||||||
ntVolume = utils_mount_volume(devpath, MS_RDONLY, true);
|
ntVolume = utils_mount_volume(devpath, MS_RDONLY, true);
|
||||||
if (!ntVolume)
|
if (!ntVolume)
|
||||||
@@ -132,12 +133,11 @@ fs_identify_partition(int fd, partition_data *partition, void **_cookie)
|
|||||||
if (!cookie)
|
if (!cookie)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
memcpy(&(cookie->boot),&boot,512);
|
memcpy(&cookie->boot, &boot, 512);
|
||||||
|
|
||||||
strcpy(cookie->label, "NTFS Volume");
|
strcpy(cookie->label, "NTFS Volume");
|
||||||
|
|
||||||
if(ntVolume->vol_name)
|
if (ntVolume->vol_name && ntVolume->vol_name[0] != '\0')
|
||||||
if(strlen(ntVolume->vol_name)>0)
|
|
||||||
strcpy(cookie->label, ntVolume->vol_name);
|
strcpy(cookie->label, ntVolume->vol_name);
|
||||||
|
|
||||||
ntfs_umount(ntVolume, true);
|
ntfs_umount(ntVolume, true);
|
||||||
@@ -147,18 +147,21 @@ fs_identify_partition(int fd, partition_data *partition, void **_cookie)
|
|||||||
return 0.8f;
|
return 0.8f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
fs_scan_partition(int fd, partition_data *partition, void *_cookie)
|
fs_scan_partition(int fd, partition_data *partition, void *_cookie)
|
||||||
{
|
{
|
||||||
identify_cookie *cookie = (identify_cookie *)_cookie;
|
identify_cookie *cookie = (identify_cookie *)_cookie;
|
||||||
partition->status = B_PARTITION_VALID;
|
partition->status = B_PARTITION_VALID;
|
||||||
partition->flags |= B_PARTITION_FILE_SYSTEM;
|
partition->flags |= B_PARTITION_FILE_SYSTEM;
|
||||||
partition->content_size = sle64_to_cpu(cookie->boot.number_of_sectors) * le16_to_cpu(cookie->boot.bpb.bytes_per_sector);
|
partition->content_size = sle64_to_cpu(cookie->boot.number_of_sectors)
|
||||||
|
* le16_to_cpu(cookie->boot.bpb.bytes_per_sector);
|
||||||
partition->block_size = le16_to_cpu(cookie->boot.bpb.bytes_per_sector);
|
partition->block_size = le16_to_cpu(cookie->boot.bpb.bytes_per_sector);
|
||||||
partition->content_name = strdup(cookie->label);
|
partition->content_name = strdup(cookie->label);
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
fs_free_identify_partition_cookie(partition_data *partition, void *_cookie)
|
fs_free_identify_partition_cookie(partition_data *partition, void *_cookie)
|
||||||
{
|
{
|
||||||
@@ -168,13 +171,14 @@ fs_free_identify_partition_cookie(partition_data *partition, void *_cookie)
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
fs_mount(fs_volume *_vol, const char *device, ulong flags, const char *args, ino_t *_rootID)
|
fs_mount(fs_volume *_vol, const char *device, ulong flags, const char *args,
|
||||||
|
ino_t *_rootID)
|
||||||
{
|
{
|
||||||
nspace *ns;
|
nspace *ns;
|
||||||
vnode *newNode = NULL;
|
vnode *newNode = NULL;
|
||||||
char lockname[32];
|
char lockname[32];
|
||||||
void *handle;
|
void *handle;
|
||||||
unsigned long mnt_flags = 0;
|
unsigned long mountFlags = 0;
|
||||||
status_t result = B_NO_ERROR;
|
status_t result = B_NO_ERROR;
|
||||||
|
|
||||||
ERRPRINT("fs_mount - ENTER\n");
|
ERRPRINT("fs_mount - ENTER\n");
|
||||||
@@ -188,30 +192,33 @@ fs_mount(fs_volume *_vol, const char *device, ulong flags, const char *args, ino
|
|||||||
*ns = (nspace) {
|
*ns = (nspace) {
|
||||||
.state = NF_FreeClustersOutdate | NF_FreeMFTOutdate,
|
.state = NF_FreeClustersOutdate | NF_FreeMFTOutdate,
|
||||||
.show_sys_files = false,
|
.show_sys_files = false,
|
||||||
.ro = false
|
.ro = false,
|
||||||
|
.flags = 0
|
||||||
};
|
};
|
||||||
|
|
||||||
ns->flags = flags;
|
|
||||||
|
|
||||||
strcpy(ns->devicePath,device);
|
strcpy(ns->devicePath,device);
|
||||||
|
|
||||||
sprintf(lockname, "ntfs_lock %lx", ns->id);
|
sprintf(lockname, "ntfs_lock %lx", ns->id);
|
||||||
recursive_lock_init_etc(&(ns->vlock), lockname, MUTEX_FLAG_CLONE_NAME);
|
recursive_lock_init_etc(&(ns->vlock), lockname, MUTEX_FLAG_CLONE_NAME);
|
||||||
|
|
||||||
handle = load_driver_settings("ntfs");
|
handle = load_driver_settings("ntfs");
|
||||||
ns->show_sys_files = ! (strcasecmp(get_driver_parameter(handle, "hide_sys_files", "true", "true"), "true") == 0);
|
ns->show_sys_files = ! (strcasecmp(get_driver_parameter(handle,
|
||||||
ns->ro = strcasecmp(get_driver_parameter(handle, "read_only", "false", "false"), "false") != 0;
|
"hide_sys_files", "true", "true"), "true") == 0);
|
||||||
ns->noatime = strcasecmp(get_driver_parameter(handle, "no_atime", "true", "true"), "true") == 0;
|
ns->ro = strcasecmp(get_driver_parameter(handle, "read_only", "false",
|
||||||
|
"false"), "false") != 0;
|
||||||
|
ns->noatime = strcasecmp(get_driver_parameter(handle, "no_atime", "true",
|
||||||
|
"true"), "true") == 0;
|
||||||
unload_driver_settings(handle);
|
unload_driver_settings(handle);
|
||||||
|
|
||||||
if (ns->ro || ns->flags & B_MOUNT_READ_ONLY) {
|
if (ns->ro || (flags & B_MOUNT_READ_ONLY) != 0) {
|
||||||
mnt_flags |= MS_RDONLY;
|
mountFlags |= MS_RDONLY;
|
||||||
ns->flags |= B_MOUNT_READ_ONLY;
|
ns->flags |= B_FS_IS_READONLY;
|
||||||
}
|
}
|
||||||
// if (ns->noatime)
|
// if (ns->noatime)
|
||||||
// mnt_flags |= MS_NOATIME;
|
// mnt_flags |= MS_NOATIME;
|
||||||
|
|
||||||
ns->ntvol=utils_mount_volume(device,mnt_flags,true);
|
// TODO: this does not take read-only volumes into account!
|
||||||
|
ns->ntvol = utils_mount_volume(device, mountFlags, true);
|
||||||
if (ns->ntvol != NULL)
|
if (ns->ntvol != NULL)
|
||||||
result = B_NO_ERROR;
|
result = B_NO_ERROR;
|
||||||
else
|
else
|
||||||
@@ -227,7 +234,6 @@ fs_mount(fs_volume *_vol, const char *device, ulong flags, const char *args, ino
|
|||||||
if (newNode == NULL)
|
if (newNode == NULL)
|
||||||
result = ENOMEM;
|
result = ENOMEM;
|
||||||
else {
|
else {
|
||||||
|
|
||||||
newNode->vnid = *_rootID;
|
newNode->vnid = *_rootID;
|
||||||
newNode->parent_vnid = -1;
|
newNode->parent_vnid = -1;
|
||||||
|
|
||||||
@@ -237,8 +243,7 @@ fs_mount(fs_volume *_vol, const char *device, ulong flags, const char *args, ino
|
|||||||
free(ns);
|
free(ns);
|
||||||
result = EINVAL;
|
result = EINVAL;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
result = B_NO_ERROR;
|
result = B_NO_ERROR;
|
||||||
ntfs_mark_free_space_outdated(ns);
|
ntfs_mark_free_space_outdated(ns);
|
||||||
ntfs_calc_free_space(ns);
|
ntfs_calc_free_space(ns);
|
||||||
@@ -247,12 +252,12 @@ fs_mount(fs_volume *_vol, const char *device, ulong flags, const char *args, ino
|
|||||||
}
|
}
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
|
||||||
ERRPRINT("fs_mount - EXIT, result code is %s\n", strerror(result));
|
ERRPRINT("fs_mount - EXIT, result code is %s\n", strerror(result));
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
fs_unmount(fs_volume *_vol)
|
fs_unmount(fs_volume *_vol)
|
||||||
{
|
{
|
||||||
@@ -272,6 +277,7 @@ fs_unmount(fs_volume *_vol)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
fs_rfsstat(fs_volume *_vol, struct fs_info *fss)
|
fs_rfsstat(fs_volume *_vol, struct fs_info *fss)
|
||||||
{
|
{
|
||||||
@@ -286,7 +292,8 @@ fs_rfsstat( fs_volume *_vol, struct fs_info * fss )
|
|||||||
|
|
||||||
fss->dev = ns->id;
|
fss->dev = ns->id;
|
||||||
fss->root = FILE_root;
|
fss->root = FILE_root;
|
||||||
fss->flags = B_FS_IS_PERSISTENT|B_FS_HAS_MIME|B_FS_HAS_ATTR;
|
fss->flags = B_FS_IS_PERSISTENT | B_FS_HAS_MIME | B_FS_HAS_ATTR | ns->flags;
|
||||||
|
|
||||||
fss->block_size = ns->ntvol->cluster_size;
|
fss->block_size = ns->ntvol->cluster_size;
|
||||||
fss->io_size = 65536;
|
fss->io_size = 65536;
|
||||||
fss->total_blocks = ns->ntvol->nr_clusters;
|
fss->total_blocks = ns->ntvol->nr_clusters;
|
||||||
@@ -294,9 +301,10 @@ fs_rfsstat( fs_volume *_vol, struct fs_info * fss )
|
|||||||
strncpy(fss->device_name, ns->devicePath, sizeof(fss->device_name));
|
strncpy(fss->device_name, ns->devicePath, sizeof(fss->device_name));
|
||||||
strncpy(fss->volume_name, ns->ntvol->vol_name, sizeof(fss->volume_name));
|
strncpy(fss->volume_name, ns->ntvol->vol_name, sizeof(fss->volume_name));
|
||||||
|
|
||||||
for (i = strlen(fss->volume_name)-1; i >=0 ; i--)
|
for (i = strlen(fss->volume_name) - 1; i >=0 ; i--) {
|
||||||
if (fss->volume_name[i] != ' ')
|
if (fss->volume_name[i] != ' ')
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
if (i < 0)
|
if (i < 0)
|
||||||
strcpy(fss->volume_name, "NTFS Untitled");
|
strcpy(fss->volume_name, "NTFS Untitled");
|
||||||
else
|
else
|
||||||
@@ -331,12 +339,12 @@ fs_wfsstat( fs_volume *_vol, const struct fs_info * fss, uint32 mask)
|
|||||||
}
|
}
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
|
||||||
UNLOCK_VOL(ns);
|
UNLOCK_VOL(ns);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
fs_walk(fs_volume *_vol, fs_vnode *_dir, const char *file, ino_t *vnid)
|
fs_walk(fs_volume *_vol, fs_vnode *_dir, const char *file, ino_t *vnid)
|
||||||
{
|
{
|
||||||
@@ -398,7 +406,6 @@ fs_walk(fs_volume *_vol, fs_vnode *_dir, const char *file, ino_t *vnid)
|
|||||||
}
|
}
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
|
||||||
ERRPRINT("fs_walk - EXIT, result is %s\n", strerror(result));
|
ERRPRINT("fs_walk - EXIT, result is %s\n", strerror(result));
|
||||||
|
|
||||||
UNLOCK_VOL(ns);
|
UNLOCK_VOL(ns);
|
||||||
@@ -406,8 +413,10 @@ exit:
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
fs_get_vnode_name(fs_volume *_vol, fs_vnode *_vnode, char *buffer, size_t bufferSize)
|
fs_get_vnode_name(fs_volume *_vol, fs_vnode *_vnode, char *buffer,
|
||||||
|
size_t bufferSize)
|
||||||
{
|
{
|
||||||
nspace *ns = (nspace*)_vol->private_volume;
|
nspace *ns = (nspace*)_vol->private_volume;
|
||||||
vnode *node = (vnode*)_vnode->private_node;
|
vnode *node = (vnode*)_vnode->private_node;
|
||||||
@@ -429,13 +438,13 @@ fs_get_vnode_name(fs_volume *_vol, fs_vnode *_vnode, char *buffer, size_t buffer
|
|||||||
result = EINVAL;
|
result = EINVAL;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
name = strrchr(path, '/');
|
name = strrchr(path, '/');
|
||||||
name++;
|
name++;
|
||||||
|
|
||||||
strlcpy(buffer, name, bufferSize);
|
strlcpy(buffer, name, bufferSize);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
|
||||||
if (ni)
|
if (ni)
|
||||||
ntfs_inode_close(ni);
|
ntfs_inode_close(ni);
|
||||||
|
|
||||||
@@ -446,7 +455,8 @@ exit:
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
fs_read_vnode(fs_volume *_vol, ino_t vnid, fs_vnode *_node, int *_type, uint32 *_flags, bool reenter)
|
fs_read_vnode(fs_volume *_vol, ino_t vnid, fs_vnode *_node, int *_type,
|
||||||
|
uint32 *_flags, bool reenter)
|
||||||
{
|
{
|
||||||
nspace *ns = (nspace*)_vol->private_volume;
|
nspace *ns = (nspace*)_vol->private_volume;
|
||||||
vnode *newNode = NULL;
|
vnode *newNode = NULL;
|
||||||
@@ -492,11 +502,10 @@ fs_read_vnode(fs_volume *_vol, ino_t vnid, fs_vnode *_node, int *_type, uint32 *
|
|||||||
}
|
}
|
||||||
|
|
||||||
_node->private_node = newNode;
|
_node->private_node = newNode;
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
result = ENOMEM;
|
result = ENOMEM;
|
||||||
exit:
|
|
||||||
|
|
||||||
|
exit:
|
||||||
if (ni != NULL)
|
if (ni != NULL)
|
||||||
ntfs_inode_close(ni);
|
ntfs_inode_close(ni);
|
||||||
|
|
||||||
@@ -511,6 +520,7 @@ exit:
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
fs_write_vnode(fs_volume *_vol, fs_vnode *_node, bool reenter)
|
fs_write_vnode(fs_volume *_vol, fs_vnode *_node, bool reenter)
|
||||||
{
|
{
|
||||||
@@ -523,7 +533,6 @@ fs_write_vnode( fs_volume *_vol, fs_vnode *_node, bool reenter )
|
|||||||
|
|
||||||
ERRPRINT("fs_write_vnode - ENTER (%Ld)\n", node->vnid);
|
ERRPRINT("fs_write_vnode - ENTER (%Ld)\n", node->vnid);
|
||||||
|
|
||||||
if (node)
|
|
||||||
free(node);
|
free(node);
|
||||||
|
|
||||||
ERRPRINT("fs_write_vnode - EXIT\n");
|
ERRPRINT("fs_write_vnode - EXIT\n");
|
||||||
@@ -534,6 +543,7 @@ fs_write_vnode( fs_volume *_vol, fs_vnode *_node, bool reenter )
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
fs_remove_vnode(fs_volume *_vol, fs_vnode *_node, bool reenter)
|
fs_remove_vnode(fs_volume *_vol, fs_vnode *_node, bool reenter)
|
||||||
{
|
{
|
||||||
@@ -541,12 +551,12 @@ fs_remove_vnode( fs_volume *_vol, fs_vnode *_node, bool reenter )
|
|||||||
vnode *node = (vnode*)_node->private_node;
|
vnode *node = (vnode*)_node->private_node;
|
||||||
status_t result = B_NO_ERROR;
|
status_t result = B_NO_ERROR;
|
||||||
|
|
||||||
|
// TODO: this does not look right! The space if the node must be freed *here*
|
||||||
if (!reenter)
|
if (!reenter)
|
||||||
LOCK_VOL(ns);
|
LOCK_VOL(ns);
|
||||||
|
|
||||||
ERRPRINT("fs_remove_vnode - ENTER (%Ld)\n", node->vnid);
|
ERRPRINT("fs_remove_vnode - ENTER (%Ld)\n", node->vnid);
|
||||||
|
|
||||||
if(node)
|
|
||||||
free(node);
|
free(node);
|
||||||
|
|
||||||
ERRPRINT("fs_remove_vnode - EXIT, result is %s\n", strerror(result));
|
ERRPRINT("fs_remove_vnode - EXIT, result is %s\n", strerror(result));
|
||||||
@@ -557,6 +567,7 @@ fs_remove_vnode( fs_volume *_vol, fs_vnode *_node, bool reenter )
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
fs_rstat(fs_volume *_vol, fs_vnode *_node, struct stat *stbuf)
|
fs_rstat(fs_volume *_vol, fs_vnode *_node, struct stat *stbuf)
|
||||||
{
|
{
|
||||||
@@ -608,12 +619,14 @@ fs_rstat( fs_volume *_vol, fs_vnode *_node, struct stat *stbuf )
|
|||||||
|
|
||||||
stbuf->st_size = na->data_size;
|
stbuf->st_size = na->data_size;
|
||||||
|
|
||||||
if (!ni->flags & FILE_ATTR_HIDDEN) {
|
if (!(ni->flags & FILE_ATTR_HIDDEN)) {
|
||||||
if (na->data_size == 0)
|
if (na->data_size == 0)
|
||||||
stbuf->st_mode = S_IFIFO;
|
stbuf->st_mode = S_IFIFO;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (na->data_size <= sizeof(INTX_FILE_TYPES) + sizeof(ntfschar) * MAX_PATH && na->data_size >sizeof(INTX_FILE_TYPES)) {
|
if (na->data_size <= sizeof(INTX_FILE_TYPES)
|
||||||
|
+ sizeof(ntfschar) * MAX_PATH
|
||||||
|
&& na->data_size >sizeof(INTX_FILE_TYPES)) {
|
||||||
INTX_FILE *intx_file;
|
INTX_FILE *intx_file;
|
||||||
|
|
||||||
intx_file = ntfs_malloc(na->data_size);
|
intx_file = ntfs_malloc(na->data_size);
|
||||||
@@ -622,7 +635,8 @@ fs_rstat( fs_volume *_vol, fs_vnode *_node, struct stat *stbuf )
|
|||||||
ntfs_attr_close(na);
|
ntfs_attr_close(na);
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
if (ntfs_attr_pread(na, 0, na->data_size,intx_file) != na->data_size) {
|
if (ntfs_attr_pread(na, 0, na->data_size,intx_file)
|
||||||
|
!= na->data_size) {
|
||||||
result = EINVAL;
|
result = EINVAL;
|
||||||
free(intx_file);
|
free(intx_file);
|
||||||
ntfs_attr_close(na);
|
ntfs_attr_close(na);
|
||||||
@@ -647,7 +661,6 @@ fs_rstat( fs_volume *_vol, fs_vnode *_node, struct stat *stbuf )
|
|||||||
stbuf->st_mtime = ni->last_data_change_time;
|
stbuf->st_mtime = ni->last_data_change_time;
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
|
||||||
if (ni)
|
if (ni)
|
||||||
ntfs_inode_close(ni);
|
ntfs_inode_close(ni);
|
||||||
|
|
||||||
@@ -656,9 +669,9 @@ exit:
|
|||||||
UNLOCK_VOL(ns);
|
UNLOCK_VOL(ns);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
fs_wstat(fs_volume *_vol, fs_vnode *_node, const struct stat *st, uint32 mask)
|
fs_wstat(fs_volume *_vol, fs_vnode *_node, const struct stat *st, uint32 mask)
|
||||||
{
|
{
|
||||||
@@ -678,13 +691,11 @@ fs_wstat( fs_volume *_vol, fs_vnode *_node, const struct stat *st, uint32 mask )
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (mask & B_STAT_SIZE) {
|
if (mask & B_STAT_SIZE) {
|
||||||
|
|
||||||
ERRPRINT("fs_wstat: setting file size to %Lx\n", st->st_size);
|
ERRPRINT("fs_wstat: setting file size to %Lx\n", st->st_size);
|
||||||
|
|
||||||
if (ni->mrec->flags & MFT_RECORD_IS_DIRECTORY) {
|
if (ni->mrec->flags & MFT_RECORD_IS_DIRECTORY) {
|
||||||
result = EISDIR;
|
result = EISDIR;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
ntfs_attr *na = ntfs_attr_open(ni, AT_DATA, NULL, 0);
|
ntfs_attr *na = ntfs_attr_open(ni, AT_DATA, NULL, 0);
|
||||||
if (!na) {
|
if (!na) {
|
||||||
result = EINVAL;
|
result = EINVAL;
|
||||||
@@ -701,7 +712,6 @@ fs_wstat( fs_volume *_vol, fs_vnode *_node, const struct stat *st, uint32 mask )
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (mask & B_STAT_MODIFICATION_TIME) {
|
if (mask & B_STAT_MODIFICATION_TIME) {
|
||||||
|
|
||||||
ERRPRINT("fs_wstat: setting modification time\n");
|
ERRPRINT("fs_wstat: setting modification time\n");
|
||||||
|
|
||||||
ni->last_access_time = st->st_atime;
|
ni->last_access_time = st->st_atime;
|
||||||
@@ -712,7 +722,6 @@ fs_wstat( fs_volume *_vol, fs_vnode *_node, const struct stat *st, uint32 mask )
|
|||||||
}
|
}
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
|
||||||
if (ni)
|
if (ni)
|
||||||
ntfs_inode_close(ni);
|
ntfs_inode_close(ni);
|
||||||
|
|
||||||
@@ -767,7 +776,6 @@ fs_fsync(fs_volume *_vol, fs_vnode *_node)
|
|||||||
ntfs_inode_sync(ni);
|
ntfs_inode_sync(ni);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
|
||||||
if (ni)
|
if (ni)
|
||||||
ntfs_inode_close(ni);
|
ntfs_inode_close(ni);
|
||||||
|
|
||||||
@@ -778,6 +786,7 @@ exit:
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
fs_open(fs_volume *_vol, fs_vnode *_node, int omode, void **_cookie)
|
fs_open(fs_volume *_vol, fs_vnode *_node, int omode, void **_cookie)
|
||||||
{
|
{
|
||||||
@@ -814,16 +823,13 @@ fs_open(fs_volume *_vol, fs_vnode *_node, int omode, void **_cookie)
|
|||||||
|
|
||||||
cookie = (filecookie*)ntfs_calloc(sizeof(filecookie));
|
cookie = (filecookie*)ntfs_calloc(sizeof(filecookie));
|
||||||
|
|
||||||
if ( cookie != NULL )
|
if (cookie != NULL) {
|
||||||
{
|
|
||||||
cookie->omode = omode;
|
cookie->omode = omode;
|
||||||
*_cookie = (void*)cookie;
|
*_cookie = (void*)cookie;
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
result = ENOMEM;
|
result = ENOMEM;
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
|
||||||
if (na)
|
if (na)
|
||||||
ntfs_attr_close(na);
|
ntfs_attr_close(na);
|
||||||
|
|
||||||
@@ -839,7 +845,8 @@ exit:
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
fs_create(fs_volume *_vol, fs_vnode *_dir, const char *name, int omode, int perms, void **_cookie, ino_t *_vnid)
|
fs_create(fs_volume *_vol, fs_vnode *_dir, const char *name, int omode,
|
||||||
|
int perms, void **_cookie, ino_t *_vnid)
|
||||||
{
|
{
|
||||||
nspace *ns = (nspace*)_vol->private_volume;
|
nspace *ns = (nspace*)_vol->private_volume;
|
||||||
vnode *dir = (vnode*)_dir->private_node;
|
vnode *dir = (vnode*)_dir->private_node;
|
||||||
@@ -850,7 +857,7 @@ fs_create(fs_volume *_vol, fs_vnode *_dir, const char *name, int omode, int perm
|
|||||||
ntfs_inode *bi = NULL;
|
ntfs_inode *bi = NULL;
|
||||||
ntfschar *uname = NULL;
|
ntfschar *uname = NULL;
|
||||||
status_t result = B_NO_ERROR;
|
status_t result = B_NO_ERROR;
|
||||||
int uname_len;
|
int unameLength;
|
||||||
|
|
||||||
if (ns->flags & B_FS_IS_READONLY) {
|
if (ns->flags & B_FS_IS_READONLY) {
|
||||||
ERRPRINT("ntfs is read-only\n");
|
ERRPRINT("ntfs is read-only\n");
|
||||||
@@ -866,7 +873,8 @@ fs_create(fs_volume *_vol, fs_vnode *_dir, const char *name, int omode, int perm
|
|||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (name == NULL || *name == '\0' || strchr(name, '/') || strcmp(name, ".") == 0 || strcmp(name, "..") == 0) {
|
if (name == NULL || *name == '\0' || strchr(name, '/')
|
||||||
|
|| strcmp(name, ".") == 0 || strcmp(name, "..") == 0) {
|
||||||
result = EINVAL;
|
result = EINVAL;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
@@ -877,13 +885,13 @@ fs_create(fs_volume *_vol, fs_vnode *_dir, const char *name, int omode, int perm
|
|||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !bi->mrec->flags & MFT_RECORD_IS_DIRECTORY ) {
|
if (!(bi->mrec->flags & MFT_RECORD_IS_DIRECTORY)) {
|
||||||
result = EINVAL;
|
result = EINVAL;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
uname_len = ntfs_mbstoucs(name, &uname);
|
unameLength = ntfs_mbstoucs(name, &uname);
|
||||||
if (uname_len < 0) {
|
if (unameLength < 0) {
|
||||||
result = EINVAL;
|
result = EINVAL;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
@@ -898,7 +906,8 @@ fs_create(fs_volume *_vol, fs_vnode *_dir, const char *name, int omode, int perm
|
|||||||
}
|
}
|
||||||
|
|
||||||
ni = ntfs_pathname_to_inode(ns->ntvol, bi, name);
|
ni = ntfs_pathname_to_inode(ns->ntvol, bi, name);
|
||||||
if(ni) { //file exist
|
if (ni) {
|
||||||
|
// file exists
|
||||||
*_vnid = MREF(ni->mft_no);
|
*_vnid = MREF(ni->mft_no);
|
||||||
if (omode & O_TRUNC) {
|
if (omode & O_TRUNC) {
|
||||||
na = ntfs_attr_open(ni, AT_DATA, NULL, 0);
|
na = ntfs_attr_open(ni, AT_DATA, NULL, 0);
|
||||||
@@ -909,8 +918,7 @@ fs_create(fs_volume *_vol, fs_vnode *_dir, const char *name, int omode, int perm
|
|||||||
result = errno;
|
result = errno;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ni = ntfs_create(bi, uname, uname_len, S_IFREG);
|
ni = ntfs_create(bi, uname, unameLength, S_IFREG);
|
||||||
|
|
||||||
if (ni) {
|
if (ni) {
|
||||||
*_vnid = MREF(ni->mft_no);
|
*_vnid = MREF(ni->mft_no);
|
||||||
|
|
||||||
@@ -931,7 +939,6 @@ fs_create(fs_volume *_vol, fs_vnode *_dir, const char *name, int omode, int perm
|
|||||||
ntfs_mark_free_space_outdated(ns);
|
ntfs_mark_free_space_outdated(ns);
|
||||||
|
|
||||||
notify_entry_created(ns->id, MREF(bi->mft_no), name, *_vnid);
|
notify_entry_created(ns->id, MREF(bi->mft_no), name, *_vnid);
|
||||||
|
|
||||||
} else
|
} else
|
||||||
result = errno;
|
result = errno;
|
||||||
}
|
}
|
||||||
@@ -939,7 +946,6 @@ fs_create(fs_volume *_vol, fs_vnode *_dir, const char *name, int omode, int perm
|
|||||||
free(uname);
|
free(uname);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
|
||||||
if (result >= B_OK) {
|
if (result >= B_OK) {
|
||||||
*_cookie = cookie;
|
*_cookie = cookie;
|
||||||
} else
|
} else
|
||||||
@@ -959,12 +965,13 @@ exit:
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
fs_read( fs_volume *_vol, fs_vnode *_dir, void *_cookie, off_t offset, void *buf, size_t *len )
|
fs_read(fs_volume *_vol, fs_vnode *_dir, void *_cookie, off_t offset, void *buf,
|
||||||
|
size_t *len)
|
||||||
{
|
{
|
||||||
nspace *ns = (nspace*)_vol->private_volume;
|
nspace *ns = (nspace*)_vol->private_volume;
|
||||||
vnode *node = (vnode*)_dir->private_node;
|
vnode *node = (vnode*)_dir->private_node;
|
||||||
//filecookie *cookie = (filecookie*)_cookie; //temporary not used
|
|
||||||
ntfs_inode *ni = NULL;
|
ntfs_inode *ni = NULL;
|
||||||
ntfs_attr *na = NULL;
|
ntfs_attr *na = NULL;
|
||||||
size_t size = *len;
|
size_t size = *len;
|
||||||
@@ -1003,6 +1010,7 @@ fs_read( fs_volume *_vol, fs_vnode *_dir, void *_cookie, off_t offset, void *buf
|
|||||||
}
|
}
|
||||||
if (offset + size > na->data_size)
|
if (offset + size > na->data_size)
|
||||||
size = na->data_size - offset;
|
size = na->data_size - offset;
|
||||||
|
|
||||||
while (size) {
|
while (size) {
|
||||||
result = ntfs_attr_pread(na, offset, size, buf);
|
result = ntfs_attr_pread(na, offset, size, buf);
|
||||||
if (result < (s64)size)
|
if (result < (s64)size)
|
||||||
@@ -1018,13 +1026,12 @@ fs_read( fs_volume *_vol, fs_vnode *_dir, void *_cookie, off_t offset, void *buf
|
|||||||
}
|
}
|
||||||
result = total;
|
result = total;
|
||||||
*len = result;
|
*len = result;
|
||||||
exit:
|
|
||||||
|
|
||||||
|
exit:
|
||||||
if (na)
|
if (na)
|
||||||
ntfs_attr_close(na);
|
ntfs_attr_close(na);
|
||||||
|
|
||||||
exit2:
|
exit2:
|
||||||
|
|
||||||
if (ni)
|
if (ni)
|
||||||
ntfs_inode_close(ni);
|
ntfs_inode_close(ni);
|
||||||
|
|
||||||
@@ -1037,7 +1044,8 @@ exit2:
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
fs_write( fs_volume *_vol, fs_vnode *_dir, void *_cookie, off_t offset, const void *buf, size_t *len )
|
fs_write(fs_volume *_vol, fs_vnode *_dir, void *_cookie, off_t offset,
|
||||||
|
const void *buf, size_t *len)
|
||||||
{
|
{
|
||||||
nspace *ns = (nspace*)_vol->private_volume;
|
nspace *ns = (nspace*)_vol->private_volume;
|
||||||
vnode *node = (vnode*)_dir->private_node;
|
vnode *node = (vnode*)_dir->private_node;
|
||||||
@@ -1114,15 +1122,16 @@ fs_write( fs_volume *_vol, fs_vnode *_dir, void *_cookie, off_t offset, const vo
|
|||||||
*len = total;
|
*len = total;
|
||||||
ERRPRINT(("fs_write - OK\n"));
|
ERRPRINT(("fs_write - OK\n"));
|
||||||
result = B_NO_ERROR;
|
result = B_NO_ERROR;
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
if (na)
|
if (na)
|
||||||
ntfs_attr_close(na);
|
ntfs_attr_close(na);
|
||||||
exit2:
|
exit2:
|
||||||
|
|
||||||
if (ni)
|
if (ni)
|
||||||
ntfs_inode_close(ni);
|
ntfs_inode_close(ni);
|
||||||
|
|
||||||
ERRPRINT("fs_write - EXIT, result is %s, writed %d bytes\n", strerror(result),(int)(*len));
|
ERRPRINT("fs_write - EXIT, result is %s, writed %d bytes\n",
|
||||||
|
strerror(result), (int)(*len));
|
||||||
|
|
||||||
UNLOCK_VOL(ns);
|
UNLOCK_VOL(ns);
|
||||||
|
|
||||||
@@ -1139,18 +1148,19 @@ fs_close(fs_volume *_vol, fs_vnode *_node, void *cookie)
|
|||||||
return B_NO_ERROR;
|
return B_NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
fs_free_cookie(fs_volume *_vol, fs_vnode *_node, void *cookie)
|
fs_free_cookie(fs_volume *_vol, fs_vnode *_node, void *cookie)
|
||||||
{
|
{
|
||||||
ERRPRINT("fs_free_cookie - ENTER\n");
|
ERRPRINT("fs_free_cookie - ENTER\n");
|
||||||
|
|
||||||
if(cookie)
|
|
||||||
free(cookie);
|
free(cookie);
|
||||||
|
|
||||||
ERRPRINT("fs_free_cookie - EXIT\n");
|
ERRPRINT("fs_free_cookie - EXIT\n");
|
||||||
return B_NO_ERROR;
|
return B_NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
fs_access(fs_volume *_vol, fs_vnode *_node, int mode)
|
fs_access(fs_volume *_vol, fs_vnode *_node, int mode)
|
||||||
{
|
{
|
||||||
@@ -1160,15 +1170,16 @@ fs_access( fs_volume *_vol, fs_vnode *_node, int mode )
|
|||||||
return B_NO_ERROR;
|
return B_NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
fs_readlink(fs_volume *_vol, fs_vnode *_node, char *buff, size_t *buff_size)
|
fs_readlink(fs_volume *_vol, fs_vnode *_node, char *buffer, size_t *bufferSize)
|
||||||
{
|
{
|
||||||
nspace *ns = (nspace*)_vol->private_volume;
|
nspace *ns = (nspace*)_vol->private_volume;
|
||||||
vnode *node = (vnode*)_node->private_node;
|
vnode *node = (vnode*)_node->private_node;
|
||||||
ntfs_attr *na = NULL;
|
ntfs_attr *na = NULL;
|
||||||
INTX_FILE *intx_file = NULL;
|
INTX_FILE *intxFile = NULL;
|
||||||
ntfs_inode *ni = NULL;
|
ntfs_inode *ni = NULL;
|
||||||
char *buf = NULL;
|
char *tempBuffer = NULL;
|
||||||
status_t result = B_NO_ERROR;
|
status_t result = B_NO_ERROR;
|
||||||
int l = 0;
|
int l = 0;
|
||||||
|
|
||||||
@@ -1176,7 +1187,7 @@ fs_readlink(fs_volume *_vol, fs_vnode *_node, char *buff, size_t *buff_size)
|
|||||||
|
|
||||||
ERRPRINT("fs_readlink - ENTER\n");
|
ERRPRINT("fs_readlink - ENTER\n");
|
||||||
|
|
||||||
if(ns==NULL || node==NULL || buff ==NULL || buff_size ==NULL) {
|
if (ns == NULL || node == NULL || buffer == NULL || bufferSize == NULL) {
|
||||||
result = EINVAL;
|
result = EINVAL;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
@@ -1201,48 +1212,50 @@ fs_readlink(fs_volume *_vol, fs_vnode *_node, char *buff, size_t *buff_size)
|
|||||||
result = EINVAL;
|
result = EINVAL;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
if (na->data_size > sizeof(INTX_FILE_TYPES) +
|
if (na->data_size > sizeof(INTX_FILE_TYPES) + sizeof(ntfschar) * MAX_PATH) {
|
||||||
sizeof(ntfschar) * MAX_PATH) {
|
|
||||||
result = ENAMETOOLONG;
|
result = ENAMETOOLONG;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
/* Receive file content. */
|
/* Receive file content. */
|
||||||
intx_file = ntfs_malloc(na->data_size);
|
intxFile = ntfs_malloc(na->data_size);
|
||||||
if (!intx_file) {
|
if (!intxFile) {
|
||||||
result = errno;
|
result = errno;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
if (ntfs_attr_pread(na, 0, na->data_size, intx_file) != na->data_size) {
|
if (ntfs_attr_pread(na, 0, na->data_size, intxFile) != na->data_size) {
|
||||||
result = errno;
|
result = errno;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
/* Sanity check. */
|
/* Sanity check. */
|
||||||
if (intx_file->magic != INTX_SYMBOLIC_LINK) {
|
if (intxFile->magic != INTX_SYMBOLIC_LINK) {
|
||||||
result = EINVAL;
|
result = EINVAL;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
/* Convert link from unicode to local encoding. */
|
/* Convert link from unicode to local encoding. */
|
||||||
l = ntfs_ucstombs(intx_file->target, (na->data_size - offsetof(INTX_FILE, target)) / sizeof(ntfschar), &buf, 0);
|
l = ntfs_ucstombs(intxFile->target,
|
||||||
|
(na->data_size - offsetof(INTX_FILE, target)) / sizeof(ntfschar),
|
||||||
|
&tempBuffer, 0);
|
||||||
|
|
||||||
if (l < 0) {
|
if (l < 0) {
|
||||||
result = errno;
|
result = errno;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
if (tempBuffer == NULL) {
|
||||||
|
result = B_NO_MEMORY;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
ERRPRINT("fs_readlink - LINK:[%s]\n",buf);
|
ERRPRINT("fs_readlink - LINK:[%s]\n", buffer);
|
||||||
|
|
||||||
strcpy(buff,buf);
|
strlcpy(buffer, tempBuffer, *bufferSize);
|
||||||
if(buf)
|
free(tempBuffer);
|
||||||
free(buf);
|
|
||||||
|
|
||||||
*buff_size = l+1;
|
*bufferSize = l + 1;
|
||||||
|
|
||||||
result = B_NO_ERROR;
|
result = B_NO_ERROR;
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
free(intxFile);
|
||||||
if (intx_file)
|
|
||||||
free(intx_file);
|
|
||||||
if (na)
|
if (na)
|
||||||
ntfs_attr_close(na);
|
ntfs_attr_close(na);
|
||||||
if (ni)
|
if (ni)
|
||||||
@@ -1255,18 +1268,20 @@ exit:
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
fs_create_symlink(fs_volume *_vol, fs_vnode *_dir, const char *name, const char *target, int mode)
|
fs_create_symlink(fs_volume *_vol, fs_vnode *_dir, const char *name,
|
||||||
|
const char *target, int mode)
|
||||||
{
|
{
|
||||||
nspace *ns = (nspace*)_vol->private_volume;
|
nspace *ns = (nspace*)_vol->private_volume;
|
||||||
vnode *dir = (vnode*)_dir->private_node;
|
vnode *dir = (vnode*)_dir->private_node;
|
||||||
ntfs_inode *sym = NULL;
|
ntfs_inode *sym = NULL;
|
||||||
ntfs_inode *bi = NULL;
|
ntfs_inode *bi = NULL;
|
||||||
vnode *symnode = NULL;
|
vnode *symnode = NULL;
|
||||||
ntfschar *uname = NULL,
|
ntfschar *uname = NULL;
|
||||||
*utarget = NULL;
|
ntfschar *utarget = NULL;
|
||||||
int uname_len,
|
int unameLength;
|
||||||
utarget_len;
|
int utargetLength;
|
||||||
status_t result = B_NO_ERROR;
|
status_t result = B_NO_ERROR;
|
||||||
int fmode;
|
int fmode;
|
||||||
|
|
||||||
@@ -1285,19 +1300,19 @@ fs_create_symlink(fs_volume *_vol, fs_vnode *_dir, const char *name, const char
|
|||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
uname_len = ntfs_mbstoucs(name, &uname);
|
unameLength = ntfs_mbstoucs(name, &uname);
|
||||||
if (uname_len < 0) {
|
if (unameLength < 0) {
|
||||||
result = EINVAL;
|
result = EINVAL;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
utarget_len = ntfs_mbstoucs(target, &utarget);
|
utargetLength = ntfs_mbstoucs(target, &utarget);
|
||||||
if (utarget_len < 0) {
|
if (utargetLength < 0) {
|
||||||
result = EINVAL;
|
result = EINVAL;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
sym = ntfs_create_symlink(bi, uname, uname_len, utarget, utarget_len);
|
sym = ntfs_create_symlink(bi, uname, unameLength, utarget, utargetLength);
|
||||||
if (sym == NULL) {
|
if (sym == NULL) {
|
||||||
result = EINVAL;
|
result = EINVAL;
|
||||||
goto exit;
|
goto exit;
|
||||||
@@ -1320,16 +1335,18 @@ fs_create_symlink(fs_volume *_vol, fs_vnode *_dir, const char *name, const char
|
|||||||
fmode = FS_FILE_MODE;
|
fmode = FS_FILE_MODE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((result = publish_vnode(_vol, MREF(sym->mft_no), symnode,
|
result = publish_vnode(_vol, MREF(sym->mft_no), symnode, &gNTFSVnodeOps,
|
||||||
&gNTFSVnodeOps, S_IFLNK | fmode, 0)) != 0)
|
S_IFLNK | fmode, 0);
|
||||||
ERRPRINT("fs_symlink - new_vnode failed for vnid %Ld: %s\n", MREF(sym->mft_no), strerror(result));
|
if (result != 0) {
|
||||||
|
ERRPRINT("fs_symlink - new_vnode failed for vnid %Ld: %s\n",
|
||||||
|
MREF(sym->mft_no), strerror(result));
|
||||||
|
}
|
||||||
|
|
||||||
put_vnode(_vol, MREF(sym->mft_no));
|
put_vnode(_vol, MREF(sym->mft_no));
|
||||||
|
|
||||||
notify_entry_created(ns->id, MREF( bi->mft_no ), name, MREF(sym->mft_no));
|
notify_entry_created(ns->id, MREF( bi->mft_no ), name, MREF(sym->mft_no));
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
|
||||||
if (sym)
|
if (sym)
|
||||||
ntfs_inode_close(sym);
|
ntfs_inode_close(sym);
|
||||||
if (bi)
|
if (bi)
|
||||||
@@ -1350,7 +1367,7 @@ fs_mkdir(fs_volume *_vol, fs_vnode *_dir, const char *name, int perms)
|
|||||||
vnode *dir = (vnode*)_dir->private_node;
|
vnode *dir = (vnode*)_dir->private_node;
|
||||||
vnode *newNode =NULL;
|
vnode *newNode =NULL;
|
||||||
ntfschar *uname = NULL;
|
ntfschar *uname = NULL;
|
||||||
int uname_len;
|
int unameLength;
|
||||||
ntfs_inode *ni = NULL;
|
ntfs_inode *ni = NULL;
|
||||||
ntfs_inode *bi = NULL;
|
ntfs_inode *bi = NULL;
|
||||||
status_t result = B_NO_ERROR;
|
status_t result = B_NO_ERROR;
|
||||||
@@ -1375,19 +1392,18 @@ fs_mkdir(fs_volume *_vol, fs_vnode *_dir, const char *name, int perms)
|
|||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! bi->mrec->flags & MFT_RECORD_IS_DIRECTORY) {
|
if (!(bi->mrec->flags & MFT_RECORD_IS_DIRECTORY)) {
|
||||||
result = EINVAL;
|
result = EINVAL;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
uname_len = ntfs_mbstoucs(name, &uname);
|
unameLength = ntfs_mbstoucs(name, &uname);
|
||||||
if (uname_len < 0) {
|
if (unameLength < 0) {
|
||||||
result = EINVAL;
|
result = EINVAL;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
ni = ntfs_create(bi, uname, uname_len, S_IFDIR);
|
ni = ntfs_create(bi, uname, unameLength, S_IFDIR);
|
||||||
|
|
||||||
if (ni) {
|
if (ni) {
|
||||||
ino_t vnid = MREF(ni->mft_no);
|
ino_t vnid = MREF(ni->mft_no);
|
||||||
|
|
||||||
@@ -1410,12 +1426,10 @@ fs_mkdir(fs_volume *_vol, fs_vnode *_dir, const char *name, int perms)
|
|||||||
ntfs_mark_free_space_outdated(ns);
|
ntfs_mark_free_space_outdated(ns);
|
||||||
|
|
||||||
notify_entry_created(ns->id, MREF(bi->mft_no), name, vnid);
|
notify_entry_created(ns->id, MREF(bi->mft_no), name, vnid);
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
result = errno;
|
result = errno;
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
|
||||||
if (ni)
|
if (ni)
|
||||||
ntfs_inode_close(ni);
|
ntfs_inode_close(ni);
|
||||||
if (bi)
|
if (bi)
|
||||||
@@ -1428,8 +1442,10 @@ exit:
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
fs_rename(fs_volume *_vol, fs_vnode *_odir, const char *oldname, fs_vnode *_ndir, const char *newname)
|
fs_rename(fs_volume *_vol, fs_vnode *_odir, const char *oldname, fs_vnode *_ndir,
|
||||||
|
const char *newname)
|
||||||
{
|
{
|
||||||
nspace *ns = (nspace*)_vol->private_volume;
|
nspace *ns = (nspace*)_vol->private_volume;
|
||||||
vnode *odir = (vnode*)_odir->private_node;
|
vnode *odir = (vnode*)_odir->private_node;
|
||||||
@@ -1444,10 +1460,10 @@ fs_rename(fs_volume *_vol, fs_vnode *_odir, const char *oldname, fs_vnode *_ndir
|
|||||||
ntfs_inode *ndi = NULL;
|
ntfs_inode *ndi = NULL;
|
||||||
ntfs_inode *odi = NULL;
|
ntfs_inode *odi = NULL;
|
||||||
|
|
||||||
ntfschar *unewname = NULL,
|
ntfschar *unewname = NULL;
|
||||||
*uoldname=NULL;
|
ntfschar *uoldname = NULL;
|
||||||
int unewname_len,
|
int unewnameLength;
|
||||||
uoldname_len;
|
int uoldnameLength;
|
||||||
|
|
||||||
status_t result = B_NO_ERROR;
|
status_t result = B_NO_ERROR;
|
||||||
|
|
||||||
@@ -1475,14 +1491,14 @@ fs_rename(fs_volume *_vol, fs_vnode *_odir, const char *oldname, fs_vnode *_ndir
|
|||||||
goto exit;
|
goto exit;
|
||||||
|
|
||||||
// convert names from utf8 to unicode string
|
// convert names from utf8 to unicode string
|
||||||
unewname_len = ntfs_mbstoucs(newname, &unewname);
|
unewnameLength = ntfs_mbstoucs(newname, &unewname);
|
||||||
if (unewname_len < 0) {
|
if (unewnameLength < 0) {
|
||||||
result = EINVAL;
|
result = EINVAL;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
uoldname_len = ntfs_mbstoucs(oldname, &uoldname);
|
uoldnameLength = ntfs_mbstoucs(oldname, &uoldname);
|
||||||
if (uoldname_len < 0) {
|
if (uoldnameLength < 0) {
|
||||||
result = EINVAL;
|
result = EINVAL;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
@@ -1494,7 +1510,7 @@ fs_rename(fs_volume *_vol, fs_vnode *_odir, const char *oldname, fs_vnode *_ndir
|
|||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
ovnid = MREF( ntfs_inode_lookup_by_name(odi, uoldname, uoldname_len) );
|
ovnid = MREF(ntfs_inode_lookup_by_name(odi, uoldname, uoldnameLength));
|
||||||
if (ovnid == (u64) -1) {
|
if (ovnid == (u64) -1) {
|
||||||
result = EINVAL;
|
result = EINVAL;
|
||||||
goto exit;
|
goto exit;
|
||||||
@@ -1505,10 +1521,12 @@ fs_rename(fs_volume *_vol, fs_vnode *_odir, const char *oldname, fs_vnode *_ndir
|
|||||||
goto exit;
|
goto exit;
|
||||||
|
|
||||||
|
|
||||||
if(odir != ndir) { //moving
|
if (odir != ndir) {
|
||||||
|
// moving
|
||||||
ndi = ntfs_inode_open(ns->ntvol, ndir->vnid);
|
ndi = ntfs_inode_open(ns->ntvol, ndir->vnid);
|
||||||
if (ndi != NULL) {
|
if (ndi != NULL) {
|
||||||
nvnid = MREF( ntfs_inode_lookup_by_name(ndi, unewname, unewname_len) );
|
nvnid = MREF(ntfs_inode_lookup_by_name(ndi, unewname,
|
||||||
|
unewnameLength));
|
||||||
if (nvnid != (u64) -1)
|
if (nvnid != (u64) -1)
|
||||||
get_vnode(_vol, nvnid, (void**)&nnode);
|
get_vnode(_vol, nvnid, (void**)&nnode);
|
||||||
}
|
}
|
||||||
@@ -1525,7 +1543,7 @@ fs_rename(fs_volume *_vol, fs_vnode *_odir, const char *oldname, fs_vnode *_ndir
|
|||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ntfs_link(oi, ndi, unewname, unewname_len)) {
|
if (ntfs_link(oi, ndi, unewname, unewnameLength)) {
|
||||||
ntfs_inode_close(oi);
|
ntfs_inode_close(oi);
|
||||||
result = EINVAL;
|
result = EINVAL;
|
||||||
goto exit;
|
goto exit;
|
||||||
@@ -1546,17 +1564,18 @@ fs_rename(fs_volume *_vol, fs_vnode *_odir, const char *oldname, fs_vnode *_ndir
|
|||||||
|
|
||||||
onode->parent_vnid = MREF(ndi->mft_no);
|
onode->parent_vnid = MREF(ndi->mft_no);
|
||||||
|
|
||||||
notify_entry_moved(ns->id, MREF( odi->mft_no ), oldname, MREF( ndi->mft_no ), newname, onode->vnid );
|
notify_entry_moved(ns->id, MREF(odi->mft_no), oldname, MREF(ndi->mft_no),
|
||||||
notify_attribute_changed(ns->id, onode->vnid, "BEOS:TYPE", B_ATTR_CHANGED);
|
newname, onode->vnid);
|
||||||
|
|
||||||
ntfs_delete(oi, odi, uoldname, uoldname_len);
|
ntfs_delete(oi, odi, uoldname, uoldnameLength);
|
||||||
oi = odi = NULL; /* ntfs_delete() always closes ni and dir_ni */
|
oi = odi = NULL;
|
||||||
|
/* ntfs_delete() always closes ni and dir_ni */
|
||||||
|
|
||||||
put_vnode(_vol, onode->vnid);
|
put_vnode(_vol, onode->vnid);
|
||||||
|
} else {
|
||||||
|
// renaming
|
||||||
|
|
||||||
} else { //renaming
|
nvnid = MREF(ntfs_inode_lookup_by_name(odi, unewname, unewnameLength));
|
||||||
|
|
||||||
nvnid = MREF( ntfs_inode_lookup_by_name(odi, unewname, unewname_len) );
|
|
||||||
if (nvnid != (u64) -1)
|
if (nvnid != (u64) -1)
|
||||||
get_vnode(_vol, nvnid, (void**)&nnode);
|
get_vnode(_vol, nvnid, (void**)&nnode);
|
||||||
|
|
||||||
@@ -1572,7 +1591,7 @@ fs_rename(fs_volume *_vol, fs_vnode *_odir, const char *oldname, fs_vnode *_ndir
|
|||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ntfs_link(oi, odi, unewname, unewname_len)) {
|
if (ntfs_link(oi, odi, unewname, unewnameLength)) {
|
||||||
ntfs_inode_close(oi);
|
ntfs_inode_close(oi);
|
||||||
result = EINVAL;
|
result = EINVAL;
|
||||||
goto exit;
|
goto exit;
|
||||||
@@ -1591,18 +1610,18 @@ fs_rename(fs_volume *_vol, fs_vnode *_odir, const char *oldname, fs_vnode *_ndir
|
|||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
notify_entry_moved(ns->id, MREF( odi->mft_no ), oldname, MREF( odi->mft_no ), newname, onode->vnid );
|
notify_entry_moved(ns->id, MREF(odi->mft_no), oldname, MREF(odi->mft_no),
|
||||||
notify_attribute_changed(ns->id, onode->vnid, "BEOS:TYPE", B_ATTR_CHANGED);
|
newname, onode->vnid);
|
||||||
put_vnode(_vol, onode->vnid);
|
put_vnode(_vol, onode->vnid);
|
||||||
|
|
||||||
ntfs_delete(oi, odi, uoldname, uoldname_len);
|
ntfs_delete(oi, odi, uoldname, uoldnameLength);
|
||||||
oi = odi = NULL; /* ntfs_delete() always closes ni and dir_ni */
|
oi = odi = NULL;
|
||||||
|
/* ntfs_delete() always closes ni and dir_ni */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
if(unewname!=NULL)free(unewname);
|
free(unewname);
|
||||||
if(uoldname!=NULL)free(uoldname);
|
free(uoldname);
|
||||||
|
|
||||||
if (odi)
|
if (odi)
|
||||||
ntfs_inode_close(odi);
|
ntfs_inode_close(odi);
|
||||||
@@ -1614,10 +1633,10 @@ exit:
|
|||||||
UNLOCK_VOL(ns);
|
UNLOCK_VOL(ns);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t
|
|
||||||
|
static status_t
|
||||||
do_unlink(fs_volume *_vol, vnode *dir, const char *name, bool isdir)
|
do_unlink(fs_volume *_vol, vnode *dir, const char *name, bool isdir)
|
||||||
{
|
{
|
||||||
nspace *vol = (nspace*)_vol->private_volume;
|
nspace *vol = (nspace*)_vol->private_volume;
|
||||||
@@ -1626,11 +1645,11 @@ do_unlink(fs_volume *_vol, vnode *dir, const char *name, bool isdir)
|
|||||||
ntfs_inode *ni = NULL;
|
ntfs_inode *ni = NULL;
|
||||||
ntfs_inode *bi = NULL;
|
ntfs_inode *bi = NULL;
|
||||||
ntfschar *uname = NULL;
|
ntfschar *uname = NULL;
|
||||||
int uname_len;
|
int unameLength;
|
||||||
status_t result = B_NO_ERROR;
|
status_t result = B_NO_ERROR;
|
||||||
|
|
||||||
uname_len = ntfs_mbstoucs(name, &uname);
|
unameLength = ntfs_mbstoucs(name, &uname);
|
||||||
if (uname_len < 0) {
|
if (unameLength < 0) {
|
||||||
result = EINVAL;
|
result = EINVAL;
|
||||||
goto exit1;
|
goto exit1;
|
||||||
}
|
}
|
||||||
@@ -1641,7 +1660,7 @@ do_unlink(fs_volume *_vol, vnode *dir, const char *name, bool isdir)
|
|||||||
goto exit1;
|
goto exit1;
|
||||||
}
|
}
|
||||||
|
|
||||||
vnid = MREF( ntfs_inode_lookup_by_name(bi, uname, uname_len) );
|
vnid = MREF(ntfs_inode_lookup_by_name(bi, uname, unameLength));
|
||||||
|
|
||||||
if ( vnid == (u64) -1 || vnid == FILE_root) {
|
if ( vnid == (u64) -1 || vnid == FILE_root) {
|
||||||
result = EINVAL;
|
result = EINVAL;
|
||||||
@@ -1650,8 +1669,7 @@ do_unlink(fs_volume *_vol, vnode *dir, const char *name, bool isdir)
|
|||||||
|
|
||||||
result = get_vnode(_vol, vnid, (void**)&node);
|
result = get_vnode(_vol, vnid, (void**)&node);
|
||||||
|
|
||||||
if(result != B_NO_ERROR || node==NULL)
|
if (result != B_NO_ERROR || node==NULL) {
|
||||||
{
|
|
||||||
result = ENOENT;
|
result = ENOENT;
|
||||||
goto exit1;
|
goto exit1;
|
||||||
}
|
}
|
||||||
@@ -1663,7 +1681,7 @@ do_unlink(fs_volume *_vol, vnode *dir, const char *name, bool isdir)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isdir) {
|
if (isdir) {
|
||||||
if (!ni->mrec->flags & MFT_RECORD_IS_DIRECTORY) {
|
if (!(ni->mrec->flags & MFT_RECORD_IS_DIRECTORY)) {
|
||||||
result = ENOTDIR;
|
result = ENOTDIR;
|
||||||
goto exit2;
|
goto exit2;
|
||||||
}
|
}
|
||||||
@@ -1676,7 +1694,8 @@ do_unlink(fs_volume *_vol, vnode *dir, const char *name, bool isdir)
|
|||||||
goto exit2;
|
goto exit2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ntfs_delete(ni, bi, uname, uname_len))
|
// TODO: the file must not be deleted here, only unlinked!
|
||||||
|
if (ntfs_delete(ni, bi, uname, unameLength))
|
||||||
result = errno;
|
result = errno;
|
||||||
|
|
||||||
ni = bi = NULL;
|
ni = bi = NULL;
|
||||||
@@ -1686,15 +1705,14 @@ do_unlink(fs_volume *_vol, vnode *dir, const char *name, bool isdir)
|
|||||||
notify_entry_removed(vol->id, dir->vnid, name, vnid);
|
notify_entry_removed(vol->id, dir->vnid, name, vnid);
|
||||||
|
|
||||||
result = remove_vnode(_vol, vnid);
|
result = remove_vnode(_vol, vnid);
|
||||||
|
|
||||||
exit2:
|
exit2:
|
||||||
put_vnode(_vol, vnid);
|
put_vnode(_vol, vnid);
|
||||||
exit1:
|
exit1:
|
||||||
if(uname!=NULL)
|
|
||||||
free(uname);
|
free(uname);
|
||||||
|
|
||||||
if (ni)
|
if (ni)
|
||||||
ntfs_inode_close(ni);
|
ntfs_inode_close(ni);
|
||||||
|
|
||||||
if (bi)
|
if (bi)
|
||||||
ntfs_inode_close(bi);
|
ntfs_inode_close(bi);
|
||||||
|
|
||||||
@@ -1735,10 +1753,10 @@ fs_rmdir(fs_volume *_vol, fs_vnode *_dir, const char *name)
|
|||||||
|
|
||||||
result = do_unlink(_vol, dir, name, true);
|
result = do_unlink(_vol, dir, name, true);
|
||||||
|
|
||||||
|
// TODO: space must not be freed here, but in fs_remove_vnode()!!!
|
||||||
ntfs_mark_free_space_outdated(ns);
|
ntfs_mark_free_space_outdated(ns);
|
||||||
|
|
||||||
exit1:
|
exit1:
|
||||||
|
|
||||||
ERRPRINT("fs_rmdir - EXIT, result is %s\n", strerror(result));
|
ERRPRINT("fs_rmdir - EXIT, result is %s\n", strerror(result));
|
||||||
|
|
||||||
UNLOCK_VOL(ns);
|
UNLOCK_VOL(ns);
|
||||||
@@ -1780,10 +1798,10 @@ fs_unlink(fs_volume *_vol, fs_vnode *_dir, const char *name)
|
|||||||
|
|
||||||
result = do_unlink(_vol, dir, name, false);
|
result = do_unlink(_vol, dir, name, false);
|
||||||
|
|
||||||
|
// TODO: space must not be freed here, but in fs_remove_vnode()!!!
|
||||||
ntfs_mark_free_space_outdated(ns);
|
ntfs_mark_free_space_outdated(ns);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
|
||||||
ERRPRINT("fs_unlink - EXIT, result is %s\n", strerror(result));
|
ERRPRINT("fs_unlink - EXIT, result is %s\n", strerror(result));
|
||||||
|
|
||||||
UNLOCK_VOL(ns);
|
UNLOCK_VOL(ns);
|
||||||
|
|||||||
@@ -19,9 +19,8 @@
|
|||||||
* file COPYING); if not, write to the Free Software Foundation,Inc., 59 Temple
|
* file COPYING); if not, write to the Free Software Foundation,Inc., 59 Temple
|
||||||
* Place, Suite 330, Boston, MA 02111-1307 USA
|
* Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
#ifndef NTFS_FS_FUNC_H
|
||||||
#ifndef _fs_FUNC_H_
|
#define NTFS_FS_FUNC_H
|
||||||
#define _fs_FUNC_H_
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@@ -42,52 +41,68 @@
|
|||||||
#include "lock.h"
|
#include "lock.h"
|
||||||
#include "volume_util.h"
|
#include "volume_util.h"
|
||||||
|
|
||||||
#define FS_DIR_MODE S_IFDIR | S_IRUSR | S_IRGRP | S_IROTH | S_IWUSR | S_IWGRP | S_IWOTH
|
#define FS_DIR_MODE S_IFDIR | S_IRUSR | S_IRGRP | S_IROTH | S_IWUSR | \
|
||||||
#define FS_FILE_MODE S_IFREG | S_IRUSR | S_IRGRP | S_IROTH | S_IWUSR | S_IWGRP | S_IWOTH
|
S_IWGRP | S_IWOTH
|
||||||
#define FS_SLNK_MODE S_IFLNK | S_IRUSR | S_IRGRP | S_IROTH | S_IWUSR | S_IWGRP | S_IWOTH
|
#define FS_FILE_MODE S_IFREG | S_IRUSR | S_IRGRP | S_IROTH | S_IWUSR | \
|
||||||
|
S_IWGRP | S_IWOTH
|
||||||
|
#define FS_SLNK_MODE S_IFLNK | S_IRUSR | S_IRGRP | S_IROTH | S_IWUSR | \
|
||||||
|
S_IWGRP | S_IWOTH
|
||||||
|
|
||||||
|
|
||||||
extern fs_vnode_ops gNTFSVnodeOps;
|
extern fs_vnode_ops gNTFSVnodeOps;
|
||||||
extern fs_volume_ops gNTFSVolumeOps;
|
extern fs_volume_ops gNTFSVolumeOps;
|
||||||
|
|
||||||
|
|
||||||
float fs_identify_partition(int fd, partition_data *partition, void **_cookie);
|
float fs_identify_partition(int fd, partition_data *partition,
|
||||||
|
void **_cookie);
|
||||||
status_t fs_scan_partition(int fd, partition_data *partition, void *_cookie);
|
status_t fs_scan_partition(int fd, partition_data *partition, void *_cookie);
|
||||||
void fs_free_identify_partition_cookie(partition_data *partition, void *_cookie);
|
void fs_free_identify_partition_cookie(partition_data *partition,
|
||||||
|
void *_cookie);
|
||||||
|
|
||||||
status_t fs_mount(fs_volume *_vol, const char *device, ulong flags, const char *args, ino_t *vnid);
|
status_t fs_mount(fs_volume *_vol, const char *device, ulong flags,
|
||||||
status_t fs_create_symlink(fs_volume *volume, fs_vnode *dir, const char *name, const char *target, int mode);
|
const char *args, ino_t *vnid);
|
||||||
status_t fs_create(fs_volume *volume, fs_vnode *dir, const char *name, int omode, int perms, void **_cookie, ino_t *_vnid);
|
status_t fs_create_symlink(fs_volume *volume, fs_vnode *dir, const char *name,
|
||||||
status_t fs_walk(fs_volume *_vol, fs_vnode *_dir, const char *file, ino_t *vnid);
|
const char *target, int mode);
|
||||||
status_t fs_get_vnode_name(fs_volume *volume, fs_vnode *vnode, char *buffer, size_t bufferSize);
|
status_t fs_create(fs_volume *volume, fs_vnode *dir, const char *name,
|
||||||
|
int omode, int perms, void **_cookie, ino_t *_vnid);
|
||||||
|
status_t fs_walk(fs_volume *_vol, fs_vnode *_dir, const char *file,
|
||||||
|
ino_t *vnid);
|
||||||
|
status_t fs_get_vnode_name(fs_volume *volume, fs_vnode *vnode, char *buffer,
|
||||||
|
size_t bufferSize);
|
||||||
status_t fs_unmount(fs_volume *_vol);
|
status_t fs_unmount(fs_volume *_vol);
|
||||||
status_t fs_rfsstat(fs_volume *_vol, struct fs_info *);
|
status_t fs_rfsstat(fs_volume *_vol, struct fs_info *);
|
||||||
status_t fs_wfsstat(fs_volume *_vol, const struct fs_info *fss, uint32 mask);
|
status_t fs_wfsstat(fs_volume *_vol, const struct fs_info *fss, uint32 mask);
|
||||||
status_t fs_sync(fs_volume *_vol);
|
status_t fs_sync(fs_volume *_vol);
|
||||||
status_t fs_read_vnode(fs_volume *_vol, ino_t vnid, fs_vnode *_node, int *_type, uint32 *_flags, bool reenter);
|
status_t fs_read_vnode(fs_volume *_vol, ino_t vnid, fs_vnode *_node,
|
||||||
|
int *_type, uint32 *_flags, bool reenter);
|
||||||
status_t fs_write_vnode(fs_volume *volume, fs_vnode *vnode, bool reenter);
|
status_t fs_write_vnode(fs_volume *volume, fs_vnode *vnode, bool reenter);
|
||||||
status_t fs_remove_vnode(fs_volume *volume, fs_vnode *vnode, bool reenter);
|
status_t fs_remove_vnode(fs_volume *volume, fs_vnode *vnode, bool reenter);
|
||||||
status_t fs_access(fs_volume *volume, fs_vnode *vnode, int mode);
|
status_t fs_access(fs_volume *volume, fs_vnode *vnode, int mode);
|
||||||
status_t fs_rstat(fs_volume *volume, fs_vnode *vnode, struct stat *st);
|
status_t fs_rstat(fs_volume *volume, fs_vnode *vnode, struct stat *st);
|
||||||
status_t fs_wstat(fs_volume *volume, fs_vnode *vnode, const struct stat *st, uint32 mask);
|
status_t fs_wstat(fs_volume *volume, fs_vnode *vnode, const struct stat *st,
|
||||||
status_t fs_open(fs_volume *volume, fs_vnode *vnode, int omode, void **cookie);
|
uint32 mask);
|
||||||
|
status_t fs_open(fs_volume *volume, fs_vnode *vnode, int omode,
|
||||||
|
void **cookie);
|
||||||
status_t fs_close(fs_volume *volume, fs_vnode *vnode, void *cookie);
|
status_t fs_close(fs_volume *volume, fs_vnode *vnode, void *cookie);
|
||||||
status_t fs_free_cookie(fs_volume *volume, fs_vnode *vnode, void *cookie);
|
status_t fs_free_cookie(fs_volume *volume, fs_vnode *vnode, void *cookie);
|
||||||
status_t fs_read(fs_volume *volume, fs_vnode *vnode, void *cookie, off_t pos, void *buf, size_t *len);
|
status_t fs_read(fs_volume *volume, fs_vnode *vnode, void *cookie, off_t pos,
|
||||||
status_t fs_write(fs_volume *volume, fs_vnode *vnode, void *cookie, off_t pos, const void *buf, size_t *len);
|
void *buf, size_t *len);
|
||||||
status_t fs_mkdir(fs_volume *volume, fs_vnode *parent, const char *name, int perms);
|
status_t fs_write(fs_volume *volume, fs_vnode *vnode, void *cookie, off_t pos,
|
||||||
|
const void *buf, size_t *len);
|
||||||
|
status_t fs_mkdir(fs_volume *volume, fs_vnode *parent, const char *name,
|
||||||
|
int perms);
|
||||||
status_t fs_rmdir(fs_volume *volume, fs_vnode *parent, const char *name);
|
status_t fs_rmdir(fs_volume *volume, fs_vnode *parent, const char *name);
|
||||||
status_t fs_opendir(fs_volume *volume, fs_vnode *vnode, void** cookie);
|
status_t fs_opendir(fs_volume *volume, fs_vnode *vnode, void** cookie);
|
||||||
status_t fs_readdir(fs_volume *volume, fs_vnode *vnode, void *_cookie, struct dirent *buf, size_t bufsize, uint32 *num );
|
status_t fs_readdir(fs_volume *volume, fs_vnode *vnode, void *_cookie,
|
||||||
|
struct dirent *buf, size_t bufsize, uint32 *num);
|
||||||
status_t fs_rewinddir(fs_volume *volume, fs_vnode *vnode, void *cookie);
|
status_t fs_rewinddir(fs_volume *volume, fs_vnode *vnode, void *cookie);
|
||||||
status_t fs_closedir(fs_volume *volume, fs_vnode *vnode, void *cookie);
|
status_t fs_closedir(fs_volume *volume, fs_vnode *vnode, void *cookie);
|
||||||
status_t fs_free_dircookie(fs_volume *volume, fs_vnode *vnode, void *cookie);
|
status_t fs_free_dircookie(fs_volume *volume, fs_vnode *vnode, void *cookie);
|
||||||
status_t fs_readlink(fs_volume *volume, fs_vnode *link, char *buf, size_t *bufsize);
|
status_t fs_readlink(fs_volume *volume, fs_vnode *link, char *buf,
|
||||||
|
size_t *bufsize);
|
||||||
status_t fs_fsync(fs_volume *_vol, fs_vnode *_node);
|
status_t fs_fsync(fs_volume *_vol, fs_vnode *_node);
|
||||||
status_t fs_rename(fs_volume *volume, fs_vnode *fromDir, const char *fromName, fs_vnode *toDir, const char *toName);
|
status_t fs_rename(fs_volume *volume, fs_vnode *fromDir, const char *fromName,
|
||||||
|
fs_vnode *toDir, const char *toName);
|
||||||
status_t fs_unlink(fs_volume *volume, fs_vnode *dir, const char *name);
|
status_t fs_unlink(fs_volume *volume, fs_vnode *dir, const char *name);
|
||||||
|
|
||||||
|
#endif // NTFS_FS_FUNC_H
|
||||||
status_t do_unlink(fs_volume *volume, vnode *dir, const char *name, bool isdir);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
Reference in New Issue
Block a user