bk://linux-ntfs.bkbits.net/ntfs-2.6-devel ntfs@flatcap.org|ChangeSet|20040924030939|47432 ntfs # This is a BitKeeper generated diff -Nru style patch. # # ChangeSet # 2004/09/23 17:00:09-07:00 akpm@bix.(none) # Merge bk://linux-ntfs.bkbits.net/ntfs-2.6-devel # into bix.(none):/usr/src/bk-ntfs # # fs/ntfs/super.c # 2004/09/23 17:00:05-07:00 akpm@bix.(none) +0 -0 # Auto merged # # fs/ntfs/inode.c # 2004/09/23 17:00:05-07:00 akpm@bix.(none) +0 -0 # Auto merged # # ChangeSet # 2004/09/23 11:25:46+01:00 aia21@cantab.net # NTFS: - Update ->truncate (fs/ntfs/inode.c::ntfs_truncate()) to check if the # inode size has changed and to only output an error if so. # - Rename fs/ntfs/attrib.h::attribute_value_length() to ntfs_attr_size(). # # Signed-off-by: Anton Altaparmakov # # fs/ntfs/inode.c # 2004/09/23 11:25:38+01:00 aia21@cantab.net +34 -8 # - Update ->truncate (fs/ntfs/inode.c::ntfs_truncate()) to check if the # inode size has changed and to only output an error if so. # - Rename fs/ntfs/attrib.h::attribute_value_length() to ntfs_attr_size(). # # fs/ntfs/attrib.h # 2004/09/23 11:25:38+01:00 aia21@cantab.net +1 -1 # Rename attribute_value_length() to ntfs_attr_size(). # # fs/ntfs/ChangeLog # 2004/09/23 11:25:38+01:00 aia21@cantab.net +3 -0 # Update # # ChangeSet # 2004/09/23 11:05:08+01:00 aia21@cantab.net # NTFS: Change '\0' and L'\0' to simply 0 as per advice from Linus Torvalds. # # Signed-off-by: Anton Altaparmakov # # fs/ntfs/unistr.c # 2004/09/23 11:04:59+01:00 aia21@cantab.net +2 -2 # Change '\0' and L'\0' to simply 0 as per advice from Linus Torvalds. # # fs/ntfs/super.c # 2004/09/23 11:04:59+01:00 aia21@cantab.net +1 -1 # Change '\0' and L'\0' to simply 0 as per advice from Linus Torvalds. # # fs/ntfs/inode.c # 2004/09/23 11:04:59+01:00 aia21@cantab.net +10 -4 # Change '\0' and L'\0' to simply 0 as per advice from Linus Torvalds. # # fs/ntfs/ChangeLog # 2004/09/23 11:04:59+01:00 aia21@cantab.net +1 -0 # Update # # ChangeSet # 2004/09/22 23:41:10-07:00 akpm@bix.(none) # Merge bk://linux-ntfs.bkbits.net/ntfs-2.6-devel # into bix.(none):/usr/src/bk-ntfs # # fs/ntfs/dir.c # 2004/09/22 23:41:06-07:00 akpm@bix.(none) +0 -0 # Auto merged # # ChangeSet # 2004/09/22 23:13:39+01:00 aia21@cantab.net # NTFS: Improve the previous transparent union removal. # # Signed-off-by: Anton Altaparmakov # # fs/ntfs/dir.c # 2004/09/22 23:12:20+01:00 aia21@cantab.net +7 -8 # Improve the previous transparent union removal. # # ChangeSet # 2004/09/22 13:53:34-07:00 akpm@bix.(none) # Merge bk://linux-ntfs.bkbits.net/ntfs-2.6-devel # into bix.(none):/usr/src/bk-ntfs # # fs/ntfs/inode.c # 2004/09/22 13:53:28-07:00 akpm@bix.(none) +0 -0 # Auto merged # # fs/ntfs/dir.c # 2004/09/22 13:53:28-07:00 akpm@bix.(none) +0 -0 # Auto merged # # ChangeSet # 2004/09/22 13:52:24-07:00 akpm@bix.(none) # Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-ntfs # # fs/ntfs/inode.c # 2004/09/22 13:52:20-07:00 akpm@bix.(none) +0 -0 # Auto merged # # ChangeSet # 2004/09/22 20:07:55+01:00 aia21@cantab.net # NTFS: Get rid of the ugly transparent union in fs/ntfs/dir.c::ntfs_readdir() # and ntfs_filldir() as per suggestion from Al Viro. # # Signed-off-by: Anton Altaparmakov # # fs/ntfs/dir.c # 2004/09/22 20:06:29+01:00 aia21@cantab.net +14 -28 # Get rid of the ugly transparent union in fs/ntfs/dir.c::ntfs_readdir() # and ntfs_filldir() as per suggestion from Al Viro. # # fs/ntfs/ChangeLog # 2004/09/22 20:06:25+01:00 aia21@cantab.net +2 -0 # Update # # ChangeSet # 2004/09/22 16:31:09+01:00 aia21@cantab.net # NTFS: - Remove BKL use from ntfs_setattr() syncing up with the rest of the # kernel. # - Update ->setattr (fs/ntfs/inode.c::ntfs_setattr()) to refuse to # change the uid, gid, and mode of an inode as we do not support NTFS # ACLs yet. # # Signed-off-by: Anton Altaparmakov # # fs/ntfs/inode.c # 2004/09/22 16:31:01+01:00 aia21@cantab.net +34 -35 # - Update ->setattr (fs/ntfs/inode.c::ntfs_setattr()) to refuse to # change the uid, gid, and mode of an inode as we do not support NTFS # ACLs yet. # - Remove BKL use from ntfs_setattr() syncing up with the rest of the # kernel. # # fs/ntfs/Makefile # 2004/09/22 16:31:01+01:00 aia21@cantab.net +1 -1 # Start 2.1.19-WIP # # fs/ntfs/ChangeLog # 2004/09/22 16:31:01+01:00 aia21@cantab.net +8 -0 # Update # # ChangeSet # 2004/09/21 21:05:32-07:00 akpm@bix.(none) # Merge bk://linux-ntfs.bkbits.net/ntfs-2.6-devel # into bix.(none):/usr/src/bk-ntfs # # fs/ntfs/super.c # 2004/09/21 21:05:28-07:00 akpm@bix.(none) +0 -0 # Auto merged # # fs/ntfs/inode.c # 2004/09/21 21:05:28-07:00 akpm@bix.(none) +0 -0 # Auto merged # # fs/ntfs/dir.c # 2004/09/21 21:05:28-07:00 akpm@bix.(none) +0 -0 # Auto merged # # fs/ntfs/attrib.c # 2004/09/21 21:05:27-07:00 akpm@bix.(none) +0 -0 # Auto merged # # fs/ntfs/aops.c # 2004/09/21 21:05:27-07:00 akpm@bix.(none) +0 -0 # Auto merged # # ChangeSet # 2004/09/20 14:19:39-07:00 akpm@bix.(none) # Merge bk://linux-ntfs.bkbits.net/ntfs-2.6-devel # into bix.(none):/usr/src/bk-ntfs # # fs/ntfs/super.c # 2004/09/20 14:19:35-07:00 akpm@bix.(none) +0 -0 # Auto merged # # fs/ntfs/inode.c # 2004/09/20 14:19:35-07:00 akpm@bix.(none) +0 -0 # Auto merged # # ChangeSet # 2004/09/17 13:12:24-07:00 akpm@bix.(none) # Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-ntfs # # fs/ntfs/super.c # 2004/09/17 13:12:20-07:00 akpm@bix.(none) +0 -0 # Auto merged # # fs/ntfs/inode.c # 2004/09/17 13:12:20-07:00 akpm@bix.(none) +0 -0 # Auto merged # # ChangeSet # 2004/09/14 14:26:30-07:00 akpm@bix.(none) # Merge bk://linux-ntfs.bkbits.net/ntfs-2.6-devel # into bix.(none):/usr/src/bk-ntfs # # fs/ntfs/super.c # 2004/09/14 14:26:26-07:00 akpm@bix.(none) +0 -0 # Auto merged # # fs/ntfs/inode.c # 2004/09/14 14:26:26-07:00 akpm@bix.(none) +0 -0 # Auto merged # # ChangeSet # 2004/08/27 13:55:53-07:00 akpm@bix.(none) # Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-ntfs # # fs/ntfs/super.c # 2004/08/27 13:55:49-07:00 akpm@bix.(none) +0 -0 # Auto merged # # ChangeSet # 2004/08/24 17:34:17-07:00 akpm@bix.(none) # Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-ntfs # # fs/ntfs/super.c # 2004/08/24 17:34:13-07:00 akpm@bix.(none) +0 -0 # Auto merged # # ChangeSet # 2004/08/23 16:42:55-07:00 akpm@bix.(none) # Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-ntfs # # fs/ntfs/inode.c # 2004/08/23 16:42:51-07:00 akpm@bix.(none) +0 -0 # Auto merged # # fs/ntfs/dir.c # 2004/08/23 16:42:51-07:00 akpm@bix.(none) +0 -0 # Auto merged # # fs/ntfs/attrib.c # 2004/08/23 16:42:51-07:00 akpm@bix.(none) +0 -0 # Auto merged # # fs/ntfs/aops.c # 2004/08/23 16:42:51-07:00 akpm@bix.(none) +0 -0 # Auto merged # # ChangeSet # 2004/08/23 14:26:58-07:00 akpm@bix.(none) # Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-ntfs # # fs/ntfs/inode.c # 2004/08/23 14:26:52-07:00 akpm@bix.(none) +0 -0 # Auto merged # # fs/ntfs/dir.c # 2004/08/23 14:26:52-07:00 akpm@bix.(none) +0 -0 # Auto merged # # fs/ntfs/attrib.c # 2004/08/23 14:26:52-07:00 akpm@bix.(none) +0 -0 # Auto merged # # fs/ntfs/aops.c # 2004/08/23 14:26:52-07:00 akpm@bix.(none) +0 -0 # Auto merged # # ChangeSet # 2004/08/18 12:24:54-07:00 akpm@bix.(none) # Merge bk://linux-ntfs.bkbits.net/ntfs-2.6-devel # into bix.(none):/usr/src/bk-ntfs # # fs/ntfs/super.c # 2004/08/18 12:24:51-07:00 akpm@bix.(none) +0 -0 # Auto merged # # ChangeSet # 2004/08/16 10:41:28-07:00 akpm@bix.(none) # Merge bk://linux-ntfs.bkbits.net/ntfs-2.6-devel # into bix.(none):/usr/src/bk-ntfs # # fs/ntfs/super.c # 2004/08/16 10:41:24-07:00 akpm@bix.(none) +0 -0 # Auto merged # # ChangeSet # 2004/08/07 14:39:35-07:00 akpm@bix.(none) # Merge bk://linux-ntfs.bkbits.net/ntfs-2.6-devel # into bix.(none):/usr/src/bk-ntfs # # fs/ntfs/super.c # 2004/08/07 14:39:32-07:00 akpm@bix.(none) +0 -0 # Auto merged # # fs/ntfs/dir.c # 2004/08/07 14:39:32-07:00 akpm@bix.(none) +0 -0 # Auto merged # # fs/ntfs/compress.c # 2004/08/07 14:39:32-07:00 akpm@bix.(none) +0 -0 # Auto merged # # ChangeSet # 2004/07/26 23:13:47-07:00 akpm@bix.(none) # Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-ntfs # # fs/ntfs/super.c # 2004/07/26 23:13:44-07:00 akpm@bix.(none) +0 -0 # Auto merged # # fs/ntfs/dir.c # 2004/07/26 23:13:43-07:00 akpm@bix.(none) +0 -0 # Auto merged # # fs/ntfs/compress.c # 2004/07/26 23:13:43-07:00 akpm@bix.(none) +0 -0 # Auto merged # diff -Nru a/fs/ntfs/ChangeLog b/fs/ntfs/ChangeLog --- a/fs/ntfs/ChangeLog 2004-09-23 20:58:39 -07:00 +++ b/fs/ntfs/ChangeLog 2004-09-23 20:58:39 -07:00 @@ -21,6 +21,20 @@ - Enable the code for setting the NT4 compatibility flag when we start making NTFS 1.2 specific modifications. +2.1.19-WIP + + - Update ->setattr (fs/ntfs/inode.c::ntfs_setattr()) to refuse to + change the uid, gid, and mode of an inode as we do not support NTFS + ACLs yet. + - Remove BKL use from ntfs_setattr() syncing up with the rest of the + kernel. + - Get rid of the ugly transparent union in fs/ntfs/dir.c::ntfs_readdir() + and ntfs_filldir() as per suggestion from Al Viro. + - Change '\0' and L'\0' to simply 0 as per advice from Linus Torvalds. + - Update ->truncate (fs/ntfs/inode.c::ntfs_truncate()) to check if the + inode size has changed and to only output an error if so. + - Rename fs/ntfs/attrib.h::attribute_value_length() to ntfs_attr_size(). + 2.1.18 - Fix scheduling latencies at mount time as well as an endianness bug. - Remove vol->nr_mft_records as it was pretty meaningless and optimize diff -Nru a/fs/ntfs/Makefile b/fs/ntfs/Makefile --- a/fs/ntfs/Makefile 2004-09-23 20:58:39 -07:00 +++ b/fs/ntfs/Makefile 2004-09-23 20:58:39 -07:00 @@ -6,7 +6,7 @@ index.o inode.o mft.o mst.o namei.o super.o sysctl.o unistr.o \ upcase.o -EXTRA_CFLAGS = -DNTFS_VERSION=\"2.1.18\" +EXTRA_CFLAGS = -DNTFS_VERSION=\"2.1.19-WIP\" ifeq ($(CONFIG_NTFS_DEBUG),y) EXTRA_CFLAGS += -DDEBUG diff -Nru a/fs/ntfs/attrib.h b/fs/ntfs/attrib.h --- a/fs/ntfs/attrib.h 2004-09-23 20:58:39 -07:00 +++ b/fs/ntfs/attrib.h 2004-09-23 20:58:39 -07:00 @@ -89,7 +89,7 @@ extern int load_attribute_list(ntfs_volume *vol, runlist *rl, u8 *al_start, const s64 size, const s64 initialized_size); -static inline s64 attribute_value_length(const ATTR_RECORD *a) +static inline s64 ntfs_attr_size(const ATTR_RECORD *a) { if (!a->non_resident) return (s64)le32_to_cpu(a->data.resident.value_length); diff -Nru a/fs/ntfs/dir.c b/fs/ntfs/dir.c --- a/fs/ntfs/dir.c 2004-09-23 20:58:39 -07:00 +++ b/fs/ntfs/dir.c 2004-09-23 20:58:39 -07:00 @@ -999,23 +999,11 @@ #endif -typedef union { - INDEX_ROOT *ir; - INDEX_ALLOCATION *ia; -} index_union __attribute__ ((__transparent_union__)); - -typedef enum { - INDEX_TYPE_ROOT, /* index root */ - INDEX_TYPE_ALLOCATION, /* index allocation */ -} INDEX_TYPE; - /** * ntfs_filldir - ntfs specific filldir method * @vol: current ntfs volume * @fpos: position in the directory * @ndir: ntfs inode of current directory - * @index_type: specifies whether @iu is an index root or an index allocation - * @iu: index root or index allocation attribute to which @ie belongs * @ia_page: page in which the index allocation buffer @ie is in resides * @ie: current index entry * @name: buffer to use for the converted name @@ -1025,9 +1013,8 @@ * Convert the Unicode @name to the loaded NLS and pass it to the @filldir * callback. * - * If @index_type is INDEX_TYPE_ALLOCATION, @ia_page is the locked page - * containing the index allocation block containing the index entry @ie. - * Otherwise, @ia_page is NULL. + * If @ia_page is not NULL it is the locked page containing the index + * allocation block containing the index entry @ie. * * Note, we drop (and then reacquire) the page lock on @ia_page across the * @filldir() call otherwise we would deadlock with NFSd when it calls ->lookup @@ -1035,9 +1022,8 @@ * retake the lock if we are returning a non-zero value as ntfs_readdir() * would need to drop the lock immediately anyway. */ -static inline int ntfs_filldir(ntfs_volume *vol, loff_t *fpos, - ntfs_inode *ndir, const INDEX_TYPE index_type, - index_union iu, struct page *ia_page, INDEX_ENTRY *ie, +static inline int ntfs_filldir(ntfs_volume *vol, loff_t fpos, + ntfs_inode *ndir, struct page *ia_page, INDEX_ENTRY *ie, u8 *name, void *dirent, filldir_t filldir) { unsigned long mref; @@ -1045,14 +1031,6 @@ unsigned dt_type; FILE_NAME_TYPE_FLAGS name_type; - /* Advance the position even if going to skip the entry. */ - if (index_type == INDEX_TYPE_ALLOCATION) - *fpos = (u8*)ie - (u8*)iu.ia + - (sle64_to_cpu(iu.ia->index_block_vcn) << - ndir->itype.index.vcn_size_bits) + - vol->mft_record_size; - else /* if (index_type == INDEX_TYPE_ROOT) */ - *fpos = (u8*)ie - (u8*)iu.ir; name_type = ie->key.file_name.file_name_type; if (name_type == FILE_NAME_DOS) { ntfs_debug("Skipping DOS name space entry."); @@ -1084,14 +1062,14 @@ * Drop the page lock otherwise we deadlock with NFS when it calls * ->lookup since ntfs_lookup() will lock the same page. */ - if (index_type == INDEX_TYPE_ALLOCATION) + if (ia_page) unlock_page(ia_page); ntfs_debug("Calling filldir for %s with len %i, fpos 0x%llx, inode " - "0x%lx, DT_%s.", name, name_len, *fpos, mref, + "0x%lx, DT_%s.", name, name_len, fpos, mref, dt_type == DT_DIR ? "DIR" : "REG"); - rc = filldir(dirent, name, name_len, *fpos, mref, dt_type); + rc = filldir(dirent, name, name_len, fpos, mref, dt_type); /* Relock the page but not if we are aborting ->readdir. */ - if (!rc && index_type == INDEX_TYPE_ALLOCATION) + if (!rc && ia_page) lock_page(ia_page); return rc; } @@ -1244,9 +1222,11 @@ /* Skip index root entry if continuing previous readdir. */ if (ir_pos > (u8*)ie - (u8*)ir) continue; + /* Advance the position even if going to skip the entry. */ + fpos = (u8*)ie - (u8*)ir; /* Submit the name to the filldir callback. */ - rc = ntfs_filldir(vol, &fpos, ndir, INDEX_TYPE_ROOT, ir, NULL, - ie, name, dirent, filldir); + rc = ntfs_filldir(vol, fpos, ndir, NULL, ie, name, dirent, + filldir); if (rc) { kfree(ir); goto abort; @@ -1420,14 +1400,19 @@ /* Skip index block entry if continuing previous readdir. */ if (ia_pos - ia_start > (u8*)ie - (u8*)ia) continue; + /* Advance the position even if going to skip the entry. */ + fpos = (u8*)ie - (u8*)ia + + (sle64_to_cpu(ia->index_block_vcn) << + ndir->itype.index.vcn_size_bits) + + vol->mft_record_size; /* * Submit the name to the @filldir callback. Note, * ntfs_filldir() drops the lock on @ia_page but it retakes it * before returning, unless a non-zero value is returned in * which case the page is left unlocked. */ - rc = ntfs_filldir(vol, &fpos, ndir, INDEX_TYPE_ALLOCATION, ia, - ia_page, ie, name, dirent, filldir); + rc = ntfs_filldir(vol, fpos, ndir, ia_page, ie, name, dirent, + filldir); if (rc) { /* @ia_page is already unlocked in this case. */ ntfs_unmap_page(ia_page); diff -Nru a/fs/ntfs/inode.c b/fs/ntfs/inode.c --- a/fs/ntfs/inode.c 2004-09-23 20:58:39 -07:00 +++ b/fs/ntfs/inode.c 2004-09-23 20:58:39 -07:00 @@ -130,7 +130,7 @@ if (!ni->name) return -ENOMEM; memcpy(ni->name, na->name, i); - ni->name[i] = cpu_to_le16(L'\0'); + ni->name[i] = cpu_to_le16(0); } return 0; } @@ -680,7 +680,7 @@ goto unm_err_out; } /* Now allocate memory for the attribute list. */ - ni->attr_list_size = (u32)attribute_value_length(ctx->attr); + ni->attr_list_size = (u32)ntfs_attr_size(ctx->attr); ni->attr_list = ntfs_malloc_nofs(ni->attr_list_size); if (!ni->attr_list) { ntfs_error(vi->i_sb, "Not enough memory to allocate " @@ -1794,7 +1794,7 @@ goto put_err_out; } /* Now allocate memory for the attribute list. */ - ni->attr_list_size = (u32)attribute_value_length(ctx->attr); + ni->attr_list_size = (u32)ntfs_attr_size(ctx->attr); ni->attr_list = ntfs_malloc_nofs(ni->attr_list_size); if (!ni->attr_list) { ntfs_error(sb, "Not enough memory to allocate buffer " @@ -2270,16 +2270,52 @@ * * We don't support i_size changes yet. * - * Called with ->i_sem held. + * The kernel guarantees that @vi is a regular file (S_ISREG() is true) and + * that the change is allowed. + * + * This implies for us that @vi is a file inode rather than a directory, index, + * or attribute inode as well as that @vi is a base inode. + * + * Called with ->i_sem held. In all but one case ->i_alloc_sem is held for + * writing. The only case where ->i_alloc_sem is not held is + * mm/filemap.c::generic_file_buffered_write() where vmtruncate() is called + * with the current i_size as the offset which means that it is a noop as far + * as ntfs_truncate() is concerned. */ void ntfs_truncate(struct inode *vi) { - // TODO: Implement... - ntfs_warning(vi->i_sb, "Eeek: i_size may have changed! If you see " - "this right after a message from " - "ntfs_{prepare,commit}_{,nonresident_}write() then " - "just ignore it. Otherwise it is bad news."); - // TODO: reset i_size now! + ntfs_inode *ni = NTFS_I(vi); + ntfs_attr_search_ctx *ctx; + MFT_RECORD *m; + + m = map_mft_record(ni); + if (IS_ERR(m)) { + ntfs_error(vi->i_sb, "Failed to map mft record for inode 0x%lx " + "(error code %ld).", vi->i_ino, PTR_ERR(m)); + if (PTR_ERR(m) != ENOMEM) + make_bad_inode(vi); + return; + } + ctx = ntfs_attr_get_search_ctx(ni, m); + if (unlikely(!ctx)) { + ntfs_error(vi->i_sb, "Failed to allocate a search context: " + "Not enough memory"); + // FIXME: We can't report an error code upstream. So what do + // we do?!? make_bad_inode() seems a bit harsh... + unmap_mft_record(ni); + goto out; + } + /* If the size has not changed there is nothing to do. */ + if (ntfs_attr_size(ctx->attr) == i_size_read(vi)) + goto out; + // TODO: Implement the truncate... + ntfs_error(vi->i_sb, "Inode size has changed but this is not " + "implemented yet. Resetting inode size to old value. " + " This is most likely a bug in the ntfs driver!"); + i_size_write(vi, ntfs_attr_size(ctx->attr)); +out: + ntfs_attr_put_search_ctx(ctx); + unmap_mft_record(ni); return; } @@ -2289,67 +2325,62 @@ * @attr: structure describing the attributes and the changes * * We have to trap VFS attempts to truncate the file described by @dentry as - * soon as possible, because we do not implement changes in i_size yet. So we + * soon as possible, because we do not implement changes in i_size yet. So we * abort all i_size changes here. * - * Called with ->i_sem held. + * We also abort all changes of user, group, and mode as we do not implement + * the NTFS ACLs yet. + * + * Called with ->i_sem held. For the ATTR_SIZE (i.e. ->truncate) case, also + * called with ->i_alloc_sem held for writing. * * Basically this is a copy of generic notify_change() and inode_setattr() * functionality, except we intercept and abort changes in i_size. */ int ntfs_setattr(struct dentry *dentry, struct iattr *attr) { - struct inode *vi; + struct inode *vi = dentry->d_inode; int err; unsigned int ia_valid = attr->ia_valid; - vi = dentry->d_inode; - err = inode_change_ok(vi, attr); if (err) return err; - if ((ia_valid & ATTR_UID && attr->ia_uid != vi->i_uid) || - (ia_valid & ATTR_GID && attr->ia_gid != vi->i_gid)) { - err = DQUOT_TRANSFER(vi, attr) ? -EDQUOT : 0; - if (err) - return err; + /* We do not support NTFS ACLs yet. */ + if (ia_valid & (ATTR_UID | ATTR_GID | ATTR_MODE)) { + ntfs_warning(vi->i_sb, "Changes in user/group/mode are not " + "supported yet, ignoring."); + err = -EOPNOTSUPP; + goto out; } - lock_kernel(); - if (ia_valid & ATTR_SIZE) { - ntfs_error(vi->i_sb, "Changes in i_size are not supported " - "yet. Sorry."); - // TODO: Implement... - // err = vmtruncate(vi, attr->ia_size); - err = -EOPNOTSUPP; - if (err) - goto trunc_err; + if (attr->ia_size != i_size_read(vi)) { + ntfs_warning(vi->i_sb, "Changes in inode size are not " + "supported yet, ignoring."); + err = -EOPNOTSUPP; + // TODO: Implement... + // err = vmtruncate(vi, attr->ia_size); + if (err || ia_valid == ATTR_SIZE) + goto out; + } else { + /* + * We skipped the truncate but must still update + * timestamps. + */ + ia_valid |= ATTR_MTIME|ATTR_CTIME; + } } - if (ia_valid & ATTR_UID) - vi->i_uid = attr->ia_uid; - if (ia_valid & ATTR_GID) - vi->i_gid = attr->ia_gid; if (ia_valid & ATTR_ATIME) vi->i_atime = attr->ia_atime; if (ia_valid & ATTR_MTIME) vi->i_mtime = attr->ia_mtime; if (ia_valid & ATTR_CTIME) vi->i_ctime = attr->ia_ctime; - if (ia_valid & ATTR_MODE) { - vi->i_mode = attr->ia_mode; - if (!in_group_p(vi->i_gid) && - !capable(CAP_FSETID)) - vi->i_mode &= ~S_ISGID; - } mark_inode_dirty(vi); - -trunc_err: - - unlock_kernel(); - +out: return err; } diff -Nru a/fs/ntfs/super.c b/fs/ntfs/super.c --- a/fs/ntfs/super.c 2004-09-23 20:58:39 -07:00 +++ b/fs/ntfs/super.c 2004-09-23 20:58:39 -07:00 @@ -145,7 +145,7 @@ ntfs_debug("Entering with mount options string: %s", opt); while ((p = strsep(&opt, ","))) { if ((v = strchr(p, '='))) - *v++ = '\0'; + *v++ = 0; NTFS_GETOPT("uid", uid) else NTFS_GETOPT("gid", gid) else NTFS_GETOPT("umask", fmask = dmask) diff -Nru a/fs/ntfs/unistr.c b/fs/ntfs/unistr.c --- a/fs/ntfs/unistr.c 2004-09-23 20:58:39 -07:00 +++ b/fs/ntfs/unistr.c 2004-09-23 20:58:39 -07:00 @@ -276,7 +276,7 @@ } /* else (wc_len < 0) */ goto conversion_err; } - ucs[o] = cpu_to_le16('\0'); + ucs[o] = cpu_to_le16(0); *outs = ucs; return o; } /* else (!ucs) */ @@ -362,7 +362,7 @@ } /* wc < 0, real error. */ goto conversion_err; } - ns[o] = '\0'; + ns[o] = 0; *outs = ns; return o; } /* else (!ins) */