* Removed write_link from the FS module interface. Adjusted all FS
add-ons accordingly and removed the syscall. * Removed send_notification(). * Reimplemented notify_listener(). It used the unimplemented send_notification(). Now it has a chance to work. Note that notify_listener() is obsolete. I would already have removed it, if there weren't lots of FS implementations still using it (Hint!). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20329 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
5a5aacca23
commit
12d359b85a
@ -115,7 +115,6 @@ typedef struct file_system_module_info {
|
||||
|
||||
status_t (*read_link)(fs_volume fs, fs_vnode link, char *buffer,
|
||||
size_t *_bufferSize);
|
||||
status_t (*write_link)(fs_volume fs, fs_vnode link, char *toPath);
|
||||
status_t (*create_symlink)(fs_volume fs, fs_vnode dir, const char *name,
|
||||
const char *path, int mode);
|
||||
|
||||
@ -269,11 +268,9 @@ extern status_t unremove_vnode(mount_id mountID, vnode_id vnodeID);
|
||||
extern status_t get_vnode_removed(mount_id mountID, vnode_id vnodeID,
|
||||
bool* removed);
|
||||
|
||||
// Deprecated! Will disappear soon!
|
||||
extern status_t notify_listener(int op, mount_id device, vnode_id parentNode,
|
||||
vnode_id toParentNode, vnode_id node, const char *name);
|
||||
extern status_t send_notification(port_id port, long token, ulong what, long op,
|
||||
mount_id device, mount_id toDevice, vnode_id parentNode,
|
||||
vnode_id toParentNode, vnode_id node, const char *name);
|
||||
|
||||
extern status_t notify_entry_created(mount_id device, vnode_id directory,
|
||||
const char *name, vnode_id node);
|
||||
|
@ -149,7 +149,6 @@ extern status_t _kern_create_dir(int fd, const char *path, int perms);
|
||||
extern status_t _kern_remove_dir(int fd, const char *path);
|
||||
extern status_t _kern_read_link(int fd, const char *path, char *buffer,
|
||||
size_t *_bufferSize);
|
||||
extern status_t _kern_write_link(const char *path, const char *toPath);
|
||||
extern status_t _kern_create_symlink(int fd, const char *path,
|
||||
const char *toPath, int mode);
|
||||
extern status_t _kern_create_link(const char *path, const char *toPath);
|
||||
|
@ -2098,7 +2098,6 @@ static file_system_module_info sBeFileSystem = {
|
||||
&bfs_fsync,
|
||||
|
||||
&bfs_read_link,
|
||||
NULL, // write link
|
||||
&bfs_create_symlink,
|
||||
|
||||
&bfs_link,
|
||||
|
@ -1226,7 +1226,6 @@ static file_system_module_info sDosFileSystem = {
|
||||
&dosfs_fsync,
|
||||
|
||||
&dosfs_readlink,
|
||||
NULL, // write link
|
||||
NULL, //&fs_create_symlink,
|
||||
|
||||
NULL, //&fs_link,
|
||||
|
@ -1654,7 +1654,6 @@ static file_system_module_info sGoogleFSModule = {
|
||||
NULL, // &googlefs_fsync
|
||||
|
||||
NULL, // &googlefs_read_link,
|
||||
NULL, // write link
|
||||
NULL, // &googlefs_create_symlink,
|
||||
|
||||
NULL, // &googlefs_link,
|
||||
|
@ -1006,7 +1006,6 @@ static file_system_module_info sISO660FileSystem = {
|
||||
NULL, // &fs_fsync
|
||||
|
||||
&fs_read_link,
|
||||
NULL, // write link
|
||||
NULL, // &fs_create_symlink,
|
||||
|
||||
NULL, // &fs_link,
|
||||
|
@ -2460,7 +2460,6 @@ static file_system_module_info sNFSModule = {
|
||||
NULL, // &fs_fsync
|
||||
|
||||
&fs_readlink,
|
||||
NULL, // &fs_write link,
|
||||
&fs_symlink,
|
||||
|
||||
NULL, // &fs_link,
|
||||
|
@ -138,9 +138,7 @@ static file_system_module_info sNTFSFileSystem = {
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
#else
|
||||
NULL, // write link
|
||||
&fs_create_symlink,
|
||||
NULL, // &fs_link,
|
||||
&fs_unlink,
|
||||
|
@ -1036,7 +1036,6 @@ static file_system_module_info sUserlandFSModuleInfo = {
|
||||
&userlandfs_fsync,
|
||||
|
||||
&userlandfs_read_symlink,
|
||||
NULL, // write link
|
||||
&userlandfs_create_symlink,
|
||||
|
||||
&userlandfs_link,
|
||||
|
@ -13,7 +13,6 @@ KernelMergeObject kernel_fs.o :
|
||||
vfs.cpp
|
||||
vfs_boot.cpp
|
||||
vfs_select.cpp
|
||||
message.c
|
||||
node_monitor.cpp
|
||||
IOScheduler.cpp
|
||||
KPath.cpp
|
||||
|
@ -1890,7 +1890,6 @@ file_system_module_info gDeviceFileSystem = {
|
||||
&devfs_fsync,
|
||||
|
||||
&devfs_read_link,
|
||||
NULL, // write_link
|
||||
NULL, // symlink
|
||||
NULL, // link
|
||||
NULL, // unlink
|
||||
|
@ -1,39 +0,0 @@
|
||||
/*
|
||||
** Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
|
||||
** Distributed under the terms of the OpenBeOS License.
|
||||
*/
|
||||
|
||||
|
||||
#include <KernelExport.h>
|
||||
#include <OS.h>
|
||||
#include <vfs.h>
|
||||
|
||||
|
||||
#define MESSAGE_HEADER 'FOB1'
|
||||
|
||||
/*
|
||||
static void
|
||||
init_message(uint8 **_buffer, uint32 what, uint32 token)
|
||||
{
|
||||
uint32 *header = *_buffer;
|
||||
*header++ = MESSAGE_HEADER;
|
||||
|
||||
*_buffer = (uint8 *)header;
|
||||
}
|
||||
*/
|
||||
|
||||
status_t
|
||||
send_notification(port_id port, long token, ulong what, long op, mount_id device,
|
||||
mount_id toDevice, vnode_id parentNode, vnode_id toParentNode,
|
||||
vnode_id node, const char *name)
|
||||
{
|
||||
// this is currently the BeOS compatible send_notification() function
|
||||
// and will probably stay that way, not yet implemented, though
|
||||
|
||||
dprintf("send_notification(port = %ld, token = %ld, op = %ld, device = %ld, "
|
||||
"node = %Ld, parentNode = %Ld, toParentNode = %Ld, name = \"%s\"\n",
|
||||
port, token, op, device, node, parentNode, toParentNode, name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -687,78 +687,37 @@ status_t
|
||||
notify_listener(int op, mount_id device, vnode_id parentNode, vnode_id toParentNode,
|
||||
vnode_id node, const char *name)
|
||||
{
|
||||
monitor_listener *listener;
|
||||
node_monitor *monitor;
|
||||
|
||||
TRACE(("notify_listener(op = %d, device = %ld, node = %Ld, parent = %Ld, toParent = %Ld"
|
||||
", name = \"%s\"\n", op, device, node, parentNode, toParentNode, name));
|
||||
|
||||
mutex_lock(&gMonitorMutex);
|
||||
switch (op) {
|
||||
case B_ENTRY_CREATED:
|
||||
return notify_entry_created(device, parentNode, name, node);
|
||||
|
||||
// check the main "node"
|
||||
case B_ENTRY_REMOVED:
|
||||
return notify_entry_removed(device, parentNode, name, node);
|
||||
|
||||
if ((op == B_ENTRY_MOVED
|
||||
|| op == B_ENTRY_REMOVED
|
||||
|| op == B_STAT_CHANGED
|
||||
|| op == B_ATTR_CHANGED)
|
||||
&& (monitor = get_monitor_for(device, node)) != NULL) {
|
||||
// iterate over all listeners for this monitor, and see
|
||||
// if we have to send anything
|
||||
listener = NULL;
|
||||
while ((listener = (monitor_listener*)list_get_next_item(
|
||||
&monitor->listeners, listener)) != NULL) {
|
||||
// do we have a reason to notify this listener?
|
||||
if (((listener->flags & B_WATCH_NAME) != 0
|
||||
&& (op == B_ENTRY_MOVED || op == B_ENTRY_REMOVED))
|
||||
|| ((listener->flags & B_WATCH_STAT) != 0
|
||||
&& op == B_STAT_CHANGED)
|
||||
|| ((listener->flags & B_WATCH_ATTR) != 0
|
||||
&& op == B_ATTR_CHANGED)) {
|
||||
// then do it!
|
||||
send_notification(listener->port, listener->token, B_NODE_MONITOR,
|
||||
op, device, 0, parentNode, toParentNode, node, name);
|
||||
}
|
||||
case B_ENTRY_MOVED:
|
||||
// no fromName -- use an empty string
|
||||
return notify_entry_moved(device, parentNode, "", toParentNode,
|
||||
name, node);
|
||||
|
||||
case B_STAT_CHANGED:
|
||||
{
|
||||
// no statFields -- consider all stat fields changed
|
||||
uint32 statFields = B_STAT_MODE | B_STAT_UID | B_STAT_GID
|
||||
| B_STAT_SIZE | B_STAT_ACCESS_TIME | B_STAT_MODIFICATION_TIME
|
||||
| B_STAT_CREATION_TIME | B_STAT_CHANGE_TIME;
|
||||
return notify_stat_changed(device, node, statFields);
|
||||
}
|
||||
|
||||
case B_ATTR_CHANGED:
|
||||
// no cause -- use B_ATTR_CHANGED
|
||||
return notify_attribute_changed(device, node, name, B_ATTR_CHANGED);
|
||||
|
||||
default:
|
||||
return B_BAD_VALUE;
|
||||
}
|
||||
|
||||
// check its parent directory
|
||||
|
||||
if ((op == B_ENTRY_MOVED
|
||||
|| op == B_ENTRY_REMOVED
|
||||
|| op == B_ENTRY_CREATED)
|
||||
&& (monitor = get_monitor_for(device, parentNode)) != NULL) {
|
||||
// iterate over all listeners for this monitor, and see
|
||||
// if we have to send anything
|
||||
listener = NULL;
|
||||
while ((listener = (monitor_listener*)list_get_next_item(
|
||||
&monitor->listeners, listener)) != NULL) {
|
||||
// do we have a reason to notify this listener?
|
||||
if ((listener->flags & B_WATCH_DIRECTORY) != 0) {
|
||||
send_notification(listener->port, listener->token, B_NODE_MONITOR,
|
||||
op, device, 0, parentNode, toParentNode, node, name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// check its new target parent directory
|
||||
|
||||
if (op == B_ENTRY_MOVED
|
||||
&& (monitor = get_monitor_for(device, toParentNode)) != NULL) {
|
||||
// iterate over all listeners for this monitor, and see
|
||||
// if we have to send anything
|
||||
listener = NULL;
|
||||
while ((listener = (monitor_listener*)list_get_next_item(
|
||||
&monitor->listeners, listener)) != NULL) {
|
||||
// do we have a reason to notify this listener?
|
||||
if ((listener->flags & B_WATCH_DIRECTORY) != 0) {
|
||||
send_notification(listener->port, listener->token, B_NODE_MONITOR,
|
||||
B_ENTRY_MOVED, device, 0, parentNode, toParentNode, node, name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mutex_unlock(&gMonitorMutex);
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1724,7 +1724,6 @@ file_system_module_info gPipeFileSystem = {
|
||||
&pipefs_fsync,
|
||||
|
||||
NULL, // fs_read_link()
|
||||
NULL, // fs_write_link()
|
||||
NULL, // fs_symlink()
|
||||
NULL, // fs_link()
|
||||
&pipefs_unlink,
|
||||
|
@ -1066,7 +1066,6 @@ file_system_module_info gRootFileSystem = {
|
||||
&rootfs_fsync,
|
||||
|
||||
&rootfs_read_link,
|
||||
NULL, // fs_write_link()
|
||||
&rootfs_symlink,
|
||||
NULL, // fs_link()
|
||||
&rootfs_unlink,
|
||||
|
@ -4355,27 +4355,6 @@ common_read_link(int fd, char *path, char *buffer, size_t *_bufferSize,
|
||||
}
|
||||
|
||||
|
||||
static status_t
|
||||
common_write_link(char *path, char *toPath, bool kernel)
|
||||
{
|
||||
struct vnode *vnode;
|
||||
status_t status;
|
||||
|
||||
status = path_to_vnode(path, false, &vnode, NULL, kernel);
|
||||
if (status < B_OK)
|
||||
return status;
|
||||
|
||||
if (FS_CALL(vnode, write_link) != NULL)
|
||||
status = FS_CALL(vnode, write_link)(vnode->mount->cookie, vnode->private_node, toPath);
|
||||
else
|
||||
status = EOPNOTSUPP;
|
||||
|
||||
put_vnode(vnode);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
static status_t
|
||||
common_create_symlink(int fd, char *path, const char *toPath, int mode,
|
||||
bool kernel)
|
||||
@ -6210,24 +6189,6 @@ _kern_read_link(int fd, const char *path, char *buffer, size_t *_bufferSize)
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
_kern_write_link(const char *path, const char *toPath)
|
||||
{
|
||||
KPath pathBuffer(path, false, B_PATH_NAME_LENGTH + 1);
|
||||
KPath toPathBuffer(toPath, false, B_PATH_NAME_LENGTH + 1);
|
||||
if (pathBuffer.InitCheck() != B_OK || toPathBuffer.InitCheck() != B_OK)
|
||||
return B_NO_MEMORY;
|
||||
|
||||
char *toBuffer = toPathBuffer.LockBuffer();
|
||||
|
||||
status_t status = check_path(toBuffer);
|
||||
if (status < B_OK)
|
||||
return status;
|
||||
|
||||
return common_write_link(pathBuffer.LockBuffer(), toBuffer, true);
|
||||
}
|
||||
|
||||
|
||||
/** \brief Creates a symlink specified by a FD + path pair.
|
||||
*
|
||||
* \a path must always be specified (it contains the name of the new symlink
|
||||
@ -7071,31 +7032,6 @@ _user_read_link(int fd, const char *userPath, char *userBuffer, size_t *userBuff
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
_user_write_link(const char *userPath, const char *userToPath)
|
||||
{
|
||||
KPath pathBuffer(B_PATH_NAME_LENGTH + 1);
|
||||
KPath toPathBuffer(B_PATH_NAME_LENGTH + 1);
|
||||
if (pathBuffer.InitCheck() != B_OK || toPathBuffer.InitCheck() != B_OK)
|
||||
return B_NO_MEMORY;
|
||||
|
||||
char *path = pathBuffer.LockBuffer();
|
||||
char *toPath = toPathBuffer.LockBuffer();
|
||||
|
||||
if (!IS_USER_ADDRESS(userPath)
|
||||
|| !IS_USER_ADDRESS(userToPath)
|
||||
|| user_strlcpy(path, userPath, B_PATH_NAME_LENGTH) < B_OK
|
||||
|| user_strlcpy(toPath, userToPath, B_PATH_NAME_LENGTH) < B_OK)
|
||||
return B_BAD_ADDRESS;
|
||||
|
||||
status_t status = check_path(toPath);
|
||||
if (status < B_OK)
|
||||
return status;
|
||||
|
||||
return common_write_link(path, toPath, false);
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
_user_create_symlink(int fd, const char *userPath, const char *userToPath,
|
||||
int mode)
|
||||
|
@ -54,6 +54,7 @@ SYSHDRS = $(HAIKU_HDRS) ;
|
||||
fstat=build_platform_fstat
|
||||
read_pos=build_platform_read_pos
|
||||
ioctl=build_platform_ioctl
|
||||
"send_notification\\(...\\)="
|
||||
;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user