Changes by: yura
Update of /cvs/linux-ntfs/ntfsprogs/libntfs
In directory delta357:/tmp/cvs-serv16920/libntfs
Modified Files:
unix_io.c volume.c
Log Message:
Introduce MNT_NTFS_NOT_EXCLUSIVE mount option that tells libntfs do
not open volume exclusively. Useful if libntfs user cares about this
himself, eg. FUSE with blkdev option.
Index: unix_io.c
===================================================================
RCS file: /cvs/linux-ntfs/ntfsprogs/libntfs/unix_io.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -p -r1.14 -r1.15
--- unix_io.c 1 Nov 2006 13:30:40 -0000 1.14
+++ unix_io.c 25 Nov 2006 17:37:37 -0000 1.15
@@ -88,12 +88,6 @@ static int ntfs_device_unix_io_open(stru
}
if (!(dev->d_private = ntfs_malloc(sizeof(int))))
return -1;
- /*
- * Open the device/file obtaining the file descriptor for exclusive
- * access (but only if mounting r/w).
- */
- if ((flags & O_RDWR) == O_RDWR)
- flags |= O_EXCL;
*(int*)dev->d_private = open(dev->d_name, flags);
if (*(int*)dev->d_private == -1) {
err = errno;
@@ -112,11 +106,12 @@ static int ntfs_device_unix_io_open(stru
flk.l_start = flk.l_len = 0LL;
if (fcntl(DEV_FD(dev), F_SETLK, &flk)) {
err = errno;
- ntfs_log_debug("ntfs_device_unix_io_open: Could not lock %s for %s\n",
- dev->d_name, NDevReadOnly(dev) ? "reading" : "writing");
+ ntfs_log_debug("ntfs_device_unix_io_open: Could not lock %s "
+ "for %s\n", dev->d_name, NDevReadOnly(dev) ?
+ "reading" : "writing");
if (close(DEV_FD(dev)))
- ntfs_log_perror("ntfs_device_unix_io_open: Warning: Could not "
- "close %s", dev->d_name);
+ ntfs_log_perror("ntfs_device_unix_io_open: Warning: "
+ "Could not close %s", dev->d_name);
goto err_out;
}
/* Determine if device is a block device or not, ignoring errors. */
Index: volume.c
===================================================================
RCS file: /cvs/linux-ntfs/ntfsprogs/libntfs/volume.c,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -p -r1.78 -r1.79
--- volume.c 20 Nov 2006 16:21:57 -0000 1.78
+++ volume.c 25 Nov 2006 17:37:37 -0000 1.79
@@ -438,7 +438,9 @@ ntfs_volume *ntfs_volume_startup(struct
if (flags & NTFS_MNT_CASE_SENSITIVE)
NVolSetCaseSensitive(vol);
ntfs_log_debug("Reading bootsector... ");
- if (dev->d_ops->open(dev, NVolReadOnly(vol) ? O_RDONLY: O_RDWR)) {
+ if (dev->d_ops->open(dev, NVolReadOnly(vol) ? O_RDONLY :
+ ((flags & NTFS_MNT_NOT_EXCLUSIVE) ? O_RDWR :
+ (O_RDWR | O_EXCL)))) {
ntfs_log_debug(FAILED);
ntfs_log_perror("Error opening partition device");
goto error_exit;
@@ -752,6 +754,7 @@ out:
* NTFS_MNT_NOATIME - do not update access time
* NTFS_MNT_CASE_SENSITIVE - treat filenames as case sensitive even if
* they are not in POSIX namespace
+ * NTFS_MNT_NOT_EXCLUSIVE - (unix only) do not open volume exclusively
*
* The function opens the device @dev and verifies that it contains a valid
* bootsector. Then, it allocates an ntfs_volume structure and initializes
@@ -1150,6 +1153,7 @@ error_exit:
* NTFS_MNT_NOATIME - do not update access time
* NTFS_MNT_CASE_SENSITIVE - treat filenames as case sensitive even if
* they are not in POSIX namespace
+ * NTFS_MNT_NOT_EXCLUSIVE - (unix only) do not open volume exclusively
*
* The function opens the device or file @name and verifies that it contains a
* valid bootsector. Then, it allocates an ntfs_volume structure and initializes
|