FAT: More miscellaneous cleanup.
* Remove __RO__ hack inherited from BeOS sample code. * Remove and excise unneeded macros. * Remove readlink, VFS will return EINVAL in its absence anyway.
This commit is contained in:
@@ -40,8 +40,6 @@ dosfs_open_attrdir(fs_volume *_vol, fs_vnode *_node, void **_cookie)
|
||||
{
|
||||
nspace *vol = (nspace *)_vol->private_volume;
|
||||
|
||||
TOUCH(_node);
|
||||
|
||||
DPRINTF(0, ("dosfs_open_attrdir called\n"));
|
||||
|
||||
RecursiveLocker lock(vol->vlock);
|
||||
@@ -60,8 +58,6 @@ dosfs_close_attrdir(fs_volume *_vol, fs_vnode *_node, void *_cookie)
|
||||
{
|
||||
nspace *vol = (nspace *)_vol->private_volume;
|
||||
|
||||
TOUCH(_node);
|
||||
|
||||
DPRINTF(0, ("dosfs_close_attrdir called\n"));
|
||||
|
||||
RecursiveLocker lock(vol->vlock);
|
||||
@@ -75,8 +71,6 @@ dosfs_close_attrdir(fs_volume *_vol, fs_vnode *_node, void *_cookie)
|
||||
status_t
|
||||
dosfs_free_attrdir_cookie(fs_volume *_vol, fs_vnode *_node, void *_cookie)
|
||||
{
|
||||
TOUCH(_vol); TOUCH(_node);
|
||||
|
||||
DPRINTF(0, ("dosfs_free_attrcookie called\n"));
|
||||
|
||||
if (_cookie == NULL) {
|
||||
@@ -94,8 +88,6 @@ dosfs_free_attrdir_cookie(fs_volume *_vol, fs_vnode *_node, void *_cookie)
|
||||
status_t
|
||||
dosfs_rewind_attrdir(fs_volume *_vol, fs_vnode *_node, void *_cookie)
|
||||
{
|
||||
TOUCH(_vol); TOUCH(_node);
|
||||
|
||||
DPRINTF(0, ("dosfs_rewind_attrdir called\n"));
|
||||
|
||||
if (_cookie == NULL) {
|
||||
@@ -116,8 +108,6 @@ dosfs_read_attrdir(fs_volume *_vol, fs_vnode *_node, void *_cookie,
|
||||
vnode *node = (vnode *)_node->private_node;
|
||||
int32 *cookie = (int32 *)_cookie;
|
||||
|
||||
TOUCH(bufsize);
|
||||
|
||||
DPRINTF(0, ("dosfs_read_attrdir called\n"));
|
||||
|
||||
*num = 0;
|
||||
|
||||
@@ -1084,18 +1084,6 @@ dosfs_access(fs_volume *_vol, fs_vnode *_node, int mode)
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
dosfs_readlink(fs_volume *_vol, fs_vnode *_node, char *buf, size_t *bufsize)
|
||||
{
|
||||
TOUCH(_vol); TOUCH(_node); TOUCH(buf); TOUCH(bufsize);
|
||||
|
||||
// no links in fat...
|
||||
DPRINTF(0, ("dosfs_readlink called\n"));
|
||||
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
dosfs_opendir(fs_volume *_vol, fs_vnode *_node, void **_cookie)
|
||||
{
|
||||
@@ -1218,11 +1206,9 @@ dosfs_rewinddir(fs_volume *_vol, fs_vnode *_node, void* _cookie)
|
||||
status_t
|
||||
dosfs_closedir(fs_volume *_vol, fs_vnode *_node, void *_cookie)
|
||||
{
|
||||
TOUCH(_vol); TOUCH(_node); TOUCH(_cookie);
|
||||
|
||||
DPRINTF(0, ("dosfs_closedir called\n"));
|
||||
|
||||
return 0;
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -30,8 +30,6 @@ status_t dosfs_read_vnode(fs_volume *_vol, ino_t vnid, fs_vnode *_node,
|
||||
status_t dosfs_walk(fs_volume *_vol, fs_vnode *_dir, const char *file,
|
||||
ino_t *_vnid);
|
||||
status_t dosfs_access(fs_volume *_vol, fs_vnode *_node, int mode);
|
||||
status_t dosfs_readlink(fs_volume *_vol, fs_vnode *_node, char *buf,
|
||||
size_t *bufsize);
|
||||
status_t dosfs_opendir(fs_volume *_vol, fs_vnode *_node, void **cookie);
|
||||
status_t dosfs_readdir(fs_volume *_vol, fs_vnode *_node, void *cookie,
|
||||
struct dirent *buf, size_t bufsize, uint32 *num);
|
||||
|
||||
@@ -425,10 +425,6 @@ volume_init(int fd, uint8* buf,
|
||||
DPRINTF(0, ("volume label [%s] (%" B_PRIu32 ")\n", vol->vol_label,
|
||||
vol->vol_entry));
|
||||
|
||||
// steal a trick from bfs
|
||||
if (!memcmp(vol->vol_label, "__RO__ ", 11))
|
||||
vol->flags |= B_FS_IS_READONLY;
|
||||
|
||||
return vol;
|
||||
|
||||
error:
|
||||
@@ -453,7 +449,7 @@ volume_count_free_cluster(nspace *vol)
|
||||
if (vol->flags & B_FS_IS_READONLY)
|
||||
vol->free_clusters = 0;
|
||||
else {
|
||||
uint32 free_count, last_allocated;
|
||||
uint32 free_count = 0, last_allocated = 0;
|
||||
err = get_fsinfo(vol, &free_count, &last_allocated);
|
||||
if (err >= 0) {
|
||||
if (free_count < vol->total_clusters)
|
||||
@@ -646,10 +642,6 @@ mount_fat_disk(const char *path, fs_volume *_vol, const int flags,
|
||||
DPRINTF(0, ("volume label [%s] (%" B_PRIu32 ")\n", vol->vol_label,
|
||||
vol->vol_entry));
|
||||
|
||||
// steal a trick from bfs
|
||||
if (!memcmp(vol->vol_label, "__RO__ ", 11))
|
||||
vol->flags |= B_FS_IS_READONLY;
|
||||
|
||||
*newVol = vol;
|
||||
return B_NO_ERROR;
|
||||
|
||||
@@ -819,14 +811,7 @@ dosfs_mount(fs_volume *_vol, const char *device, uint32 flags,
|
||||
unload_driver_settings(handle);
|
||||
}
|
||||
|
||||
/* args is a command line option; dosfs doesn't use any so
|
||||
we can ignore these arguments */
|
||||
TOUCH(args);
|
||||
|
||||
#if __RO__
|
||||
// make it read-only
|
||||
flags |= 1;
|
||||
#endif
|
||||
/* args is a command line option; dosfs doesn't use any so we can ignore it */
|
||||
|
||||
// Try and mount volume as a FAT volume
|
||||
if ((result = mount_fat_disk(device, _vol, flags, &vol, fs_flags,
|
||||
@@ -1032,9 +1017,8 @@ dosfs_write_fs_stat(fs_volume *_vol, const struct fs_info * fss, uint32 mask)
|
||||
|
||||
DPRINTF(0, ("dosfs_write_fs_stat called\n"));
|
||||
|
||||
/* if it's a r/o file system and not the special hack, then don't allow
|
||||
* volume renaming */
|
||||
if ((vol->flags & B_FS_IS_READONLY) && memcmp(vol->vol_label, "__RO__ ", 11))
|
||||
/* if it's a r/o file system, then don't allow volume renaming */
|
||||
if ((vol->flags & B_FS_IS_READONLY) == 0)
|
||||
return EROFS;
|
||||
|
||||
if (mask & FS_WRITE_FSINFO_NAME) {
|
||||
@@ -1310,7 +1294,7 @@ fs_vnode_ops gFATVnodeOps = {
|
||||
NULL, // fs_deselect
|
||||
&dosfs_fsync,
|
||||
|
||||
&dosfs_readlink,
|
||||
NULL,
|
||||
NULL, // fs_create_symlink,
|
||||
|
||||
NULL, // fs_link,
|
||||
|
||||
@@ -12,10 +12,6 @@
|
||||
//#define DEBUG 1
|
||||
|
||||
|
||||
#define LOCK(l) recursive_lock_lock(&l);
|
||||
#define UNLOCK(l) recursive_lock_unlock(&l);
|
||||
|
||||
|
||||
/* Unfortunately, ino_t's are defined as signed. This causes problems with
|
||||
* programs (notably cp) that use the modulo of a ino_t as a
|
||||
* hash function to index an array. This means the high bit of every ino_t
|
||||
@@ -165,8 +161,6 @@ typedef struct _nspace {
|
||||
#define FS_FLAGS_OP_SYNC 0x1
|
||||
#define FS_FLAGS_LOCK_DOOR 0x2
|
||||
|
||||
#define TOUCH(x) ((void)(x))
|
||||
|
||||
extern fs_vnode_ops gFATVnodeOps;
|
||||
extern fs_volume_ops gFATVolumeOps;
|
||||
|
||||
|
||||
@@ -120,8 +120,6 @@ dosfs_release_vnode(fs_volume *_vol, fs_vnode *_node, bool reenter)
|
||||
nspace *vol = (nspace *)_vol->private_volume;
|
||||
vnode *node = (vnode *)_node->private_node;
|
||||
|
||||
TOUCH(reenter);
|
||||
|
||||
if (node != NULL) {
|
||||
DPRINTF(0, ("dosfs_release_vnode (ino_t %" B_PRIdINO ")\n", node->vnid));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user