* [PATCH 02/10] NFS: Use C99 struct initializers in nfs4proc.c @ 2007-05-25 21:41 Chuck Lever 2007-05-26 18:01 ` Trond Myklebust 0 siblings, 1 reply; 10+ messages in thread From: Chuck Lever @ 2007-05-25 21:41 UTC (permalink / raw) To: trond.myklebust; +Cc: nfs Follow kernel coding conventions. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> --- fs/nfs/nfs4_fs.h | 5 ++++ fs/nfs/nfs4proc.c | 70 ++++++++++++++++++++++++++++------------------------- 2 files changed, 42 insertions(+), 33 deletions(-) diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h index cf3a17e..1a526c4 100644 --- a/fs/nfs/nfs4_fs.h +++ b/fs/nfs/nfs4_fs.h @@ -145,6 +145,11 @@ struct nfs4_exception { int retry; }; +#define DECLARE_NFS4_EXCEPTION(name) \ + struct nfs4_exception name = { \ + .timeout = 0, \ + } + struct nfs4_state_recovery_ops { int (*recover_open)(struct nfs4_state_owner *, struct nfs4_state *); int (*recover_lock)(struct nfs4_state *, struct file_lock *); diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 648e0ac..b220c09 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -493,7 +493,7 @@ static int _nfs4_do_open_reclaim(struct nfs4_state_owner *sp, struct nfs4_state static int nfs4_do_open_reclaim(struct nfs4_state_owner *sp, struct nfs4_state *state, struct dentry *dentry) { struct nfs_server *server = NFS_SERVER(state->inode); - struct nfs4_exception exception = { }; + DECLARE_NFS4_EXCEPTION(exception); int err; do { err = _nfs4_do_open_reclaim(sp, state, dentry); @@ -538,8 +538,8 @@ static int _nfs4_open_delegation_recall(struct dentry *dentry, struct nfs4_state int nfs4_open_delegation_recall(struct dentry *dentry, struct nfs4_state *state) { - struct nfs4_exception exception = { }; struct nfs_server *server = NFS_SERVER(dentry->d_inode); + DECLARE_NFS4_EXCEPTION(exception); int err; do { err = _nfs4_open_delegation_recall(dentry, state); @@ -843,7 +843,7 @@ static int _nfs4_open_expired(struct nfs4_state_owner *sp, struct nfs4_state *st static inline int nfs4_do_open_expired(struct nfs4_state_owner *sp, struct nfs4_state *state, struct dentry *dentry) { struct nfs_server *server = NFS_SERVER(dentry->d_inode); - struct nfs4_exception exception = { }; + DECLARE_NFS4_EXCEPTION(exception); int err; do { @@ -938,8 +938,8 @@ out_put_state_owner: static struct nfs4_state *nfs4_open_delegated(struct inode *inode, int flags, struct rpc_cred *cred) { - struct nfs4_exception exception = { }; struct nfs4_state *res = ERR_PTR(-EIO); + DECLARE_NFS4_EXCEPTION(exception); int err; do { @@ -1008,7 +1008,7 @@ out_err: static struct nfs4_state *nfs4_do_open(struct inode *dir, struct dentry *dentry, int flags, struct iattr *sattr, struct rpc_cred *cred) { - struct nfs4_exception exception = { }; + DECLARE_NFS4_EXCEPTION(exception); struct nfs4_state *res; int status; @@ -1090,7 +1090,7 @@ static int nfs4_do_setattr(struct inode *inode, struct nfs_fattr *fattr, struct iattr *sattr, struct nfs4_state *state) { struct nfs_server *server = NFS_SERVER(inode); - struct nfs4_exception exception = { }; + DECLARE_NFS4_EXCEPTION(exception); int err; do { err = nfs4_handle_exception(server, @@ -1330,7 +1330,9 @@ out_drop: static int _nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *fhandle) { - struct nfs4_server_caps_res res = {}; + struct nfs4_server_caps_res res = { + .acl_bitmask = 0, + }; struct rpc_message msg = { .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_SERVER_CAPS], .rpc_argp = fhandle, @@ -1354,7 +1356,7 @@ static int _nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *f int nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *fhandle) { - struct nfs4_exception exception = { }; + DECLARE_NFS4_EXCEPTION(exception); int err; do { err = nfs4_handle_exception(server, @@ -1387,7 +1389,7 @@ static int _nfs4_lookup_root(struct nfs_server *server, struct nfs_fh *fhandle, static int nfs4_lookup_root(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fsinfo *info) { - struct nfs4_exception exception = { }; + DECLARE_NFS4_EXCEPTION(exception); int err; do { err = nfs4_handle_exception(server, @@ -1476,7 +1478,7 @@ static int _nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, static int nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fattr *fattr) { - struct nfs4_exception exception = { }; + DECLARE_NFS4_EXCEPTION(exception); int err; do { err = nfs4_handle_exception(server, @@ -1568,7 +1570,7 @@ static int nfs4_proc_lookupfh(struct nfs_server *server, struct nfs_fh *dirfh, struct qstr *name, struct nfs_fh *fhandle, struct nfs_fattr *fattr) { - struct nfs4_exception exception = { }; + DECLARE_NFS4_EXCEPTION(exception); int err; do { err = nfs4_handle_exception(server, @@ -1612,7 +1614,7 @@ static int _nfs4_proc_lookup(struct inode *dir, struct qstr *name, static int nfs4_proc_lookup(struct inode *dir, struct qstr *name, struct nfs_fh *fhandle, struct nfs_fattr *fattr) { - struct nfs4_exception exception = { }; + DECLARE_NFS4_EXCEPTION(exception); int err; do { err = nfs4_handle_exception(NFS_SERVER(dir), @@ -1627,7 +1629,9 @@ static int _nfs4_proc_access(struct inode *inode, struct nfs_access_entry *entry struct nfs4_accessargs args = { .fh = NFS_FH(inode), }; - struct nfs4_accessres res = { 0 }; + struct nfs4_accessres res = { + .access = 0, + }; struct rpc_message msg = { .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_ACCESS], .rpc_argp = &args, @@ -1668,7 +1672,7 @@ static int _nfs4_proc_access(struct inode *inode, struct nfs_access_entry *entry static int nfs4_proc_access(struct inode *inode, struct nfs_access_entry *entry) { - struct nfs4_exception exception = { }; + DECLARE_NFS4_EXCEPTION(exception); int err; do { err = nfs4_handle_exception(NFS_SERVER(inode), @@ -1723,7 +1727,7 @@ static int _nfs4_proc_readlink(struct inode *inode, struct page *page, static int nfs4_proc_readlink(struct inode *inode, struct page *page, unsigned int pgbase, unsigned int pglen) { - struct nfs4_exception exception = { }; + DECLARE_NFS4_EXCEPTION(exception); int err; do { err = nfs4_handle_exception(NFS_SERVER(inode), @@ -1813,7 +1817,7 @@ static int _nfs4_proc_remove(struct inode *dir, struct qstr *name) static int nfs4_proc_remove(struct inode *dir, struct qstr *name) { - struct nfs4_exception exception = { }; + DECLARE_NFS4_EXCEPTION(exception); int err; do { err = nfs4_handle_exception(NFS_SERVER(dir), @@ -1907,7 +1911,7 @@ static int _nfs4_proc_rename(struct inode *old_dir, struct qstr *old_name, static int nfs4_proc_rename(struct inode *old_dir, struct qstr *old_name, struct inode *new_dir, struct qstr *new_name) { - struct nfs4_exception exception = { }; + DECLARE_NFS4_EXCEPTION(exception); int err; do { err = nfs4_handle_exception(NFS_SERVER(old_dir), @@ -1954,7 +1958,7 @@ static int _nfs4_proc_link(struct inode *inode, struct inode *dir, struct qstr * static int nfs4_proc_link(struct inode *inode, struct inode *dir, struct qstr *name) { - struct nfs4_exception exception = { }; + DECLARE_NFS4_EXCEPTION(exception); int err; do { err = nfs4_handle_exception(NFS_SERVER(inode), @@ -2011,7 +2015,7 @@ static int _nfs4_proc_symlink(struct inode *dir, struct dentry *dentry, static int nfs4_proc_symlink(struct inode *dir, struct dentry *dentry, struct page *page, unsigned int len, struct iattr *sattr) { - struct nfs4_exception exception = { }; + DECLARE_NFS4_EXCEPTION(exception); int err; do { err = nfs4_handle_exception(NFS_SERVER(dir), @@ -2064,7 +2068,7 @@ static int _nfs4_proc_mkdir(struct inode *dir, struct dentry *dentry, static int nfs4_proc_mkdir(struct inode *dir, struct dentry *dentry, struct iattr *sattr) { - struct nfs4_exception exception = { }; + DECLARE_NFS4_EXCEPTION(exception); int err; do { err = nfs4_handle_exception(NFS_SERVER(dir), @@ -2110,7 +2114,7 @@ static int _nfs4_proc_readdir(struct dentry *dentry, struct rpc_cred *cred, static int nfs4_proc_readdir(struct dentry *dentry, struct rpc_cred *cred, u64 cookie, struct page *page, unsigned int count, int plus) { - struct nfs4_exception exception = { }; + DECLARE_NFS4_EXCEPTION(exception); int err; do { err = nfs4_handle_exception(NFS_SERVER(dentry->d_inode), @@ -2180,7 +2184,7 @@ static int _nfs4_proc_mknod(struct inode *dir, struct dentry *dentry, static int nfs4_proc_mknod(struct inode *dir, struct dentry *dentry, struct iattr *sattr, dev_t rdev) { - struct nfs4_exception exception = { }; + DECLARE_NFS4_EXCEPTION(exception); int err; do { err = nfs4_handle_exception(NFS_SERVER(dir), @@ -2209,7 +2213,7 @@ static int _nfs4_proc_statfs(struct nfs_server *server, struct nfs_fh *fhandle, static int nfs4_proc_statfs(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fsstat *fsstat) { - struct nfs4_exception exception = { }; + DECLARE_NFS4_EXCEPTION(exception); int err; do { err = nfs4_handle_exception(server, @@ -2237,7 +2241,7 @@ static int _nfs4_do_fsinfo(struct nfs_server *server, struct nfs_fh *fhandle, static int nfs4_do_fsinfo(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fsinfo *fsinfo) { - struct nfs4_exception exception = { }; + DECLARE_NFS4_EXCEPTION(exception); int err; do { @@ -2280,7 +2284,7 @@ static int _nfs4_proc_pathconf(struct nfs_server *server, struct nfs_fh *fhandle static int nfs4_proc_pathconf(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_pathconf *pathconf) { - struct nfs4_exception exception = { }; + DECLARE_NFS4_EXCEPTION(exception); int err; do { @@ -2599,7 +2603,7 @@ out_free: static ssize_t nfs4_get_acl_uncached(struct inode *inode, void *buf, size_t buflen) { - struct nfs4_exception exception = { }; + DECLARE_NFS4_EXCEPTION(exception); ssize_t ret; do { ret = __nfs4_get_acl_uncached(inode, buf, buflen); @@ -2653,7 +2657,7 @@ static int __nfs4_proc_set_acl(struct inode *inode, const void *buf, size_t bufl static int nfs4_proc_set_acl(struct inode *inode, const void *buf, size_t buflen) { - struct nfs4_exception exception = { }; + DECLARE_NFS4_EXCEPTION(exception); int err; do { err = nfs4_handle_exception(NFS_SERVER(inode), @@ -2950,7 +2954,7 @@ static int _nfs4_proc_delegreturn(struct inode *inode, struct rpc_cred *cred, co int nfs4_proc_delegreturn(struct inode *inode, struct rpc_cred *cred, const nfs4_stateid *stateid) { struct nfs_server *server = NFS_SERVER(inode); - struct nfs4_exception exception = { }; + DECLARE_NFS4_EXCEPTION(exception); int err; do { err = _nfs4_proc_delegreturn(inode, cred, stateid); @@ -3025,7 +3029,7 @@ out: static int nfs4_proc_getlk(struct nfs4_state *state, int cmd, struct file_lock *request) { - struct nfs4_exception exception = { }; + DECLARE_NFS4_EXCEPTION(exception); int err; do { @@ -3354,7 +3358,7 @@ static int _nfs4_do_setlk(struct nfs4_state *state, int cmd, struct file_lock *f static int nfs4_lock_reclaim(struct nfs4_state *state, struct file_lock *request) { struct nfs_server *server = NFS_SERVER(state->inode); - struct nfs4_exception exception = { }; + DECLARE_NFS4_EXCEPTION(exception); int err; do { @@ -3372,7 +3376,7 @@ static int nfs4_lock_reclaim(struct nfs4_state *state, struct file_lock *request static int nfs4_lock_expired(struct nfs4_state *state, struct file_lock *request) { struct nfs_server *server = NFS_SERVER(state->inode); - struct nfs4_exception exception = { }; + DECLARE_NFS4_EXCEPTION(exception); int err; err = nfs4_set_lock_state(state, request); @@ -3433,7 +3437,7 @@ out: static int nfs4_proc_setlk(struct nfs4_state *state, int cmd, struct file_lock *request) { - struct nfs4_exception exception = { }; + DECLARE_NFS4_EXCEPTION(exception); int err; do { @@ -3483,7 +3487,7 @@ nfs4_proc_lock(struct file *filp, int cmd, struct file_lock *request) int nfs4_lock_delegation_recall(struct nfs4_state *state, struct file_lock *fl) { struct nfs_server *server = NFS_SERVER(state->inode); - struct nfs4_exception exception = { }; + DECLARE_NFS4_EXCEPTION(exception); int err; err = nfs4_set_lock_state(state, fl); ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ NFS maillist - NFS@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nfs ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 02/10] NFS: Use C99 struct initializers in nfs4proc.c 2007-05-25 21:41 [PATCH 02/10] NFS: Use C99 struct initializers in nfs4proc.c Chuck Lever @ 2007-05-26 18:01 ` Trond Myklebust 2007-05-29 14:10 ` Chuck Lever 0 siblings, 1 reply; 10+ messages in thread From: Trond Myklebust @ 2007-05-26 18:01 UTC (permalink / raw) To: Chuck Lever; +Cc: nfs On Fri, 2007-05-25 at 17:41 -0400, Chuck Lever wrote: > Follow kernel coding conventions. > > Signed-off-by: Chuck Lever <chuck.lever@oracle.com> > --- > > fs/nfs/nfs4_fs.h | 5 ++++ > fs/nfs/nfs4proc.c | 70 ++++++++++++++++++++++++++++------------------------- > 2 files changed, 42 insertions(+), 33 deletions(-) > > diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h > index cf3a17e..1a526c4 100644 > --- a/fs/nfs/nfs4_fs.h > +++ b/fs/nfs/nfs4_fs.h > @@ -145,6 +145,11 @@ struct nfs4_exception { > int retry; > }; > > +#define DECLARE_NFS4_EXCEPTION(name) \ > + struct nfs4_exception name = { \ > + .timeout = 0, \ > + } Why would we want this? The existing code uses bog standard C99 initialisers. There is no need to explicitly set .timeout to zero. > struct nfs4_state_recovery_ops { > int (*recover_open)(struct nfs4_state_owner *, struct nfs4_state *); > int (*recover_lock)(struct nfs4_state *, struct file_lock *); > diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c > index 648e0ac..b220c09 100644 > --- a/fs/nfs/nfs4proc.c > +++ b/fs/nfs/nfs4proc.c > @@ -493,7 +493,7 @@ static int _nfs4_do_open_reclaim(struct nfs4_state_owner *sp, struct nfs4_state > static int nfs4_do_open_reclaim(struct nfs4_state_owner *sp, struct nfs4_state *state, struct dentry *dentry) > { > struct nfs_server *server = NFS_SERVER(state->inode); > - struct nfs4_exception exception = { }; > + DECLARE_NFS4_EXCEPTION(exception); > int err; > do { > err = _nfs4_do_open_reclaim(sp, state, dentry); > @@ -538,8 +538,8 @@ static int _nfs4_open_delegation_recall(struct dentry *dentry, struct nfs4_state > > int nfs4_open_delegation_recall(struct dentry *dentry, struct nfs4_state *state) > { > - struct nfs4_exception exception = { }; > struct nfs_server *server = NFS_SERVER(dentry->d_inode); > + DECLARE_NFS4_EXCEPTION(exception); > int err; > do { > err = _nfs4_open_delegation_recall(dentry, state); > @@ -843,7 +843,7 @@ static int _nfs4_open_expired(struct nfs4_state_owner *sp, struct nfs4_state *st > static inline int nfs4_do_open_expired(struct nfs4_state_owner *sp, struct nfs4_state *state, struct dentry *dentry) > { > struct nfs_server *server = NFS_SERVER(dentry->d_inode); > - struct nfs4_exception exception = { }; > + DECLARE_NFS4_EXCEPTION(exception); > int err; > > do { > @@ -938,8 +938,8 @@ out_put_state_owner: > > static struct nfs4_state *nfs4_open_delegated(struct inode *inode, int flags, struct rpc_cred *cred) > { > - struct nfs4_exception exception = { }; > struct nfs4_state *res = ERR_PTR(-EIO); > + DECLARE_NFS4_EXCEPTION(exception); > int err; > > do { > @@ -1008,7 +1008,7 @@ out_err: > > static struct nfs4_state *nfs4_do_open(struct inode *dir, struct dentry *dentry, int flags, struct iattr *sattr, struct rpc_cred *cred) > { > - struct nfs4_exception exception = { }; > + DECLARE_NFS4_EXCEPTION(exception); > struct nfs4_state *res; > int status; > > @@ -1090,7 +1090,7 @@ static int nfs4_do_setattr(struct inode *inode, struct nfs_fattr *fattr, > struct iattr *sattr, struct nfs4_state *state) > { > struct nfs_server *server = NFS_SERVER(inode); > - struct nfs4_exception exception = { }; > + DECLARE_NFS4_EXCEPTION(exception); > int err; > do { > err = nfs4_handle_exception(server, > @@ -1330,7 +1330,9 @@ out_drop: > > static int _nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *fhandle) > { > - struct nfs4_server_caps_res res = {}; > + struct nfs4_server_caps_res res = { > + .acl_bitmask = 0, > + }; > struct rpc_message msg = { > .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_SERVER_CAPS], > .rpc_argp = fhandle, > @@ -1354,7 +1356,7 @@ static int _nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *f > > int nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *fhandle) > { > - struct nfs4_exception exception = { }; > + DECLARE_NFS4_EXCEPTION(exception); > int err; > do { > err = nfs4_handle_exception(server, > @@ -1387,7 +1389,7 @@ static int _nfs4_lookup_root(struct nfs_server *server, struct nfs_fh *fhandle, > static int nfs4_lookup_root(struct nfs_server *server, struct nfs_fh *fhandle, > struct nfs_fsinfo *info) > { > - struct nfs4_exception exception = { }; > + DECLARE_NFS4_EXCEPTION(exception); > int err; > do { > err = nfs4_handle_exception(server, > @@ -1476,7 +1478,7 @@ static int _nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, > > static int nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fattr *fattr) > { > - struct nfs4_exception exception = { }; > + DECLARE_NFS4_EXCEPTION(exception); > int err; > do { > err = nfs4_handle_exception(server, > @@ -1568,7 +1570,7 @@ static int nfs4_proc_lookupfh(struct nfs_server *server, struct nfs_fh *dirfh, > struct qstr *name, struct nfs_fh *fhandle, > struct nfs_fattr *fattr) > { > - struct nfs4_exception exception = { }; > + DECLARE_NFS4_EXCEPTION(exception); > int err; > do { > err = nfs4_handle_exception(server, > @@ -1612,7 +1614,7 @@ static int _nfs4_proc_lookup(struct inode *dir, struct qstr *name, > > static int nfs4_proc_lookup(struct inode *dir, struct qstr *name, struct nfs_fh *fhandle, struct nfs_fattr *fattr) > { > - struct nfs4_exception exception = { }; > + DECLARE_NFS4_EXCEPTION(exception); > int err; > do { > err = nfs4_handle_exception(NFS_SERVER(dir), > @@ -1627,7 +1629,9 @@ static int _nfs4_proc_access(struct inode *inode, struct nfs_access_entry *entry > struct nfs4_accessargs args = { > .fh = NFS_FH(inode), > }; > - struct nfs4_accessres res = { 0 }; > + struct nfs4_accessres res = { > + .access = 0, > + }; > struct rpc_message msg = { > .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_ACCESS], > .rpc_argp = &args, > @@ -1668,7 +1672,7 @@ static int _nfs4_proc_access(struct inode *inode, struct nfs_access_entry *entry > > static int nfs4_proc_access(struct inode *inode, struct nfs_access_entry *entry) > { > - struct nfs4_exception exception = { }; > + DECLARE_NFS4_EXCEPTION(exception); > int err; > do { > err = nfs4_handle_exception(NFS_SERVER(inode), > @@ -1723,7 +1727,7 @@ static int _nfs4_proc_readlink(struct inode *inode, struct page *page, > static int nfs4_proc_readlink(struct inode *inode, struct page *page, > unsigned int pgbase, unsigned int pglen) > { > - struct nfs4_exception exception = { }; > + DECLARE_NFS4_EXCEPTION(exception); > int err; > do { > err = nfs4_handle_exception(NFS_SERVER(inode), > @@ -1813,7 +1817,7 @@ static int _nfs4_proc_remove(struct inode *dir, struct qstr *name) > > static int nfs4_proc_remove(struct inode *dir, struct qstr *name) > { > - struct nfs4_exception exception = { }; > + DECLARE_NFS4_EXCEPTION(exception); > int err; > do { > err = nfs4_handle_exception(NFS_SERVER(dir), > @@ -1907,7 +1911,7 @@ static int _nfs4_proc_rename(struct inode *old_dir, struct qstr *old_name, > static int nfs4_proc_rename(struct inode *old_dir, struct qstr *old_name, > struct inode *new_dir, struct qstr *new_name) > { > - struct nfs4_exception exception = { }; > + DECLARE_NFS4_EXCEPTION(exception); > int err; > do { > err = nfs4_handle_exception(NFS_SERVER(old_dir), > @@ -1954,7 +1958,7 @@ static int _nfs4_proc_link(struct inode *inode, struct inode *dir, struct qstr * > > static int nfs4_proc_link(struct inode *inode, struct inode *dir, struct qstr *name) > { > - struct nfs4_exception exception = { }; > + DECLARE_NFS4_EXCEPTION(exception); > int err; > do { > err = nfs4_handle_exception(NFS_SERVER(inode), > @@ -2011,7 +2015,7 @@ static int _nfs4_proc_symlink(struct inode *dir, struct dentry *dentry, > static int nfs4_proc_symlink(struct inode *dir, struct dentry *dentry, > struct page *page, unsigned int len, struct iattr *sattr) > { > - struct nfs4_exception exception = { }; > + DECLARE_NFS4_EXCEPTION(exception); > int err; > do { > err = nfs4_handle_exception(NFS_SERVER(dir), > @@ -2064,7 +2068,7 @@ static int _nfs4_proc_mkdir(struct inode *dir, struct dentry *dentry, > static int nfs4_proc_mkdir(struct inode *dir, struct dentry *dentry, > struct iattr *sattr) > { > - struct nfs4_exception exception = { }; > + DECLARE_NFS4_EXCEPTION(exception); > int err; > do { > err = nfs4_handle_exception(NFS_SERVER(dir), > @@ -2110,7 +2114,7 @@ static int _nfs4_proc_readdir(struct dentry *dentry, struct rpc_cred *cred, > static int nfs4_proc_readdir(struct dentry *dentry, struct rpc_cred *cred, > u64 cookie, struct page *page, unsigned int count, int plus) > { > - struct nfs4_exception exception = { }; > + DECLARE_NFS4_EXCEPTION(exception); > int err; > do { > err = nfs4_handle_exception(NFS_SERVER(dentry->d_inode), > @@ -2180,7 +2184,7 @@ static int _nfs4_proc_mknod(struct inode *dir, struct dentry *dentry, > static int nfs4_proc_mknod(struct inode *dir, struct dentry *dentry, > struct iattr *sattr, dev_t rdev) > { > - struct nfs4_exception exception = { }; > + DECLARE_NFS4_EXCEPTION(exception); > int err; > do { > err = nfs4_handle_exception(NFS_SERVER(dir), > @@ -2209,7 +2213,7 @@ static int _nfs4_proc_statfs(struct nfs_server *server, struct nfs_fh *fhandle, > > static int nfs4_proc_statfs(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fsstat *fsstat) > { > - struct nfs4_exception exception = { }; > + DECLARE_NFS4_EXCEPTION(exception); > int err; > do { > err = nfs4_handle_exception(server, > @@ -2237,7 +2241,7 @@ static int _nfs4_do_fsinfo(struct nfs_server *server, struct nfs_fh *fhandle, > > static int nfs4_do_fsinfo(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fsinfo *fsinfo) > { > - struct nfs4_exception exception = { }; > + DECLARE_NFS4_EXCEPTION(exception); > int err; > > do { > @@ -2280,7 +2284,7 @@ static int _nfs4_proc_pathconf(struct nfs_server *server, struct nfs_fh *fhandle > static int nfs4_proc_pathconf(struct nfs_server *server, struct nfs_fh *fhandle, > struct nfs_pathconf *pathconf) > { > - struct nfs4_exception exception = { }; > + DECLARE_NFS4_EXCEPTION(exception); > int err; > > do { > @@ -2599,7 +2603,7 @@ out_free: > > static ssize_t nfs4_get_acl_uncached(struct inode *inode, void *buf, size_t buflen) > { > - struct nfs4_exception exception = { }; > + DECLARE_NFS4_EXCEPTION(exception); > ssize_t ret; > do { > ret = __nfs4_get_acl_uncached(inode, buf, buflen); > @@ -2653,7 +2657,7 @@ static int __nfs4_proc_set_acl(struct inode *inode, const void *buf, size_t bufl > > static int nfs4_proc_set_acl(struct inode *inode, const void *buf, size_t buflen) > { > - struct nfs4_exception exception = { }; > + DECLARE_NFS4_EXCEPTION(exception); > int err; > do { > err = nfs4_handle_exception(NFS_SERVER(inode), > @@ -2950,7 +2954,7 @@ static int _nfs4_proc_delegreturn(struct inode *inode, struct rpc_cred *cred, co > int nfs4_proc_delegreturn(struct inode *inode, struct rpc_cred *cred, const nfs4_stateid *stateid) > { > struct nfs_server *server = NFS_SERVER(inode); > - struct nfs4_exception exception = { }; > + DECLARE_NFS4_EXCEPTION(exception); > int err; > do { > err = _nfs4_proc_delegreturn(inode, cred, stateid); > @@ -3025,7 +3029,7 @@ out: > > static int nfs4_proc_getlk(struct nfs4_state *state, int cmd, struct file_lock *request) > { > - struct nfs4_exception exception = { }; > + DECLARE_NFS4_EXCEPTION(exception); > int err; > > do { > @@ -3354,7 +3358,7 @@ static int _nfs4_do_setlk(struct nfs4_state *state, int cmd, struct file_lock *f > static int nfs4_lock_reclaim(struct nfs4_state *state, struct file_lock *request) > { > struct nfs_server *server = NFS_SERVER(state->inode); > - struct nfs4_exception exception = { }; > + DECLARE_NFS4_EXCEPTION(exception); > int err; > > do { > @@ -3372,7 +3376,7 @@ static int nfs4_lock_reclaim(struct nfs4_state *state, struct file_lock *request > static int nfs4_lock_expired(struct nfs4_state *state, struct file_lock *request) > { > struct nfs_server *server = NFS_SERVER(state->inode); > - struct nfs4_exception exception = { }; > + DECLARE_NFS4_EXCEPTION(exception); > int err; > > err = nfs4_set_lock_state(state, request); > @@ -3433,7 +3437,7 @@ out: > > static int nfs4_proc_setlk(struct nfs4_state *state, int cmd, struct file_lock *request) > { > - struct nfs4_exception exception = { }; > + DECLARE_NFS4_EXCEPTION(exception); > int err; > > do { > @@ -3483,7 +3487,7 @@ nfs4_proc_lock(struct file *filp, int cmd, struct file_lock *request) > int nfs4_lock_delegation_recall(struct nfs4_state *state, struct file_lock *fl) > { > struct nfs_server *server = NFS_SERVER(state->inode); > - struct nfs4_exception exception = { }; > + DECLARE_NFS4_EXCEPTION(exception); > int err; > > err = nfs4_set_lock_state(state, fl); > ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ NFS maillist - NFS@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nfs ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 02/10] NFS: Use C99 struct initializers in nfs4proc.c 2007-05-26 18:01 ` Trond Myklebust @ 2007-05-29 14:10 ` Chuck Lever 2007-05-30 20:12 ` Trond Myklebust 0 siblings, 1 reply; 10+ messages in thread From: Chuck Lever @ 2007-05-29 14:10 UTC (permalink / raw) To: Trond Myklebust; +Cc: nfs [-- Attachment #1: Type: text/plain, Size: 13506 bytes --] Trond Myklebust wrote: > On Fri, 2007-05-25 at 17:41 -0400, Chuck Lever wrote: >> Follow kernel coding conventions. >> >> Signed-off-by: Chuck Lever <chuck.lever@oracle.com> >> --- >> >> fs/nfs/nfs4_fs.h | 5 ++++ >> fs/nfs/nfs4proc.c | 70 ++++++++++++++++++++++++++++------------------------- >> 2 files changed, 42 insertions(+), 33 deletions(-) >> >> diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h >> index cf3a17e..1a526c4 100644 >> --- a/fs/nfs/nfs4_fs.h >> +++ b/fs/nfs/nfs4_fs.h >> @@ -145,6 +145,11 @@ struct nfs4_exception { >> int retry; >> }; >> >> +#define DECLARE_NFS4_EXCEPTION(name) \ >> + struct nfs4_exception name = { \ >> + .timeout = 0, \ >> + } > > Why would we want this? The existing code uses bog standard C99 > initialisers. There is no need to explicitly set .timeout to zero. Using struct nfs4_exception name = { }; causes compiler complaints. One correct way to fix this is to set at least one field in the structure, and setting that field to zero clears the other one by default. >> struct nfs4_state_recovery_ops { >> int (*recover_open)(struct nfs4_state_owner *, struct nfs4_state *); >> int (*recover_lock)(struct nfs4_state *, struct file_lock *); >> diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c >> index 648e0ac..b220c09 100644 >> --- a/fs/nfs/nfs4proc.c >> +++ b/fs/nfs/nfs4proc.c >> @@ -493,7 +493,7 @@ static int _nfs4_do_open_reclaim(struct nfs4_state_owner *sp, struct nfs4_state >> static int nfs4_do_open_reclaim(struct nfs4_state_owner *sp, struct nfs4_state *state, struct dentry *dentry) >> { >> struct nfs_server *server = NFS_SERVER(state->inode); >> - struct nfs4_exception exception = { }; >> + DECLARE_NFS4_EXCEPTION(exception); >> int err; >> do { >> err = _nfs4_do_open_reclaim(sp, state, dentry); >> @@ -538,8 +538,8 @@ static int _nfs4_open_delegation_recall(struct dentry *dentry, struct nfs4_state >> >> int nfs4_open_delegation_recall(struct dentry *dentry, struct nfs4_state *state) >> { >> - struct nfs4_exception exception = { }; >> struct nfs_server *server = NFS_SERVER(dentry->d_inode); >> + DECLARE_NFS4_EXCEPTION(exception); >> int err; >> do { >> err = _nfs4_open_delegation_recall(dentry, state); >> @@ -843,7 +843,7 @@ static int _nfs4_open_expired(struct nfs4_state_owner *sp, struct nfs4_state *st >> static inline int nfs4_do_open_expired(struct nfs4_state_owner *sp, struct nfs4_state *state, struct dentry *dentry) >> { >> struct nfs_server *server = NFS_SERVER(dentry->d_inode); >> - struct nfs4_exception exception = { }; >> + DECLARE_NFS4_EXCEPTION(exception); >> int err; >> >> do { >> @@ -938,8 +938,8 @@ out_put_state_owner: >> >> static struct nfs4_state *nfs4_open_delegated(struct inode *inode, int flags, struct rpc_cred *cred) >> { >> - struct nfs4_exception exception = { }; >> struct nfs4_state *res = ERR_PTR(-EIO); >> + DECLARE_NFS4_EXCEPTION(exception); >> int err; >> >> do { >> @@ -1008,7 +1008,7 @@ out_err: >> >> static struct nfs4_state *nfs4_do_open(struct inode *dir, struct dentry *dentry, int flags, struct iattr *sattr, struct rpc_cred *cred) >> { >> - struct nfs4_exception exception = { }; >> + DECLARE_NFS4_EXCEPTION(exception); >> struct nfs4_state *res; >> int status; >> >> @@ -1090,7 +1090,7 @@ static int nfs4_do_setattr(struct inode *inode, struct nfs_fattr *fattr, >> struct iattr *sattr, struct nfs4_state *state) >> { >> struct nfs_server *server = NFS_SERVER(inode); >> - struct nfs4_exception exception = { }; >> + DECLARE_NFS4_EXCEPTION(exception); >> int err; >> do { >> err = nfs4_handle_exception(server, >> @@ -1330,7 +1330,9 @@ out_drop: >> >> static int _nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *fhandle) >> { >> - struct nfs4_server_caps_res res = {}; >> + struct nfs4_server_caps_res res = { >> + .acl_bitmask = 0, >> + }; >> struct rpc_message msg = { >> .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_SERVER_CAPS], >> .rpc_argp = fhandle, >> @@ -1354,7 +1356,7 @@ static int _nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *f >> >> int nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *fhandle) >> { >> - struct nfs4_exception exception = { }; >> + DECLARE_NFS4_EXCEPTION(exception); >> int err; >> do { >> err = nfs4_handle_exception(server, >> @@ -1387,7 +1389,7 @@ static int _nfs4_lookup_root(struct nfs_server *server, struct nfs_fh *fhandle, >> static int nfs4_lookup_root(struct nfs_server *server, struct nfs_fh *fhandle, >> struct nfs_fsinfo *info) >> { >> - struct nfs4_exception exception = { }; >> + DECLARE_NFS4_EXCEPTION(exception); >> int err; >> do { >> err = nfs4_handle_exception(server, >> @@ -1476,7 +1478,7 @@ static int _nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, >> >> static int nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fattr *fattr) >> { >> - struct nfs4_exception exception = { }; >> + DECLARE_NFS4_EXCEPTION(exception); >> int err; >> do { >> err = nfs4_handle_exception(server, >> @@ -1568,7 +1570,7 @@ static int nfs4_proc_lookupfh(struct nfs_server *server, struct nfs_fh *dirfh, >> struct qstr *name, struct nfs_fh *fhandle, >> struct nfs_fattr *fattr) >> { >> - struct nfs4_exception exception = { }; >> + DECLARE_NFS4_EXCEPTION(exception); >> int err; >> do { >> err = nfs4_handle_exception(server, >> @@ -1612,7 +1614,7 @@ static int _nfs4_proc_lookup(struct inode *dir, struct qstr *name, >> >> static int nfs4_proc_lookup(struct inode *dir, struct qstr *name, struct nfs_fh *fhandle, struct nfs_fattr *fattr) >> { >> - struct nfs4_exception exception = { }; >> + DECLARE_NFS4_EXCEPTION(exception); >> int err; >> do { >> err = nfs4_handle_exception(NFS_SERVER(dir), >> @@ -1627,7 +1629,9 @@ static int _nfs4_proc_access(struct inode *inode, struct nfs_access_entry *entry >> struct nfs4_accessargs args = { >> .fh = NFS_FH(inode), >> }; >> - struct nfs4_accessres res = { 0 }; >> + struct nfs4_accessres res = { >> + .access = 0, >> + }; >> struct rpc_message msg = { >> .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_ACCESS], >> .rpc_argp = &args, >> @@ -1668,7 +1672,7 @@ static int _nfs4_proc_access(struct inode *inode, struct nfs_access_entry *entry >> >> static int nfs4_proc_access(struct inode *inode, struct nfs_access_entry *entry) >> { >> - struct nfs4_exception exception = { }; >> + DECLARE_NFS4_EXCEPTION(exception); >> int err; >> do { >> err = nfs4_handle_exception(NFS_SERVER(inode), >> @@ -1723,7 +1727,7 @@ static int _nfs4_proc_readlink(struct inode *inode, struct page *page, >> static int nfs4_proc_readlink(struct inode *inode, struct page *page, >> unsigned int pgbase, unsigned int pglen) >> { >> - struct nfs4_exception exception = { }; >> + DECLARE_NFS4_EXCEPTION(exception); >> int err; >> do { >> err = nfs4_handle_exception(NFS_SERVER(inode), >> @@ -1813,7 +1817,7 @@ static int _nfs4_proc_remove(struct inode *dir, struct qstr *name) >> >> static int nfs4_proc_remove(struct inode *dir, struct qstr *name) >> { >> - struct nfs4_exception exception = { }; >> + DECLARE_NFS4_EXCEPTION(exception); >> int err; >> do { >> err = nfs4_handle_exception(NFS_SERVER(dir), >> @@ -1907,7 +1911,7 @@ static int _nfs4_proc_rename(struct inode *old_dir, struct qstr *old_name, >> static int nfs4_proc_rename(struct inode *old_dir, struct qstr *old_name, >> struct inode *new_dir, struct qstr *new_name) >> { >> - struct nfs4_exception exception = { }; >> + DECLARE_NFS4_EXCEPTION(exception); >> int err; >> do { >> err = nfs4_handle_exception(NFS_SERVER(old_dir), >> @@ -1954,7 +1958,7 @@ static int _nfs4_proc_link(struct inode *inode, struct inode *dir, struct qstr * >> >> static int nfs4_proc_link(struct inode *inode, struct inode *dir, struct qstr *name) >> { >> - struct nfs4_exception exception = { }; >> + DECLARE_NFS4_EXCEPTION(exception); >> int err; >> do { >> err = nfs4_handle_exception(NFS_SERVER(inode), >> @@ -2011,7 +2015,7 @@ static int _nfs4_proc_symlink(struct inode *dir, struct dentry *dentry, >> static int nfs4_proc_symlink(struct inode *dir, struct dentry *dentry, >> struct page *page, unsigned int len, struct iattr *sattr) >> { >> - struct nfs4_exception exception = { }; >> + DECLARE_NFS4_EXCEPTION(exception); >> int err; >> do { >> err = nfs4_handle_exception(NFS_SERVER(dir), >> @@ -2064,7 +2068,7 @@ static int _nfs4_proc_mkdir(struct inode *dir, struct dentry *dentry, >> static int nfs4_proc_mkdir(struct inode *dir, struct dentry *dentry, >> struct iattr *sattr) >> { >> - struct nfs4_exception exception = { }; >> + DECLARE_NFS4_EXCEPTION(exception); >> int err; >> do { >> err = nfs4_handle_exception(NFS_SERVER(dir), >> @@ -2110,7 +2114,7 @@ static int _nfs4_proc_readdir(struct dentry *dentry, struct rpc_cred *cred, >> static int nfs4_proc_readdir(struct dentry *dentry, struct rpc_cred *cred, >> u64 cookie, struct page *page, unsigned int count, int plus) >> { >> - struct nfs4_exception exception = { }; >> + DECLARE_NFS4_EXCEPTION(exception); >> int err; >> do { >> err = nfs4_handle_exception(NFS_SERVER(dentry->d_inode), >> @@ -2180,7 +2184,7 @@ static int _nfs4_proc_mknod(struct inode *dir, struct dentry *dentry, >> static int nfs4_proc_mknod(struct inode *dir, struct dentry *dentry, >> struct iattr *sattr, dev_t rdev) >> { >> - struct nfs4_exception exception = { }; >> + DECLARE_NFS4_EXCEPTION(exception); >> int err; >> do { >> err = nfs4_handle_exception(NFS_SERVER(dir), >> @@ -2209,7 +2213,7 @@ static int _nfs4_proc_statfs(struct nfs_server *server, struct nfs_fh *fhandle, >> >> static int nfs4_proc_statfs(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fsstat *fsstat) >> { >> - struct nfs4_exception exception = { }; >> + DECLARE_NFS4_EXCEPTION(exception); >> int err; >> do { >> err = nfs4_handle_exception(server, >> @@ -2237,7 +2241,7 @@ static int _nfs4_do_fsinfo(struct nfs_server *server, struct nfs_fh *fhandle, >> >> static int nfs4_do_fsinfo(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fsinfo *fsinfo) >> { >> - struct nfs4_exception exception = { }; >> + DECLARE_NFS4_EXCEPTION(exception); >> int err; >> >> do { >> @@ -2280,7 +2284,7 @@ static int _nfs4_proc_pathconf(struct nfs_server *server, struct nfs_fh *fhandle >> static int nfs4_proc_pathconf(struct nfs_server *server, struct nfs_fh *fhandle, >> struct nfs_pathconf *pathconf) >> { >> - struct nfs4_exception exception = { }; >> + DECLARE_NFS4_EXCEPTION(exception); >> int err; >> >> do { >> @@ -2599,7 +2603,7 @@ out_free: >> >> static ssize_t nfs4_get_acl_uncached(struct inode *inode, void *buf, size_t buflen) >> { >> - struct nfs4_exception exception = { }; >> + DECLARE_NFS4_EXCEPTION(exception); >> ssize_t ret; >> do { >> ret = __nfs4_get_acl_uncached(inode, buf, buflen); >> @@ -2653,7 +2657,7 @@ static int __nfs4_proc_set_acl(struct inode *inode, const void *buf, size_t bufl >> >> static int nfs4_proc_set_acl(struct inode *inode, const void *buf, size_t buflen) >> { >> - struct nfs4_exception exception = { }; >> + DECLARE_NFS4_EXCEPTION(exception); >> int err; >> do { >> err = nfs4_handle_exception(NFS_SERVER(inode), >> @@ -2950,7 +2954,7 @@ static int _nfs4_proc_delegreturn(struct inode *inode, struct rpc_cred *cred, co >> int nfs4_proc_delegreturn(struct inode *inode, struct rpc_cred *cred, const nfs4_stateid *stateid) >> { >> struct nfs_server *server = NFS_SERVER(inode); >> - struct nfs4_exception exception = { }; >> + DECLARE_NFS4_EXCEPTION(exception); >> int err; >> do { >> err = _nfs4_proc_delegreturn(inode, cred, stateid); >> @@ -3025,7 +3029,7 @@ out: >> >> static int nfs4_proc_getlk(struct nfs4_state *state, int cmd, struct file_lock *request) >> { >> - struct nfs4_exception exception = { }; >> + DECLARE_NFS4_EXCEPTION(exception); >> int err; >> >> do { >> @@ -3354,7 +3358,7 @@ static int _nfs4_do_setlk(struct nfs4_state *state, int cmd, struct file_lock *f >> static int nfs4_lock_reclaim(struct nfs4_state *state, struct file_lock *request) >> { >> struct nfs_server *server = NFS_SERVER(state->inode); >> - struct nfs4_exception exception = { }; >> + DECLARE_NFS4_EXCEPTION(exception); >> int err; >> >> do { >> @@ -3372,7 +3376,7 @@ static int nfs4_lock_reclaim(struct nfs4_state *state, struct file_lock *request >> static int nfs4_lock_expired(struct nfs4_state *state, struct file_lock *request) >> { >> struct nfs_server *server = NFS_SERVER(state->inode); >> - struct nfs4_exception exception = { }; >> + DECLARE_NFS4_EXCEPTION(exception); >> int err; >> >> err = nfs4_set_lock_state(state, request); >> @@ -3433,7 +3437,7 @@ out: >> >> static int nfs4_proc_setlk(struct nfs4_state *state, int cmd, struct file_lock *request) >> { >> - struct nfs4_exception exception = { }; >> + DECLARE_NFS4_EXCEPTION(exception); >> int err; >> >> do { >> @@ -3483,7 +3487,7 @@ nfs4_proc_lock(struct file *filp, int cmd, struct file_lock *request) >> int nfs4_lock_delegation_recall(struct nfs4_state *state, struct file_lock *fl) >> { >> struct nfs_server *server = NFS_SERVER(state->inode); >> - struct nfs4_exception exception = { }; >> + DECLARE_NFS4_EXCEPTION(exception); >> int err; >> >> err = nfs4_set_lock_state(state, fl); >> > [-- Attachment #2: chuck.lever.vcf --] [-- Type: text/x-vcard, Size: 291 bytes --] begin:vcard fn:Chuck Lever n:Lever;Chuck org:Oracle Corporation;Corporate Architecture: Linux Projects Group adr:;;1015 Granger Avenue;Ann Arbor;MI;48104;USA title:Principal Member of Staff tel;work:+1 248 614 5091 x-mozilla-html:FALSE url:http://oss.oracle.com/~cel/ version:2.1 end:vcard [-- Attachment #3: Type: text/plain, Size: 286 bytes --] ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ [-- Attachment #4: Type: text/plain, Size: 140 bytes --] _______________________________________________ NFS maillist - NFS@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nfs ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 02/10] NFS: Use C99 struct initializers in nfs4proc.c 2007-05-29 14:10 ` Chuck Lever @ 2007-05-30 20:12 ` Trond Myklebust 2007-05-31 8:18 ` Frank van Maarseveen 2007-05-31 15:14 ` Chuck Lever 0 siblings, 2 replies; 10+ messages in thread From: Trond Myklebust @ 2007-05-30 20:12 UTC (permalink / raw) To: chuck.lever; +Cc: nfs On Tue, 2007-05-29 at 10:10 -0400, Chuck Lever wrote: > Trond Myklebust wrote: > > On Fri, 2007-05-25 at 17:41 -0400, Chuck Lever wrote: > >> Follow kernel coding conventions. > >> > >> Signed-off-by: Chuck Lever <chuck.lever@oracle.com> > >> --- > >> > >> fs/nfs/nfs4_fs.h | 5 ++++ > >> fs/nfs/nfs4proc.c | 70 ++++++++++++++++++++++++++++------------------------- > >> 2 files changed, 42 insertions(+), 33 deletions(-) > >> > >> diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h > >> index cf3a17e..1a526c4 100644 > >> --- a/fs/nfs/nfs4_fs.h > >> +++ b/fs/nfs/nfs4_fs.h > >> @@ -145,6 +145,11 @@ struct nfs4_exception { > >> int retry; > >> }; > >> > >> +#define DECLARE_NFS4_EXCEPTION(name) \ > >> + struct nfs4_exception name = { \ > >> + .timeout = 0, \ > >> + } > > > > Why would we want this? The existing code uses bog standard C99 > > initialisers. There is no need to explicitly set .timeout to zero. > > Using > > struct nfs4_exception name = { }; > > causes compiler complaints. One correct way to fix this is to set at > least one field in the structure, and setting that field to zero clears > the other one by default. I can't find anything in Harbison & Steele stating that name = {} is illegal. All they say is that "if there are fewer initializers than there are structure components, the remaining components are initialized to their default initial values.". Anyhow, if you really do have to set one component, then a much less verbose form would be to write "name = {0}" There is no need for the macro. > >> struct nfs4_state_recovery_ops { > >> int (*recover_open)(struct nfs4_state_owner *, struct nfs4_state *); > >> int (*recover_lock)(struct nfs4_state *, struct file_lock *); > >> diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c > >> index 648e0ac..b220c09 100644 > >> --- a/fs/nfs/nfs4proc.c > >> +++ b/fs/nfs/nfs4proc.c > >> @@ -493,7 +493,7 @@ static int _nfs4_do_open_reclaim(struct nfs4_state_owner *sp, struct nfs4_state > >> static int nfs4_do_open_reclaim(struct nfs4_state_owner *sp, struct nfs4_state *state, struct dentry *dentry) > >> { > >> struct nfs_server *server = NFS_SERVER(state->inode); > >> - struct nfs4_exception exception = { }; > >> + DECLARE_NFS4_EXCEPTION(exception); > >> int err; > >> do { > >> err = _nfs4_do_open_reclaim(sp, state, dentry); > >> @@ -538,8 +538,8 @@ static int _nfs4_open_delegation_recall(struct dentry *dentry, struct nfs4_state > >> > >> int nfs4_open_delegation_recall(struct dentry *dentry, struct nfs4_state *state) > >> { > >> - struct nfs4_exception exception = { }; > >> struct nfs_server *server = NFS_SERVER(dentry->d_inode); > >> + DECLARE_NFS4_EXCEPTION(exception); > >> int err; > >> do { > >> err = _nfs4_open_delegation_recall(dentry, state); > >> @@ -843,7 +843,7 @@ static int _nfs4_open_expired(struct nfs4_state_owner *sp, struct nfs4_state *st > >> static inline int nfs4_do_open_expired(struct nfs4_state_owner *sp, struct nfs4_state *state, struct dentry *dentry) > >> { > >> struct nfs_server *server = NFS_SERVER(dentry->d_inode); > >> - struct nfs4_exception exception = { }; > >> + DECLARE_NFS4_EXCEPTION(exception); > >> int err; > >> > >> do { > >> @@ -938,8 +938,8 @@ out_put_state_owner: > >> > >> static struct nfs4_state *nfs4_open_delegated(struct inode *inode, int flags, struct rpc_cred *cred) > >> { > >> - struct nfs4_exception exception = { }; > >> struct nfs4_state *res = ERR_PTR(-EIO); > >> + DECLARE_NFS4_EXCEPTION(exception); > >> int err; > >> > >> do { > >> @@ -1008,7 +1008,7 @@ out_err: > >> > >> static struct nfs4_state *nfs4_do_open(struct inode *dir, struct dentry *dentry, int flags, struct iattr *sattr, struct rpc_cred *cred) > >> { > >> - struct nfs4_exception exception = { }; > >> + DECLARE_NFS4_EXCEPTION(exception); > >> struct nfs4_state *res; > >> int status; > >> > >> @@ -1090,7 +1090,7 @@ static int nfs4_do_setattr(struct inode *inode, struct nfs_fattr *fattr, > >> struct iattr *sattr, struct nfs4_state *state) > >> { > >> struct nfs_server *server = NFS_SERVER(inode); > >> - struct nfs4_exception exception = { }; > >> + DECLARE_NFS4_EXCEPTION(exception); > >> int err; > >> do { > >> err = nfs4_handle_exception(server, > >> @@ -1330,7 +1330,9 @@ out_drop: > >> > >> static int _nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *fhandle) > >> { > >> - struct nfs4_server_caps_res res = {}; > >> + struct nfs4_server_caps_res res = { > >> + .acl_bitmask = 0, > >> + }; > >> struct rpc_message msg = { > >> .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_SERVER_CAPS], > >> .rpc_argp = fhandle, > >> @@ -1354,7 +1356,7 @@ static int _nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *f > >> > >> int nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *fhandle) > >> { > >> - struct nfs4_exception exception = { }; > >> + DECLARE_NFS4_EXCEPTION(exception); > >> int err; > >> do { > >> err = nfs4_handle_exception(server, > >> @@ -1387,7 +1389,7 @@ static int _nfs4_lookup_root(struct nfs_server *server, struct nfs_fh *fhandle, > >> static int nfs4_lookup_root(struct nfs_server *server, struct nfs_fh *fhandle, > >> struct nfs_fsinfo *info) > >> { > >> - struct nfs4_exception exception = { }; > >> + DECLARE_NFS4_EXCEPTION(exception); > >> int err; > >> do { > >> err = nfs4_handle_exception(server, > >> @@ -1476,7 +1478,7 @@ static int _nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, > >> > >> static int nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fattr *fattr) > >> { > >> - struct nfs4_exception exception = { }; > >> + DECLARE_NFS4_EXCEPTION(exception); > >> int err; > >> do { > >> err = nfs4_handle_exception(server, > >> @@ -1568,7 +1570,7 @@ static int nfs4_proc_lookupfh(struct nfs_server *server, struct nfs_fh *dirfh, > >> struct qstr *name, struct nfs_fh *fhandle, > >> struct nfs_fattr *fattr) > >> { > >> - struct nfs4_exception exception = { }; > >> + DECLARE_NFS4_EXCEPTION(exception); > >> int err; > >> do { > >> err = nfs4_handle_exception(server, > >> @@ -1612,7 +1614,7 @@ static int _nfs4_proc_lookup(struct inode *dir, struct qstr *name, > >> > >> static int nfs4_proc_lookup(struct inode *dir, struct qstr *name, struct nfs_fh *fhandle, struct nfs_fattr *fattr) > >> { > >> - struct nfs4_exception exception = { }; > >> + DECLARE_NFS4_EXCEPTION(exception); > >> int err; > >> do { > >> err = nfs4_handle_exception(NFS_SERVER(dir), > >> @@ -1627,7 +1629,9 @@ static int _nfs4_proc_access(struct inode *inode, struct nfs_access_entry *entry > >> struct nfs4_accessargs args = { > >> .fh = NFS_FH(inode), > >> }; > >> - struct nfs4_accessres res = { 0 }; > >> + struct nfs4_accessres res = { > >> + .access = 0, > >> + }; > >> struct rpc_message msg = { > >> .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_ACCESS], > >> .rpc_argp = &args, > >> @@ -1668,7 +1672,7 @@ static int _nfs4_proc_access(struct inode *inode, struct nfs_access_entry *entry > >> > >> static int nfs4_proc_access(struct inode *inode, struct nfs_access_entry *entry) > >> { > >> - struct nfs4_exception exception = { }; > >> + DECLARE_NFS4_EXCEPTION(exception); > >> int err; > >> do { > >> err = nfs4_handle_exception(NFS_SERVER(inode), > >> @@ -1723,7 +1727,7 @@ static int _nfs4_proc_readlink(struct inode *inode, struct page *page, > >> static int nfs4_proc_readlink(struct inode *inode, struct page *page, > >> unsigned int pgbase, unsigned int pglen) > >> { > >> - struct nfs4_exception exception = { }; > >> + DECLARE_NFS4_EXCEPTION(exception); > >> int err; > >> do { > >> err = nfs4_handle_exception(NFS_SERVER(inode), > >> @@ -1813,7 +1817,7 @@ static int _nfs4_proc_remove(struct inode *dir, struct qstr *name) > >> > >> static int nfs4_proc_remove(struct inode *dir, struct qstr *name) > >> { > >> - struct nfs4_exception exception = { }; > >> + DECLARE_NFS4_EXCEPTION(exception); > >> int err; > >> do { > >> err = nfs4_handle_exception(NFS_SERVER(dir), > >> @@ -1907,7 +1911,7 @@ static int _nfs4_proc_rename(struct inode *old_dir, struct qstr *old_name, > >> static int nfs4_proc_rename(struct inode *old_dir, struct qstr *old_name, > >> struct inode *new_dir, struct qstr *new_name) > >> { > >> - struct nfs4_exception exception = { }; > >> + DECLARE_NFS4_EXCEPTION(exception); > >> int err; > >> do { > >> err = nfs4_handle_exception(NFS_SERVER(old_dir), > >> @@ -1954,7 +1958,7 @@ static int _nfs4_proc_link(struct inode *inode, struct inode *dir, struct qstr * > >> > >> static int nfs4_proc_link(struct inode *inode, struct inode *dir, struct qstr *name) > >> { > >> - struct nfs4_exception exception = { }; > >> + DECLARE_NFS4_EXCEPTION(exception); > >> int err; > >> do { > >> err = nfs4_handle_exception(NFS_SERVER(inode), > >> @@ -2011,7 +2015,7 @@ static int _nfs4_proc_symlink(struct inode *dir, struct dentry *dentry, > >> static int nfs4_proc_symlink(struct inode *dir, struct dentry *dentry, > >> struct page *page, unsigned int len, struct iattr *sattr) > >> { > >> - struct nfs4_exception exception = { }; > >> + DECLARE_NFS4_EXCEPTION(exception); > >> int err; > >> do { > >> err = nfs4_handle_exception(NFS_SERVER(dir), > >> @@ -2064,7 +2068,7 @@ static int _nfs4_proc_mkdir(struct inode *dir, struct dentry *dentry, > >> static int nfs4_proc_mkdir(struct inode *dir, struct dentry *dentry, > >> struct iattr *sattr) > >> { > >> - struct nfs4_exception exception = { }; > >> + DECLARE_NFS4_EXCEPTION(exception); > >> int err; > >> do { > >> err = nfs4_handle_exception(NFS_SERVER(dir), > >> @@ -2110,7 +2114,7 @@ static int _nfs4_proc_readdir(struct dentry *dentry, struct rpc_cred *cred, > >> static int nfs4_proc_readdir(struct dentry *dentry, struct rpc_cred *cred, > >> u64 cookie, struct page *page, unsigned int count, int plus) > >> { > >> - struct nfs4_exception exception = { }; > >> + DECLARE_NFS4_EXCEPTION(exception); > >> int err; > >> do { > >> err = nfs4_handle_exception(NFS_SERVER(dentry->d_inode), > >> @@ -2180,7 +2184,7 @@ static int _nfs4_proc_mknod(struct inode *dir, struct dentry *dentry, > >> static int nfs4_proc_mknod(struct inode *dir, struct dentry *dentry, > >> struct iattr *sattr, dev_t rdev) > >> { > >> - struct nfs4_exception exception = { }; > >> + DECLARE_NFS4_EXCEPTION(exception); > >> int err; > >> do { > >> err = nfs4_handle_exception(NFS_SERVER(dir), > >> @@ -2209,7 +2213,7 @@ static int _nfs4_proc_statfs(struct nfs_server *server, struct nfs_fh *fhandle, > >> > >> static int nfs4_proc_statfs(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fsstat *fsstat) > >> { > >> - struct nfs4_exception exception = { }; > >> + DECLARE_NFS4_EXCEPTION(exception); > >> int err; > >> do { > >> err = nfs4_handle_exception(server, > >> @@ -2237,7 +2241,7 @@ static int _nfs4_do_fsinfo(struct nfs_server *server, struct nfs_fh *fhandle, > >> > >> static int nfs4_do_fsinfo(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fsinfo *fsinfo) > >> { > >> - struct nfs4_exception exception = { }; > >> + DECLARE_NFS4_EXCEPTION(exception); > >> int err; > >> > >> do { > >> @@ -2280,7 +2284,7 @@ static int _nfs4_proc_pathconf(struct nfs_server *server, struct nfs_fh *fhandle > >> static int nfs4_proc_pathconf(struct nfs_server *server, struct nfs_fh *fhandle, > >> struct nfs_pathconf *pathconf) > >> { > >> - struct nfs4_exception exception = { }; > >> + DECLARE_NFS4_EXCEPTION(exception); > >> int err; > >> > >> do { > >> @@ -2599,7 +2603,7 @@ out_free: > >> > >> static ssize_t nfs4_get_acl_uncached(struct inode *inode, void *buf, size_t buflen) > >> { > >> - struct nfs4_exception exception = { }; > >> + DECLARE_NFS4_EXCEPTION(exception); > >> ssize_t ret; > >> do { > >> ret = __nfs4_get_acl_uncached(inode, buf, buflen); > >> @@ -2653,7 +2657,7 @@ static int __nfs4_proc_set_acl(struct inode *inode, const void *buf, size_t bufl > >> > >> static int nfs4_proc_set_acl(struct inode *inode, const void *buf, size_t buflen) > >> { > >> - struct nfs4_exception exception = { }; > >> + DECLARE_NFS4_EXCEPTION(exception); > >> int err; > >> do { > >> err = nfs4_handle_exception(NFS_SERVER(inode), > >> @@ -2950,7 +2954,7 @@ static int _nfs4_proc_delegreturn(struct inode *inode, struct rpc_cred *cred, co > >> int nfs4_proc_delegreturn(struct inode *inode, struct rpc_cred *cred, const nfs4_stateid *stateid) > >> { > >> struct nfs_server *server = NFS_SERVER(inode); > >> - struct nfs4_exception exception = { }; > >> + DECLARE_NFS4_EXCEPTION(exception); > >> int err; > >> do { > >> err = _nfs4_proc_delegreturn(inode, cred, stateid); > >> @@ -3025,7 +3029,7 @@ out: > >> > >> static int nfs4_proc_getlk(struct nfs4_state *state, int cmd, struct file_lock *request) > >> { > >> - struct nfs4_exception exception = { }; > >> + DECLARE_NFS4_EXCEPTION(exception); > >> int err; > >> > >> do { > >> @@ -3354,7 +3358,7 @@ static int _nfs4_do_setlk(struct nfs4_state *state, int cmd, struct file_lock *f > >> static int nfs4_lock_reclaim(struct nfs4_state *state, struct file_lock *request) > >> { > >> struct nfs_server *server = NFS_SERVER(state->inode); > >> - struct nfs4_exception exception = { }; > >> + DECLARE_NFS4_EXCEPTION(exception); > >> int err; > >> > >> do { > >> @@ -3372,7 +3376,7 @@ static int nfs4_lock_reclaim(struct nfs4_state *state, struct file_lock *request > >> static int nfs4_lock_expired(struct nfs4_state *state, struct file_lock *request) > >> { > >> struct nfs_server *server = NFS_SERVER(state->inode); > >> - struct nfs4_exception exception = { }; > >> + DECLARE_NFS4_EXCEPTION(exception); > >> int err; > >> > >> err = nfs4_set_lock_state(state, request); > >> @@ -3433,7 +3437,7 @@ out: > >> > >> static int nfs4_proc_setlk(struct nfs4_state *state, int cmd, struct file_lock *request) > >> { > >> - struct nfs4_exception exception = { }; > >> + DECLARE_NFS4_EXCEPTION(exception); > >> int err; > >> > >> do { > >> @@ -3483,7 +3487,7 @@ nfs4_proc_lock(struct file *filp, int cmd, struct file_lock *request) > >> int nfs4_lock_delegation_recall(struct nfs4_state *state, struct file_lock *fl) > >> { > >> struct nfs_server *server = NFS_SERVER(state->inode); > >> - struct nfs4_exception exception = { }; > >> + DECLARE_NFS4_EXCEPTION(exception); > >> int err; > >> > >> err = nfs4_set_lock_state(state, fl); > >> > > > ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ NFS maillist - NFS@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nfs ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 02/10] NFS: Use C99 struct initializers in nfs4proc.c 2007-05-30 20:12 ` Trond Myklebust @ 2007-05-31 8:18 ` Frank van Maarseveen 2007-05-31 12:18 ` Trond Myklebust 2007-05-31 15:14 ` Chuck Lever 1 sibling, 1 reply; 10+ messages in thread From: Frank van Maarseveen @ 2007-05-31 8:18 UTC (permalink / raw) To: Trond Myklebust; +Cc: nfs On Wed, May 30, 2007 at 04:12:27PM -0400, Trond Myklebust wrote: > On Tue, 2007-05-29 at 10:10 -0400, Chuck Lever wrote: > > Trond Myklebust wrote: > > > On Fri, 2007-05-25 at 17:41 -0400, Chuck Lever wrote: > > >> Follow kernel coding conventions. > > >> > > >> Signed-off-by: Chuck Lever <chuck.lever@oracle.com> > > >> --- > > >> > > >> fs/nfs/nfs4_fs.h | 5 ++++ > > >> fs/nfs/nfs4proc.c | 70 ++++++++++++++++++++++++++++------------------------- > > >> 2 files changed, 42 insertions(+), 33 deletions(-) > > >> > > >> diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h > > >> index cf3a17e..1a526c4 100644 > > >> --- a/fs/nfs/nfs4_fs.h > > >> +++ b/fs/nfs/nfs4_fs.h > > >> @@ -145,6 +145,11 @@ struct nfs4_exception { > > >> int retry; > > >> }; > > >> > > >> +#define DECLARE_NFS4_EXCEPTION(name) \ > > >> + struct nfs4_exception name = { \ > > >> + .timeout = 0, \ > > >> + } > > > > > > Why would we want this? The existing code uses bog standard C99 > > > initialisers. There is no need to explicitly set .timeout to zero. > > > > Using > > > > struct nfs4_exception name = { }; > > > > causes compiler complaints. One correct way to fix this is to set at > > least one field in the structure, and setting that field to zero clears > > the other one by default. > > I can't find anything in Harbison & Steele stating that name = {} is > illegal. All they say is that "if there are fewer initializers than > there are structure components, the remaining components are initialized > to their default initial values.". AFAIK and I checked ISO/IEC 9899:1999 to be sure, {initializer-list} cannot be empty according to the C syntax. > > Anyhow, if you really do have to set one component, then a much less > verbose form would be to write "name = {0}" There is no need for the > macro. > -- Frank ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ NFS maillist - NFS@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nfs ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 02/10] NFS: Use C99 struct initializers in nfs4proc.c 2007-05-31 8:18 ` Frank van Maarseveen @ 2007-05-31 12:18 ` Trond Myklebust 2007-05-31 12:19 ` Frank van Maarseveen 0 siblings, 1 reply; 10+ messages in thread From: Trond Myklebust @ 2007-05-31 12:18 UTC (permalink / raw) To: Frank van Maarseveen; +Cc: nfs On Thu, 2007-05-31 at 10:18 +0200, Frank van Maarseveen wrote: > On Wed, May 30, 2007 at 04:12:27PM -0400, Trond Myklebust wrote: > > On Tue, 2007-05-29 at 10:10 -0400, Chuck Lever wrote: > > > Trond Myklebust wrote: > > > > On Fri, 2007-05-25 at 17:41 -0400, Chuck Lever wrote: > > > >> Follow kernel coding conventions. > > > >> > > > >> Signed-off-by: Chuck Lever <chuck.lever@oracle.com> > > > >> --- > > > >> > > > >> fs/nfs/nfs4_fs.h | 5 ++++ > > > >> fs/nfs/nfs4proc.c | 70 ++++++++++++++++++++++++++++------------------------- > > > >> 2 files changed, 42 insertions(+), 33 deletions(-) > > > >> > > > >> diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h > > > >> index cf3a17e..1a526c4 100644 > > > >> --- a/fs/nfs/nfs4_fs.h > > > >> +++ b/fs/nfs/nfs4_fs.h > > > >> @@ -145,6 +145,11 @@ struct nfs4_exception { > > > >> int retry; > > > >> }; > > > >> > > > >> +#define DECLARE_NFS4_EXCEPTION(name) \ > > > >> + struct nfs4_exception name = { \ > > > >> + .timeout = 0, \ > > > >> + } > > > > > > > > Why would we want this? The existing code uses bog standard C99 > > > > initialisers. There is no need to explicitly set .timeout to zero. > > > > > > Using > > > > > > struct nfs4_exception name = { }; > > > > > > causes compiler complaints. One correct way to fix this is to set at > > > least one field in the structure, and setting that field to zero clears > > > the other one by default. > > > > I can't find anything in Harbison & Steele stating that name = {} is > > illegal. All they say is that "if there are fewer initializers than > > there are structure components, the remaining components are initialized > > to their default initial values.". > > AFAIK and I checked ISO/IEC 9899:1999 to be sure, {initializer-list} > cannot be empty according to the C syntax. but a trivial initialiser like "name = {0}" is, right? Trond ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ NFS maillist - NFS@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nfs ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 02/10] NFS: Use C99 struct initializers in nfs4proc.c 2007-05-31 12:18 ` Trond Myklebust @ 2007-05-31 12:19 ` Frank van Maarseveen 0 siblings, 0 replies; 10+ messages in thread From: Frank van Maarseveen @ 2007-05-31 12:19 UTC (permalink / raw) To: Trond Myklebust; +Cc: nfs, Frank van Maarseveen On Thu, May 31, 2007 at 08:18:51AM -0400, Trond Myklebust wrote: > On Thu, 2007-05-31 at 10:18 +0200, Frank van Maarseveen wrote: > > On Wed, May 30, 2007 at 04:12:27PM -0400, Trond Myklebust wrote: > > > On Tue, 2007-05-29 at 10:10 -0400, Chuck Lever wrote: > > > > Trond Myklebust wrote: > > > > > On Fri, 2007-05-25 at 17:41 -0400, Chuck Lever wrote: > > > > >> Follow kernel coding conventions. > > > > >> > > > > >> Signed-off-by: Chuck Lever <chuck.lever@oracle.com> > > > > >> --- > > > > >> > > > > >> fs/nfs/nfs4_fs.h | 5 ++++ > > > > >> fs/nfs/nfs4proc.c | 70 ++++++++++++++++++++++++++++------------------------- > > > > >> 2 files changed, 42 insertions(+), 33 deletions(-) > > > > >> > > > > >> diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h > > > > >> index cf3a17e..1a526c4 100644 > > > > >> --- a/fs/nfs/nfs4_fs.h > > > > >> +++ b/fs/nfs/nfs4_fs.h > > > > >> @@ -145,6 +145,11 @@ struct nfs4_exception { > > > > >> int retry; > > > > >> }; > > > > >> > > > > >> +#define DECLARE_NFS4_EXCEPTION(name) \ > > > > >> + struct nfs4_exception name = { \ > > > > >> + .timeout = 0, \ > > > > >> + } > > > > > > > > > > Why would we want this? The existing code uses bog standard C99 > > > > > initialisers. There is no need to explicitly set .timeout to zero. > > > > > > > > Using > > > > > > > > struct nfs4_exception name = { }; > > > > > > > > causes compiler complaints. One correct way to fix this is to set at > > > > least one field in the structure, and setting that field to zero clears > > > > the other one by default. > > > > > > I can't find anything in Harbison & Steele stating that name = {} is > > > illegal. All they say is that "if there are fewer initializers than > > > there are structure components, the remaining components are initialized > > > to their default initial values.". > > > > AFAIK and I checked ISO/IEC 9899:1999 to be sure, {initializer-list} > > cannot be empty according to the C syntax. > > but a trivial initialiser like "name = {0}" is, right? yes. -- Frank ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ NFS maillist - NFS@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nfs ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 02/10] NFS: Use C99 struct initializers in nfs4proc.c 2007-05-30 20:12 ` Trond Myklebust 2007-05-31 8:18 ` Frank van Maarseveen @ 2007-05-31 15:14 ` Chuck Lever 2007-05-31 16:18 ` Trond Myklebust 1 sibling, 1 reply; 10+ messages in thread From: Chuck Lever @ 2007-05-31 15:14 UTC (permalink / raw) To: Trond Myklebust; +Cc: nfs [-- Attachment #1: Type: text/plain, Size: 15834 bytes --] Sorry for the delay in responding. See below. Trond Myklebust wrote: > On Tue, 2007-05-29 at 10:10 -0400, Chuck Lever wrote: >> Trond Myklebust wrote: >>> On Fri, 2007-05-25 at 17:41 -0400, Chuck Lever wrote: >>>> Follow kernel coding conventions. >>>> >>>> Signed-off-by: Chuck Lever <chuck.lever@oracle.com> >>>> --- >>>> >>>> fs/nfs/nfs4_fs.h | 5 ++++ >>>> fs/nfs/nfs4proc.c | 70 ++++++++++++++++++++++++++++------------------------- >>>> 2 files changed, 42 insertions(+), 33 deletions(-) >>>> >>>> diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h >>>> index cf3a17e..1a526c4 100644 >>>> --- a/fs/nfs/nfs4_fs.h >>>> +++ b/fs/nfs/nfs4_fs.h >>>> @@ -145,6 +145,11 @@ struct nfs4_exception { >>>> int retry; >>>> }; >>>> >>>> +#define DECLARE_NFS4_EXCEPTION(name) \ >>>> + struct nfs4_exception name = { \ >>>> + .timeout = 0, \ >>>> + } >>> Why would we want this? The existing code uses bog standard C99 >>> initialisers. There is no need to explicitly set .timeout to zero. >> Using >> >> struct nfs4_exception name = { }; >> >> causes compiler complaints. One correct way to fix this is to set at >> least one field in the structure, and setting that field to zero clears >> the other one by default. > > I can't find anything in Harbison & Steele stating that name = {} is > illegal. All they say is that "if there are fewer initializers than > there are structure components, the remaining components are initialized > to their default initial values.". The exact compiler warning is this: /home/cel/src/linux/main/fs/nfs/nfs4proc.c: In function ‘nfs4_do_open_reclaim’: /home/cel/src/linux/main/fs/nfs/nfs4proc.c:496: warning: missing initializer /home/cel/src/linux/main/fs/nfs/nfs4proc.c:496: warning: (near initialization for ‘exception.timeout’) > Anyhow, if you really do have to set one component, then a much less > verbose form would be to write "name = {0}" There is no need for the > macro. Yes, that is less verbose. But it doesn't eliminate the warning, which becomes this: /home/cel/src/linux/main/fs/nfs/nfs4proc.c: In function ‘nfs4_do_open_reclaim’: /home/cel/src/linux/main/fs/nfs/nfs4proc.c:496: warning: missing initializer /home/cel/src/linux/main/fs/nfs/nfs4proc.c:496: warning: (near initialization for ‘exception.retry’) So a complete structure initializer is necessary to eliminate both warnings. >>>> struct nfs4_state_recovery_ops { >>>> int (*recover_open)(struct nfs4_state_owner *, struct nfs4_state *); >>>> int (*recover_lock)(struct nfs4_state *, struct file_lock *); >>>> diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c >>>> index 648e0ac..b220c09 100644 >>>> --- a/fs/nfs/nfs4proc.c >>>> +++ b/fs/nfs/nfs4proc.c >>>> @@ -493,7 +493,7 @@ static int _nfs4_do_open_reclaim(struct nfs4_state_owner *sp, struct nfs4_state >>>> static int nfs4_do_open_reclaim(struct nfs4_state_owner *sp, struct nfs4_state *state, struct dentry *dentry) >>>> { >>>> struct nfs_server *server = NFS_SERVER(state->inode); >>>> - struct nfs4_exception exception = { }; >>>> + DECLARE_NFS4_EXCEPTION(exception); >>>> int err; >>>> do { >>>> err = _nfs4_do_open_reclaim(sp, state, dentry); >>>> @@ -538,8 +538,8 @@ static int _nfs4_open_delegation_recall(struct dentry *dentry, struct nfs4_state >>>> >>>> int nfs4_open_delegation_recall(struct dentry *dentry, struct nfs4_state *state) >>>> { >>>> - struct nfs4_exception exception = { }; >>>> struct nfs_server *server = NFS_SERVER(dentry->d_inode); >>>> + DECLARE_NFS4_EXCEPTION(exception); >>>> int err; >>>> do { >>>> err = _nfs4_open_delegation_recall(dentry, state); >>>> @@ -843,7 +843,7 @@ static int _nfs4_open_expired(struct nfs4_state_owner *sp, struct nfs4_state *st >>>> static inline int nfs4_do_open_expired(struct nfs4_state_owner *sp, struct nfs4_state *state, struct dentry *dentry) >>>> { >>>> struct nfs_server *server = NFS_SERVER(dentry->d_inode); >>>> - struct nfs4_exception exception = { }; >>>> + DECLARE_NFS4_EXCEPTION(exception); >>>> int err; >>>> >>>> do { >>>> @@ -938,8 +938,8 @@ out_put_state_owner: >>>> >>>> static struct nfs4_state *nfs4_open_delegated(struct inode *inode, int flags, struct rpc_cred *cred) >>>> { >>>> - struct nfs4_exception exception = { }; >>>> struct nfs4_state *res = ERR_PTR(-EIO); >>>> + DECLARE_NFS4_EXCEPTION(exception); >>>> int err; >>>> >>>> do { >>>> @@ -1008,7 +1008,7 @@ out_err: >>>> >>>> static struct nfs4_state *nfs4_do_open(struct inode *dir, struct dentry *dentry, int flags, struct iattr *sattr, struct rpc_cred *cred) >>>> { >>>> - struct nfs4_exception exception = { }; >>>> + DECLARE_NFS4_EXCEPTION(exception); >>>> struct nfs4_state *res; >>>> int status; >>>> >>>> @@ -1090,7 +1090,7 @@ static int nfs4_do_setattr(struct inode *inode, struct nfs_fattr *fattr, >>>> struct iattr *sattr, struct nfs4_state *state) >>>> { >>>> struct nfs_server *server = NFS_SERVER(inode); >>>> - struct nfs4_exception exception = { }; >>>> + DECLARE_NFS4_EXCEPTION(exception); >>>> int err; >>>> do { >>>> err = nfs4_handle_exception(server, >>>> @@ -1330,7 +1330,9 @@ out_drop: >>>> >>>> static int _nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *fhandle) >>>> { >>>> - struct nfs4_server_caps_res res = {}; >>>> + struct nfs4_server_caps_res res = { >>>> + .acl_bitmask = 0, >>>> + }; >>>> struct rpc_message msg = { >>>> .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_SERVER_CAPS], >>>> .rpc_argp = fhandle, >>>> @@ -1354,7 +1356,7 @@ static int _nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *f >>>> >>>> int nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *fhandle) >>>> { >>>> - struct nfs4_exception exception = { }; >>>> + DECLARE_NFS4_EXCEPTION(exception); >>>> int err; >>>> do { >>>> err = nfs4_handle_exception(server, >>>> @@ -1387,7 +1389,7 @@ static int _nfs4_lookup_root(struct nfs_server *server, struct nfs_fh *fhandle, >>>> static int nfs4_lookup_root(struct nfs_server *server, struct nfs_fh *fhandle, >>>> struct nfs_fsinfo *info) >>>> { >>>> - struct nfs4_exception exception = { }; >>>> + DECLARE_NFS4_EXCEPTION(exception); >>>> int err; >>>> do { >>>> err = nfs4_handle_exception(server, >>>> @@ -1476,7 +1478,7 @@ static int _nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, >>>> >>>> static int nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fattr *fattr) >>>> { >>>> - struct nfs4_exception exception = { }; >>>> + DECLARE_NFS4_EXCEPTION(exception); >>>> int err; >>>> do { >>>> err = nfs4_handle_exception(server, >>>> @@ -1568,7 +1570,7 @@ static int nfs4_proc_lookupfh(struct nfs_server *server, struct nfs_fh *dirfh, >>>> struct qstr *name, struct nfs_fh *fhandle, >>>> struct nfs_fattr *fattr) >>>> { >>>> - struct nfs4_exception exception = { }; >>>> + DECLARE_NFS4_EXCEPTION(exception); >>>> int err; >>>> do { >>>> err = nfs4_handle_exception(server, >>>> @@ -1612,7 +1614,7 @@ static int _nfs4_proc_lookup(struct inode *dir, struct qstr *name, >>>> >>>> static int nfs4_proc_lookup(struct inode *dir, struct qstr *name, struct nfs_fh *fhandle, struct nfs_fattr *fattr) >>>> { >>>> - struct nfs4_exception exception = { }; >>>> + DECLARE_NFS4_EXCEPTION(exception); >>>> int err; >>>> do { >>>> err = nfs4_handle_exception(NFS_SERVER(dir), >>>> @@ -1627,7 +1629,9 @@ static int _nfs4_proc_access(struct inode *inode, struct nfs_access_entry *entry >>>> struct nfs4_accessargs args = { >>>> .fh = NFS_FH(inode), >>>> }; >>>> - struct nfs4_accessres res = { 0 }; >>>> + struct nfs4_accessres res = { >>>> + .access = 0, >>>> + }; >>>> struct rpc_message msg = { >>>> .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_ACCESS], >>>> .rpc_argp = &args, >>>> @@ -1668,7 +1672,7 @@ static int _nfs4_proc_access(struct inode *inode, struct nfs_access_entry *entry >>>> >>>> static int nfs4_proc_access(struct inode *inode, struct nfs_access_entry *entry) >>>> { >>>> - struct nfs4_exception exception = { }; >>>> + DECLARE_NFS4_EXCEPTION(exception); >>>> int err; >>>> do { >>>> err = nfs4_handle_exception(NFS_SERVER(inode), >>>> @@ -1723,7 +1727,7 @@ static int _nfs4_proc_readlink(struct inode *inode, struct page *page, >>>> static int nfs4_proc_readlink(struct inode *inode, struct page *page, >>>> unsigned int pgbase, unsigned int pglen) >>>> { >>>> - struct nfs4_exception exception = { }; >>>> + DECLARE_NFS4_EXCEPTION(exception); >>>> int err; >>>> do { >>>> err = nfs4_handle_exception(NFS_SERVER(inode), >>>> @@ -1813,7 +1817,7 @@ static int _nfs4_proc_remove(struct inode *dir, struct qstr *name) >>>> >>>> static int nfs4_proc_remove(struct inode *dir, struct qstr *name) >>>> { >>>> - struct nfs4_exception exception = { }; >>>> + DECLARE_NFS4_EXCEPTION(exception); >>>> int err; >>>> do { >>>> err = nfs4_handle_exception(NFS_SERVER(dir), >>>> @@ -1907,7 +1911,7 @@ static int _nfs4_proc_rename(struct inode *old_dir, struct qstr *old_name, >>>> static int nfs4_proc_rename(struct inode *old_dir, struct qstr *old_name, >>>> struct inode *new_dir, struct qstr *new_name) >>>> { >>>> - struct nfs4_exception exception = { }; >>>> + DECLARE_NFS4_EXCEPTION(exception); >>>> int err; >>>> do { >>>> err = nfs4_handle_exception(NFS_SERVER(old_dir), >>>> @@ -1954,7 +1958,7 @@ static int _nfs4_proc_link(struct inode *inode, struct inode *dir, struct qstr * >>>> >>>> static int nfs4_proc_link(struct inode *inode, struct inode *dir, struct qstr *name) >>>> { >>>> - struct nfs4_exception exception = { }; >>>> + DECLARE_NFS4_EXCEPTION(exception); >>>> int err; >>>> do { >>>> err = nfs4_handle_exception(NFS_SERVER(inode), >>>> @@ -2011,7 +2015,7 @@ static int _nfs4_proc_symlink(struct inode *dir, struct dentry *dentry, >>>> static int nfs4_proc_symlink(struct inode *dir, struct dentry *dentry, >>>> struct page *page, unsigned int len, struct iattr *sattr) >>>> { >>>> - struct nfs4_exception exception = { }; >>>> + DECLARE_NFS4_EXCEPTION(exception); >>>> int err; >>>> do { >>>> err = nfs4_handle_exception(NFS_SERVER(dir), >>>> @@ -2064,7 +2068,7 @@ static int _nfs4_proc_mkdir(struct inode *dir, struct dentry *dentry, >>>> static int nfs4_proc_mkdir(struct inode *dir, struct dentry *dentry, >>>> struct iattr *sattr) >>>> { >>>> - struct nfs4_exception exception = { }; >>>> + DECLARE_NFS4_EXCEPTION(exception); >>>> int err; >>>> do { >>>> err = nfs4_handle_exception(NFS_SERVER(dir), >>>> @@ -2110,7 +2114,7 @@ static int _nfs4_proc_readdir(struct dentry *dentry, struct rpc_cred *cred, >>>> static int nfs4_proc_readdir(struct dentry *dentry, struct rpc_cred *cred, >>>> u64 cookie, struct page *page, unsigned int count, int plus) >>>> { >>>> - struct nfs4_exception exception = { }; >>>> + DECLARE_NFS4_EXCEPTION(exception); >>>> int err; >>>> do { >>>> err = nfs4_handle_exception(NFS_SERVER(dentry->d_inode), >>>> @@ -2180,7 +2184,7 @@ static int _nfs4_proc_mknod(struct inode *dir, struct dentry *dentry, >>>> static int nfs4_proc_mknod(struct inode *dir, struct dentry *dentry, >>>> struct iattr *sattr, dev_t rdev) >>>> { >>>> - struct nfs4_exception exception = { }; >>>> + DECLARE_NFS4_EXCEPTION(exception); >>>> int err; >>>> do { >>>> err = nfs4_handle_exception(NFS_SERVER(dir), >>>> @@ -2209,7 +2213,7 @@ static int _nfs4_proc_statfs(struct nfs_server *server, struct nfs_fh *fhandle, >>>> >>>> static int nfs4_proc_statfs(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fsstat *fsstat) >>>> { >>>> - struct nfs4_exception exception = { }; >>>> + DECLARE_NFS4_EXCEPTION(exception); >>>> int err; >>>> do { >>>> err = nfs4_handle_exception(server, >>>> @@ -2237,7 +2241,7 @@ static int _nfs4_do_fsinfo(struct nfs_server *server, struct nfs_fh *fhandle, >>>> >>>> static int nfs4_do_fsinfo(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fsinfo *fsinfo) >>>> { >>>> - struct nfs4_exception exception = { }; >>>> + DECLARE_NFS4_EXCEPTION(exception); >>>> int err; >>>> >>>> do { >>>> @@ -2280,7 +2284,7 @@ static int _nfs4_proc_pathconf(struct nfs_server *server, struct nfs_fh *fhandle >>>> static int nfs4_proc_pathconf(struct nfs_server *server, struct nfs_fh *fhandle, >>>> struct nfs_pathconf *pathconf) >>>> { >>>> - struct nfs4_exception exception = { }; >>>> + DECLARE_NFS4_EXCEPTION(exception); >>>> int err; >>>> >>>> do { >>>> @@ -2599,7 +2603,7 @@ out_free: >>>> >>>> static ssize_t nfs4_get_acl_uncached(struct inode *inode, void *buf, size_t buflen) >>>> { >>>> - struct nfs4_exception exception = { }; >>>> + DECLARE_NFS4_EXCEPTION(exception); >>>> ssize_t ret; >>>> do { >>>> ret = __nfs4_get_acl_uncached(inode, buf, buflen); >>>> @@ -2653,7 +2657,7 @@ static int __nfs4_proc_set_acl(struct inode *inode, const void *buf, size_t bufl >>>> >>>> static int nfs4_proc_set_acl(struct inode *inode, const void *buf, size_t buflen) >>>> { >>>> - struct nfs4_exception exception = { }; >>>> + DECLARE_NFS4_EXCEPTION(exception); >>>> int err; >>>> do { >>>> err = nfs4_handle_exception(NFS_SERVER(inode), >>>> @@ -2950,7 +2954,7 @@ static int _nfs4_proc_delegreturn(struct inode *inode, struct rpc_cred *cred, co >>>> int nfs4_proc_delegreturn(struct inode *inode, struct rpc_cred *cred, const nfs4_stateid *stateid) >>>> { >>>> struct nfs_server *server = NFS_SERVER(inode); >>>> - struct nfs4_exception exception = { }; >>>> + DECLARE_NFS4_EXCEPTION(exception); >>>> int err; >>>> do { >>>> err = _nfs4_proc_delegreturn(inode, cred, stateid); >>>> @@ -3025,7 +3029,7 @@ out: >>>> >>>> static int nfs4_proc_getlk(struct nfs4_state *state, int cmd, struct file_lock *request) >>>> { >>>> - struct nfs4_exception exception = { }; >>>> + DECLARE_NFS4_EXCEPTION(exception); >>>> int err; >>>> >>>> do { >>>> @@ -3354,7 +3358,7 @@ static int _nfs4_do_setlk(struct nfs4_state *state, int cmd, struct file_lock *f >>>> static int nfs4_lock_reclaim(struct nfs4_state *state, struct file_lock *request) >>>> { >>>> struct nfs_server *server = NFS_SERVER(state->inode); >>>> - struct nfs4_exception exception = { }; >>>> + DECLARE_NFS4_EXCEPTION(exception); >>>> int err; >>>> >>>> do { >>>> @@ -3372,7 +3376,7 @@ static int nfs4_lock_reclaim(struct nfs4_state *state, struct file_lock *request >>>> static int nfs4_lock_expired(struct nfs4_state *state, struct file_lock *request) >>>> { >>>> struct nfs_server *server = NFS_SERVER(state->inode); >>>> - struct nfs4_exception exception = { }; >>>> + DECLARE_NFS4_EXCEPTION(exception); >>>> int err; >>>> >>>> err = nfs4_set_lock_state(state, request); >>>> @@ -3433,7 +3437,7 @@ out: >>>> >>>> static int nfs4_proc_setlk(struct nfs4_state *state, int cmd, struct file_lock *request) >>>> { >>>> - struct nfs4_exception exception = { }; >>>> + DECLARE_NFS4_EXCEPTION(exception); >>>> int err; >>>> >>>> do { >>>> @@ -3483,7 +3487,7 @@ nfs4_proc_lock(struct file *filp, int cmd, struct file_lock *request) >>>> int nfs4_lock_delegation_recall(struct nfs4_state *state, struct file_lock *fl) >>>> { >>>> struct nfs_server *server = NFS_SERVER(state->inode); >>>> - struct nfs4_exception exception = { }; >>>> + DECLARE_NFS4_EXCEPTION(exception); >>>> int err; >>>> >>>> err = nfs4_set_lock_state(state, fl); >>>> > [-- Attachment #2: chuck.lever.vcf --] [-- Type: text/x-vcard, Size: 291 bytes --] begin:vcard fn:Chuck Lever n:Lever;Chuck org:Oracle Corporation;Corporate Architecture: Linux Projects Group adr:;;1015 Granger Avenue;Ann Arbor;MI;48104;USA title:Principal Member of Staff tel;work:+1 248 614 5091 x-mozilla-html:FALSE url:http://oss.oracle.com/~cel/ version:2.1 end:vcard [-- Attachment #3: Type: text/plain, Size: 286 bytes --] ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ [-- Attachment #4: Type: text/plain, Size: 140 bytes --] _______________________________________________ NFS maillist - NFS@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nfs ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 02/10] NFS: Use C99 struct initializers in nfs4proc.c 2007-05-31 15:14 ` Chuck Lever @ 2007-05-31 16:18 ` Trond Myklebust 2007-05-31 17:11 ` Chuck Lever 0 siblings, 1 reply; 10+ messages in thread From: Trond Myklebust @ 2007-05-31 16:18 UTC (permalink / raw) To: chuck.lever; +Cc: nfs T24gVGh1LCAyMDA3LTA1LTMxIGF0IDExOjE0IC0wNDAwLCBDaHVjayBMZXZlciB3cm90ZToKPiBT b3JyeSBmb3IgdGhlIGRlbGF5IGluIHJlc3BvbmRpbmcuICBTZWUgYmVsb3cuCj4gCj4gVHJvbmQg TXlrbGVidXN0IHdyb3RlOgo+ID4gT24gVHVlLCAyMDA3LTA1LTI5IGF0IDEwOjEwIC0wNDAwLCBD aHVjayBMZXZlciB3cm90ZToKPiA+PiBUcm9uZCBNeWtsZWJ1c3Qgd3JvdGU6Cj4gPj4+IE9uIEZy aSwgMjAwNy0wNS0yNSBhdCAxNzo0MSAtMDQwMCwgQ2h1Y2sgTGV2ZXIgd3JvdGU6Cj4gPj4+PiBG b2xsb3cga2VybmVsIGNvZGluZyBjb252ZW50aW9ucy4KPiA+Pj4+Cj4gPj4+PiBTaWduZWQtb2Zm LWJ5OiBDaHVjayBMZXZlciA8Y2h1Y2subGV2ZXJAb3JhY2xlLmNvbT4KPiA+Pj4+IC0tLQo+ID4+ Pj4KPiA+Pj4+ICBmcy9uZnMvbmZzNF9mcy5oICB8ICAgIDUgKysrKwo+ID4+Pj4gIGZzL25mcy9u ZnM0cHJvYy5jIHwgICA3MCArKysrKysrKysrKysrKysrKysrKysrKysrKysrLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLQo+ID4+Pj4gIDIgZmlsZXMgY2hhbmdlZCwgNDIgaW5zZXJ0aW9ucygrKSwg MzMgZGVsZXRpb25zKC0pCj4gPj4+Pgo+ID4+Pj4gZGlmZiAtLWdpdCBhL2ZzL25mcy9uZnM0X2Zz LmggYi9mcy9uZnMvbmZzNF9mcy5oCj4gPj4+PiBpbmRleCBjZjNhMTdlLi4xYTUyNmM0IDEwMDY0 NAo+ID4+Pj4gLS0tIGEvZnMvbmZzL25mczRfZnMuaAo+ID4+Pj4gKysrIGIvZnMvbmZzL25mczRf ZnMuaAo+ID4+Pj4gQEAgLTE0NSw2ICsxNDUsMTEgQEAgc3RydWN0IG5mczRfZXhjZXB0aW9uIHsK PiA+Pj4+ICAJaW50IHJldHJ5Owo+ID4+Pj4gIH07Cj4gPj4+PiAgCj4gPj4+PiArI2RlZmluZSBE RUNMQVJFX05GUzRfRVhDRVBUSU9OKG5hbWUpCQkJCVwKPiA+Pj4+ICsJc3RydWN0IG5mczRfZXhj ZXB0aW9uIG5hbWUgPSB7CQkJCVwKPiA+Pj4+ICsJCS50aW1lb3V0CT0gMCwJCQkJXAo+ID4+Pj4g Kwl9Cj4gPj4+IFdoeSB3b3VsZCB3ZSB3YW50IHRoaXM/IFRoZSBleGlzdGluZyBjb2RlIHVzZXMg Ym9nIHN0YW5kYXJkIEM5OQo+ID4+PiBpbml0aWFsaXNlcnMuIFRoZXJlIGlzIG5vIG5lZWQgdG8g ZXhwbGljaXRseSBzZXQgLnRpbWVvdXQgdG8gemVyby4KPiA+PiBVc2luZwo+ID4+Cj4gPj4gICAg c3RydWN0IG5mczRfZXhjZXB0aW9uIG5hbWUgPSB7IH07Cj4gPj4KPiA+PiBjYXVzZXMgY29tcGls ZXIgY29tcGxhaW50cy4gIE9uZSBjb3JyZWN0IHdheSB0byBmaXggdGhpcyBpcyB0byBzZXQgYXQg Cj4gPj4gbGVhc3Qgb25lIGZpZWxkIGluIHRoZSBzdHJ1Y3R1cmUsIGFuZCBzZXR0aW5nIHRoYXQg ZmllbGQgdG8gemVybyBjbGVhcnMgCj4gPj4gdGhlIG90aGVyIG9uZSBieSBkZWZhdWx0Lgo+ID4g Cj4gPiBJIGNhbid0IGZpbmQgYW55dGhpbmcgaW4gSGFyYmlzb24gJiBTdGVlbGUgc3RhdGluZyB0 aGF0IG5hbWUgPSB7fSBpcwo+ID4gaWxsZWdhbC4gQWxsIHRoZXkgc2F5IGlzIHRoYXQgImlmIHRo ZXJlIGFyZSBmZXdlciBpbml0aWFsaXplcnMgdGhhbgo+ID4gdGhlcmUgYXJlIHN0cnVjdHVyZSBj b21wb25lbnRzLCB0aGUgcmVtYWluaW5nIGNvbXBvbmVudHMgYXJlIGluaXRpYWxpemVkCj4gPiB0 byB0aGVpciBkZWZhdWx0IGluaXRpYWwgdmFsdWVzLiIuCj4gCj4gVGhlIGV4YWN0IGNvbXBpbGVy IHdhcm5pbmcgaXMgdGhpczoKPiAKPiAvaG9tZS9jZWwvc3JjL2xpbnV4L21haW4vZnMvbmZzL25m czRwcm9jLmM6IEluIGZ1bmN0aW9uIAo+IOKAmG5mczRfZG9fb3Blbl9yZWNsYWlt4oCZOgo+IC9o b21lL2NlbC9zcmMvbGludXgvbWFpbi9mcy9uZnMvbmZzNHByb2MuYzo0OTY6IHdhcm5pbmc6IG1p c3NpbmcgaW5pdGlhbGl6ZXIKPiAvaG9tZS9jZWwvc3JjL2xpbnV4L21haW4vZnMvbmZzL25mczRw cm9jLmM6NDk2OiB3YXJuaW5nOiAobmVhciAKPiBpbml0aWFsaXphdGlvbiBmb3Ig4oCYZXhjZXB0 aW9uLnRpbWVvdXTigJkpCj4gCj4gPiBBbnlob3csIGlmIHlvdSByZWFsbHkgZG8gaGF2ZSB0byBz ZXQgb25lIGNvbXBvbmVudCwgdGhlbiBhIG11Y2ggbGVzcwo+ID4gdmVyYm9zZSBmb3JtIHdvdWxk IGJlIHRvIHdyaXRlICJuYW1lID0gezB9IiBUaGVyZSBpcyBubyBuZWVkIGZvciB0aGUKPiA+IG1h Y3JvLgo+IAo+IFllcywgdGhhdCBpcyBsZXNzIHZlcmJvc2UuICBCdXQgaXQgZG9lc24ndCBlbGlt aW5hdGUgdGhlIHdhcm5pbmcsIHdoaWNoIAo+IGJlY29tZXMgdGhpczoKPiAKPiAvaG9tZS9jZWwv c3JjL2xpbnV4L21haW4vZnMvbmZzL25mczRwcm9jLmM6IEluIGZ1bmN0aW9uIAo+IOKAmG5mczRf ZG9fb3Blbl9yZWNsYWlt4oCZOgo+IC9ob21lL2NlbC9zcmMvbGludXgvbWFpbi9mcy9uZnMvbmZz NHByb2MuYzo0OTY6IHdhcm5pbmc6IG1pc3NpbmcgaW5pdGlhbGl6ZXIKPiAvaG9tZS9jZWwvc3Jj L2xpbnV4L21haW4vZnMvbmZzL25mczRwcm9jLmM6NDk2OiB3YXJuaW5nOiAobmVhciAKPiBpbml0 aWFsaXphdGlvbiBmb3Ig4oCYZXhjZXB0aW9uLnJldHJ54oCZKQo+IAo+IFNvIGEgY29tcGxldGUg c3RydWN0dXJlIGluaXRpYWxpemVyIGlzIG5lY2Vzc2FyeSB0byBlbGltaW5hdGUgYm90aCB3YXJu aW5ncy4KClNvcnJ5LCBidXQgdG8gbWUgdGhpcyBzb3VuZHMgbGlrZSBhIGNvbXBpbGVyIGJ1Zy4g U2VlIHRoZSBhYm92ZSBxdW90ZSwKcmVhZCB0aGUgc3RydWN0dXJlIGluaXRpYWxpc2F0aW9uIGV4 YW1wbGVzIGluIEhhcmJpc29uICYgU3RlZWxlIChJIGtub3cKeW91IGhhdmUgYSBjb3B5KSwgYW5k IHRoZW4gdGVsbCBtZSBob3cgdGhpcyB3b3VsZCBiZSBhbnkgZGlmZmVyZW50LgoKVHJvbmQKCgot LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tClRoaXMgU0YubmV0IGVtYWlsIGlzIHNwb25zb3JlZCBieSBEQjIgRXhw cmVzcwpEb3dubG9hZCBEQjIgRXhwcmVzcyBDIC0gdGhlIEZSRUUgdmVyc2lvbiBvZiBEQjIgZXhw cmVzcyBhbmQgdGFrZQpjb250cm9sIG9mIHlvdXIgWE1MLiBObyBsaW1pdHMuIEp1c3QgZGF0YS4g Q2xpY2sgdG8gZ2V0IGl0IG5vdy4KaHR0cDovL3NvdXJjZWZvcmdlLm5ldC9wb3dlcmJhci9kYjIv Cl9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fCk5GUyBtYWls bGlzdCAgLSAgTkZTQGxpc3RzLnNvdXJjZWZvcmdlLm5ldApodHRwczovL2xpc3RzLnNvdXJjZWZv cmdlLm5ldC9saXN0cy9saXN0aW5mby9uZnMK ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 02/10] NFS: Use C99 struct initializers in nfs4proc.c 2007-05-31 16:18 ` Trond Myklebust @ 2007-05-31 17:11 ` Chuck Lever 0 siblings, 0 replies; 10+ messages in thread From: Chuck Lever @ 2007-05-31 17:11 UTC (permalink / raw) To: Trond Myklebust; +Cc: nfs [-- Attachment #1: Type: text/plain, Size: 3313 bytes --] Trond Myklebust wrote: > On Thu, 2007-05-31 at 11:14 -0400, Chuck Lever wrote: >> Sorry for the delay in responding. See below. >> >> Trond Myklebust wrote: >>> On Tue, 2007-05-29 at 10:10 -0400, Chuck Lever wrote: >>>> Trond Myklebust wrote: >>>>> On Fri, 2007-05-25 at 17:41 -0400, Chuck Lever wrote: >>>>>> Follow kernel coding conventions. >>>>>> >>>>>> Signed-off-by: Chuck Lever <chuck.lever@oracle.com> >>>>>> --- >>>>>> >>>>>> fs/nfs/nfs4_fs.h | 5 ++++ >>>>>> fs/nfs/nfs4proc.c | 70 ++++++++++++++++++++++++++++------------------------- >>>>>> 2 files changed, 42 insertions(+), 33 deletions(-) >>>>>> >>>>>> diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h >>>>>> index cf3a17e..1a526c4 100644 >>>>>> --- a/fs/nfs/nfs4_fs.h >>>>>> +++ b/fs/nfs/nfs4_fs.h >>>>>> @@ -145,6 +145,11 @@ struct nfs4_exception { >>>>>> int retry; >>>>>> }; >>>>>> >>>>>> +#define DECLARE_NFS4_EXCEPTION(name) \ >>>>>> + struct nfs4_exception name = { \ >>>>>> + .timeout = 0, \ >>>>>> + } >>>>> Why would we want this? The existing code uses bog standard C99 >>>>> initialisers. There is no need to explicitly set .timeout to zero. >>>> Using >>>> >>>> struct nfs4_exception name = { }; >>>> >>>> causes compiler complaints. One correct way to fix this is to set at >>>> least one field in the structure, and setting that field to zero clears >>>> the other one by default. >>> I can't find anything in Harbison & Steele stating that name = {} is >>> illegal. All they say is that "if there are fewer initializers than >>> there are structure components, the remaining components are initialized >>> to their default initial values.". >> The exact compiler warning is this: >> >> /home/cel/src/linux/main/fs/nfs/nfs4proc.c: In function >> ‘nfs4_do_open_reclaim’: >> /home/cel/src/linux/main/fs/nfs/nfs4proc.c:496: warning: missing initializer >> /home/cel/src/linux/main/fs/nfs/nfs4proc.c:496: warning: (near >> initialization for ‘exception.timeout’) >> >>> Anyhow, if you really do have to set one component, then a much less >>> verbose form would be to write "name = {0}" There is no need for the >>> macro. >> Yes, that is less verbose. But it doesn't eliminate the warning, which >> becomes this: >> >> /home/cel/src/linux/main/fs/nfs/nfs4proc.c: In function >> ‘nfs4_do_open_reclaim’: >> /home/cel/src/linux/main/fs/nfs/nfs4proc.c:496: warning: missing initializer >> /home/cel/src/linux/main/fs/nfs/nfs4proc.c:496: warning: (near >> initialization for ‘exception.retry’) >> >> So a complete structure initializer is necessary to eliminate both warnings. > > Sorry, but to me this sounds like a compiler bug. See the above quote, > read the structure initialisation examples in Harbison & Steele (I know > you have a copy), and then tell me how this would be any different. Whether or not the extraneous warning is a compiler bug, I had thought it was bad form not to use ".field = foo," when initializing a structure. Are there exceptions to that guideline? Sadly Documentation/CodingStyle is silent on this issue. It seems to me that specifying "{ 0 };" today will encourage later changes that would replace it with "{ 0, foo };" instead of the preferred use of ".field = foo,". [-- Attachment #2: chuck.lever.vcf --] [-- Type: text/x-vcard, Size: 327 bytes --] begin:vcard fn:Chuck Lever n:Lever;Chuck org:Oracle Corporation;Corporate Architecture: Linux Projects Group adr:;;1015 Granger Avenue;Ann Arbor;MI;48104;USA email;internet:chuck dot lever at nospam oracle dot com title:Principal Member of Staff tel;work:+1 248 614 5091 x-mozilla-html:FALSE version:2.1 end:vcard [-- Attachment #3: Type: text/plain, Size: 286 bytes --] ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ [-- Attachment #4: Type: text/plain, Size: 140 bytes --] _______________________________________________ NFS maillist - NFS@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nfs ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2007-05-31 17:13 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2007-05-25 21:41 [PATCH 02/10] NFS: Use C99 struct initializers in nfs4proc.c Chuck Lever 2007-05-26 18:01 ` Trond Myklebust 2007-05-29 14:10 ` Chuck Lever 2007-05-30 20:12 ` Trond Myklebust 2007-05-31 8:18 ` Frank van Maarseveen 2007-05-31 12:18 ` Trond Myklebust 2007-05-31 12:19 ` Frank van Maarseveen 2007-05-31 15:14 ` Chuck Lever 2007-05-31 16:18 ` Trond Myklebust 2007-05-31 17:11 ` Chuck Lever
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.