aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ntfs
diff options
context:
space:
mode:
authorAnton Altaparmakov <aia21@cantab.net>2005-05-27 11:42:56 -0400
committerAnton Altaparmakov <aia21@cantab.net>2005-05-27 11:42:56 -0400
commit442d207eb0b4e7047c4fedccd900c425e689d502 (patch)
tree2c23dc98fba6912417164ba65b258a9da1241ae1 /fs/ntfs
parent2fb21db2548fc8b196eb8d8425f05ee1965d5344 (diff)
NTFS: 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. Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
Diffstat (limited to 'fs/ntfs')
-rw-r--r--fs/ntfs/ChangeLog3
-rw-r--r--fs/ntfs/attrib.c17
-rw-r--r--fs/ntfs/index.c16
-rw-r--r--fs/ntfs/super.c39
4 files changed, 25 insertions, 50 deletions
diff --git a/fs/ntfs/ChangeLog b/fs/ntfs/ChangeLog
index f8ba90dd8e39..cb86140aa2a3 100644
--- a/fs/ntfs/ChangeLog
+++ b/fs/ntfs/ChangeLog
@@ -116,6 +116,9 @@ ToDo/Notes:
116 - Use MAX_BUF_PER_PAGE instead of variable sized array allocation for 116 - Use MAX_BUF_PER_PAGE instead of variable sized array allocation for
117 better code generation and one less sparse warning in fs/ntfs/aops.c. 117 better code generation and one less sparse warning in fs/ntfs/aops.c.
118 - Remove spurious void pointer casts from fs/ntfs/. (Pekka Enberg) 118 - Remove spurious void pointer casts from fs/ntfs/. (Pekka Enberg)
119 - Use C99 style structure initialization after memory allocation where
120 possible (fs/ntfs/{attrib.c,index.c,super.c}). Thanks to Al Viro and
121 Pekka Enberg.
119 122
1202.1.22 - Many bug and race fixes and error handling improvements. 1232.1.22 - Many bug and race fixes and error handling improvements.
121 124
diff --git a/fs/ntfs/attrib.c b/fs/ntfs/attrib.c
index 23ca3bdfb89a..104eedfb2507 100644
--- a/fs/ntfs/attrib.c
+++ b/fs/ntfs/attrib.c
@@ -982,15 +982,14 @@ int ntfs_attr_lookup(const ATTR_TYPE type, const ntfschar *name,
982static inline void ntfs_attr_init_search_ctx(ntfs_attr_search_ctx *ctx, 982static inline void ntfs_attr_init_search_ctx(ntfs_attr_search_ctx *ctx,
983 ntfs_inode *ni, MFT_RECORD *mrec) 983 ntfs_inode *ni, MFT_RECORD *mrec)
984{ 984{
985 ctx->mrec = mrec; 985 *ctx = (ntfs_attr_search_ctx) {
986 /* Sanity checks are performed elsewhere. */ 986 .mrec = mrec,
987 ctx->attr = (ATTR_RECORD*)((u8*)mrec + le16_to_cpu(mrec->attrs_offset)); 987 /* Sanity checks are performed elsewhere. */
988 ctx->is_first = TRUE; 988 .attr = (ATTR_RECORD*)((u8*)mrec +
989 ctx->ntfs_ino = ni; 989 le16_to_cpu(mrec->attrs_offset)),
990 ctx->al_entry = NULL; 990 .is_first = TRUE,
991 ctx->base_ntfs_ino = NULL; 991 .ntfs_ino = ni,
992 ctx->base_mrec = NULL; 992 };
993 ctx->base_attr = NULL;
994} 993}
995 994
996/** 995/**
diff --git a/fs/ntfs/index.c b/fs/ntfs/index.c
index 71bd2cd7a4d9..11fd5307d780 100644
--- a/fs/ntfs/index.c
+++ b/fs/ntfs/index.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * index.c - NTFS kernel index handling. Part of the Linux-NTFS project. 2 * index.c - NTFS kernel index handling. Part of the Linux-NTFS project.
3 * 3 *
4 * Copyright (c) 2004 Anton Altaparmakov 4 * Copyright (c) 2004-2005 Anton Altaparmakov
5 * 5 *
6 * This program/include file is free software; you can redistribute it and/or 6 * This program/include file is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as published 7 * 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)
39 ntfs_index_context *ictx; 39 ntfs_index_context *ictx;
40 40
41 ictx = kmem_cache_alloc(ntfs_index_ctx_cache, SLAB_NOFS); 41 ictx = kmem_cache_alloc(ntfs_index_ctx_cache, SLAB_NOFS);
42 if (ictx) { 42 if (ictx)
43 ictx->idx_ni = idx_ni; 43 *ictx = (ntfs_index_context){ .idx_ni = idx_ni };
44 ictx->entry = NULL;
45 ictx->data = NULL;
46 ictx->data_len = 0;
47 ictx->is_in_root = 0;
48 ictx->ir = NULL;
49 ictx->actx = NULL;
50 ictx->base_ni = NULL;
51 ictx->ia = NULL;
52 ictx->page = NULL;
53 }
54 return ictx; 44 return ictx;
55} 45}
56 46
diff --git a/fs/ntfs/super.c b/fs/ntfs/super.c
index 8e50aa929f1c..455cbe0a6296 100644
--- a/fs/ntfs/super.c
+++ b/fs/ntfs/super.c
@@ -2292,36 +2292,19 @@ static int ntfs_fill_super(struct super_block *sb, void *opt, const int silent)
2292 return -ENOMEM; 2292 return -ENOMEM;
2293 } 2293 }
2294 /* Initialize ntfs_volume structure. */ 2294 /* Initialize ntfs_volume structure. */
2295 memset(vol, 0, sizeof(ntfs_volume)); 2295 *vol = (ntfs_volume) {
2296 vol->sb = sb; 2296 .sb = sb,
2297 vol->upcase = NULL; 2297 /*
2298 vol->attrdef = NULL; 2298 * Default is group and other don't have any access to files or
2299 vol->mft_ino = NULL; 2299 * directories while owner has full access. Further, files by
2300 vol->mftbmp_ino = NULL; 2300 * default are not executable but directories are of course
2301 * browseable.
2302 */
2303 .fmask = 0177,
2304 .dmask = 0077,
2305 };
2301 init_rwsem(&vol->mftbmp_lock); 2306 init_rwsem(&vol->mftbmp_lock);
2302#ifdef NTFS_RW
2303 vol->mftmirr_ino = NULL;
2304 vol->logfile_ino = NULL;
2305#endif /* NTFS_RW */
2306 vol->lcnbmp_ino = NULL;
2307 init_rwsem(&vol->lcnbmp_lock); 2307 init_rwsem(&vol->lcnbmp_lock);
2308 vol->vol_ino = NULL;
2309 vol->root_ino = NULL;
2310 vol->secure_ino = NULL;
2311 vol->extend_ino = NULL;
2312#ifdef NTFS_RW
2313 vol->quota_ino = NULL;
2314 vol->quota_q_ino = NULL;
2315#endif /* NTFS_RW */
2316 vol->nls_map = NULL;
2317
2318 /*
2319 * Default is group and other don't have any access to files or
2320 * directories while owner has full access. Further, files by default
2321 * are not executable but directories are of course browseable.
2322 */
2323 vol->fmask = 0177;
2324 vol->dmask = 0077;
2325 2308
2326 unlock_kernel(); 2309 unlock_kernel();
2327 2310