Fixes to previous commit.

edge.strict_endians
antona 2006-02-03 23:11:35 +00:00
parent af9fd39611
commit 135282539b
4 changed files with 21 additions and 9 deletions

View File

@ -40,6 +40,7 @@ typedef enum {
ND_Open, /* 1: Device is open. */
ND_ReadOnly, /* 1: Device is read-only. */
ND_Dirty, /* 1: Device is dirty, needs sync. */
ND_Block, /* 1: Device is a block device. */
} ntfs_device_state_bits;
#define test_ndev_flag(nd, flag) test_bit(ND_##flag, (nd)->d_state)
@ -58,6 +59,10 @@ typedef enum {
#define NDevSetDirty(nd) set_ndev_flag(nd, Dirty)
#define NDevClearDirty(nd) clear_ndev_flag(nd, Dirty)
#define NDevBlock(nd) test_ndev_flag(nd, Block)
#define NDevSetBlock(nd) set_ndev_flag(nd, Block)
#define NDevClearBlock(nd) clear_ndev_flag(nd, Block)
/**
* struct ntfs_device -
*

View File

@ -671,7 +671,8 @@ int ntfs_device_sector_size_get(struct ntfs_device *dev)
int sect_size = 0;
if (!dev->d_ops->ioctl(dev, BLKSSZGET, &sect_size)) {
ntfs_log_debug("BLKSSZGET sector size = %d bytes\n", sect_size);
ntfs_log_debug("BLKSSZGET sector size = %d bytes\n",
sect_size);
return sect_size;
}
}
@ -705,13 +706,15 @@ int ntfs_device_block_size_set(struct ntfs_device *dev, int block_size)
size_t s_block_size = block_size;
if (!dev->d_ops->ioctl(dev, BLKBSZSET, &s_block_size)) {
ntfs_log_debug("Used BLKBSZSET to set block size to "
"%d bytes\n", block_size);
"%d bytes.\n", block_size);
return 0;
}
/* If not a block device, pretend it was successful. */
if (!NDevBlock(dev))
return 0;
}
#else
errno = EOPNOTSUPP;
#endif
return -1;
}

View File

@ -79,6 +79,7 @@
static int ntfs_device_unix_io_open(struct ntfs_device *dev, int flags)
{
struct flock flk;
struct stat sbuf;
int err;
if (NDevOpen(dev)) {
@ -116,6 +117,9 @@ static int ntfs_device_unix_io_open(struct ntfs_device *dev, int flags)
"close %s", dev->d_name);
goto err_out;
}
/* Determine if device is a block device or not, ignoring errors. */
if (!fstat(DEV_FD(dev), &sbuf) && S_ISBLK(sbuf.st_mode))
NDevSetBlock(dev);
/* Set our open flag. */
NDevSetOpen(dev);
return 0;
@ -317,4 +321,3 @@ struct ntfs_device_operations ntfs_device_unix_io_ops = {
.stat = ntfs_device_unix_io_stat,
.ioctl = ntfs_device_unix_io_ioctl,
};

View File

@ -3745,8 +3745,8 @@ static BOOL mkntfs_override_vol_params(ntfs_volume *vol)
* "inode size" can be specified on other Linux/Unix file systems.
*/
vol->mft_record_size = 1024;
if (vol->mft_record_size < vol->sector_size)
vol->mft_record_size = vol->sector_size;
if (vol->mft_record_size < opts.sector_size)
vol->mft_record_size = opts.sector_size;
if (vol->mft_record_size > (unsigned long)page_size)
ntfs_log_warning("Mft record size (%u bytes) exceeds system "
"page size (%li bytes). You will not be able "
@ -3763,8 +3763,8 @@ static BOOL mkntfs_override_vol_params(ntfs_volume *vol)
* FIXME: Should we make the index record size to be user specifiable?
*/
vol->indx_record_size = 4096;
if (vol->indx_record_size < vol->sector_size)
vol->indx_record_size = vol->sector_size;
if (vol->indx_record_size < opts.sector_size)
vol->indx_record_size = opts.sector_size;
if (vol->indx_record_size > (unsigned long)page_size)
ntfs_log_warning("Index record size (%u bytes) exceeds system "
"page size (%li bytes). You will not be able "
@ -3893,7 +3893,8 @@ static BOOL mkntfs_initialize_rl_mft(void)
g_mft_zone_end = g_mft_zone_end >> 3; /* 12.5% */
break;
}
ntfs_log_debug("MFT zone size = %lldkiB\n", g_mft_zone_end / 1024);
ntfs_log_debug("MFT zone size = %lldkiB\n", g_mft_zone_end <<
g_vol->cluster_size_bits >> 10 /* >> 10 == / 1024 */);
/*
* The mft zone begins with the mft data attribute, not at the beginning
* of the device.