Changes by: antona
Update of /cvsroot/linux-ntfs/ntfsprogs/libntfs
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30178/libntfs
Modified Files:
device.c unix_io.c
Log Message:
Fixes to previous commit.
Index: device.c
===================================================================
RCS file: /cvsroot/linux-ntfs/ntfsprogs/libntfs/device.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -p -r1.24 -r1.25
--- device.c 3 Feb 2006 22:19:19 -0000 1.24
+++ device.c 3 Feb 2006 23:11:35 -0000 1.25
@@ -671,7 +671,8 @@ int ntfs_device_sector_size_get(struct n
int sect_size = 0;
if (!dev->d_ops->ioctl(dev, BLKSSZGET, §_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 nt
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;
}
-
Index: unix_io.c
===================================================================
RCS file: /cvsroot/linux-ntfs/ntfsprogs/libntfs/unix_io.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -p -r1.10 -r1.11
--- unix_io.c 3 Feb 2006 22:19:19 -0000 1.10
+++ unix_io.c 3 Feb 2006 23:11:35 -0000 1.11
@@ -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(stru
"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_devic
.stat = ntfs_device_unix_io_stat,
.ioctl = ntfs_device_unix_io_ioctl,
};
-
|