View | Details | Raw Unified | Return to bug 300694
Collapse All | Expand All

(-)file_not_specified_in_diff (-5 / +32 lines)
Line  Link Here
0
-- include/ntfs-3g/volume.h
0
++ include/ntfs-3g/volume.h
Lines 67-72 Link Here
67
#define MS_FORCE     0x10000000
67
#define MS_FORCE     0x10000000
68
#endif
68
#endif
69
69
70
#define MS_RWONLY    0x20000000
71
70
/* Forward declaration */
72
/* Forward declaration */
71
typedef struct _ntfs_volume ntfs_volume;
73
typedef struct _ntfs_volume ntfs_volume;
72
74
73
-- src/ntfs-3g.c
75
++ src/ntfs-3g.c
Lines 114-119 typedef struct { Link Here
114
	unsigned int dmask;
114
	unsigned int dmask;
115
	ntfs_fuse_streams_interface streams;
115
	ntfs_fuse_streams_interface streams;
116
	BOOL ro;
116
	BOOL ro;
117
	BOOL rwonly;
117
	BOOL show_sys_files;
118
	BOOL show_sys_files;
118
	BOOL silent;
119
	BOOL silent;
119
	BOOL force;
120
	BOOL force;
Lines 1670-1675 static ntfs_volume *ntfs_open(const char Link Here
1670
		flags |= MS_EXCLUSIVE;
1671
		flags |= MS_EXCLUSIVE;
1671
	if (ctx->ro)
1672
	if (ctx->ro)
1672
		flags |= MS_RDONLY;
1673
		flags |= MS_RDONLY;
1674
	if (ctx->rwonly)
1675
		flags |= MS_RWONLY;
1673
	if (ctx->noatime)
1676
	if (ctx->noatime)
1674
		flags |= MS_NOATIME;
1677
		flags |= MS_NOATIME;
1675
	if (ctx->force)
1678
	if (ctx->force)
Lines 1731-1736 static char *parse_mount_options(const c Link Here
1731
			}
1734
			}
1732
			ctx->ro = TRUE;
1735
			ctx->ro = TRUE;
1733
			strcat(ret, "ro,");
1736
			strcat(ret, "ro,");
1737
		} else if (!strcmp(opt, "rwonly")) {
1738
			if (val) {
1739
				ntfs_log_error("The option 'rwonly' does not "
1740
						"take arguments.\n");
1741
				goto err_exit;
1742
			}
1743
			ctx->rwonly = TRUE;
1744
			strcat(ret, "rwonly,");
1734
		} else if (!strcmp(opt, "noatime")) {
1745
		} else if (!strcmp(opt, "noatime")) {
1735
			if (val) {
1746
			if (val) {
1736
				ntfs_log_error("'noatime' option should not "
1747
				ntfs_log_error("'noatime' option should not "
Lines 2230-2235 int main(int argc, char *argv[]) Link Here
2230
	if (!ntfs_open(opts.device, opts.mnt_point, use_blkdev))
2241
	if (!ntfs_open(opts.device, opts.mnt_point, use_blkdev))
2231
		goto err_out;
2242
		goto err_out;
2232
	
2243
	
2244
	/* If ntfs_open fell back to MS_RDONLY, mount the filesystem read-only. */
2245
	if (ctx->vol->flags & MS_RDONLY && ctx->ro != TRUE) {
2246
		ctx->ro = TRUE;
2247
		strcat(parsed_options, ",ro");
2248
	}
2249
2233
	if (use_blkdev) {
2250
	if (use_blkdev) {
2234
	    set_fuseblk_options(parsed_options);
2251
	    set_fuseblk_options(parsed_options);
2235
	    set_user_mount_option(parsed_options, uid);
2252
	    set_user_mount_option(parsed_options, uid);
2236
-- src/utils.c
2253
++ src/utils.c
Lines 88-93 static const char *dirty_volume_msg = Link Here
88
"Volume is scheduled for check. Please boot into Windows TWICE, or\n"
88
"Volume is scheduled for check. Please boot into Windows TWICE, or\n"
89
"use the 'force' mount option. For example type on the command line:\n";
89
"use the 'force' mount option. For example type on the command line:\n";
90
90
91
static const char *rdonly_fallback_msg ="\nMounting the volume read-only for now.\n";
92
91
static const char *forced_mount_msg =
93
static const char *forced_mount_msg =
92
"\n"
94
"\n"
93
"            mount -t ntfs-3g %s %s -o force\n"
95
"            mount -t ntfs-3g %s %s -o force\n"
Lines 118-123 ntfs_volume *utils_mount_volume(const ch Link Here
118
{
120
{
119
	ntfs_volume *vol;
121
	ntfs_volume *vol;
120
122
123
retry_mount:
121
	vol = ntfs_mount(volume, flags);
124
	vol = ntfs_mount(volume, flags);
122
	if (!vol) {
125
	if (!vol) {
123
		
126
		
Lines 141-153 ntfs_volume *utils_mount_volume(const ch Link Here
141
		return NULL;
144
		return NULL;
142
	}
145
	}
143
146
144
	if (vol->flags & VOLUME_IS_DIRTY) {
147
	if (!(flags & MS_RDONLY) && vol->flags & VOLUME_IS_DIRTY) {
145
		if (!force) {
148
		if (!force) {
146
			ntfs_log_error("%s", dirty_volume_msg);
149
			ntfs_log_error("%s", dirty_volume_msg);
147
			ntfs_log_error(forced_mount_msg, volume, mntpoint, 
150
			ntfs_log_error(forced_mount_msg, volume, mntpoint, 
148
				       volume, mntpoint);
151
				       volume, mntpoint);
149
			ntfs_umount(vol, FALSE);
152
			ntfs_umount(vol, FALSE);
150
			
153
			/* If rwonly has not been given, try fallback to ro: */
154
			if (!(flags & MS_RWONLY)) {
155
				ntfs_log_error("%s", rdonly_fallback_msg);
156
				flags |= MS_RDONLY;
157
				goto retry_mount;
158
			}
151
			return NULL;
159
			return NULL;
152
		} else
160
		} else
153
			ntfs_log_error("WARNING: Forced mount, unclean volume "
161
			ntfs_log_error("WARNING: Forced mount, unclean volume "

Return to bug 300694