From e8b8e97f91b80f08a2f1b7ea4f81e7af61b2cc2f Mon Sep 17 00:00:00 2001 From: Kari Argillander Date: Tue, 3 Aug 2021 14:57:09 +0300 Subject: fs/ntfs3: Restyle comments to better align with kernel-doc Capitalize comments and end with period for better reading. Also function comments are now little more kernel-doc style. This way we can easily convert them to kernel-doc style if we want. Note that these are not yet complete with this style. Example function comments start with /* and in kernel-doc style they start /**. Use imperative mood in function descriptions. Change words like ntfs -> NTFS, linux -> Linux. Use "we" not "I" when commenting code. Signed-off-by: Kari Argillander Signed-off-by: Konstantin Komarov --- fs/ntfs3/fsntfs.c | 244 +++++++++++++++++++++++++----------------------------- 1 file changed, 111 insertions(+), 133 deletions(-) (limited to 'fs/ntfs3/fsntfs.c') diff --git a/fs/ntfs3/fsntfs.c b/fs/ntfs3/fsntfs.c index fb2652c8dd74..0edb95ed9717 100644 --- a/fs/ntfs3/fsntfs.c +++ b/fs/ntfs3/fsntfs.c @@ -101,9 +101,7 @@ const __le16 WOF_NAME[17] = { // clang-format on /* - * ntfs_fix_pre_write - * - * inserts fixups into 'rhdr' before writing to disk + * ntfs_fix_pre_write - Insert fixups into @rhdr before writing to disk. */ bool ntfs_fix_pre_write(struct NTFS_RECORD_HEADER *rhdr, size_t bytes) { @@ -117,7 +115,7 @@ bool ntfs_fix_pre_write(struct NTFS_RECORD_HEADER *rhdr, size_t bytes) return false; } - /* Get fixup pointer */ + /* Get fixup pointer. */ fixup = Add2Ptr(rhdr, fo); if (*fixup >= 0x7FFF) @@ -138,10 +136,9 @@ bool ntfs_fix_pre_write(struct NTFS_RECORD_HEADER *rhdr, size_t bytes) } /* - * ntfs_fix_post_read + * ntfs_fix_post_read - Remove fixups after reading from disk. * - * remove fixups after reading from disk - * Returns < 0 if error, 0 if ok, 1 if need to update fixups + * Return: < 0 if error, 0 if ok, 1 if need to update fixups. */ int ntfs_fix_post_read(struct NTFS_RECORD_HEADER *rhdr, size_t bytes, bool simple) @@ -154,26 +151,26 @@ int ntfs_fix_post_read(struct NTFS_RECORD_HEADER *rhdr, size_t bytes, fn = simple ? ((bytes >> SECTOR_SHIFT) + 1) : le16_to_cpu(rhdr->fix_num); - /* Check errors */ + /* Check errors. */ if ((fo & 1) || fo + fn * sizeof(short) > SECTOR_SIZE || !fn-- || fn * SECTOR_SIZE > bytes) { - return -EINVAL; /* native chkntfs returns ok! */ + return -EINVAL; /* Native chkntfs returns ok! */ } - /* Get fixup pointer */ + /* Get fixup pointer. */ fixup = Add2Ptr(rhdr, fo); sample = *fixup; ptr = Add2Ptr(rhdr, SECTOR_SIZE - sizeof(short)); ret = 0; while (fn--) { - /* Test current word */ + /* Test current word. */ if (*ptr != sample) { /* Fixup does not match! Is it serious error? */ ret = -E_NTFS_FIXUP; } - /* Replace fixup */ + /* Replace fixup. */ *ptr = *++fixup; ptr += SECTOR_SIZE / sizeof(short); } @@ -182,9 +179,7 @@ int ntfs_fix_post_read(struct NTFS_RECORD_HEADER *rhdr, size_t bytes, } /* - * ntfs_extend_init - * - * loads $Extend file + * ntfs_extend_init - Load $Extend file. */ int ntfs_extend_init(struct ntfs_sb_info *sbi) { @@ -209,7 +204,7 @@ int ntfs_extend_init(struct ntfs_sb_info *sbi) goto out; } - /* if ntfs_iget5 reads from disk it never returns bad inode */ + /* If ntfs_iget5() reads from disk it never returns bad inode. */ if (!S_ISDIR(inode->i_mode)) { err = -EINVAL; goto out; @@ -261,7 +256,7 @@ int ntfs_loadlog_and_replay(struct ntfs_inode *ni, struct ntfs_sb_info *sbi) struct MFT_REF ref; struct inode *inode; - /* Check for 4GB */ + /* Check for 4GB. */ if (ni->vfs_inode.i_size >= 0x100000000ull) { ntfs_err(sb, "\x24LogFile is too big"); err = -EINVAL; @@ -280,7 +275,7 @@ int ntfs_loadlog_and_replay(struct ntfs_inode *ni, struct ntfs_sb_info *sbi) inode = NULL; if (!inode) { - /* Try to use mft copy */ + /* Try to use MFT copy. */ u64 t64 = sbi->mft.lbo; sbi->mft.lbo = sbi->mft.lbo2; @@ -298,7 +293,7 @@ int ntfs_loadlog_and_replay(struct ntfs_inode *ni, struct ntfs_sb_info *sbi) sbi->mft.ni = ntfs_i(inode); - /* LogFile should not contains attribute list */ + /* LogFile should not contains attribute list. */ err = ni_load_all_mi(sbi->mft.ni); if (!err) err = log_replay(ni, &initialized); @@ -317,7 +312,7 @@ int ntfs_loadlog_and_replay(struct ntfs_inode *ni, struct ntfs_sb_info *sbi) if (sb_rdonly(sb) || !initialized) goto out; - /* fill LogFile by '-1' if it is initialized */ + /* Fill LogFile by '-1' if it is initialized.ssss */ err = ntfs_bio_fill_1(sbi, &ni->file.run); out: @@ -329,7 +324,7 @@ out: /* * ntfs_query_def * - * returns current ATTR_DEF_ENTRY for given attribute type + * Return: Current ATTR_DEF_ENTRY for given attribute type. */ const struct ATTR_DEF_ENTRY *ntfs_query_def(struct ntfs_sb_info *sbi, enum ATTR_TYPE type) @@ -356,9 +351,7 @@ const struct ATTR_DEF_ENTRY *ntfs_query_def(struct ntfs_sb_info *sbi, } /* - * ntfs_look_for_free_space - * - * looks for a free space in bitmap + * ntfs_look_for_free_space - Look for a free space in bitmap. */ int ntfs_look_for_free_space(struct ntfs_sb_info *sbi, CLST lcn, CLST len, CLST *new_lcn, CLST *new_len, @@ -406,7 +399,7 @@ int ntfs_look_for_free_space(struct ntfs_sb_info *sbi, CLST lcn, CLST len, /* * 'Cause cluster 0 is always used this value means that we should use - * cached value of 'next_free_lcn' to improve performance + * cached value of 'next_free_lcn' to improve performance. */ if (!lcn) lcn = sbi->used.next_free_lcn; @@ -420,18 +413,18 @@ int ntfs_look_for_free_space(struct ntfs_sb_info *sbi, CLST lcn, CLST len, goto ok; } - /* Try to use clusters from MftZone */ + /* Try to use clusters from MftZone. */ zlen = wnd_zone_len(wnd); zeroes = wnd_zeroes(wnd); - /* Check too big request */ + /* Check too big request. */ if (len > zeroes + zlen) goto no_space; if (zlen <= NTFS_MIN_MFT_ZONE) goto no_space; - /* How many clusters to cat from zone */ + /* How many clusters to cat from zone. */ zlcn = wnd_zone_bit(wnd); zlen2 = zlen >> 1; ztrim = len > zlen ? zlen : (len > zlen2 ? len : zlen2); @@ -445,7 +438,7 @@ int ntfs_look_for_free_space(struct ntfs_sb_info *sbi, CLST lcn, CLST len, wnd_zone_set(wnd, zlcn, new_zlen); - /* allocate continues clusters */ + /* Allocate continues clusters. */ *new_len = wnd_find(wnd, len, 0, BITMAP_FIND_MARK_AS_USED | BITMAP_FIND_FULL, &a_lcn); @@ -467,7 +460,7 @@ ok: if (opt & ALLOCATE_MFT) goto out; - /* Set hint for next requests */ + /* Set hint for next requests. */ sbi->used.next_free_lcn = *new_lcn + *new_len; out: @@ -476,10 +469,9 @@ out: } /* - * ntfs_extend_mft + * ntfs_extend_mft - Allocate additional MFT records. * - * allocates additional MFT records - * sbi->mft.bitmap is locked for write + * sbi->mft.bitmap is locked for write. * * NOTE: recursive: * ntfs_look_free_mft -> @@ -490,8 +482,9 @@ out: * ni_ins_attr_ext -> * ntfs_look_free_mft -> * ntfs_extend_mft - * To avoid recursive always allocate space for two new mft records - * see attrib.c: "at least two mft to avoid recursive loop" + * + * To avoid recursive always allocate space for two new MFT records + * see attrib.c: "at least two MFT to avoid recursive loop". */ static int ntfs_extend_mft(struct ntfs_sb_info *sbi) { @@ -505,7 +498,7 @@ static int ntfs_extend_mft(struct ntfs_sb_info *sbi) new_mft_total = (wnd->nbits + MFT_INCREASE_CHUNK + 127) & (CLST)~127; new_mft_bytes = (u64)new_mft_total << sbi->record_bits; - /* Step 1: Resize $MFT::DATA */ + /* Step 1: Resize $MFT::DATA. */ down_write(&ni->file.run_lock); err = attr_set_size(ni, ATTR_DATA, NULL, 0, &ni->file.run, new_mft_bytes, NULL, false, &attr); @@ -519,13 +512,13 @@ static int ntfs_extend_mft(struct ntfs_sb_info *sbi) new_mft_total = le64_to_cpu(attr->nres.alloc_size) >> sbi->record_bits; ni->mi.dirty = true; - /* Step 2: Resize $MFT::BITMAP */ + /* Step 2: Resize $MFT::BITMAP. */ new_bitmap_bytes = bitmap_size(new_mft_total); err = attr_set_size(ni, ATTR_BITMAP, NULL, 0, &sbi->mft.bitmap.run, new_bitmap_bytes, &new_bitmap_bytes, true, NULL); - /* Refresh Mft Zone if necessary */ + /* Refresh MFT Zone if necessary. */ down_write_nested(&sbi->used.bitmap.rw_lock, BITMAP_MUTEX_CLUSTERS); ntfs_refresh_zone(sbi); @@ -549,9 +542,7 @@ out: } /* - * ntfs_look_free_mft - * - * looks for a free MFT record + * ntfs_look_free_mft - Look for a free MFT record. */ int ntfs_look_free_mft(struct ntfs_sb_info *sbi, CLST *rno, bool mft, struct ntfs_inode *ni, struct mft_inode **mi) @@ -572,7 +563,7 @@ int ntfs_look_free_mft(struct ntfs_sb_info *sbi, CLST *rno, bool mft, zlen = wnd_zone_len(wnd); - /* Always reserve space for MFT */ + /* Always reserve space for MFT. */ if (zlen) { if (mft) { zbit = wnd_zone_bit(wnd); @@ -582,7 +573,7 @@ int ntfs_look_free_mft(struct ntfs_sb_info *sbi, CLST *rno, bool mft, goto found; } - /* No MFT zone. find the nearest to '0' free MFT */ + /* No MFT zone. Find the nearest to '0' free MFT. */ if (!wnd_find(wnd, 1, MFT_REC_FREE, 0, &zbit)) { /* Resize MFT */ mft_total = wnd->nbits; @@ -601,10 +592,10 @@ int ntfs_look_free_mft(struct ntfs_sb_info *sbi, CLST *rno, bool mft, /* * Look for free record reserved area [11-16) == * [MFT_REC_RESERVED, MFT_REC_FREE ) MFT bitmap always - * marks it as used + * marks it as used. */ if (!sbi->mft.reserved_bitmap) { - /* Once per session create internal bitmap for 5 bits */ + /* Once per session create internal bitmap for 5 bits. */ sbi->mft.reserved_bitmap = 0xFF; ref.high = 0; @@ -671,7 +662,7 @@ reserve_mft: while (zlen > 1 && !wnd_is_free(wnd, zbit, zlen)) zlen -= 1; - /* [zbit, zbit + zlen) will be used for Mft itself */ + /* [zbit, zbit + zlen) will be used for MFT itself. */ from = sbi->mft.used; if (from < zbit) from = zbit; @@ -692,7 +683,7 @@ reserve_mft: found: if (!mft) { - /* The request to get record for general purpose */ + /* The request to get record for general purpose. */ if (sbi->mft.next_free < MFT_REC_USER) sbi->mft.next_free = MFT_REC_USER; @@ -717,7 +708,7 @@ found: goto out; } - /* We have found a record that are not reserved for next MFT */ + /* We have found a record that are not reserved for next MFT. */ if (*rno >= MFT_REC_FREE) wnd_set_used(wnd, *rno, 1); else if (*rno >= MFT_REC_RESERVED && sbi->mft.reserved_bitmap_inited) @@ -731,9 +722,7 @@ out: } /* - * ntfs_mark_rec_free - * - * marks record as free + * ntfs_mark_rec_free - Mark record as free. */ void ntfs_mark_rec_free(struct ntfs_sb_info *sbi, CLST rno) { @@ -762,10 +751,9 @@ out: } /* - * ntfs_clear_mft_tail + * ntfs_clear_mft_tail - Format empty records [from, to). * - * formats empty records [from, to) - * sbi->mft.bitmap is locked for write + * sbi->mft.bitmap is locked for write. */ int ntfs_clear_mft_tail(struct ntfs_sb_info *sbi, size_t from, size_t to) { @@ -804,12 +792,11 @@ out: } /* - * ntfs_refresh_zone + * ntfs_refresh_zone - Refresh MFT zone. * - * refreshes Mft zone - * sbi->used.bitmap is locked for rw - * sbi->mft.bitmap is locked for write - * sbi->mft.ni->file.run_lock for write + * sbi->used.bitmap is locked for rw. + * sbi->mft.bitmap is locked for write. + * sbi->mft.ni->file.run_lock for write. */ int ntfs_refresh_zone(struct ntfs_sb_info *sbi) { @@ -818,14 +805,14 @@ int ntfs_refresh_zone(struct ntfs_sb_info *sbi) struct wnd_bitmap *wnd = &sbi->used.bitmap; struct ntfs_inode *ni = sbi->mft.ni; - /* Do not change anything unless we have non empty Mft zone */ + /* Do not change anything unless we have non empty MFT zone. */ if (wnd_zone_len(wnd)) return 0; /* - * Compute the mft zone at two steps - * It would be nice if we are able to allocate - * 1/8 of total clusters for MFT but not more then 512 MB + * Compute the MFT zone at two steps. + * It would be nice if we are able to allocate 1/8 of + * total clusters for MFT but not more then 512 MB. */ zone_limit = (512 * 1024 * 1024) >> sbi->cluster_bits; zone_max = wnd->nbits >> 3; @@ -838,29 +825,27 @@ int ntfs_refresh_zone(struct ntfs_sb_info *sbi) if (!run_lookup_entry(&ni->file.run, vcn - 1, &lcn, &len, NULL)) lcn = SPARSE_LCN; - /* We should always find Last Lcn for MFT */ + /* We should always find Last Lcn for MFT. */ if (lcn == SPARSE_LCN) return -EINVAL; lcn_s = lcn + 1; - /* Try to allocate clusters after last MFT run */ + /* Try to allocate clusters after last MFT run. */ zlen = wnd_find(wnd, zone_max, lcn_s, 0, &lcn_s); if (!zlen) { ntfs_notice(sbi->sb, "MftZone: unavailable"); return 0; } - /* Truncate too large zone */ + /* Truncate too large zone. */ wnd_zone_set(wnd, lcn_s, zlen); return 0; } /* - * ntfs_update_mftmirr - * - * updates $MFTMirr data + * ntfs_update_mftmirr - Update $MFTMirr data. */ int ntfs_update_mftmirr(struct ntfs_sb_info *sbi, int wait) { @@ -923,9 +908,9 @@ out: /* * ntfs_set_state * - * mount: ntfs_set_state(NTFS_DIRTY_DIRTY) - * umount: ntfs_set_state(NTFS_DIRTY_CLEAR) - * ntfs error: ntfs_set_state(NTFS_DIRTY_ERROR) + * Mount: ntfs_set_state(NTFS_DIRTY_DIRTY) + * Umount: ntfs_set_state(NTFS_DIRTY_CLEAR) + * NTFS error: ntfs_set_state(NTFS_DIRTY_ERROR) */ int ntfs_set_state(struct ntfs_sb_info *sbi, enum NTFS_DIRTY_FLAGS dirty) { @@ -936,14 +921,14 @@ int ntfs_set_state(struct ntfs_sb_info *sbi, enum NTFS_DIRTY_FLAGS dirty) struct ntfs_inode *ni; /* - * do not change state if fs was real_dirty - * do not change state if fs already dirty(clear) - * do not change any thing if mounted read only + * Do not change state if fs was real_dirty. + * Do not change state if fs already dirty(clear). + * Do not change any thing if mounted read only. */ if (sbi->volume.real_dirty || sb_rdonly(sbi->sb)) return 0; - /* Check cached value */ + /* Check cached value. */ if ((dirty == NTFS_DIRTY_CLEAR ? 0 : VOLUME_FLAG_DIRTY) == (sbi->volume.flags & VOLUME_FLAG_DIRTY)) return 0; @@ -978,7 +963,7 @@ int ntfs_set_state(struct ntfs_sb_info *sbi, enum NTFS_DIRTY_FLAGS dirty) info->flags &= ~VOLUME_FLAG_DIRTY; break; } - /* cache current volume flags*/ + /* Cache current volume flags. */ sbi->volume.flags = info->flags; mi->dirty = true; err = 0; @@ -989,7 +974,7 @@ out: return err; mark_inode_dirty(&ni->vfs_inode); - /*verify(!ntfs_update_mftmirr()); */ + /* verify(!ntfs_update_mftmirr()); */ /* * if we used wait=1, sync_inode_metadata waits for the io for the @@ -1005,9 +990,7 @@ out: } /* - * security_hash - * - * calculates a hash of security descriptor + * security_hash - Calculates a hash of security descriptor. */ static inline __le32 security_hash(const void *sd, size_t bytes) { @@ -1193,13 +1176,13 @@ int ntfs_read_run_nb(struct ntfs_sb_info *sbi, const struct runs_tree *run, struct buffer_head *bh; if (!run) { - /* first reading of $Volume + $MFTMirr + LogFile goes here*/ + /* First reading of $Volume + $MFTMirr + $LogFile goes here. */ if (vbo > MFT_REC_VOL * sbi->record_size) { err = -ENOENT; goto out; } - /* use absolute boot's 'MFTCluster' to read record */ + /* Use absolute boot's 'MFTCluster' to read record. */ lbo = vbo + sbi->mft.lbo; len = sbi->record_size; } else if (!run_lookup_entry(run, vcn, &lcn, &clen, &idx)) { @@ -1290,7 +1273,11 @@ out: return err; } -/* Returns < 0 if error, 0 if ok, '-E_NTFS_FIXUP' if need to update fixups */ +/* + * ntfs_read_bh + * + * Return: < 0 if error, 0 if ok, -E_NTFS_FIXUP if need to update fixups. + */ int ntfs_read_bh(struct ntfs_sb_info *sbi, const struct runs_tree *run, u64 vbo, struct NTFS_RECORD_HEADER *rhdr, u32 bytes, struct ntfs_buffers *nb) @@ -1487,7 +1474,9 @@ static inline struct bio *ntfs_alloc_bio(u32 nr_vecs) return bio; } -/* read/write pages from/to disk*/ +/* + * ntfs_bio_pages - Read/write pages from/to disk. + */ int ntfs_bio_pages(struct ntfs_sb_info *sbi, const struct runs_tree *run, struct page **pages, u32 nr_pages, u64 vbo, u32 bytes, u32 op) @@ -1509,7 +1498,7 @@ int ntfs_bio_pages(struct ntfs_sb_info *sbi, const struct runs_tree *run, blk_start_plug(&plug); - /* align vbo and bytes to be 512 bytes aligned */ + /* Align vbo and bytes to be 512 bytes aligned. */ lbo = (vbo + bytes + 511) & ~511ull; vbo = vbo & ~511ull; bytes = lbo - vbo; @@ -1588,9 +1577,10 @@ out: } /* - * Helper for ntfs_loadlog_and_replay - * fill on-disk logfile range by (-1) - * this means empty logfile + * ntfs_bio_fill_1 - Helper for ntfs_loadlog_and_replay(). + * + * Fill on-disk logfile range by (-1) + * this means empty logfile. */ int ntfs_bio_fill_1(struct ntfs_sb_info *sbi, const struct runs_tree *run) { @@ -1622,7 +1612,7 @@ int ntfs_bio_fill_1(struct ntfs_sb_info *sbi, const struct runs_tree *run) } /* - * TODO: try blkdev_issue_write_same + * TODO: Try blkdev_issue_write_same. */ blk_start_plug(&plug); do { @@ -1719,8 +1709,8 @@ out: /* * O:BAG:BAD:(A;OICI;FA;;;WD) - * owner S-1-5-32-544 (Administrators) - * group S-1-5-32-544 (Administrators) + * Owner S-1-5-32-544 (Administrators) + * Group S-1-5-32-544 (Administrators) * ACE: allow S-1-1-0 (Everyone) with FILE_ALL_ACCESS */ const u8 s_default_security[] __aligned(8) = { @@ -1741,7 +1731,9 @@ static inline u32 sid_length(const struct SID *sid) } /* - * Thanks Mark Harmstone for idea + * is_acl_valid + * + * Thanks Mark Harmstone for idea. */ static bool is_acl_valid(const struct ACL *acl, u32 len) { @@ -1857,9 +1849,7 @@ bool is_sd_valid(const struct SECURITY_DESCRIPTOR_RELATIVE *sd, u32 len) } /* - * ntfs_security_init - * - * loads and parse $Secure + * ntfs_security_init - Load and parse $Secure. */ int ntfs_security_init(struct ntfs_sb_info *sbi) { @@ -1940,9 +1930,9 @@ int ntfs_security_init(struct ntfs_sb_info *sbi) sds_size = inode->i_size; - /* Find the last valid Id */ + /* Find the last valid Id. */ sbi->security.next_id = SECURITY_ID_FIRST; - /* Always write new security at the end of bucket */ + /* Always write new security at the end of bucket. */ sbi->security.next_off = ALIGN(sds_size - SecurityDescriptorsBlockSize, 16); @@ -1975,9 +1965,7 @@ out: } /* - * ntfs_get_security_by_id - * - * reads security descriptor by id + * ntfs_get_security_by_id - Read security descriptor by id. */ int ntfs_get_security_by_id(struct ntfs_sb_info *sbi, __le32 security_id, struct SECURITY_DESCRIPTOR_RELATIVE **sd, @@ -2010,7 +1998,7 @@ int ntfs_get_security_by_id(struct ntfs_sb_info *sbi, __le32 security_id, goto out; } - /* Try to find this SECURITY descriptor in SII indexes */ + /* Try to find this SECURITY descriptor in SII indexes. */ err = indx_find(indx, ni, root_sii, &security_id, sizeof(security_id), NULL, &diff, (struct NTFS_DE **)&sii_e, fnd_sii); if (err) @@ -2026,9 +2014,7 @@ int ntfs_get_security_by_id(struct ntfs_sb_info *sbi, __le32 security_id, } if (t32 > SIZEOF_SECURITY_HDR + 0x10000) { - /* - * looks like too big security. 0x10000 - is arbitrary big number - */ + /* Looks like too big security. 0x10000 - is arbitrary big number. */ err = -EFBIG; goto out; } @@ -2071,9 +2057,7 @@ out: } /* - * ntfs_insert_security - * - * inserts security descriptor into $Secure::SDS + * ntfs_insert_security - Insert security descriptor into $Secure::SDS. * * SECURITY Descriptor Stream data is organized into chunks of 256K bytes * and it contains a mirror copy of each security descriptor. When writing @@ -2114,7 +2098,7 @@ int ntfs_insert_security(struct ntfs_sb_info *sbi, *inserted = false; *security_id = SECURITY_ID_INVALID; - /* Allocate a temporal buffer*/ + /* Allocate a temporal buffer. */ d_security = kzalloc(aligned_sec_size, GFP_NOFS); if (!d_security) return -ENOMEM; @@ -2140,8 +2124,8 @@ int ntfs_insert_security(struct ntfs_sb_info *sbi, } /* - * Check if such security already exists - * use "SDH" and hash -> to get the offset in "SDS" + * Check if such security already exists. + * Use "SDH" and hash -> to get the offset in "SDS". */ err = indx_find(indx_sdh, ni, root_sdh, &hash_key, sizeof(hash_key), &d_security->key.sec_id, &diff, (struct NTFS_DE **)&e, @@ -2161,7 +2145,7 @@ int ntfs_insert_security(struct ntfs_sb_info *sbi, d_security->key.hash == hash_key.hash && !memcmp(d_security + 1, sd, size_sd)) { *security_id = d_security->key.sec_id; - /*such security already exists*/ + /* Such security already exists. */ err = 0; goto out; } @@ -2176,17 +2160,17 @@ int ntfs_insert_security(struct ntfs_sb_info *sbi, break; } - /* Zero unused space */ + /* Zero unused space. */ next = sbi->security.next_off & (SecurityDescriptorsBlockSize - 1); left = SecurityDescriptorsBlockSize - next; - /* Zero gap until SecurityDescriptorsBlockSize */ + /* Zero gap until SecurityDescriptorsBlockSize. */ if (left < new_sec_size) { - /* zero "left" bytes from sbi->security.next_off */ + /* Zero "left" bytes from sbi->security.next_off. */ sbi->security.next_off += SecurityDescriptorsBlockSize + left; } - /* Zero tail of previous security */ + /* Zero tail of previous security. */ //used = ni->vfs_inode.i_size & (SecurityDescriptorsBlockSize - 1); /* @@ -2199,14 +2183,14 @@ int ntfs_insert_security(struct ntfs_sb_info *sbi, * zero "tozero" bytes from sbi->security.next_off - tozero */ - /* format new security descriptor */ + /* Format new security descriptor. */ d_security->key.hash = hash_key.hash; d_security->key.sec_id = cpu_to_le32(sbi->security.next_id); d_security->off = cpu_to_le64(sbi->security.next_off); d_security->size = cpu_to_le32(new_sec_size); memcpy(d_security + 1, sd, size_sd); - /* Write main SDS bucket */ + /* Write main SDS bucket. */ err = ntfs_sb_write_run(sbi, &ni->file.run, sbi->security.next_off, d_security, aligned_sec_size); @@ -2224,13 +2208,13 @@ int ntfs_insert_security(struct ntfs_sb_info *sbi, goto out; } - /* Write copy SDS bucket */ + /* Write copy SDS bucket. */ err = ntfs_sb_write_run(sbi, &ni->file.run, mirr_off, d_security, aligned_sec_size); if (err) goto out; - /* Fill SII entry */ + /* Fill SII entry. */ sii_e.de.view.data_off = cpu_to_le16(offsetof(struct NTFS_DE_SII, sec_hdr)); sii_e.de.view.data_size = cpu_to_le16(SIZEOF_SECURITY_HDR); @@ -2246,7 +2230,7 @@ int ntfs_insert_security(struct ntfs_sb_info *sbi, if (err) goto out; - /* Fill SDH entry */ + /* Fill SDH entry. */ sdh_e.de.view.data_off = cpu_to_le16(offsetof(struct NTFS_DE_SDH, sec_hdr)); sdh_e.de.view.data_size = cpu_to_le16(SIZEOF_SECURITY_HDR); @@ -2271,7 +2255,7 @@ int ntfs_insert_security(struct ntfs_sb_info *sbi, if (inserted) *inserted = true; - /* Update Id and offset for next descriptor */ + /* Update Id and offset for next descriptor. */ sbi->security.next_id += 1; sbi->security.next_off += aligned_sec_size; @@ -2285,9 +2269,7 @@ out: } /* - * ntfs_reparse_init - * - * loads and parse $Extend/$Reparse + * ntfs_reparse_init - Load and parse $Extend/$Reparse. */ int ntfs_reparse_init(struct ntfs_sb_info *sbi) { @@ -2325,9 +2307,7 @@ out: } /* - * ntfs_objid_init - * - * loads and parse $Extend/$ObjId + * ntfs_objid_init - Load and parse $Extend/$ObjId. */ int ntfs_objid_init(struct ntfs_sb_info *sbi) { @@ -2449,14 +2429,14 @@ int ntfs_remove_reparse(struct ntfs_sb_info *sbi, __le32 rtag, goto out; } - /* 1 - forces to ignore rkey.ReparseTag when comparing keys */ + /* 1 - forces to ignore rkey.ReparseTag when comparing keys. */ err = indx_find(indx, ni, root_r, &rkey, sizeof(rkey), (void *)1, &diff, (struct NTFS_DE **)&re, fnd); if (err) goto out; if (memcmp(&re->key.ref, ref, sizeof(*ref))) { - /* Impossible. Looks like volume corrupt?*/ + /* Impossible. Looks like volume corrupt? */ goto out; } @@ -2528,9 +2508,7 @@ out: } /* - * run_deallocate - * - * deallocate clusters + * run_deallocate - Deallocate clusters. */ int run_deallocate(struct ntfs_sb_info *sbi, struct runs_tree *run, bool trim) { -- cgit v1.2.3