* changed ERRPRINT macros to ERROR and TRACE
* ntfs log handler wasn't included for Haiku, it should be used to set up a log handler. * style fix git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41081 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -35,7 +35,7 @@ set_mime(vnode *node, const char *filename)
|
|||||||
struct ext_mime *p;
|
struct ext_mime *p;
|
||||||
int32 namelen, ext_len;
|
int32 namelen, ext_len;
|
||||||
|
|
||||||
ERRPRINT("set_mime - for [%s]\n", filename);
|
TRACE("set_mime - for [%s]\n", filename);
|
||||||
|
|
||||||
node->mime = NULL;
|
node->mime = NULL;
|
||||||
|
|
||||||
@@ -71,7 +71,7 @@ fs_open_attrib_dir(fs_volume *_vol, fs_vnode *_node, void **_cookie)
|
|||||||
|
|
||||||
status_t result = B_NO_ERROR;
|
status_t result = B_NO_ERROR;
|
||||||
|
|
||||||
ERRPRINT("%s - ENTER\n", __FUNCTION__);
|
TRACE("%s - ENTER\n", __FUNCTION__);
|
||||||
|
|
||||||
LOCK_VOL(ns);
|
LOCK_VOL(ns);
|
||||||
|
|
||||||
@@ -106,7 +106,7 @@ exit:
|
|||||||
if (ni)
|
if (ni)
|
||||||
ntfs_inode_close(ni);
|
ntfs_inode_close(ni);
|
||||||
|
|
||||||
ERRPRINT("%s - EXIT, result is %s\n", __FUNCTION__, strerror(result));
|
TRACE("%s - EXIT, result is %s\n", __FUNCTION__, strerror(result));
|
||||||
|
|
||||||
UNLOCK_VOL(ns);
|
UNLOCK_VOL(ns);
|
||||||
|
|
||||||
@@ -148,7 +148,7 @@ fs_rewind_attrib_dir(fs_volume *_vol, fs_vnode *_node, void *_cookie)
|
|||||||
attrdircookie *cookie = (attrdircookie *)_cookie;
|
attrdircookie *cookie = (attrdircookie *)_cookie;
|
||||||
status_t result = B_NO_ERROR;
|
status_t result = B_NO_ERROR;
|
||||||
|
|
||||||
ERRPRINT("%s - ENTER\n", __FUNCTION__);
|
TRACE("%s - ENTER\n", __FUNCTION__);
|
||||||
|
|
||||||
LOCK_VOL(ns);
|
LOCK_VOL(ns);
|
||||||
|
|
||||||
@@ -162,7 +162,7 @@ fs_rewind_attrib_dir(fs_volume *_vol, fs_vnode *_node, void *_cookie)
|
|||||||
|
|
||||||
//exit:
|
//exit:
|
||||||
|
|
||||||
ERRPRINT("%s - EXIT, result is %s\n", __FUNCTION__, strerror(result));
|
TRACE("%s - EXIT, result is %s\n", __FUNCTION__, strerror(result));
|
||||||
|
|
||||||
UNLOCK_VOL(ns);
|
UNLOCK_VOL(ns);
|
||||||
|
|
||||||
@@ -186,7 +186,7 @@ fs_read_attrib_dir(fs_volume *_vol, fs_vnode *_node, void *_cookie,
|
|||||||
|
|
||||||
LOCK_VOL(ns);
|
LOCK_VOL(ns);
|
||||||
|
|
||||||
ERRPRINT("%s - ENTER\n", __FUNCTION__);
|
TRACE("%s - ENTER\n", __FUNCTION__);
|
||||||
|
|
||||||
|
|
||||||
while (!(result = ntfs_attrs_walk(cookie->ctx))) {
|
while (!(result = ntfs_attrs_walk(cookie->ctx))) {
|
||||||
@@ -220,7 +220,7 @@ fs_read_attrib_dir(fs_volume *_vol, fs_vnode *_node, void *_cookie,
|
|||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
|
||||||
ERRPRINT("%s - EXIT, result is %s, *num %d\n", __FUNCTION__,
|
TRACE("%s - EXIT, result is %s, *num %d\n", __FUNCTION__,
|
||||||
strerror(result), *num);
|
strerror(result), *num);
|
||||||
|
|
||||||
UNLOCK_VOL(ns);
|
UNLOCK_VOL(ns);
|
||||||
@@ -247,7 +247,7 @@ fs_create_attrib(fs_volume *_vol, fs_vnode *_node, const char* name,
|
|||||||
ntfs_attr *na = NULL;
|
ntfs_attr *na = NULL;
|
||||||
status_t result = B_NO_ERROR;
|
status_t result = B_NO_ERROR;
|
||||||
|
|
||||||
ERRPRINT("%s - ENTER\n", __FUNCTION__);
|
TRACE("%s - ENTER\n", __FUNCTION__);
|
||||||
|
|
||||||
LOCK_VOL(ns);
|
LOCK_VOL(ns);
|
||||||
|
|
||||||
@@ -259,7 +259,7 @@ fs_create_attrib(fs_volume *_vol, fs_vnode *_node, const char* name,
|
|||||||
ni = ntfs_inode_open(ns->ntvol, node->vnid);
|
ni = ntfs_inode_open(ns->ntvol, node->vnid);
|
||||||
if (ni == NULL) {
|
if (ni == NULL) {
|
||||||
result = errno;
|
result = errno;
|
||||||
ERRPRINT("%s - inode_open: %s\n", __FUNCTION__, strerror(result));
|
ERROR("%s - inode_open: %s\n", __FUNCTION__, strerror(result));
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -274,28 +274,28 @@ fs_create_attrib(fs_volume *_vol, fs_vnode *_node, const char* name,
|
|||||||
ulen = ntfs_mbstoucs(name, &uname);
|
ulen = ntfs_mbstoucs(name, &uname);
|
||||||
if (ulen < 0) {
|
if (ulen < 0) {
|
||||||
result = EILSEQ;
|
result = EILSEQ;
|
||||||
ERRPRINT("%s - mb alloc: %s\n", __FUNCTION__, strerror(result));
|
ERROR("%s - mb alloc: %s\n", __FUNCTION__, strerror(result));
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
na = ntfs_attr_open(ni, AT_DATA, uname, ulen);
|
na = ntfs_attr_open(ni, AT_DATA, uname, ulen);
|
||||||
if (na) {
|
if (na) {
|
||||||
result = EEXIST;
|
result = EEXIST;
|
||||||
ERRPRINT("%s - ntfs_attr_open: %s\n", __FUNCTION__,
|
ERROR("%s - ntfs_attr_open: %s\n", __FUNCTION__,
|
||||||
strerror(result));
|
strerror(result));
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
if (ntfs_non_resident_attr_record_add(ni, AT_DATA, uname, ulen, 0, 32,
|
if (ntfs_non_resident_attr_record_add(ni, AT_DATA, uname, ulen, 0, 32,
|
||||||
0) < 0) {
|
0) < 0) {
|
||||||
result = errno;
|
result = errno;
|
||||||
ERRPRINT("%s - ntfs_non_resident_attr_record_add: %s\n",
|
ERROR("%s - ntfs_non_resident_attr_record_add: %s\n",
|
||||||
__FUNCTION__, strerror(result));
|
__FUNCTION__, strerror(result));
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
na = ntfs_attr_open(ni, AT_DATA, uname, ulen);
|
na = ntfs_attr_open(ni, AT_DATA, uname, ulen);
|
||||||
if (!na) {
|
if (!na) {
|
||||||
result = errno;
|
result = errno;
|
||||||
ERRPRINT("%s - ntfs_attr_open: %s\n", __FUNCTION__,
|
ERROR("%s - ntfs_attr_open: %s\n", __FUNCTION__,
|
||||||
strerror(result));
|
strerror(result));
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
@@ -324,7 +324,7 @@ exit:
|
|||||||
if (ni)
|
if (ni)
|
||||||
ntfs_inode_close(ni);
|
ntfs_inode_close(ni);
|
||||||
|
|
||||||
ERRPRINT("%s - EXIT, result is %s\n", __FUNCTION__, strerror(result));
|
TRACE("%s - EXIT, result is %s\n", __FUNCTION__, strerror(result));
|
||||||
|
|
||||||
UNLOCK_VOL(ns);
|
UNLOCK_VOL(ns);
|
||||||
|
|
||||||
@@ -345,7 +345,7 @@ fs_open_attrib(fs_volume *_vol, fs_vnode *_node, const char *name,
|
|||||||
ntfs_attr *na = NULL;
|
ntfs_attr *na = NULL;
|
||||||
status_t result = B_NO_ERROR;
|
status_t result = B_NO_ERROR;
|
||||||
|
|
||||||
ERRPRINT("%s - ENTER\n", __FUNCTION__);
|
TRACE("%s - ENTER\n", __FUNCTION__);
|
||||||
|
|
||||||
LOCK_VOL(ns);
|
LOCK_VOL(ns);
|
||||||
|
|
||||||
@@ -409,7 +409,7 @@ exit:
|
|||||||
if (ni)
|
if (ni)
|
||||||
ntfs_inode_close(ni);
|
ntfs_inode_close(ni);
|
||||||
|
|
||||||
ERRPRINT("%s - EXIT, result is %s\n", __FUNCTION__, strerror(result));
|
TRACE("%s - EXIT, result is %s\n", __FUNCTION__, strerror(result));
|
||||||
|
|
||||||
UNLOCK_VOL(ns);
|
UNLOCK_VOL(ns);
|
||||||
|
|
||||||
@@ -492,7 +492,7 @@ fs_read_attrib(fs_volume *_vol, fs_vnode *_node, void *_cookie, off_t pos,
|
|||||||
|
|
||||||
LOCK_VOL(ns);
|
LOCK_VOL(ns);
|
||||||
|
|
||||||
ERRPRINT("%s - ENTER\n", __FUNCTION__);
|
TRACE("%s - ENTER\n", __FUNCTION__);
|
||||||
|
|
||||||
// it is a named stream
|
// it is a named stream
|
||||||
if (na) {
|
if (na) {
|
||||||
@@ -525,7 +525,7 @@ fs_read_attrib(fs_volume *_vol, fs_vnode *_node, void *_cookie, off_t pos,
|
|||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
|
||||||
ERRPRINT("%s - EXIT, result is %s\n", __FUNCTION__, strerror(result));
|
TRACE("%s - EXIT, result is %s\n", __FUNCTION__, strerror(result));
|
||||||
|
|
||||||
UNLOCK_VOL(ns);
|
UNLOCK_VOL(ns);
|
||||||
|
|
||||||
@@ -546,9 +546,9 @@ fs_write_attrib(fs_volume *_vol, fs_vnode *_node, void *_cookie,off_t pos,
|
|||||||
int total = 0;
|
int total = 0;
|
||||||
status_t result = B_NO_ERROR;
|
status_t result = B_NO_ERROR;
|
||||||
|
|
||||||
ERRPRINT("%s - ENTER!!\n", __FUNCTION__);
|
TRACE("%s - ENTER!!\n", __FUNCTION__);
|
||||||
if (ns->flags & B_FS_IS_READONLY) {
|
if (ns->flags & B_FS_IS_READONLY) {
|
||||||
ERRPRINT("ntfs is read-only\n");
|
ERROR("ntfs is read-only\n");
|
||||||
return EROFS;
|
return EROFS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -560,7 +560,7 @@ fs_write_attrib(fs_volume *_vol, fs_vnode *_node, void *_cookie,off_t pos,
|
|||||||
|
|
||||||
LOCK_VOL(ns);
|
LOCK_VOL(ns);
|
||||||
|
|
||||||
ERRPRINT("%s - ENTER\n", __FUNCTION__);
|
TRACE("%s - ENTER\n", __FUNCTION__);
|
||||||
|
|
||||||
// it is a named stream
|
// it is a named stream
|
||||||
if (na) {
|
if (na) {
|
||||||
@@ -578,10 +578,10 @@ fs_write_attrib(fs_volume *_vol, fs_vnode *_node, void *_cookie,off_t pos,
|
|||||||
while (size) {
|
while (size) {
|
||||||
off_t bytesWritten = ntfs_attr_pwrite(na, pos, size, buffer);
|
off_t bytesWritten = ntfs_attr_pwrite(na, pos, size, buffer);
|
||||||
if (bytesWritten < (s64)size)
|
if (bytesWritten < (s64)size)
|
||||||
ERRPRINT("%s - ntfs_attr_pwrite returned less bytes than "
|
ERROR("%s - ntfs_attr_pwrite returned less bytes than "
|
||||||
"requested.\n", __FUNCTION__);
|
"requested.\n", __FUNCTION__);
|
||||||
if (bytesWritten <= 0) {
|
if (bytesWritten <= 0) {
|
||||||
ERRPRINT(("%s - ntfs_attr_pwrite()<=0\n", __FUNCTION__));
|
ERROR(("%s - ntfs_attr_pwrite()<=0\n", __FUNCTION__));
|
||||||
*_length = 0;
|
*_length = 0;
|
||||||
result = EINVAL;
|
result = EINVAL;
|
||||||
goto exit;
|
goto exit;
|
||||||
@@ -603,7 +603,7 @@ fs_write_attrib(fs_volume *_vol, fs_vnode *_node, void *_cookie,off_t pos,
|
|||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
|
||||||
ERRPRINT("%s - EXIT, result is %s\n", __FUNCTION__, strerror(result));
|
TRACE("%s - EXIT, result is %s\n", __FUNCTION__, strerror(result));
|
||||||
|
|
||||||
UNLOCK_VOL(ns);
|
UNLOCK_VOL(ns);
|
||||||
|
|
||||||
|
|||||||
@@ -119,31 +119,43 @@ fs_identify_partition(int fd, partition_data *partition, void **_cookie)
|
|||||||
char devpath[256];
|
char devpath[256];
|
||||||
|
|
||||||
// read in the boot sector
|
// read in the boot sector
|
||||||
ERRPRINT("fs_identify_partition: read in the boot sector\n");
|
TRACE("fs_identify_partition: read in the boot sector\n");
|
||||||
if (read_pos(fd, 0, (void*)&boot, 512) != 512)
|
if (read_pos(fd, 0, (void*)&boot, 512) != 512) {
|
||||||
|
ERROR("fs_identify_partition: couldn't read boot sector\n");
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
// 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) {
|
||||||
|
ERROR("fs_identify_partition: boot signature doesn't match\n");
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
// check boot signature NTFS
|
// check boot signature NTFS
|
||||||
if (memcmp(buf + 3, "NTFS ", 8) != 0)
|
if (memcmp(buf + 3, "NTFS ", 8) != 0) {
|
||||||
|
ERROR("fs_identify_partition: boot signature NTFS doesn't match\n");
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
// 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)) {
|
||||||
|
ERROR("fs_identify_partition: couldn't get path for device\n");
|
||||||
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) {
|
||||||
|
ERROR("fs_identify_partition: mount failed\n");
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
// allocate identify_cookie
|
// allocate identify_cookie
|
||||||
cookie = (identify_cookie *)malloc(sizeof(identify_cookie));
|
cookie = (identify_cookie *)malloc(sizeof(identify_cookie));
|
||||||
if (!cookie)
|
if (!cookie) {
|
||||||
|
ERROR("fs_identify_partition: cookie allocation failed\n");
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
memcpy(&cookie->boot, &boot, 512);
|
memcpy(&cookie->boot, &boot, 512);
|
||||||
|
|
||||||
@@ -193,7 +205,7 @@ fs_mount(fs_volume *_vol, const char *device, ulong flags, const char *args,
|
|||||||
unsigned long mountFlags = 0;
|
unsigned long mountFlags = 0;
|
||||||
status_t result = B_NO_ERROR;
|
status_t result = B_NO_ERROR;
|
||||||
|
|
||||||
ERRPRINT("fs_mount - ENTER\n");
|
TRACE("fs_mount - ENTER\n");
|
||||||
|
|
||||||
ns = ntfs_malloc(sizeof(nspace));
|
ns = ntfs_malloc(sizeof(nspace));
|
||||||
if (!ns) {
|
if (!ns) {
|
||||||
@@ -262,7 +274,7 @@ fs_mount(fs_volume *_vol, const char *device, ulong flags, const char *args,
|
|||||||
}
|
}
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
ERRPRINT("fs_mount - EXIT, result code is %s\n", strerror(result));
|
ERROR("fs_mount - EXIT, result code is %s\n", strerror(result));
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -274,7 +286,7 @@ fs_unmount(fs_volume *_vol)
|
|||||||
nspace *ns = (nspace*)_vol->private_volume;
|
nspace *ns = (nspace*)_vol->private_volume;
|
||||||
status_t result = B_NO_ERROR;
|
status_t result = B_NO_ERROR;
|
||||||
|
|
||||||
ERRPRINT("fs_unmount - ENTER\n");
|
TRACE("fs_unmount - ENTER\n");
|
||||||
|
|
||||||
ntfs_umount(ns->ntvol, true);
|
ntfs_umount(ns->ntvol, true);
|
||||||
|
|
||||||
@@ -282,7 +294,7 @@ fs_unmount(fs_volume *_vol)
|
|||||||
|
|
||||||
free(ns);
|
free(ns);
|
||||||
|
|
||||||
ERRPRINT("fs_unmount - EXIT, result is %s\n", strerror(result));
|
TRACE("fs_unmount - EXIT, result is %s\n", strerror(result));
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -296,7 +308,7 @@ fs_rfsstat(fs_volume *_vol, struct fs_info *fss)
|
|||||||
|
|
||||||
LOCK_VOL(ns);
|
LOCK_VOL(ns);
|
||||||
|
|
||||||
ERRPRINT("fs_rfsstat - ENTER\n");
|
TRACE("fs_rfsstat - ENTER\n");
|
||||||
|
|
||||||
ntfs_calc_free_space(ns);
|
ntfs_calc_free_space(ns);
|
||||||
|
|
||||||
@@ -322,7 +334,7 @@ fs_rfsstat(fs_volume *_vol, struct fs_info *fss)
|
|||||||
|
|
||||||
strcpy(fss->fsh_name, "NTFS");
|
strcpy(fss->fsh_name, "NTFS");
|
||||||
|
|
||||||
ERRPRINT("fs_rfsstat - EXIT\n");
|
TRACE("fs_rfsstat - EXIT\n");
|
||||||
|
|
||||||
UNLOCK_VOL(ns);
|
UNLOCK_VOL(ns);
|
||||||
|
|
||||||
@@ -337,7 +349,7 @@ fs_wfsstat(fs_volume *_vol, const struct fs_info *fss, uint32 mask)
|
|||||||
status_t result = B_NO_ERROR;
|
status_t result = B_NO_ERROR;
|
||||||
|
|
||||||
if (ns->flags & B_FS_IS_READONLY) {
|
if (ns->flags & B_FS_IS_READONLY) {
|
||||||
ERRPRINT("ntfs is read-only\n");
|
ERROR("ntfs is read-only\n");
|
||||||
return EROFS;
|
return EROFS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -368,7 +380,7 @@ fs_walk(fs_volume *_vol, fs_vnode *_dir, const char *file, ino_t *vnid)
|
|||||||
|
|
||||||
LOCK_VOL(ns);
|
LOCK_VOL(ns);
|
||||||
|
|
||||||
ERRPRINT("fs_walk - ENTER : find for \"%s\"\n",file);
|
TRACE("fs_walk - ENTER : find for \"%s\"\n",file);
|
||||||
|
|
||||||
if (ns == NULL || _dir == NULL || file == NULL || vnid == NULL) {
|
if (ns == NULL || _dir == NULL || file == NULL || vnid == NULL) {
|
||||||
result = EINVAL;
|
result = EINVAL;
|
||||||
@@ -398,7 +410,7 @@ fs_walk(fs_volume *_vol, fs_vnode *_dir, const char *file, ino_t *vnid)
|
|||||||
}
|
}
|
||||||
|
|
||||||
*vnid = MREF(ntfs_inode_lookup_by_name(bi, unicode, len));
|
*vnid = MREF(ntfs_inode_lookup_by_name(bi, unicode, len));
|
||||||
ERRPRINT("fs_walk - VNID = %d\n",*vnid);
|
TRACE("fs_walk - VNID = %d\n",*vnid);
|
||||||
|
|
||||||
ntfs_inode_close(bi);
|
ntfs_inode_close(bi);
|
||||||
|
|
||||||
@@ -415,7 +427,7 @@ 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));
|
TRACE("fs_walk - EXIT, result is %s\n", strerror(result));
|
||||||
|
|
||||||
if (unicode)
|
if (unicode)
|
||||||
free(unicode);
|
free(unicode);
|
||||||
@@ -478,7 +490,7 @@ fs_read_vnode(fs_volume *_vol, ino_t vnid, fs_vnode *_node, int *_type,
|
|||||||
if (!reenter)
|
if (!reenter)
|
||||||
LOCK_VOL(ns);
|
LOCK_VOL(ns);
|
||||||
|
|
||||||
ERRPRINT("fs_read_vnode - ENTER\n");
|
TRACE("fs_read_vnode - ENTER\n");
|
||||||
|
|
||||||
_node->private_node = NULL;
|
_node->private_node = NULL;
|
||||||
_node->ops = &gNTFSVnodeOps;
|
_node->ops = &gNTFSVnodeOps;
|
||||||
@@ -524,7 +536,7 @@ exit:
|
|||||||
if (result != B_OK && newNode != NULL)
|
if (result != B_OK && newNode != NULL)
|
||||||
free(newNode);
|
free(newNode);
|
||||||
|
|
||||||
ERRPRINT("fs_read_vnode - EXIT, result is %s\n", strerror(result));
|
TRACE("fs_read_vnode - EXIT, result is %s\n", strerror(result));
|
||||||
|
|
||||||
if (!reenter)
|
if (!reenter)
|
||||||
UNLOCK_VOL(ns);
|
UNLOCK_VOL(ns);
|
||||||
@@ -543,11 +555,11 @@ fs_write_vnode(fs_volume *_vol, fs_vnode *_node, bool reenter)
|
|||||||
if (!reenter)
|
if (!reenter)
|
||||||
LOCK_VOL(ns);
|
LOCK_VOL(ns);
|
||||||
|
|
||||||
ERRPRINT("fs_write_vnode - ENTER (%Ld)\n", node->vnid);
|
TRACE("fs_write_vnode - ENTER (%Ld)\n", node->vnid);
|
||||||
|
|
||||||
free(node);
|
free(node);
|
||||||
|
|
||||||
ERRPRINT("fs_write_vnode - EXIT\n");
|
TRACE("fs_write_vnode - EXIT\n");
|
||||||
|
|
||||||
if (!reenter)
|
if (!reenter)
|
||||||
UNLOCK_VOL(ns);
|
UNLOCK_VOL(ns);
|
||||||
@@ -567,11 +579,11 @@ fs_remove_vnode(fs_volume *_vol, fs_vnode *_node, bool reenter)
|
|||||||
if (!reenter)
|
if (!reenter)
|
||||||
LOCK_VOL(ns);
|
LOCK_VOL(ns);
|
||||||
|
|
||||||
ERRPRINT("fs_remove_vnode - ENTER (%Ld)\n", node->vnid);
|
TRACE("fs_remove_vnode - ENTER (%Ld)\n", node->vnid);
|
||||||
|
|
||||||
free(node);
|
free(node);
|
||||||
|
|
||||||
ERRPRINT("fs_remove_vnode - EXIT, result is %s\n", strerror(result));
|
TRACE("fs_remove_vnode - EXIT, result is %s\n", strerror(result));
|
||||||
|
|
||||||
if (!reenter)
|
if (!reenter)
|
||||||
UNLOCK_VOL(ns);
|
UNLOCK_VOL(ns);
|
||||||
@@ -591,7 +603,7 @@ fs_rstat(fs_volume *_vol, fs_vnode *_node, struct stat *stbuf)
|
|||||||
|
|
||||||
LOCK_VOL(ns);
|
LOCK_VOL(ns);
|
||||||
|
|
||||||
ERRPRINT("fs_rstat - ENTER:\n");
|
TRACE("fs_rstat - ENTER:\n");
|
||||||
|
|
||||||
if (ns == NULL || node == NULL || stbuf == NULL) {
|
if (ns == NULL || node == NULL || stbuf == NULL) {
|
||||||
result = ENOENT;
|
result = ENOENT;
|
||||||
@@ -670,7 +682,7 @@ exit:
|
|||||||
if (ni)
|
if (ni)
|
||||||
ntfs_inode_close(ni);
|
ntfs_inode_close(ni);
|
||||||
|
|
||||||
ERRPRINT("fs_rstat - EXIT, result is %s\n", strerror(result));
|
TRACE("fs_rstat - EXIT, result is %s\n", strerror(result));
|
||||||
|
|
||||||
UNLOCK_VOL(ns);
|
UNLOCK_VOL(ns);
|
||||||
|
|
||||||
@@ -688,7 +700,7 @@ fs_wstat(fs_volume *_vol, fs_vnode *_node, const struct stat *st, uint32 mask)
|
|||||||
|
|
||||||
LOCK_VOL(ns);
|
LOCK_VOL(ns);
|
||||||
|
|
||||||
ERRPRINT("fs_wstat: ENTER\n");
|
TRACE("fs_wstat: ENTER\n");
|
||||||
|
|
||||||
ni = ntfs_inode_open(ns->ntvol, node->vnid);
|
ni = ntfs_inode_open(ns->ntvol, node->vnid);
|
||||||
if (ni == NULL) {
|
if (ni == NULL) {
|
||||||
@@ -697,7 +709,7 @@ 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);
|
TRACE("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;
|
||||||
@@ -718,7 +730,7 @@ 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");
|
TRACE("fs_wstat: setting modification time\n");
|
||||||
|
|
||||||
ni->last_access_time = timespec2ntfs(st->st_atim);
|
ni->last_access_time = timespec2ntfs(st->st_atim);
|
||||||
ni->last_data_change_time = timespec2ntfs(st->st_mtim);
|
ni->last_data_change_time = timespec2ntfs(st->st_mtim);
|
||||||
@@ -731,7 +743,7 @@ exit:
|
|||||||
if (ni)
|
if (ni)
|
||||||
ntfs_inode_close(ni);
|
ntfs_inode_close(ni);
|
||||||
|
|
||||||
ERRPRINT("fs_wstat: EXIT with (%s)\n", strerror(result));
|
TRACE("fs_wstat: EXIT with (%s)\n", strerror(result));
|
||||||
|
|
||||||
UNLOCK_VOL(ns);
|
UNLOCK_VOL(ns);
|
||||||
|
|
||||||
@@ -746,9 +758,9 @@ fs_sync(fs_volume *_vol)
|
|||||||
|
|
||||||
LOCK_VOL(ns);
|
LOCK_VOL(ns);
|
||||||
|
|
||||||
ERRPRINT("fs_sync - ENTER\n");
|
TRACE("fs_sync - ENTER\n");
|
||||||
|
|
||||||
ERRPRINT("fs_sync - EXIT\n");
|
TRACE("fs_sync - EXIT\n");
|
||||||
|
|
||||||
UNLOCK_VOL(ns);
|
UNLOCK_VOL(ns);
|
||||||
|
|
||||||
@@ -766,7 +778,7 @@ fs_fsync(fs_volume *_vol, fs_vnode *_node)
|
|||||||
|
|
||||||
LOCK_VOL(ns);
|
LOCK_VOL(ns);
|
||||||
|
|
||||||
ERRPRINT("fs_fsync: ENTER\n");
|
TRACE("fs_fsync: ENTER\n");
|
||||||
|
|
||||||
if (ns == NULL || node == NULL) {
|
if (ns == NULL || node == NULL) {
|
||||||
result = ENOENT;
|
result = ENOENT;
|
||||||
@@ -785,7 +797,7 @@ exit:
|
|||||||
if (ni)
|
if (ni)
|
||||||
ntfs_inode_close(ni);
|
ntfs_inode_close(ni);
|
||||||
|
|
||||||
ERRPRINT("fs_fsync: EXIT\n");
|
TRACE("fs_fsync: EXIT\n");
|
||||||
|
|
||||||
UNLOCK_VOL(ns);
|
UNLOCK_VOL(ns);
|
||||||
|
|
||||||
@@ -803,7 +815,7 @@ fs_open(fs_volume *_vol, fs_vnode *_node, int omode, void **_cookie)
|
|||||||
ntfs_attr *na = NULL;
|
ntfs_attr *na = NULL;
|
||||||
status_t result = B_NO_ERROR;
|
status_t result = B_NO_ERROR;
|
||||||
|
|
||||||
ERRPRINT("fs_open - ENTER\n");
|
TRACE("fs_open - ENTER\n");
|
||||||
|
|
||||||
LOCK_VOL(ns);
|
LOCK_VOL(ns);
|
||||||
|
|
||||||
@@ -842,7 +854,7 @@ exit:
|
|||||||
if (ni)
|
if (ni)
|
||||||
ntfs_inode_close(ni);
|
ntfs_inode_close(ni);
|
||||||
|
|
||||||
ERRPRINT("fs_open - EXIT\n");
|
TRACE("fs_open - EXIT\n");
|
||||||
|
|
||||||
UNLOCK_VOL(ns);
|
UNLOCK_VOL(ns);
|
||||||
|
|
||||||
@@ -866,13 +878,13 @@ fs_create(fs_volume *_vol, fs_vnode *_dir, const char *name, int omode,
|
|||||||
int unameLength;
|
int unameLength;
|
||||||
|
|
||||||
if (ns->flags & B_FS_IS_READONLY) {
|
if (ns->flags & B_FS_IS_READONLY) {
|
||||||
ERRPRINT("ntfs is read-only\n");
|
ERROR("ntfs is read-only\n");
|
||||||
return EROFS;
|
return EROFS;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOCK_VOL(ns);
|
LOCK_VOL(ns);
|
||||||
|
|
||||||
ERRPRINT("fs_create - ENTER: name=%s\n", name);
|
TRACE("fs_create - ENTER: name=%s\n", name);
|
||||||
|
|
||||||
if (_vol == NULL || _dir == NULL) {
|
if (_vol == NULL || _dir == NULL) {
|
||||||
result = EINVAL;
|
result = EINVAL;
|
||||||
@@ -967,7 +979,7 @@ exit:
|
|||||||
if (bi)
|
if (bi)
|
||||||
ntfs_inode_close(bi);
|
ntfs_inode_close(bi);
|
||||||
|
|
||||||
ERRPRINT("fs_create - EXIT, result is %s\n", strerror(result));
|
TRACE("fs_create - EXIT, result is %s\n", strerror(result));
|
||||||
|
|
||||||
UNLOCK_VOL(ns);
|
UNLOCK_VOL(ns);
|
||||||
|
|
||||||
@@ -989,7 +1001,7 @@ fs_read(fs_volume *_vol, fs_vnode *_dir, void *_cookie, off_t offset, void *buf,
|
|||||||
|
|
||||||
LOCK_VOL(ns);
|
LOCK_VOL(ns);
|
||||||
|
|
||||||
ERRPRINT("fs_read - ENTER\n");
|
TRACE("fs_read - ENTER\n");
|
||||||
|
|
||||||
ni = ntfs_inode_open(ns->ntvol, node->vnid);
|
ni = ntfs_inode_open(ns->ntvol, node->vnid);
|
||||||
if (ni == NULL) {
|
if (ni == NULL) {
|
||||||
@@ -999,7 +1011,7 @@ fs_read(fs_volume *_vol, fs_vnode *_dir, void *_cookie, off_t offset, void *buf,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ni->mrec->flags & MFT_RECORD_IS_DIRECTORY) {
|
if (ni->mrec->flags & MFT_RECORD_IS_DIRECTORY) {
|
||||||
ERRPRINT(("ntfs_read called on directory.\n"));
|
TRACE("ntfs_read called on directory.\n");
|
||||||
*len = 0;
|
*len = 0;
|
||||||
result = EISDIR;
|
result = EISDIR;
|
||||||
goto exit2;
|
goto exit2;
|
||||||
@@ -1049,7 +1061,7 @@ exit2:
|
|||||||
|
|
||||||
UNLOCK_VOL(ns);
|
UNLOCK_VOL(ns);
|
||||||
|
|
||||||
ERRPRINT("fs_read - EXIT, result is %s\n", strerror(result));
|
TRACE("fs_read - EXIT, result is %s\n", strerror(result));
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -1069,13 +1081,13 @@ fs_write(fs_volume *_vol, fs_vnode *_dir, void *_cookie, off_t offset,
|
|||||||
status_t result = B_OK;
|
status_t result = B_OK;
|
||||||
|
|
||||||
if (ns->flags & B_FS_IS_READONLY) {
|
if (ns->flags & B_FS_IS_READONLY) {
|
||||||
ERRPRINT("ntfs is read-only\n");
|
ERROR("ntfs is read-only\n");
|
||||||
return EROFS;
|
return EROFS;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOCK_VOL(ns);
|
LOCK_VOL(ns);
|
||||||
|
|
||||||
ERRPRINT("fs_write - ENTER, offset=%lld, len=%ld\n", offset, *len);
|
TRACE("fs_write - ENTER, offset=%lld, len=%ld\n", offset, *len);
|
||||||
|
|
||||||
ni = ntfs_inode_open(ns->ntvol, node->vnid);
|
ni = ntfs_inode_open(ns->ntvol, node->vnid);
|
||||||
if (ni == NULL) {
|
if (ni == NULL) {
|
||||||
@@ -1085,14 +1097,14 @@ fs_write(fs_volume *_vol, fs_vnode *_dir, void *_cookie, off_t offset,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ni->mrec->flags & MFT_RECORD_IS_DIRECTORY) {
|
if (ni->mrec->flags & MFT_RECORD_IS_DIRECTORY) {
|
||||||
ERRPRINT(("fs_write - called on directory.\n"));
|
ERROR("fs_write - called on directory.\n");
|
||||||
*len = 0;
|
*len = 0;
|
||||||
result = EISDIR;
|
result = EISDIR;
|
||||||
goto exit2;
|
goto exit2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (offset < 0) {
|
if (offset < 0) {
|
||||||
ERRPRINT(("fs_write - offset < 0.\n"));
|
ERROR("fs_write - offset < 0.\n");
|
||||||
*len = 0;
|
*len = 0;
|
||||||
result = EINVAL;
|
result = EINVAL;
|
||||||
goto exit2;
|
goto exit2;
|
||||||
@@ -1100,7 +1112,7 @@ fs_write(fs_volume *_vol, fs_vnode *_dir, void *_cookie, off_t offset,
|
|||||||
|
|
||||||
na = ntfs_attr_open(ni, AT_DATA, NULL, 0);
|
na = ntfs_attr_open(ni, AT_DATA, NULL, 0);
|
||||||
if (!na) {
|
if (!na) {
|
||||||
ERRPRINT(("fs_write - ntfs_attr_open()==NULL\n"));
|
ERROR("fs_write - ntfs_attr_open()==NULL\n");
|
||||||
*len = 0;
|
*len = 0;
|
||||||
result = EINVAL;
|
result = EINVAL;
|
||||||
goto exit2;
|
goto exit2;
|
||||||
@@ -1120,11 +1132,11 @@ fs_write(fs_volume *_vol, fs_vnode *_dir, void *_cookie, off_t offset,
|
|||||||
while (size) {
|
while (size) {
|
||||||
off_t bytesWritten = ntfs_attr_pwrite(na, offset, size, buf);
|
off_t bytesWritten = ntfs_attr_pwrite(na, offset, size, buf);
|
||||||
if (bytesWritten < (s64)size) {
|
if (bytesWritten < (s64)size) {
|
||||||
ERRPRINT("fs_write - ntfs_attr_pwrite returned less bytes than "
|
ERROR("fs_write - ntfs_attr_pwrite returned less bytes than "
|
||||||
"requested.\n");
|
"requested.\n");
|
||||||
}
|
}
|
||||||
if (bytesWritten <= 0) {
|
if (bytesWritten <= 0) {
|
||||||
ERRPRINT(("fs_write - ntfs_attr_pwrite()<=0\n"));
|
ERROR("fs_write - ntfs_attr_pwrite()<=0\n");
|
||||||
*len = 0;
|
*len = 0;
|
||||||
result = EINVAL;
|
result = EINVAL;
|
||||||
goto exit;
|
goto exit;
|
||||||
@@ -1138,7 +1150,7 @@ fs_write(fs_volume *_vol, fs_vnode *_dir, void *_cookie, off_t offset,
|
|||||||
if (total > 0)
|
if (total > 0)
|
||||||
fs_ntfs_update_times(_vol, ni, NTFS_UPDATE_MCTIME);
|
fs_ntfs_update_times(_vol, ni, NTFS_UPDATE_MCTIME);
|
||||||
|
|
||||||
ERRPRINT(("fs_write - OK\n"));
|
TRACE("fs_write - OK\n");
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
if (na)
|
if (na)
|
||||||
@@ -1147,7 +1159,7 @@ exit2:
|
|||||||
if (ni)
|
if (ni)
|
||||||
ntfs_inode_close(ni);
|
ntfs_inode_close(ni);
|
||||||
|
|
||||||
ERRPRINT("fs_write - EXIT, result is %s, writed %d bytes\n",
|
TRACE("fs_write - EXIT, result is %s, writed %d bytes\n",
|
||||||
strerror(result), (int)(*len));
|
strerror(result), (int)(*len));
|
||||||
|
|
||||||
UNLOCK_VOL(ns);
|
UNLOCK_VOL(ns);
|
||||||
@@ -1159,9 +1171,9 @@ exit2:
|
|||||||
status_t
|
status_t
|
||||||
fs_close(fs_volume *_vol, fs_vnode *_node, void *cookie)
|
fs_close(fs_volume *_vol, fs_vnode *_node, void *cookie)
|
||||||
{
|
{
|
||||||
ERRPRINT("fs_close - ENTER\n");
|
TRACE("fs_close - ENTER\n");
|
||||||
|
|
||||||
ERRPRINT("fs_close - EXIT\n");
|
TRACE("fs_close - EXIT\n");
|
||||||
return B_NO_ERROR;
|
return B_NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1169,11 +1181,11 @@ fs_close(fs_volume *_vol, fs_vnode *_node, void *cookie)
|
|||||||
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");
|
TRACE("fs_free_cookie - ENTER\n");
|
||||||
|
|
||||||
free(cookie);
|
free(cookie);
|
||||||
|
|
||||||
ERRPRINT("fs_free_cookie - EXIT\n");
|
TRACE("fs_free_cookie - EXIT\n");
|
||||||
return B_NO_ERROR;
|
return B_NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1181,9 +1193,9 @@ fs_free_cookie(fs_volume *_vol, fs_vnode *_node, void *cookie)
|
|||||||
status_t
|
status_t
|
||||||
fs_access(fs_volume *_vol, fs_vnode *_node, int mode)
|
fs_access(fs_volume *_vol, fs_vnode *_node, int mode)
|
||||||
{
|
{
|
||||||
ERRPRINT("fs_access - ENTER\n");
|
TRACE("fs_access - ENTER\n");
|
||||||
|
|
||||||
ERRPRINT("fs_access - EXIT\n");
|
TRACE("fs_access - EXIT\n");
|
||||||
return B_NO_ERROR;
|
return B_NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1202,7 +1214,7 @@ fs_readlink(fs_volume *_vol, fs_vnode *_node, char *buffer, size_t *bufferSize)
|
|||||||
|
|
||||||
LOCK_VOL(ns);
|
LOCK_VOL(ns);
|
||||||
|
|
||||||
ERRPRINT("fs_readlink - ENTER\n");
|
TRACE("fs_readlink - ENTER\n");
|
||||||
|
|
||||||
if (ns == NULL || node == NULL || buffer == NULL || bufferSize == NULL) {
|
if (ns == NULL || node == NULL || buffer == NULL || bufferSize == NULL) {
|
||||||
result = EINVAL;
|
result = EINVAL;
|
||||||
@@ -1262,7 +1274,7 @@ fs_readlink(fs_volume *_vol, fs_vnode *_node, char *buffer, size_t *bufferSize)
|
|||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
ERRPRINT("fs_readlink - LINK:[%s]\n", buffer);
|
TRACE("fs_readlink - LINK:[%s]\n", buffer);
|
||||||
|
|
||||||
strlcpy(buffer, tempBuffer, *bufferSize);
|
strlcpy(buffer, tempBuffer, *bufferSize);
|
||||||
free(tempBuffer);
|
free(tempBuffer);
|
||||||
@@ -1278,7 +1290,7 @@ exit:
|
|||||||
if (ni)
|
if (ni)
|
||||||
ntfs_inode_close(ni);
|
ntfs_inode_close(ni);
|
||||||
|
|
||||||
ERRPRINT("fs_readlink - EXIT, result is %s\n", strerror(result));
|
TRACE("fs_readlink - EXIT, result is %s\n", strerror(result));
|
||||||
|
|
||||||
UNLOCK_VOL(ns);
|
UNLOCK_VOL(ns);
|
||||||
|
|
||||||
@@ -1305,7 +1317,7 @@ fs_create_symlink(fs_volume *_vol, fs_vnode *_dir, const char *name,
|
|||||||
|
|
||||||
LOCK_VOL(ns);
|
LOCK_VOL(ns);
|
||||||
|
|
||||||
ERRPRINT("fs_symlink - ENTER, name=%s, path=%s\n",name, target);
|
TRACE("fs_symlink - ENTER, name=%s, path=%s\n",name, target);
|
||||||
|
|
||||||
if (ns == NULL || dir == NULL || name == NULL || target == NULL) {
|
if (ns == NULL || dir == NULL || name == NULL || target == NULL) {
|
||||||
result = EINVAL;
|
result = EINVAL;
|
||||||
@@ -1357,7 +1369,7 @@ fs_create_symlink(fs_volume *_vol, fs_vnode *_dir, const char *name,
|
|||||||
result = publish_vnode(_vol, MREF(sym->mft_no), symnode, &gNTFSVnodeOps,
|
result = publish_vnode(_vol, MREF(sym->mft_no), symnode, &gNTFSVnodeOps,
|
||||||
S_IFLNK | fmode, 0);
|
S_IFLNK | fmode, 0);
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
ERRPRINT("fs_symlink - new_vnode failed for vnid %Ld: %s\n",
|
ERROR("fs_symlink - new_vnode failed for vnid %Ld: %s\n",
|
||||||
MREF(sym->mft_no), strerror(result));
|
MREF(sym->mft_no), strerror(result));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1373,7 +1385,7 @@ exit:
|
|||||||
if (bi)
|
if (bi)
|
||||||
ntfs_inode_close(bi);
|
ntfs_inode_close(bi);
|
||||||
|
|
||||||
ERRPRINT("fs_symlink - EXIT, result is %s\n", strerror(result));
|
TRACE("fs_symlink - EXIT, result is %s\n", strerror(result));
|
||||||
|
|
||||||
UNLOCK_VOL(ns);
|
UNLOCK_VOL(ns);
|
||||||
|
|
||||||
@@ -1395,13 +1407,13 @@ fs_mkdir(fs_volume *_vol, fs_vnode *_dir, const char *name, int perms)
|
|||||||
le32 securid = 0;
|
le32 securid = 0;
|
||||||
|
|
||||||
if (ns->flags & B_FS_IS_READONLY) {
|
if (ns->flags & B_FS_IS_READONLY) {
|
||||||
ERRPRINT("ntfs is read-only\n");
|
ERROR("ntfs is read-only\n");
|
||||||
return EROFS;
|
return EROFS;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOCK_VOL(ns);
|
LOCK_VOL(ns);
|
||||||
|
|
||||||
ERRPRINT("fs_mkdir - ENTER: name=%s\n", name);
|
TRACE("fs_mkdir - ENTER: name=%s\n", name);
|
||||||
|
|
||||||
if (_vol == NULL || _dir == NULL || name == NULL) {
|
if (_vol == NULL || _dir == NULL || name == NULL) {
|
||||||
result = EINVAL;
|
result = EINVAL;
|
||||||
@@ -1458,7 +1470,7 @@ exit:
|
|||||||
if (bi)
|
if (bi)
|
||||||
ntfs_inode_close(bi);
|
ntfs_inode_close(bi);
|
||||||
|
|
||||||
ERRPRINT("fs_mkdir - EXIT, result is %s\n", strerror(result));
|
TRACE("fs_mkdir - EXIT, result is %s\n", strerror(result));
|
||||||
|
|
||||||
UNLOCK_VOL(ns);
|
UNLOCK_VOL(ns);
|
||||||
|
|
||||||
@@ -1493,13 +1505,13 @@ fs_rename(fs_volume *_vol, fs_vnode *_odir, const char *oldname,
|
|||||||
char path[MAX_PATH];
|
char path[MAX_PATH];
|
||||||
|
|
||||||
if (ns->flags & B_FS_IS_READONLY) {
|
if (ns->flags & B_FS_IS_READONLY) {
|
||||||
ERRPRINT("ntfs is read-only\n");
|
ERROR("ntfs is read-only\n");
|
||||||
return EROFS;
|
return EROFS;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOCK_VOL(ns);
|
LOCK_VOL(ns);
|
||||||
|
|
||||||
ERRPRINT("fs_rename - oldname:%s newname:%s\n", oldname, newname);
|
TRACE("fs_rename - oldname:%s newname:%s\n", oldname, newname);
|
||||||
|
|
||||||
// convert names from utf8 to unicode string
|
// convert names from utf8 to unicode string
|
||||||
unewnameLength = ntfs_mbstoucs(newname, &unewname);
|
unewnameLength = ntfs_mbstoucs(newname, &unewname);
|
||||||
@@ -1649,7 +1661,7 @@ exit:
|
|||||||
if (ndi)
|
if (ndi)
|
||||||
ntfs_inode_close(ndi);
|
ntfs_inode_close(ndi);
|
||||||
|
|
||||||
ERRPRINT("fs_rename - EXIT, result is %s\n", strerror(result));
|
TRACE("fs_rename - EXIT, result is %s\n", strerror(result));
|
||||||
|
|
||||||
UNLOCK_VOL(ns);
|
UNLOCK_VOL(ns);
|
||||||
|
|
||||||
@@ -1756,13 +1768,13 @@ fs_rmdir(fs_volume *_vol, fs_vnode *_dir, const char *name)
|
|||||||
status_t result = B_NO_ERROR;
|
status_t result = B_NO_ERROR;
|
||||||
|
|
||||||
if (ns->flags & B_FS_IS_READONLY) {
|
if (ns->flags & B_FS_IS_READONLY) {
|
||||||
ERRPRINT("ntfs is read-only\n");
|
ERROR("ntfs is read-only\n");
|
||||||
return EROFS;
|
return EROFS;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOCK_VOL(ns);
|
LOCK_VOL(ns);
|
||||||
|
|
||||||
ERRPRINT("fs_rmdir - ENTER: name %s\n", name == NULL ? "NULL" : name);
|
TRACE("fs_rmdir - ENTER: name %s\n", name == NULL ? "NULL" : name);
|
||||||
|
|
||||||
if (ns == NULL || dir == NULL || name == NULL) {
|
if (ns == NULL || dir == NULL || name == NULL) {
|
||||||
result = EINVAL;
|
result = EINVAL;
|
||||||
@@ -1780,7 +1792,7 @@ fs_rmdir(fs_volume *_vol, fs_vnode *_dir, const char *name)
|
|||||||
ntfs_mark_free_space_outdated(ns);
|
ntfs_mark_free_space_outdated(ns);
|
||||||
|
|
||||||
exit1:
|
exit1:
|
||||||
ERRPRINT("fs_rmdir - EXIT, result is %s\n", strerror(result));
|
TRACE("fs_rmdir - EXIT, result is %s\n", strerror(result));
|
||||||
|
|
||||||
UNLOCK_VOL(ns);
|
UNLOCK_VOL(ns);
|
||||||
|
|
||||||
@@ -1796,13 +1808,13 @@ fs_unlink(fs_volume *_vol, fs_vnode *_dir, const char *name)
|
|||||||
status_t result = B_NO_ERROR;
|
status_t result = B_NO_ERROR;
|
||||||
|
|
||||||
if (ns->flags & B_FS_IS_READONLY) {
|
if (ns->flags & B_FS_IS_READONLY) {
|
||||||
ERRPRINT("ntfs is read-only\n");
|
ERROR("ntfs is read-only\n");
|
||||||
return EROFS;
|
return EROFS;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOCK_VOL(ns);
|
LOCK_VOL(ns);
|
||||||
|
|
||||||
ERRPRINT("fs_unlink - ENTER: name %s\n", name == NULL ? "NULL" : name);
|
TRACE("fs_unlink - ENTER: name %s\n", name == NULL ? "NULL" : name);
|
||||||
|
|
||||||
if (ns == NULL || dir == NULL || name == NULL) {
|
if (ns == NULL || dir == NULL || name == NULL) {
|
||||||
result = EINVAL;
|
result = EINVAL;
|
||||||
@@ -1820,7 +1832,7 @@ fs_unlink(fs_volume *_vol, fs_vnode *_dir, const char *name)
|
|||||||
ntfs_mark_free_space_outdated(ns);
|
ntfs_mark_free_space_outdated(ns);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
ERRPRINT("fs_unlink - EXIT, result is %s\n", strerror(result));
|
TRACE("fs_unlink - EXIT, result is %s\n", strerror(result));
|
||||||
|
|
||||||
UNLOCK_VOL(ns);
|
UNLOCK_VOL(ns);
|
||||||
|
|
||||||
|
|||||||
@@ -277,7 +277,7 @@ static const char * ntfs_log_get_prefix(u32 level)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __HAIKU__
|
|
||||||
/**
|
/**
|
||||||
* ntfs_log_set_handler - Provide an alternate logging handler
|
* ntfs_log_set_handler - Provide an alternate logging handler
|
||||||
* @handler: function to perform the logging
|
* @handler: function to perform the logging
|
||||||
@@ -296,7 +296,7 @@ void ntfs_log_set_handler(ntfs_log_handler *handler)
|
|||||||
} else
|
} else
|
||||||
ntfs_log.handler = ntfs_log_handler_null;
|
ntfs_log.handler = ntfs_log_handler_null;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ntfs_log_redirect - Pass on the request to the real handler
|
* ntfs_log_redirect - Pass on the request to the real handler
|
||||||
@@ -390,6 +390,7 @@ out:
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef __HAIKU__
|
||||||
/**
|
/**
|
||||||
* ntfs_log_handler_fprintf - Basic logging handler
|
* ntfs_log_handler_fprintf - Basic logging handler
|
||||||
* @function: Function in which the log line occurred
|
* @function: Function in which the log line occurred
|
||||||
@@ -414,9 +415,6 @@ out:
|
|||||||
int ntfs_log_handler_fprintf(const char *function, const char *file,
|
int ntfs_log_handler_fprintf(const char *function, const char *file,
|
||||||
int line, u32 level, void *data, const char *format, va_list args)
|
int line, u32 level, void *data, const char *format, va_list args)
|
||||||
{
|
{
|
||||||
#ifdef __HAIKU__
|
|
||||||
return 0;
|
|
||||||
#else
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
int i;
|
int i;
|
||||||
#endif
|
#endif
|
||||||
@@ -467,9 +465,10 @@ int ntfs_log_handler_fprintf(const char *function, const char *file,
|
|||||||
fflush(stream);
|
fflush(stream);
|
||||||
errno = olderr;
|
errno = olderr;
|
||||||
return ret;
|
return ret;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // __HAIKU__
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ntfs_log_handler_null - Null logging handler (no output)
|
* ntfs_log_handler_null - Null logging handler (no output)
|
||||||
* @function: Function in which the log line occurred
|
* @function: Function in which the log line occurred
|
||||||
@@ -492,6 +491,8 @@ int ntfs_log_handler_null(const char *function __attribute__((unused)), const ch
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef __HAIKU__
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ntfs_log_handler_stdout - All logs go to stdout
|
* ntfs_log_handler_stdout - All logs go to stdout
|
||||||
* @function: Function in which the log line occurred
|
* @function: Function in which the log line occurred
|
||||||
@@ -516,14 +517,10 @@ int ntfs_log_handler_null(const char *function __attribute__((unused)), const ch
|
|||||||
int ntfs_log_handler_stdout(const char *function, const char *file,
|
int ntfs_log_handler_stdout(const char *function, const char *file,
|
||||||
int line, u32 level, void *data, const char *format, va_list args)
|
int line, u32 level, void *data, const char *format, va_list args)
|
||||||
{
|
{
|
||||||
#ifdef __HAIKU__
|
|
||||||
return 0;
|
|
||||||
#else
|
|
||||||
if (!data)
|
if (!data)
|
||||||
data = stdout;
|
data = stdout;
|
||||||
|
|
||||||
return ntfs_log_handler_fprintf(function, file, line, level, data, format, args);
|
return ntfs_log_handler_fprintf(function, file, line, level, data, format, args);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -551,14 +548,10 @@ int ntfs_log_handler_stdout(const char *function, const char *file,
|
|||||||
int ntfs_log_handler_outerr(const char *function, const char *file,
|
int ntfs_log_handler_outerr(const char *function, const char *file,
|
||||||
int line, u32 level, void *data, const char *format, va_list args)
|
int line, u32 level, void *data, const char *format, va_list args)
|
||||||
{
|
{
|
||||||
#ifdef __HAIKU__
|
|
||||||
return 0;
|
|
||||||
#else
|
|
||||||
if (!data)
|
if (!data)
|
||||||
data = ntfs_log_get_stream(level);
|
data = ntfs_log_get_stream(level);
|
||||||
|
|
||||||
return ntfs_log_handler_fprintf(function, file, line, level, data, format, args);
|
return ntfs_log_handler_fprintf(function, file, line, level, data, format, args);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -585,16 +578,14 @@ int ntfs_log_handler_outerr(const char *function, const char *file,
|
|||||||
int ntfs_log_handler_stderr(const char *function, const char *file,
|
int ntfs_log_handler_stderr(const char *function, const char *file,
|
||||||
int line, u32 level, void *data, const char *format, va_list args)
|
int line, u32 level, void *data, const char *format, va_list args)
|
||||||
{
|
{
|
||||||
#ifdef __HAIKU__
|
|
||||||
return 0;
|
|
||||||
#else
|
|
||||||
if (!data)
|
if (!data)
|
||||||
data = stderr;
|
data = stderr;
|
||||||
|
|
||||||
return ntfs_log_handler_fprintf(function, file, line, level, data, format, args);
|
return ntfs_log_handler_fprintf(function, file, line, level, data, format, args);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // __HAIKU__
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ntfs_log_parse_option - Act upon command line options
|
* ntfs_log_parse_option - Act upon command line options
|
||||||
|
|||||||
@@ -54,8 +54,9 @@ extern "C" {
|
|||||||
#include "lock.h"
|
#include "lock.h"
|
||||||
#include "ntfsdir.h"
|
#include "ntfsdir.h"
|
||||||
|
|
||||||
#define ERRPRINT(...) ;
|
#define TRACE(...) ;
|
||||||
//#define ERRPRINT dprintf
|
//#define TRACE dprintf
|
||||||
|
#define ERROR dprintf
|
||||||
|
|
||||||
#define DEV_FD(dev) (*(int *)dev->d_private)
|
#define DEV_FD(dev) (*(int *)dev->d_private)
|
||||||
|
|
||||||
|
|||||||
@@ -75,11 +75,11 @@ fs_free_dircookie(fs_volume *_vol, fs_vnode *vnode, void *cookie)
|
|||||||
nspace *ns = (nspace*)_vol->private_volume;
|
nspace *ns = (nspace*)_vol->private_volume;
|
||||||
|
|
||||||
LOCK_VOL(ns);
|
LOCK_VOL(ns);
|
||||||
ERRPRINT("fs_free_dircookie - ENTER\n");
|
TRACE("fs_free_dircookie - ENTER\n");
|
||||||
if (cookie != NULL)
|
if (cookie != NULL)
|
||||||
free(cookie);
|
free(cookie);
|
||||||
|
|
||||||
ERRPRINT("fs_free_dircookie - EXIT\n");
|
TRACE("fs_free_dircookie - EXIT\n");
|
||||||
|
|
||||||
UNLOCK_VOL(ns);
|
UNLOCK_VOL(ns);
|
||||||
|
|
||||||
@@ -98,7 +98,7 @@ fs_opendir(fs_volume *_vol, fs_vnode *_node, void** _cookie)
|
|||||||
|
|
||||||
LOCK_VOL(ns);
|
LOCK_VOL(ns);
|
||||||
|
|
||||||
ERRPRINT("fs_opendir - ENTER\n");
|
TRACE("fs_opendir - ENTER\n");
|
||||||
|
|
||||||
ni = ntfs_inode_open(ns->ntvol, node->vnid);
|
ni = ntfs_inode_open(ns->ntvol, node->vnid);
|
||||||
if (ni == NULL) {
|
if (ni == NULL) {
|
||||||
@@ -126,7 +126,7 @@ exit:
|
|||||||
if (ni)
|
if (ni)
|
||||||
ntfs_inode_close(ni);
|
ntfs_inode_close(ni);
|
||||||
|
|
||||||
ERRPRINT("fs_opendir - EXIT\n");
|
TRACE("fs_opendir - EXIT\n");
|
||||||
|
|
||||||
UNLOCK_VOL(ns);
|
UNLOCK_VOL(ns);
|
||||||
|
|
||||||
@@ -144,7 +144,7 @@ fs_closedir(fs_volume *_vol, fs_vnode *_node, void *cookie)
|
|||||||
|
|
||||||
LOCK_VOL(ns);
|
LOCK_VOL(ns);
|
||||||
|
|
||||||
ERRPRINT("fs_closedir - ENTER\n");
|
TRACE("fs_closedir - ENTER\n");
|
||||||
|
|
||||||
ni = ntfs_inode_open(ns->ntvol, node->vnid);
|
ni = ntfs_inode_open(ns->ntvol, node->vnid);
|
||||||
if (ni == NULL) {
|
if (ni == NULL) {
|
||||||
@@ -158,7 +158,7 @@ exit:
|
|||||||
if (ni)
|
if (ni)
|
||||||
ntfs_inode_close(ni);
|
ntfs_inode_close(ni);
|
||||||
|
|
||||||
ERRPRINT("fs_closedir - EXIT\n");
|
TRACE("fs_closedir - EXIT\n");
|
||||||
|
|
||||||
UNLOCK_VOL(ns);
|
UNLOCK_VOL(ns);
|
||||||
|
|
||||||
@@ -179,7 +179,8 @@ fs_readdir(fs_volume *_vol, fs_vnode *_node, void *_cookie, struct dirent *buf,
|
|||||||
|
|
||||||
LOCK_VOL(ns);
|
LOCK_VOL(ns);
|
||||||
|
|
||||||
ERRPRINT("fs_readdir - ENTER (sizeof(buf)=%d, bufsize=%d, num=%d\n",sizeof(buf),bufsize,*num);
|
TRACE("fs_readdir - ENTER (sizeof(buf)=%d, bufsize=%d, num=%d\n",
|
||||||
|
sizeof(buf), bufsize, *num);
|
||||||
|
|
||||||
if (!ns || !node || !cookie || !num || bufsize < sizeof(buf)) {
|
if (!ns || !node || !cookie || !num || bufsize < sizeof(buf)) {
|
||||||
result = EINVAL;
|
result = EINVAL;
|
||||||
@@ -193,12 +194,13 @@ fs_readdir(fs_volume *_vol, fs_vnode *_node, void *_cookie, struct dirent *buf,
|
|||||||
|
|
||||||
ni = ntfs_inode_open(ns->ntvol, node->vnid);
|
ni = ntfs_inode_open(ns->ntvol, node->vnid);
|
||||||
if (ni == NULL) {
|
if (ni == NULL) {
|
||||||
ERRPRINT("fs_readdir - dir not opened\n");
|
ERROR("fs_readdir - dir not opened\n");
|
||||||
result = ENOENT;
|
result = ENOENT;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = ntfs_readdir(ni, &cookie->pos, cookie, (ntfs_filldir_t)_ntfs_dirent_filler);
|
result = ntfs_readdir(ni, &cookie->pos, cookie,
|
||||||
|
(ntfs_filldir_t)_ntfs_dirent_filler);
|
||||||
|
|
||||||
realLen = nameLength > 255 ? 255 : nameLength;
|
realLen = nameLength > 255 ? 255 : nameLength;
|
||||||
buf->d_dev = ns->id;
|
buf->d_dev = ns->id;
|
||||||
@@ -211,7 +213,7 @@ fs_readdir(fs_volume *_vol, fs_vnode *_node, void *_cookie, struct dirent *buf,
|
|||||||
|
|
||||||
result = B_NO_ERROR;
|
result = B_NO_ERROR;
|
||||||
|
|
||||||
ERRPRINT("fs_readdir - FILE: [%s]\n",buf->d_name);
|
TRACE("fs_readdir - FILE: [%s]\n",buf->d_name);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
if (ni)
|
if (ni)
|
||||||
@@ -225,7 +227,7 @@ exit:
|
|||||||
if (result == ENOENT)
|
if (result == ENOENT)
|
||||||
result = B_NO_ERROR;
|
result = B_NO_ERROR;
|
||||||
|
|
||||||
ERRPRINT("fs_readdir - EXIT result (%s)\n", strerror(result));
|
TRACE("fs_readdir - EXIT result (%s)\n", strerror(result));
|
||||||
|
|
||||||
UNLOCK_VOL(ns);
|
UNLOCK_VOL(ns);
|
||||||
|
|
||||||
@@ -242,7 +244,7 @@ fs_rewinddir(fs_volume *_vol, fs_vnode *vnode, void *_cookie)
|
|||||||
|
|
||||||
LOCK_VOL(ns);
|
LOCK_VOL(ns);
|
||||||
|
|
||||||
ERRPRINT("fs_rewinddir - ENTER\n");
|
TRACE("fs_rewinddir - ENTER\n");
|
||||||
if (cookie != NULL) {
|
if (cookie != NULL) {
|
||||||
cookie->pos = 0;
|
cookie->pos = 0;
|
||||||
cookie->ino = 0;
|
cookie->ino = 0;
|
||||||
@@ -252,7 +254,7 @@ fs_rewinddir(fs_volume *_vol, fs_vnode *vnode, void *_cookie)
|
|||||||
result = B_NO_ERROR;
|
result = B_NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
ERRPRINT("fs_rewinddir - EXIT, result is %s\n", strerror(result));
|
TRACE("fs_rewinddir - EXIT, result is %s\n", strerror(result));
|
||||||
|
|
||||||
UNLOCK_VOL(ns);
|
UNLOCK_VOL(ns);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user