Unverified Commit a846cd0d authored by Konstantin Komarov's avatar Konstantin Komarov
Browse files

fs/ntfs3: Reformat code and update terminology



Reformatted the driver code according to the current .clang-format rules
and updated description of used terminology. No functional changes
intended.

Signed-off-by: default avatarKonstantin Komarov <almaz.alexandrovich@paragon-software.com>
parent 51801386
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -332,8 +332,7 @@ static inline bool ntfs_dir_emit(struct ntfs_sb_info *sbi,
	 * It does additional locks/reads just to get the type of name.
	 * Should we use additional mount option to enable branch below?
	 */
	if (fname->dup.extend_data &&
	    ino != ni->mi.rno) {
	if (fname->dup.extend_data && ino != ni->mi.rno) {
		struct inode *inode = ntfs_iget5(sbi->sb, &e->ref, NULL);
		if (!IS_ERR_OR_NULL(inode)) {
			dt_type = fs_umode_to_dtype(inode->i_mode);
+3 −5
Original line number Diff line number Diff line
@@ -503,8 +503,6 @@ static int ntfs_truncate(struct inode *inode, loff_t new_size)
	if (dirty)
		mark_inode_dirty(inode);

	/*ntfs_flush_inodes(inode->i_sb, inode, NULL);*/

	return 0;
}

@@ -1114,8 +1112,8 @@ static ssize_t ntfs_compress_write(struct kiocb *iocb, struct iov_iter *from)
			size_t cp, tail = PAGE_SIZE - off;

			folio = page_folio(pages[ip]);
			cp = copy_folio_from_iter_atomic(folio, off,
							min(tail, bytes), from);
			cp = copy_folio_from_iter_atomic(
				folio, off, min(tail, bytes), from);
			flush_dcache_folio(folio);

			copied += cp;
+4 −3
Original line number Diff line number Diff line
@@ -3026,8 +3026,8 @@ int ni_rename(struct ntfs_inode *dir_ni, struct ntfs_inode *new_dir_ni,
	err = ni_add_name(new_dir_ni, ni, new_de);
	if (!err) {
		err = ni_remove_name(dir_ni, ni, de, &de2, &undo);
		WARN_ON(err && ni_remove_name(new_dir_ni, ni, new_de, &de2,
			&undo));
		WARN_ON(err &&
			ni_remove_name(new_dir_ni, ni, new_de, &de2, &undo));
	}

	/*
@@ -3127,7 +3127,8 @@ static bool ni_update_parent(struct ntfs_inode *ni, struct NTFS_DUP_INFO *dup,
		if (attr) {
			const struct REPARSE_POINT *rp;

			rp = resident_data_ex(attr, sizeof(struct REPARSE_POINT));
			rp = resident_data_ex(attr,
					      sizeof(struct REPARSE_POINT));
			/* If ATTR_REPARSE exists 'rp' can't be NULL. */
			if (rp)
				dup->extend_data = rp->ReparseTag;
+11 −8
Original line number Diff line number Diff line
@@ -975,9 +975,9 @@ int ntfs_write_begin(const struct kiocb *iocb, struct address_space *mapping,
/*
 * ntfs_write_end - Address_space_operations::write_end.
 */
int ntfs_write_end(const struct kiocb *iocb,
		   struct address_space *mapping, loff_t pos,
		   u32 len, u32 copied, struct folio *folio, void *fsdata)
int ntfs_write_end(const struct kiocb *iocb, struct address_space *mapping,
		   loff_t pos, u32 len, u32 copied, struct folio *folio,
		   void *fsdata)
{
	struct inode *inode = mapping->host;
	struct ntfs_inode *ni = ntfs_i(inode);
@@ -1099,7 +1099,7 @@ ntfs_create_reparse_buffer(struct ntfs_sb_info *sbi, const char *symname,
	typeof(rp->SymbolicLinkReparseBuffer) *rs;
	bool is_absolute;

	is_absolute = (strlen(symname) > 1 && symname[1] == ':');
	is_absolute = symname[0] && symname[1] == ':';

	rp = kzalloc(ntfs_reparse_bytes(2 * size + 2, is_absolute), GFP_NOFS);
	if (!rp)
@@ -1136,17 +1136,19 @@ ntfs_create_reparse_buffer(struct ntfs_sb_info *sbi, const char *symname,

	/* PrintName + SubstituteName. */
	rs->SubstituteNameOffset = cpu_to_le16(sizeof(short) * err);
	rs->SubstituteNameLength = cpu_to_le16(sizeof(short) * err + (is_absolute ? 8 : 0));
	rs->SubstituteNameLength =
		cpu_to_le16(sizeof(short) * err + (is_absolute ? 8 : 0));
	rs->PrintNameLength = rs->SubstituteNameOffset;

	/*
	 * TODO: Use relative path if possible to allow Windows to
	 * parse this path.
	 * 0-absolute path 1- relative path (SYMLINK_FLAG_RELATIVE).
	 * 0-absolute path, 1- relative path (SYMLINK_FLAG_RELATIVE).
	 */
	rs->Flags = cpu_to_le32(is_absolute ? 0 : SYMLINK_FLAG_RELATIVE);

	memmove(rp_name + err + (is_absolute ? 4 : 0), rp_name, sizeof(short) * err);
	memmove(rp_name + err + (is_absolute ? 4 : 0), rp_name,
		sizeof(short) * err);

	if (is_absolute) {
		/* Decorate SubstituteName. */
@@ -1635,7 +1637,8 @@ int ntfs_create_inode(struct mnt_idmap *idmap, struct inode *dir,
		 * Use ni_find_attr cause layout of MFT record may be changed
		 * in ntfs_init_acl and ntfs_save_wsl_perm.
		 */
		attr = ni_find_attr(ni, NULL, NULL, ATTR_NAME, NULL, 0, NULL, NULL);
		attr = ni_find_attr(ni, NULL, NULL, ATTR_NAME, NULL, 0, NULL,
				    NULL);
		if (attr) {
			struct ATTR_FILE_NAME *fn;

+3 −3
Original line number Diff line number Diff line
@@ -212,8 +212,8 @@ static int ntfs_symlink(struct mnt_idmap *idmap, struct inode *dir,
static struct dentry *ntfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
				 struct dentry *dentry, umode_t mode)
{
	return ERR_PTR(ntfs_create_inode(idmap, dir, dentry, NULL, S_IFDIR | mode, 0,
					 NULL, 0, NULL));
	return ERR_PTR(ntfs_create_inode(idmap, dir, dentry, NULL,
					 S_IFDIR | mode, 0, NULL, 0, NULL));
}

/*
Loading