]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
NTFS: Use C99 style structure initialization after memory allocation where
authorAnton Altaparmakov <aia21@cantab.net>
Fri, 27 May 2005 15:42:56 +0000 (16:42 +0100)
committerAnton Altaparmakov <aia21@cantab.net>
Fri, 27 May 2005 15:42:56 +0000 (16:42 +0100)
      possible (fs/ntfs/{attrib.c,index.c,super.c}).  Thanks to Al Viro and
      Pekka Enberg.

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
fs/ntfs/ChangeLog
fs/ntfs/attrib.c
fs/ntfs/index.c
fs/ntfs/super.c

index f8ba90dd8e39d133bde7457c5e76d5d796899c37..cb86140aa2a364f27945151b70db406ef7670870 100644 (file)
@@ -116,6 +116,9 @@ ToDo/Notes:
        - Use MAX_BUF_PER_PAGE instead of variable sized array allocation for
          better code generation and one less sparse warning in fs/ntfs/aops.c.
        - Remove spurious void pointer casts from fs/ntfs/.  (Pekka Enberg)
+       - Use C99 style structure initialization after memory allocation where
+         possible (fs/ntfs/{attrib.c,index.c,super.c}).  Thanks to Al Viro and
+         Pekka Enberg.
 
 2.1.22 - Many bug and race fixes and error handling improvements.
 
index 23ca3bdfb89a0bcf761913cce2221e00e0d51ff5..104eedfb2507110c3880df918481e76c5809bb74 100644 (file)
@@ -982,15 +982,14 @@ int ntfs_attr_lookup(const ATTR_TYPE type, const ntfschar *name,
 static inline void ntfs_attr_init_search_ctx(ntfs_attr_search_ctx *ctx,
                ntfs_inode *ni, MFT_RECORD *mrec)
 {
-       ctx->mrec = mrec;
-       /* Sanity checks are performed elsewhere. */
-       ctx->attr = (ATTR_RECORD*)((u8*)mrec + le16_to_cpu(mrec->attrs_offset));
-       ctx->is_first = TRUE;
-       ctx->ntfs_ino = ni;
-       ctx->al_entry = NULL;
-       ctx->base_ntfs_ino = NULL;
-       ctx->base_mrec = NULL;
-       ctx->base_attr = NULL;
+       *ctx = (ntfs_attr_search_ctx) {
+               .mrec = mrec,
+               /* Sanity checks are performed elsewhere. */
+               .attr = (ATTR_RECORD*)((u8*)mrec +
+                               le16_to_cpu(mrec->attrs_offset)),
+               .is_first = TRUE,
+               .ntfs_ino = ni,
+       };
 }
 
 /**
index 71bd2cd7a4d99f4b9e1ea003c34b2dab4e6d95ef..11fd5307d780568ce8b5a0fc8ab63cf39d1aaf02 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * index.c - NTFS kernel index handling.  Part of the Linux-NTFS project.
  *
- * Copyright (c) 2004 Anton Altaparmakov
+ * Copyright (c) 2004-2005 Anton Altaparmakov
  *
  * This program/include file is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as published
@@ -39,18 +39,8 @@ ntfs_index_context *ntfs_index_ctx_get(ntfs_inode *idx_ni)
        ntfs_index_context *ictx;
 
        ictx = kmem_cache_alloc(ntfs_index_ctx_cache, SLAB_NOFS);
-       if (ictx) {
-               ictx->idx_ni = idx_ni;
-               ictx->entry = NULL;
-               ictx->data = NULL;
-               ictx->data_len = 0;
-               ictx->is_in_root = 0;
-               ictx->ir = NULL;
-               ictx->actx = NULL;
-               ictx->base_ni = NULL;
-               ictx->ia = NULL;
-               ictx->page = NULL;
-       }
+       if (ictx)
+               *ictx = (ntfs_index_context){ .idx_ni = idx_ni };
        return ictx;
 }
 
index 8e50aa929f1c067b132bc1eb85ff9320c8558c8a..455cbe0a6296802e6f168ad678dab82e6de295c1 100644 (file)
@@ -2292,36 +2292,19 @@ static int ntfs_fill_super(struct super_block *sb, void *opt, const int silent)
                return -ENOMEM;
        }
        /* Initialize ntfs_volume structure. */
-       memset(vol, 0, sizeof(ntfs_volume));
-       vol->sb = sb;
-       vol->upcase = NULL;
-       vol->attrdef = NULL;
-       vol->mft_ino = NULL;
-       vol->mftbmp_ino = NULL;
+       *vol = (ntfs_volume) {
+               .sb = sb,
+               /*
+                * Default is group and other don't have any access to files or
+                * directories while owner has full access. Further, files by
+                * default are not executable but directories are of course
+                * browseable.
+                */
+               .fmask = 0177,
+               .dmask = 0077,
+       };
        init_rwsem(&vol->mftbmp_lock);
-#ifdef NTFS_RW
-       vol->mftmirr_ino = NULL;
-       vol->logfile_ino = NULL;
-#endif /* NTFS_RW */
-       vol->lcnbmp_ino = NULL;
        init_rwsem(&vol->lcnbmp_lock);
-       vol->vol_ino = NULL;
-       vol->root_ino = NULL;
-       vol->secure_ino = NULL;
-       vol->extend_ino = NULL;
-#ifdef NTFS_RW
-       vol->quota_ino = NULL;
-       vol->quota_q_ino = NULL;
-#endif /* NTFS_RW */
-       vol->nls_map = NULL;
-
-       /*
-        * Default is group and other don't have any access to files or
-        * directories while owner has full access. Further, files by default
-        * are not executable but directories are of course browseable.
-        */
-       vol->fmask = 0177;
-       vol->dmask = 0077;
 
        unlock_kernel();