From d63f4274b665d32065f24a7a01a025578c8a43c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Mon, 18 Oct 2010 18:48:54 +0000 Subject: [PATCH] added a file system call preallocate() as described in #6285, currently unused git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39006 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/os/drivers/fs_interface.h | 2 ++ headers/private/fs_shell/fssh_fs_interface.h | 2 ++ src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp | 1 + src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp | 1 + src/add-ons/kernel/file_systems/ext2/kernel_interface.cpp | 1 + src/add-ons/kernel/file_systems/fat/dosfs.c | 1 + src/add-ons/kernel/file_systems/googlefs/googlefs.c | 1 + src/add-ons/kernel/file_systems/iso9660/kernel_interface.cpp | 1 + .../file_systems/layers/attribute_overlay/attribute_overlay.cpp | 1 + .../kernel/file_systems/layers/log_overlay/log_overlay.cpp | 1 + .../kernel/file_systems/layers/write_overlay/write_overlay.cpp | 1 + src/add-ons/kernel/file_systems/nfs/nfs_add_on.c | 1 + src/add-ons/kernel/file_systems/packagefs/kernel_interface.cpp | 1 + src/add-ons/kernel/file_systems/ramfs/kernel_interface.cpp | 1 + src/add-ons/kernel/file_systems/reiserfs/kernel_interface.cpp | 1 + src/add-ons/kernel/file_systems/udf/kernel_interface.cpp | 1 + .../file_systems/userlandfs/kernel_add_on/kernel_interface.cpp | 1 + 17 files changed, 19 insertions(+) diff --git a/headers/os/drivers/fs_interface.h b/headers/os/drivers/fs_interface.h index f3a13e840f..86ad096eb8 100644 --- a/headers/os/drivers/fs_interface.h +++ b/headers/os/drivers/fs_interface.h @@ -167,6 +167,8 @@ struct fs_vnode_ops { struct stat* stat); status_t (*write_stat)(fs_volume* volume, fs_vnode* vnode, const struct stat* stat, uint32 statMask); + status_t (*preallocate)(fs_volume* volume, fs_vnode* vnode, + off_t pos, off_t length); /* file operations */ status_t (*create)(fs_volume* volume, fs_vnode* dir, const char* name, diff --git a/headers/private/fs_shell/fssh_fs_interface.h b/headers/private/fs_shell/fssh_fs_interface.h index aa5a4bf013..5f23b1d366 100644 --- a/headers/private/fs_shell/fssh_fs_interface.h +++ b/headers/private/fs_shell/fssh_fs_interface.h @@ -185,6 +185,8 @@ struct fssh_fs_vnode_ops { struct fssh_stat *stat); fssh_status_t (*write_stat)(fssh_fs_volume *volume, fssh_fs_vnode *vnode, const struct fssh_stat *stat, uint32_t statMask); + fssh_status_t (*preallocate)(fssh_fs_volume* volume, fssh_fs_vnode* vnode, + fssh_off_t pos, fssh_off_t length); /* file operations */ fssh_status_t (*create)(fssh_fs_volume *volume, fssh_fs_vnode *dir, diff --git a/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp b/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp index 3ad1ec1f7e..20de45e2ce 100644 --- a/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp +++ b/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp @@ -2354,6 +2354,7 @@ fs_vnode_ops gBFSVnodeOps = { &bfs_access, &bfs_read_stat, &bfs_write_stat, + NULL, // fs_preallocate /* file operations */ &bfs_create, diff --git a/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp b/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp index 9487500d06..6f4561dbdd 100644 --- a/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp +++ b/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp @@ -2201,6 +2201,7 @@ fs_vnode_ops gCDDAVnodeOps = { NULL, // fs_access() cdda_read_stat, NULL, // fs_write_stat() + NULL, // fs_preallocate() // file NULL, // fs_create() diff --git a/src/add-ons/kernel/file_systems/ext2/kernel_interface.cpp b/src/add-ons/kernel/file_systems/ext2/kernel_interface.cpp index 37770da5b0..fb2eb0d722 100644 --- a/src/add-ons/kernel/file_systems/ext2/kernel_interface.cpp +++ b/src/add-ons/kernel/file_systems/ext2/kernel_interface.cpp @@ -1648,6 +1648,7 @@ fs_vnode_ops gExt2VnodeOps = { &ext2_access, &ext2_read_stat, &ext2_write_stat, + NULL, // fs_preallocate /* file operations */ &ext2_create, diff --git a/src/add-ons/kernel/file_systems/fat/dosfs.c b/src/add-ons/kernel/file_systems/fat/dosfs.c index 768cd63f5b..0db33eeed3 100644 --- a/src/add-ons/kernel/file_systems/fat/dosfs.c +++ b/src/add-ons/kernel/file_systems/fat/dosfs.c @@ -1351,6 +1351,7 @@ fs_vnode_ops gFATVnodeOps = { &dosfs_access, &dosfs_rstat, &dosfs_wstat, + NULL, // &fs_preallocate, /* file operations */ &dosfs_create, diff --git a/src/add-ons/kernel/file_systems/googlefs/googlefs.c b/src/add-ons/kernel/file_systems/googlefs/googlefs.c index 58b3e32cb0..ca085198cf 100644 --- a/src/add-ons/kernel/file_systems/googlefs/googlefs.c +++ b/src/add-ons/kernel/file_systems/googlefs/googlefs.c @@ -1627,6 +1627,7 @@ static fs_vnode_ops sGoogleFSVnodeOps = { &googlefs_access, &googlefs_rstat, &googlefs_wstat, + NULL, // fs_preallocate /* file operations */ &googlefs_create, diff --git a/src/add-ons/kernel/file_systems/iso9660/kernel_interface.cpp b/src/add-ons/kernel/file_systems/iso9660/kernel_interface.cpp index 51decde7df..abcc8962a5 100644 --- a/src/add-ons/kernel/file_systems/iso9660/kernel_interface.cpp +++ b/src/add-ons/kernel/file_systems/iso9660/kernel_interface.cpp @@ -733,6 +733,7 @@ fs_vnode_ops gISO9660VnodeOps = { &fs_access, &fs_read_stat, NULL, + NULL, /* file */ NULL, diff --git a/src/add-ons/kernel/file_systems/layers/attribute_overlay/attribute_overlay.cpp b/src/add-ons/kernel/file_systems/layers/attribute_overlay/attribute_overlay.cpp index 673e80a611..5e451aae73 100644 --- a/src/add-ons/kernel/file_systems/layers/attribute_overlay/attribute_overlay.cpp +++ b/src/add-ons/kernel/file_systems/layers/attribute_overlay/attribute_overlay.cpp @@ -1679,6 +1679,7 @@ static fs_vnode_ops sOverlayVnodeOps = { &overlay_access, &overlay_read_stat, &overlay_write_stat, + NULL, // fs_preallocate /* file */ &overlay_create, diff --git a/src/add-ons/kernel/file_systems/layers/log_overlay/log_overlay.cpp b/src/add-ons/kernel/file_systems/layers/log_overlay/log_overlay.cpp index 0b9a386051..b710b302ec 100644 --- a/src/add-ons/kernel/file_systems/layers/log_overlay/log_overlay.cpp +++ b/src/add-ons/kernel/file_systems/layers/log_overlay/log_overlay.cpp @@ -715,6 +715,7 @@ static fs_vnode_ops sOverlayVnodeOps = { &overlay_access, &overlay_read_stat, &overlay_write_stat, + NULL, // fs_preallocate /* file */ &overlay_create, diff --git a/src/add-ons/kernel/file_systems/layers/write_overlay/write_overlay.cpp b/src/add-ons/kernel/file_systems/layers/write_overlay/write_overlay.cpp index 129b952bda..5fd8d6c75c 100644 --- a/src/add-ons/kernel/file_systems/layers/write_overlay/write_overlay.cpp +++ b/src/add-ons/kernel/file_systems/layers/write_overlay/write_overlay.cpp @@ -2228,6 +2228,7 @@ static fs_vnode_ops sOverlayVnodeOps = { &overlay_access, &overlay_read_stat, &overlay_write_stat, + NULL, // fs_preallocate /* file */ &overlay_create, diff --git a/src/add-ons/kernel/file_systems/nfs/nfs_add_on.c b/src/add-ons/kernel/file_systems/nfs/nfs_add_on.c index 31898bef57..fb96244531 100644 --- a/src/add-ons/kernel/file_systems/nfs/nfs_add_on.c +++ b/src/add-ons/kernel/file_systems/nfs/nfs_add_on.c @@ -2505,6 +2505,7 @@ fs_vnode_ops sNFSVnodeOps = { &fs_access, &fs_rstat, &fs_wstat, + NULL, // fs_preallocate() /* file operations */ &fs_create, diff --git a/src/add-ons/kernel/file_systems/packagefs/kernel_interface.cpp b/src/add-ons/kernel/file_systems/packagefs/kernel_interface.cpp index 5cc0aec202..efa3291f93 100644 --- a/src/add-ons/kernel/file_systems/packagefs/kernel_interface.cpp +++ b/src/add-ons/kernel/file_systems/packagefs/kernel_interface.cpp @@ -1122,6 +1122,7 @@ fs_vnode_ops gPackageFSVnodeOps = { &packagefs_access, &packagefs_read_stat, NULL, // write_stat, + NULL, // preallocate, // file operations NULL, // create, diff --git a/src/add-ons/kernel/file_systems/ramfs/kernel_interface.cpp b/src/add-ons/kernel/file_systems/ramfs/kernel_interface.cpp index e4e45a53e9..12070b3e02 100644 --- a/src/add-ons/kernel/file_systems/ramfs/kernel_interface.cpp +++ b/src/add-ons/kernel/file_systems/ramfs/kernel_interface.cpp @@ -2100,6 +2100,7 @@ static file_system_module_info sRamFSModuleInfo = { &ramfs_access, &ramfs_read_stat, &ramfs_write_stat, + NULL, // &ramfs_preallocate, /* file operations */ &ramfs_create, diff --git a/src/add-ons/kernel/file_systems/reiserfs/kernel_interface.cpp b/src/add-ons/kernel/file_systems/reiserfs/kernel_interface.cpp index e2b9dcdcc9..0c50e85bc3 100644 --- a/src/add-ons/kernel/file_systems/reiserfs/kernel_interface.cpp +++ b/src/add-ons/kernel/file_systems/reiserfs/kernel_interface.cpp @@ -783,6 +783,7 @@ fs_vnode_ops gReiserFSVnodeOps = { &reiserfs_access, &reiserfs_read_stat, NULL, // &reiserfs_write_stat, + NULL, // &reiserfs_preallocate, /* file operations */ NULL, // &reiserfs_create, diff --git a/src/add-ons/kernel/file_systems/udf/kernel_interface.cpp b/src/add-ons/kernel/file_systems/udf/kernel_interface.cpp index c718e0b072..9a7e42cfa2 100644 --- a/src/add-ons/kernel/file_systems/udf/kernel_interface.cpp +++ b/src/add-ons/kernel/file_systems/udf/kernel_interface.cpp @@ -671,6 +671,7 @@ fs_vnode_ops gUDFVnodeOps = { &udf_access, &udf_read_stat, NULL, // write_stat + NULL, // preallocate /* file operations */ NULL, // create diff --git a/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/kernel_interface.cpp b/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/kernel_interface.cpp index d096b5ccfb..c7eb8c3157 100644 --- a/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/kernel_interface.cpp +++ b/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/kernel_interface.cpp @@ -1209,6 +1209,7 @@ fs_vnode_ops gUserlandFSVnodeOps = { &userlandfs_access, &userlandfs_read_stat, &userlandfs_write_stat, + NULL, // preallocate() // file operations &userlandfs_create,