From 482fb94e1b0c2efe8258334aa2a68d4f4a91de9c Mon Sep 17 00:00:00 2001 From: Chuck Lever Date: Mon, 12 Feb 2007 00:53:29 -0800 Subject: [PATCH] knfsd: SUNRPC: allow creating an RPC service without registering with portmapper Sometimes we need to create an RPC service but not register it with the local portmapper. NFSv4 delegation callback, for example. Change the svc_makesock() API to allow optionally creating temporary or permanent sockets, optionally registering with the local portmapper, and make it return the ephemeral port of the new socket. Signed-off-by: Chuck Lever Cc: Aurelien Charbon Signed-off-by: Neil Brown Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- fs/nfs/callback.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'fs/nfs') diff --git a/fs/nfs/callback.c b/fs/nfs/callback.c index 7933e2e99dbc..a070109fa6c7 100644 --- a/fs/nfs/callback.c +++ b/fs/nfs/callback.c @@ -106,7 +106,6 @@ static void nfs_callback_svc(struct svc_rqst *rqstp) int nfs_callback_up(void) { struct svc_serv *serv; - struct svc_sock *svsk; int ret = 0; lock_kernel(); @@ -119,17 +118,14 @@ int nfs_callback_up(void) ret = -ENOMEM; if (!serv) goto out_err; - /* FIXME: We don't want to register this socket with the portmapper */ - ret = svc_makesock(serv, IPPROTO_TCP, nfs_callback_set_tcpport); - if (ret < 0) + + ret = svc_makesock(serv, IPPROTO_TCP, nfs_callback_set_tcpport, + SVC_SOCK_ANONYMOUS); + if (ret <= 0) goto out_destroy; - if (!list_empty(&serv->sv_permsocks)) { - svsk = list_entry(serv->sv_permsocks.next, - struct svc_sock, sk_list); - nfs_callback_tcpport = ntohs(inet_sk(svsk->sk_sk)->sport); - dprintk ("Callback port = 0x%x\n", nfs_callback_tcpport); - } else - BUG(); + nfs_callback_tcpport = ret; + dprintk("Callback port = 0x%x\n", nfs_callback_tcpport); + ret = svc_create_thread(nfs_callback_svc, serv); if (ret < 0) goto out_destroy; @@ -140,6 +136,8 @@ out: unlock_kernel(); return ret; out_destroy: + dprintk("Couldn't create callback socket or server thread; err = %d\n", + ret); svc_destroy(serv); out_err: nfs_callback_info.users--; -- cgit v1.2.3 From ad06e4bd62351bc569cca0f25d68c58dbd298146 Mon Sep 17 00:00:00 2001 From: Chuck Lever Date: Mon, 12 Feb 2007 00:53:32 -0800 Subject: [PATCH] knfsd: SUNRPC: Add a function to format the address in an svc_rqst for printing There are loads of places where the RPC server assumes that the rq_addr fields contains an IPv4 address. Top among these are error and debugging messages that display the server's IP address. Let's refactor the address printing into a separate function that's smart enough to figure out the difference between IPv4 and IPv6 addresses. Signed-off-by: Chuck Lever Cc: Aurelien Charbon Signed-off-by: Neil Brown Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- fs/lockd/svc.c | 6 ++-- fs/lockd/svc4proc.c | 7 ++--- fs/lockd/svcproc.c | 7 ++--- fs/nfs/callback.c | 12 ++++++-- fs/nfsd/nfsfh.c | 7 +++-- fs/nfsd/nfsproc.c | 7 +++-- include/linux/sunrpc/svc.h | 3 ++ net/sunrpc/svcsock.c | 76 ++++++++++++++++++++++++++++++++++------------ 8 files changed, 86 insertions(+), 39 deletions(-) (limited to 'fs/nfs') diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c index 2c3d5ac4a3b6..80fcacc1acf9 100644 --- a/fs/lockd/svc.c +++ b/fs/lockd/svc.c @@ -141,6 +141,7 @@ lockd(struct svc_rqst *rqstp) */ while ((nlmsvc_users || !signalled()) && nlmsvc_pid == current->pid) { long timeout = MAX_SCHEDULE_TIMEOUT; + char buf[RPC_MAX_ADDRBUFLEN]; if (signalled()) { flush_signals(current); @@ -175,11 +176,10 @@ lockd(struct svc_rqst *rqstp) break; } - dprintk("lockd: request from %08x\n", - (unsigned)ntohl(rqstp->rq_addr.sin_addr.s_addr)); + dprintk("lockd: request from %s\n", + svc_print_addr(rqstp, buf, sizeof(buf))); svc_process(rqstp); - } flush_signals(current); diff --git a/fs/lockd/svc4proc.c b/fs/lockd/svc4proc.c index f67146a8199a..9b591bc18341 100644 --- a/fs/lockd/svc4proc.c +++ b/fs/lockd/svc4proc.c @@ -426,10 +426,9 @@ nlm4svc_proc_sm_notify(struct svc_rqst *rqstp, struct nlm_reboot *argp, dprintk("lockd: SM_NOTIFY called\n"); if (saddr.sin_addr.s_addr != htonl(INADDR_LOOPBACK) || ntohs(saddr.sin_port) >= 1024) { - printk(KERN_WARNING - "lockd: rejected NSM callback from %08x:%d\n", - ntohl(rqstp->rq_addr.sin_addr.s_addr), - ntohs(rqstp->rq_addr.sin_port)); + char buf[RPC_MAX_ADDRBUFLEN]; + printk(KERN_WARNING "lockd: rejected NSM callback from %s\n", + svc_print_addr(rqstp, buf, sizeof(buf))); return rpc_system_err; } diff --git a/fs/lockd/svcproc.c b/fs/lockd/svcproc.c index 3707c3a23e93..f590304d93bf 100644 --- a/fs/lockd/svcproc.c +++ b/fs/lockd/svcproc.c @@ -457,10 +457,9 @@ nlmsvc_proc_sm_notify(struct svc_rqst *rqstp, struct nlm_reboot *argp, dprintk("lockd: SM_NOTIFY called\n"); if (saddr.sin_addr.s_addr != htonl(INADDR_LOOPBACK) || ntohs(saddr.sin_port) >= 1024) { - printk(KERN_WARNING - "lockd: rejected NSM callback from %08x:%d\n", - ntohl(rqstp->rq_addr.sin_addr.s_addr), - ntohs(rqstp->rq_addr.sin_port)); + char buf[RPC_MAX_ADDRBUFLEN]; + printk(KERN_WARNING "lockd: rejected NSM callback from %s\n", + svc_print_addr(rqstp, buf, sizeof(buf))); return rpc_system_err; } diff --git a/fs/nfs/callback.c b/fs/nfs/callback.c index a070109fa6c7..8c790af85984 100644 --- a/fs/nfs/callback.c +++ b/fs/nfs/callback.c @@ -71,6 +71,8 @@ static void nfs_callback_svc(struct svc_rqst *rqstp) complete(&nfs_callback_info.started); for(;;) { + char buf[RPC_MAX_ADDRBUFLEN]; + if (signalled()) { if (nfs_callback_info.users == 0) break; @@ -88,8 +90,8 @@ static void nfs_callback_svc(struct svc_rqst *rqstp) __FUNCTION__, -err); break; } - dprintk("%s: request from %u.%u.%u.%u\n", __FUNCTION__, - NIPQUAD(rqstp->rq_addr.sin_addr.s_addr)); + dprintk("%s: request from %s\n", __FUNCTION__, + svc_print_addr(rqstp, buf, sizeof(buf))); svc_process(rqstp); } @@ -166,13 +168,17 @@ static int nfs_callback_authenticate(struct svc_rqst *rqstp) { struct sockaddr_in *addr = &rqstp->rq_addr; struct nfs_client *clp; + char buf[RPC_MAX_ADDRBUFLEN]; /* Don't talk to strangers */ clp = nfs_find_client(addr, 4); if (clp == NULL) return SVC_DROP; - dprintk("%s: %u.%u.%u.%u NFSv4 callback!\n", __FUNCTION__, NIPQUAD(addr->sin_addr)); + + dprintk("%s: %s NFSv4 callback!\n", __FUNCTION__, + svc_print_addr(rqstp, buf, sizeof(buf))); nfs_put_client(clp); + switch (rqstp->rq_authop->flavour) { case RPC_AUTH_NULL: if (rqstp->rq_proc != CB_NULL) diff --git a/fs/nfsd/nfsfh.c b/fs/nfsd/nfsfh.c index c59d6fbb7a6b..a0b4282cb284 100644 --- a/fs/nfsd/nfsfh.c +++ b/fs/nfsd/nfsfh.c @@ -20,6 +20,7 @@ #include #include +#include #include #include @@ -180,10 +181,10 @@ fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, int access) /* Check if the request originated from a secure port. */ error = nfserr_perm; if (!rqstp->rq_secure && EX_SECURE(exp)) { + char buf[RPC_MAX_ADDRBUFLEN]; printk(KERN_WARNING - "nfsd: request from insecure port (%u.%u.%u.%u:%d)!\n", - NIPQUAD(rqstp->rq_addr.sin_addr.s_addr), - ntohs(rqstp->rq_addr.sin_port)); + "nfsd: request from insecure port %s!\n", + svc_print_addr(rqstp, buf, sizeof(buf))); goto out; } diff --git a/fs/nfsd/nfsproc.c b/fs/nfsd/nfsproc.c index ec983b777680..5cc2eec981b8 100644 --- a/fs/nfsd/nfsproc.c +++ b/fs/nfsd/nfsproc.c @@ -19,6 +19,7 @@ #include #include +#include #include #include #include @@ -147,10 +148,10 @@ nfsd_proc_read(struct svc_rqst *rqstp, struct nfsd_readargs *argp, */ if (NFSSVC_MAXBLKSIZE_V2 < argp->count) { + char buf[RPC_MAX_ADDRBUFLEN]; printk(KERN_NOTICE - "oversized read request from %u.%u.%u.%u:%d (%d bytes)\n", - NIPQUAD(rqstp->rq_addr.sin_addr.s_addr), - ntohs(rqstp->rq_addr.sin_port), + "oversized read request from %s (%d bytes)\n", + svc_print_addr(rqstp, buf, sizeof(buf)), argp->count); argp->count = NFSSVC_MAXBLKSIZE_V2; } diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h index 64f3d60c72af..1178689b9156 100644 --- a/include/linux/sunrpc/svc.h +++ b/include/linux/sunrpc/svc.h @@ -368,5 +368,8 @@ int svc_register(struct svc_serv *, int, unsigned short); void svc_wake_up(struct svc_serv *); void svc_reserve(struct svc_rqst *rqstp, int space); struct svc_pool * svc_pool_for_cpu(struct svc_serv *serv, int cpu); +char * svc_print_addr(struct svc_rqst *, char *, size_t); + +#define RPC_MAX_ADDRBUFLEN (63U) #endif /* SUNRPC_SVC_H */ diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c index a98be09768a0..08de328ce433 100644 --- a/net/sunrpc/svcsock.c +++ b/net/sunrpc/svcsock.c @@ -41,6 +41,7 @@ #include #include +#include #include #include #include @@ -121,6 +122,41 @@ static inline void svc_reclassify_socket(struct socket *sock) } #endif +static char *__svc_print_addr(struct sockaddr *addr, char *buf, size_t len) +{ + switch (addr->sa_family) { + case AF_INET: + snprintf(buf, len, "%u.%u.%u.%u, port=%u", + NIPQUAD(((struct sockaddr_in *) addr)->sin_addr), + htons(((struct sockaddr_in *) addr)->sin_port)); + break; +#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) + case AF_INET6: + snprintf(buf, len, "%x:%x:%x:%x:%x:%x:%x:%x, port=%u", + NIP6(((struct sockaddr_in6 *) addr)->sin6_addr), + htons(((struct sockaddr_in6 *) addr)->sin6_port)); + break; +#endif + default: + snprintf(buf, len, "unknown address type: %d", addr->sa_family); + break; + } + return buf; +} + +/** + * svc_print_addr - Format rq_addr field for printing + * @rqstp: svc_rqst struct containing address to print + * @buf: target buffer for formatted address + * @len: length of target buffer + * + */ +char *svc_print_addr(struct svc_rqst *rqstp, char *buf, size_t len) +{ + return __svc_print_addr((struct sockaddr *) &rqstp->rq_addr, buf, len); +} +EXPORT_SYMBOL_GPL(svc_print_addr); + /* * Queue up an idle server thread. Must have pool->sp_lock held. * Note: this is really a stack rather than a queue, so that we only @@ -429,6 +465,7 @@ svc_sendto(struct svc_rqst *rqstp, struct xdr_buf *xdr) size_t base = xdr->page_base; unsigned int pglen = xdr->page_len; unsigned int flags = MSG_MORE; + char buf[RPC_MAX_ADDRBUFLEN]; slen = xdr->len; @@ -491,9 +528,9 @@ svc_sendto(struct svc_rqst *rqstp, struct xdr_buf *xdr) len += result; } out: - dprintk("svc: socket %p sendto([%p %Zu... ], %d) = %d (addr %x)\n", - rqstp->rq_sock, xdr->head[0].iov_base, xdr->head[0].iov_len, xdr->len, len, - rqstp->rq_addr.sin_addr.s_addr); + dprintk("svc: socket %p sendto([%p %Zu... ], %d) = %d (addr %s)\n", + rqstp->rq_sock, xdr->head[0].iov_base, xdr->head[0].iov_len, + xdr->len, len, svc_print_addr(rqstp, buf, sizeof(buf))); return len; } @@ -878,6 +915,7 @@ svc_tcp_accept(struct svc_sock *svsk) struct socket *newsock; struct svc_sock *newsvsk; int err, slen; + char buf[RPC_MAX_ADDRBUFLEN]; dprintk("svc: tcp_accept %p sock %p\n", svsk, sock); if (!sock) @@ -908,18 +946,19 @@ svc_tcp_accept(struct svc_sock *svsk) } /* Ideally, we would want to reject connections from unauthorized - * hosts here, but when we get encription, the IP of the host won't - * tell us anything. For now just warn about unpriv connections. + * hosts here, but when we get encryption, the IP of the host won't + * tell us anything. For now just warn about unpriv connections. */ if (ntohs(sin.sin_port) >= 1024) { dprintk(KERN_WARNING - "%s: connect from unprivileged port: %u.%u.%u.%u:%d\n", + "%s: connect from unprivileged port: %s\n", serv->sv_name, - NIPQUAD(sin.sin_addr.s_addr), ntohs(sin.sin_port)); + __svc_print_addr((struct sockaddr *) &sin, buf, + sizeof(buf))); } - - dprintk("%s: connect from %u.%u.%u.%u:%04x\n", serv->sv_name, - NIPQUAD(sin.sin_addr.s_addr), ntohs(sin.sin_port)); + dprintk("%s: connect from %s\n", serv->sv_name, + __svc_print_addr((struct sockaddr *) &sin, buf, + sizeof(buf))); /* make sure that a write doesn't block forever when * low on memory @@ -955,11 +994,9 @@ svc_tcp_accept(struct svc_sock *svsk) "sockets, consider increasing the " "number of nfsd threads\n", serv->sv_name); - printk(KERN_NOTICE "%s: last TCP connect from " - "%u.%u.%u.%u:%d\n", - serv->sv_name, - NIPQUAD(sin.sin_addr.s_addr), - ntohs(sin.sin_port)); + printk(KERN_NOTICE + "%s: last TCP connect from %s\n", + serv->sv_name, buf); } /* * Always select the oldest socket. It's not fair, @@ -1587,11 +1624,12 @@ static int svc_create_socket(struct svc_serv *serv, int protocol, struct socket *sock; int error; int type; + char buf[RPC_MAX_ADDRBUFLEN]; - dprintk("svc: svc_create_socket(%s, %d, %u.%u.%u.%u:%d)\n", - serv->sv_program->pg_name, protocol, - NIPQUAD(sin->sin_addr.s_addr), - ntohs(sin->sin_port)); + dprintk("svc: svc_create_socket(%s, %d, %s)\n", + serv->sv_program->pg_name, protocol, + __svc_print_addr((struct sockaddr *) sin, buf, + sizeof(buf))); if (protocol != IPPROTO_UDP && protocol != IPPROTO_TCP) { printk(KERN_WARNING "svc: only UDP and TCP " -- cgit v1.2.3 From 27459f0940e16c68e080f5fc7e85aa9eb3f74528 Mon Sep 17 00:00:00 2001 From: Chuck Lever Date: Mon, 12 Feb 2007 00:53:34 -0800 Subject: [PATCH] knfsd: SUNRPC: Provide room in svc_rqst for larger addresses Expand the rq_addr field to allow it to contain larger addresses. Specifically, we replace a 'sockaddr_in' with a 'sockaddr_storage', then everywhere the 'sockaddr_in' was referenced, we use instead an accessor function (svc_addr_in) which safely casts the _storage to _in. Signed-off-by: Chuck Lever Cc: Aurelien Charbon Signed-off-by: Neil Brown Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- fs/lockd/host.c | 2 +- fs/lockd/svc4proc.c | 6 ++++-- fs/lockd/svcproc.c | 6 ++++-- fs/nfs/callback.c | 2 +- fs/nfs/callback_xdr.c | 4 ++-- fs/nfsd/nfs4state.c | 18 +++++++++--------- fs/nfsd/nfscache.c | 2 +- include/linux/sunrpc/svc.h | 17 +++++++++++++++-- net/sunrpc/svcauth_unix.c | 3 ++- net/sunrpc/svcsock.c | 19 ++++++++++++------- 10 files changed, 51 insertions(+), 28 deletions(-) (limited to 'fs/nfs') diff --git a/fs/lockd/host.c b/fs/lockd/host.c index 3d4610c2a266..22d403208973 100644 --- a/fs/lockd/host.c +++ b/fs/lockd/host.c @@ -192,7 +192,7 @@ struct nlm_host * nlmsvc_lookup_host(struct svc_rqst *rqstp, const char *hostname, int hostname_len) { - return nlm_lookup_host(1, &rqstp->rq_addr, + return nlm_lookup_host(1, svc_addr_in(rqstp), rqstp->rq_prot, rqstp->rq_vers, hostname, hostname_len); } diff --git a/fs/lockd/svc4proc.c b/fs/lockd/svc4proc.c index 9b591bc18341..47a66aa5d55b 100644 --- a/fs/lockd/svc4proc.c +++ b/fs/lockd/svc4proc.c @@ -224,7 +224,7 @@ nlm4svc_proc_granted(struct svc_rqst *rqstp, struct nlm_args *argp, resp->cookie = argp->cookie; dprintk("lockd: GRANTED called\n"); - resp->status = nlmclnt_grant(&rqstp->rq_addr, &argp->lock); + resp->status = nlmclnt_grant(svc_addr_in(rqstp), &argp->lock); dprintk("lockd: GRANTED status %d\n", ntohl(resp->status)); return rpc_success; } @@ -421,7 +421,9 @@ static __be32 nlm4svc_proc_sm_notify(struct svc_rqst *rqstp, struct nlm_reboot *argp, void *resp) { - struct sockaddr_in saddr = rqstp->rq_addr; + struct sockaddr_in saddr; + + memcpy(&saddr, svc_addr_in(rqstp), sizeof(saddr)); dprintk("lockd: SM_NOTIFY called\n"); if (saddr.sin_addr.s_addr != htonl(INADDR_LOOPBACK) diff --git a/fs/lockd/svcproc.c b/fs/lockd/svcproc.c index f590304d93bf..31cb48425733 100644 --- a/fs/lockd/svcproc.c +++ b/fs/lockd/svcproc.c @@ -253,7 +253,7 @@ nlmsvc_proc_granted(struct svc_rqst *rqstp, struct nlm_args *argp, resp->cookie = argp->cookie; dprintk("lockd: GRANTED called\n"); - resp->status = nlmclnt_grant(&rqstp->rq_addr, &argp->lock); + resp->status = nlmclnt_grant(svc_addr_in(rqstp), &argp->lock); dprintk("lockd: GRANTED status %d\n", ntohl(resp->status)); return rpc_success; } @@ -452,7 +452,9 @@ static __be32 nlmsvc_proc_sm_notify(struct svc_rqst *rqstp, struct nlm_reboot *argp, void *resp) { - struct sockaddr_in saddr = rqstp->rq_addr; + struct sockaddr_in saddr; + + memcpy(&saddr, svc_addr_in(rqstp), sizeof(saddr)); dprintk("lockd: SM_NOTIFY called\n"); if (saddr.sin_addr.s_addr != htonl(INADDR_LOOPBACK) diff --git a/fs/nfs/callback.c b/fs/nfs/callback.c index 8c790af85984..75f309c8741a 100644 --- a/fs/nfs/callback.c +++ b/fs/nfs/callback.c @@ -166,7 +166,7 @@ void nfs_callback_down(void) static int nfs_callback_authenticate(struct svc_rqst *rqstp) { - struct sockaddr_in *addr = &rqstp->rq_addr; + struct sockaddr_in *addr = svc_addr_in(rqstp); struct nfs_client *clp; char buf[RPC_MAX_ADDRBUFLEN]; diff --git a/fs/nfs/callback_xdr.c b/fs/nfs/callback_xdr.c index f8ea1f51f590..849a2029975d 100644 --- a/fs/nfs/callback_xdr.c +++ b/fs/nfs/callback_xdr.c @@ -176,7 +176,7 @@ static __be32 decode_getattr_args(struct svc_rqst *rqstp, struct xdr_stream *xdr status = decode_fh(xdr, &args->fh); if (unlikely(status != 0)) goto out; - args->addr = &rqstp->rq_addr; + args->addr = svc_addr_in(rqstp); status = decode_bitmap(xdr, args->bitmap); out: dprintk("%s: exit with status = %d\n", __FUNCTION__, status); @@ -188,7 +188,7 @@ static __be32 decode_recall_args(struct svc_rqst *rqstp, struct xdr_stream *xdr, __be32 *p; __be32 status; - args->addr = &rqstp->rq_addr; + args->addr = svc_addr_in(rqstp); status = decode_stateid(xdr, &args->stateid); if (unlikely(status != 0)) goto out; diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 9de89df961f4..9e4067999209 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -714,7 +714,7 @@ __be32 nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, struct nfsd4_setclientid *setclid) { - __be32 ip_addr = rqstp->rq_addr.sin_addr.s_addr; + struct sockaddr_in *sin = svc_addr_in(rqstp); struct xdr_netobj clname = { .len = setclid->se_namelen, .data = setclid->se_name, @@ -749,7 +749,7 @@ nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, */ status = nfserr_clid_inuse; if (!cmp_creds(&conf->cl_cred, &rqstp->rq_cred) - || conf->cl_addr != ip_addr) { + || conf->cl_addr != sin->sin_addr.s_addr) { printk("NFSD: setclientid: string in use by client" "(clientid %08x/%08x)\n", conf->cl_clientid.cl_boot, conf->cl_clientid.cl_id); @@ -769,7 +769,7 @@ nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, if (new == NULL) goto out; copy_verf(new, &clverifier); - new->cl_addr = ip_addr; + new->cl_addr = sin->sin_addr.s_addr; copy_cred(&new->cl_cred,&rqstp->rq_cred); gen_clid(new); gen_confirm(new); @@ -801,7 +801,7 @@ nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, if (new == NULL) goto out; copy_verf(new,&conf->cl_verifier); - new->cl_addr = ip_addr; + new->cl_addr = sin->sin_addr.s_addr; copy_cred(&new->cl_cred,&rqstp->rq_cred); copy_clid(new, conf); gen_confirm(new); @@ -820,7 +820,7 @@ nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, if (new == NULL) goto out; copy_verf(new,&clverifier); - new->cl_addr = ip_addr; + new->cl_addr = sin->sin_addr.s_addr; copy_cred(&new->cl_cred,&rqstp->rq_cred); gen_clid(new); gen_confirm(new); @@ -847,7 +847,7 @@ nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, if (new == NULL) goto out; copy_verf(new,&clverifier); - new->cl_addr = ip_addr; + new->cl_addr = sin->sin_addr.s_addr; copy_cred(&new->cl_cred,&rqstp->rq_cred); gen_clid(new); gen_confirm(new); @@ -881,7 +881,7 @@ nfsd4_setclientid_confirm(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, struct nfsd4_setclientid_confirm *setclientid_confirm) { - __be32 ip_addr = rqstp->rq_addr.sin_addr.s_addr; + struct sockaddr_in *sin = svc_addr_in(rqstp); struct nfs4_client *conf, *unconf; nfs4_verifier confirm = setclientid_confirm->sc_confirm; clientid_t * clid = &setclientid_confirm->sc_clientid; @@ -900,9 +900,9 @@ nfsd4_setclientid_confirm(struct svc_rqst *rqstp, unconf = find_unconfirmed_client(clid); status = nfserr_clid_inuse; - if (conf && conf->cl_addr != ip_addr) + if (conf && conf->cl_addr != sin->sin_addr.s_addr) goto out; - if (unconf && unconf->cl_addr != ip_addr) + if (unconf && unconf->cl_addr != sin->sin_addr.s_addr) goto out; if ((conf && unconf) && diff --git a/fs/nfsd/nfscache.c b/fs/nfsd/nfscache.c index f90d70475854..578f2c9d56be 100644 --- a/fs/nfsd/nfscache.c +++ b/fs/nfsd/nfscache.c @@ -185,7 +185,7 @@ nfsd_cache_lookup(struct svc_rqst *rqstp, int type) rp->c_state = RC_INPROG; rp->c_xid = xid; rp->c_proc = proc; - rp->c_addr = rqstp->rq_addr; + memcpy(&rp->c_addr, svc_addr_in(rqstp), sizeof(rp->c_addr)); rp->c_prot = proto; rp->c_vers = vers; rp->c_timestamp = jiffies; diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h index 52db9c8985c5..96c1b6ae7d96 100644 --- a/include/linux/sunrpc/svc.h +++ b/include/linux/sunrpc/svc.h @@ -200,8 +200,8 @@ struct svc_rqst { struct list_head rq_list; /* idle list */ struct list_head rq_all; /* all threads list */ struct svc_sock * rq_sock; /* socket */ - struct sockaddr_in rq_addr; /* peer address */ - int rq_addrlen; + struct sockaddr_storage rq_addr; /* peer address */ + size_t rq_addrlen; struct svc_serv * rq_server; /* RPC service definition */ struct svc_pool * rq_pool; /* thread pool */ @@ -255,6 +255,19 @@ struct svc_rqst { struct task_struct *rq_task; /* service thread */ }; +/* + * Rigorous type checking on sockaddr type conversions + */ +static inline struct sockaddr_in *svc_addr_in(struct svc_rqst *rqst) +{ + return (struct sockaddr_in *) &rqst->rq_addr; +} + +static inline struct sockaddr *svc_addr(struct svc_rqst *rqst) +{ + return (struct sockaddr *) &rqst->rq_addr; +} + /* * Check buffer bounds after decoding arguments */ diff --git a/net/sunrpc/svcauth_unix.c b/net/sunrpc/svcauth_unix.c index 987244f95909..4b775dbf580d 100644 --- a/net/sunrpc/svcauth_unix.c +++ b/net/sunrpc/svcauth_unix.c @@ -421,6 +421,7 @@ svcauth_unix_info_release(void *info) static int svcauth_unix_set_client(struct svc_rqst *rqstp) { + struct sockaddr_in *sin = svc_addr_in(rqstp); struct ip_map *ipm; rqstp->rq_client = NULL; @@ -430,7 +431,7 @@ svcauth_unix_set_client(struct svc_rqst *rqstp) ipm = ip_map_cached_get(rqstp); if (ipm == NULL) ipm = ip_map_lookup(rqstp->rq_server->sv_program->pg_class, - rqstp->rq_addr.sin_addr); + sin->sin_addr); if (ipm == NULL) return SVC_DENIED; diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c index 6680e0f0560d..b11669670baa 100644 --- a/net/sunrpc/svcsock.c +++ b/net/sunrpc/svcsock.c @@ -153,7 +153,7 @@ static char *__svc_print_addr(struct sockaddr *addr, char *buf, size_t len) */ char *svc_print_addr(struct svc_rqst *rqstp, char *buf, size_t len) { - return __svc_print_addr((struct sockaddr *) &rqstp->rq_addr, buf, len); + return __svc_print_addr(svc_addr(rqstp), buf, len); } EXPORT_SYMBOL_GPL(svc_print_addr); @@ -473,7 +473,7 @@ svc_sendto(struct svc_rqst *rqstp, struct xdr_buf *xdr) /* set the source and destination */ struct msghdr msg; msg.msg_name = &rqstp->rq_addr; - msg.msg_namelen = sizeof(rqstp->rq_addr); + msg.msg_namelen = rqstp->rq_addrlen; msg.msg_iov = NULL; msg.msg_iovlen = 0; msg.msg_flags = MSG_MORE; @@ -696,6 +696,7 @@ svc_write_space(struct sock *sk) static int svc_udp_recvfrom(struct svc_rqst *rqstp) { + struct sockaddr_in *sin = svc_addr_in(rqstp); struct svc_sock *svsk = rqstp->rq_sock; struct svc_serv *serv = svsk->sk_server; struct sk_buff *skb; @@ -756,9 +757,12 @@ svc_udp_recvfrom(struct svc_rqst *rqstp) rqstp->rq_prot = IPPROTO_UDP; /* Get sender address */ - rqstp->rq_addr.sin_family = AF_INET; - rqstp->rq_addr.sin_port = skb->h.uh->source; - rqstp->rq_addr.sin_addr.s_addr = skb->nh.iph->saddr; + sin->sin_family = AF_INET; + sin->sin_port = skb->h.uh->source; + sin->sin_addr.s_addr = skb->nh.iph->saddr; + rqstp->rq_addrlen = sizeof(struct sockaddr_in); + + /* Remember which interface received this request */ rqstp->rq_daddr = skb->nh.iph->daddr; if (skb_is_nonlinear(skb)) { @@ -1298,7 +1302,8 @@ svc_sock_update_bufs(struct svc_serv *serv) int svc_recv(struct svc_rqst *rqstp, long timeout) { - struct svc_sock *svsk =NULL; + struct svc_sock *svsk = NULL; + struct sockaddr_in *sin = svc_addr_in(rqstp); struct svc_serv *serv = rqstp->rq_server; struct svc_pool *pool = rqstp->rq_pool; int len, i; @@ -1395,7 +1400,7 @@ svc_recv(struct svc_rqst *rqstp, long timeout) svsk->sk_lastrecv = get_seconds(); clear_bit(SK_OLD, &svsk->sk_flags); - rqstp->rq_secure = ntohs(rqstp->rq_addr.sin_port) < 1024; + rqstp->rq_secure = ntohs(sin->sin_port) < PROT_SOCK; rqstp->rq_chandle.defer = svc_defer; if (serv->sv_stats) -- cgit v1.2.3 From b5d5dfbd59577aed72263f22e28d3eaf98e1c6e5 Mon Sep 17 00:00:00 2001 From: Adrian Bunk Date: Mon, 12 Feb 2007 00:53:40 -0800 Subject: [PATCH] include/linux/nfsd/const.h: remove NFS_SUPER_MAGIC NFS_SUPER_MAGIC is already defined in include/linux/magic.h Signed-off-by: Adrian Bunk Cc: Neil Brown Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- fs/nfs/super.c | 1 + include/linux/nfsd/const.h | 4 ---- 2 files changed, 1 insertion(+), 4 deletions(-) (limited to 'fs/nfs') diff --git a/fs/nfs/super.c b/fs/nfs/super.c index 28108c82b887..76b980097621 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c @@ -44,6 +44,7 @@ #include #include #include +#include #include #include diff --git a/include/linux/nfsd/const.h b/include/linux/nfsd/const.h index f0cc77790527..323f8cfa060a 100644 --- a/include/linux/nfsd/const.h +++ b/include/linux/nfsd/const.h @@ -30,10 +30,6 @@ #include -#ifndef NFS_SUPER_MAGIC -# define NFS_SUPER_MAGIC 0x6969 -#endif - /* * Largest number of bytes we need to allocate for an NFS * call or reply. Used to control buffer sizes. We use -- cgit v1.2.3 From 00977a59b951207d38380c75f03a36829950265c Mon Sep 17 00:00:00 2001 From: Arjan van de Ven Date: Mon, 12 Feb 2007 00:55:34 -0800 Subject: [PATCH] mark struct file_operations const 6 Many struct file_operations in the kernel can be "const". Marking them const moves these to the .rodata section, which avoids false sharing with potential dirty data. In addition it'll catch accidental writes at compile time to these shared resources. Signed-off-by: Arjan van de Ven Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/sbus/char/bpp.c | 2 +- drivers/sbus/char/cpwatchdog.c | 2 +- drivers/sbus/char/display7seg.c | 2 +- drivers/sbus/char/envctrl.c | 2 +- drivers/sbus/char/flash.c | 2 +- drivers/sbus/char/jsflash.c | 2 +- drivers/sbus/char/openprom.c | 2 +- drivers/sbus/char/riowatchdog.c | 2 +- drivers/sbus/char/rtc.c | 2 +- drivers/sbus/char/uctrl.c | 2 +- drivers/sbus/char/vfc_dev.c | 4 ++-- drivers/scsi/3w-9xxx.c | 2 +- drivers/scsi/3w-xxxx.c | 2 +- drivers/scsi/aacraid/linit.c | 2 +- drivers/scsi/ch.c | 2 +- drivers/scsi/dpt_i2o.c | 2 +- drivers/scsi/gdth.c | 2 +- drivers/scsi/megaraid.c | 2 +- drivers/scsi/megaraid/megaraid_mm.c | 2 +- drivers/scsi/megaraid/megaraid_sas.c | 2 +- drivers/scsi/osst.c | 2 +- drivers/scsi/scsi_proc.c | 2 +- drivers/scsi/scsi_tgt_if.c | 2 +- drivers/scsi/st.c | 2 +- drivers/telephony/ixj.c | 2 +- drivers/telephony/phonedev.c | 2 +- drivers/usb/misc/adutux.c | 2 +- drivers/usb/misc/ftdi-elan.c | 2 +- drivers/video/mbx/mbxdebugfs.c | 12 ++++++------ drivers/zorro/proc.c | 2 +- fs/debugfs/file.c | 2 +- fs/dlm/debug_fs.c | 4 ++-- fs/dlm/user.c | 6 +++--- fs/gfs2/locking/dlm/plock.c | 2 +- fs/nfs/client.c | 4 ++-- fs/ocfs2/dlm/dlmfs.c | 4 ++-- fs/proc/base.c | 32 ++++++++++++++++---------------- fs/proc/generic.c | 4 ++-- fs/proc/internal.h | 12 ++++++------ fs/proc/nommu.c | 2 +- fs/proc/proc_misc.c | 26 +++++++++++++------------- fs/proc/proc_tty.c | 2 +- fs/proc/root.c | 2 +- fs/proc/task_mmu.c | 6 +++--- fs/proc/task_nommu.c | 2 +- 45 files changed, 91 insertions(+), 91 deletions(-) (limited to 'fs/nfs') diff --git a/drivers/sbus/char/bpp.c b/drivers/sbus/char/bpp.c index ac7d1258efee..a39ee80c9715 100644 --- a/drivers/sbus/char/bpp.c +++ b/drivers/sbus/char/bpp.c @@ -846,7 +846,7 @@ static int bpp_ioctl(struct inode *inode, struct file *f, unsigned int cmd, return errno; } -static struct file_operations bpp_fops = { +static const struct file_operations bpp_fops = { .owner = THIS_MODULE, .read = bpp_read, .write = bpp_write, diff --git a/drivers/sbus/char/cpwatchdog.c b/drivers/sbus/char/cpwatchdog.c index ad1c7db96cb4..0cfd1e4c032c 100644 --- a/drivers/sbus/char/cpwatchdog.c +++ b/drivers/sbus/char/cpwatchdog.c @@ -459,7 +459,7 @@ static irqreturn_t wd_interrupt(int irq, void *dev_id) return IRQ_HANDLED; } -static struct file_operations wd_fops = { +static const struct file_operations wd_fops = { .owner = THIS_MODULE, .ioctl = wd_ioctl, .compat_ioctl = wd_compat_ioctl, diff --git a/drivers/sbus/char/display7seg.c b/drivers/sbus/char/display7seg.c index a4909e0c7f83..2d14a29effe4 100644 --- a/drivers/sbus/char/display7seg.c +++ b/drivers/sbus/char/display7seg.c @@ -166,7 +166,7 @@ static long d7s_ioctl(struct file *file, unsigned int cmd, unsigned long arg) return error; } -static struct file_operations d7s_fops = { +static const struct file_operations d7s_fops = { .owner = THIS_MODULE, .unlocked_ioctl = d7s_ioctl, .compat_ioctl = d7s_ioctl, diff --git a/drivers/sbus/char/envctrl.c b/drivers/sbus/char/envctrl.c index fff4660cdf96..2cea4f5d2084 100644 --- a/drivers/sbus/char/envctrl.c +++ b/drivers/sbus/char/envctrl.c @@ -705,7 +705,7 @@ envctrl_release(struct inode *inode, struct file *file) return 0; } -static struct file_operations envctrl_fops = { +static const struct file_operations envctrl_fops = { .owner = THIS_MODULE, .read = envctrl_read, .unlocked_ioctl = envctrl_ioctl, diff --git a/drivers/sbus/char/flash.c b/drivers/sbus/char/flash.c index fa2418f7ad39..6e99507aeb12 100644 --- a/drivers/sbus/char/flash.c +++ b/drivers/sbus/char/flash.c @@ -142,7 +142,7 @@ flash_release(struct inode *inode, struct file *file) return 0; } -static struct file_operations flash_fops = { +static const struct file_operations flash_fops = { /* no write to the Flash, use mmap * and play flash dependent tricks. */ diff --git a/drivers/sbus/char/jsflash.c b/drivers/sbus/char/jsflash.c index 14631ac11bc7..512857a23169 100644 --- a/drivers/sbus/char/jsflash.c +++ b/drivers/sbus/char/jsflash.c @@ -431,7 +431,7 @@ static int jsf_release(struct inode *inode, struct file *file) return 0; } -static struct file_operations jsf_fops = { +static const struct file_operations jsf_fops = { .owner = THIS_MODULE, .llseek = jsf_lseek, .read = jsf_read, diff --git a/drivers/sbus/char/openprom.c b/drivers/sbus/char/openprom.c index 4e2a0e2dcc2e..e8776230782b 100644 --- a/drivers/sbus/char/openprom.c +++ b/drivers/sbus/char/openprom.c @@ -704,7 +704,7 @@ static int openprom_release(struct inode * inode, struct file * file) return 0; } -static struct file_operations openprom_fops = { +static const struct file_operations openprom_fops = { .owner = THIS_MODULE, .llseek = no_llseek, .ioctl = openprom_ioctl, diff --git a/drivers/sbus/char/riowatchdog.c b/drivers/sbus/char/riowatchdog.c index 2a9cc8204429..a2fc6b8c1334 100644 --- a/drivers/sbus/char/riowatchdog.c +++ b/drivers/sbus/char/riowatchdog.c @@ -193,7 +193,7 @@ static ssize_t riowd_write(struct file *file, const char __user *buf, size_t cou return 0; } -static struct file_operations riowd_fops = { +static const struct file_operations riowd_fops = { .owner = THIS_MODULE, .ioctl = riowd_ioctl, .open = riowd_open, diff --git a/drivers/sbus/char/rtc.c b/drivers/sbus/char/rtc.c index 9b988baf0b51..94d185829119 100644 --- a/drivers/sbus/char/rtc.c +++ b/drivers/sbus/char/rtc.c @@ -233,7 +233,7 @@ static int rtc_release(struct inode *inode, struct file *file) return 0; } -static struct file_operations rtc_fops = { +static const struct file_operations rtc_fops = { .owner = THIS_MODULE, .llseek = no_llseek, .ioctl = rtc_ioctl, diff --git a/drivers/sbus/char/uctrl.c b/drivers/sbus/char/uctrl.c index b30372f17f1c..4d1a505e9e74 100644 --- a/drivers/sbus/char/uctrl.c +++ b/drivers/sbus/char/uctrl.c @@ -224,7 +224,7 @@ static irqreturn_t uctrl_interrupt(int irq, void *dev_id) return IRQ_HANDLED; } -static struct file_operations uctrl_fops = { +static const struct file_operations uctrl_fops = { .owner = THIS_MODULE, .llseek = no_llseek, .ioctl = uctrl_ioctl, diff --git a/drivers/sbus/char/vfc_dev.c b/drivers/sbus/char/vfc_dev.c index 386e7de0b7e3..37a04a0cecfa 100644 --- a/drivers/sbus/char/vfc_dev.c +++ b/drivers/sbus/char/vfc_dev.c @@ -44,7 +44,7 @@ #include "vfc.h" #include -static struct file_operations vfc_fops; +static const struct file_operations vfc_fops; struct vfc_dev **vfc_dev_lst; static char vfcstr[]="vfc"; static unsigned char saa9051_init_array[VFC_SAA9051_NR] = { @@ -633,7 +633,7 @@ static int vfc_mmap(struct file *file, struct vm_area_struct *vma) } -static struct file_operations vfc_fops = { +static const struct file_operations vfc_fops = { .owner = THIS_MODULE, .llseek = no_llseek, .ioctl = vfc_ioctl, diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c index b091a0fc4eb0..eb766c3af1c8 100644 --- a/drivers/scsi/3w-9xxx.c +++ b/drivers/scsi/3w-9xxx.c @@ -197,7 +197,7 @@ static struct class_device_attribute *twa_host_attrs[] = { }; /* File operations struct for character device */ -static struct file_operations twa_fops = { +static const struct file_operations twa_fops = { .owner = THIS_MODULE, .ioctl = twa_chrdev_ioctl, .open = twa_chrdev_open, diff --git a/drivers/scsi/3w-xxxx.c b/drivers/scsi/3w-xxxx.c index e1b44d6c0c32..bf5d63e1beee 100644 --- a/drivers/scsi/3w-xxxx.c +++ b/drivers/scsi/3w-xxxx.c @@ -1040,7 +1040,7 @@ static int tw_chrdev_open(struct inode *inode, struct file *file) } /* End tw_chrdev_open() */ /* File operations struct for character device */ -static struct file_operations tw_fops = { +static const struct file_operations tw_fops = { .owner = THIS_MODULE, .ioctl = tw_chrdev_ioctl, .open = tw_chrdev_open, diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c index a9734e08fe28..0f948c2fb609 100644 --- a/drivers/scsi/aacraid/linit.c +++ b/drivers/scsi/aacraid/linit.c @@ -774,7 +774,7 @@ static struct class_device_attribute *aac_attrs[] = { }; -static struct file_operations aac_cfg_fops = { +static const struct file_operations aac_cfg_fops = { .owner = THIS_MODULE, .ioctl = aac_cfg_ioctl, #ifdef CONFIG_COMPAT diff --git a/drivers/scsi/ch.c b/drivers/scsi/ch.c index f6caa4307768..d02759f13469 100644 --- a/drivers/scsi/ch.c +++ b/drivers/scsi/ch.c @@ -129,7 +129,7 @@ static struct scsi_driver ch_template = }, }; -static struct file_operations changer_fops = +static const struct file_operations changer_fops = { .owner = THIS_MODULE, .open = ch_open, diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c index 365db537a28d..cd36e81b2d93 100644 --- a/drivers/scsi/dpt_i2o.c +++ b/drivers/scsi/dpt_i2o.c @@ -116,7 +116,7 @@ static int sys_tbl_len = 0; static adpt_hba* hba_chain = NULL; static int hba_count = 0; -static struct file_operations adpt_fops = { +static const struct file_operations adpt_fops = { .ioctl = adpt_ioctl, .open = adpt_open, .release = adpt_close diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c index 4c698a71f66f..a1992928e671 100644 --- a/drivers/scsi/gdth.c +++ b/drivers/scsi/gdth.c @@ -687,7 +687,7 @@ MODULE_AUTHOR("Achim Leubner"); MODULE_LICENSE("GPL"); /* ioctl interface */ -static struct file_operations gdth_fops = { +static const struct file_operations gdth_fops = { .ioctl = gdth_ioctl, .open = gdth_open, .release = gdth_close, diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c index 77d9d3804ccf..808a1b8c4043 100644 --- a/drivers/scsi/megaraid.c +++ b/drivers/scsi/megaraid.c @@ -92,7 +92,7 @@ static struct mega_hbas mega_hbas[MAX_CONTROLLERS]; /* * The File Operations structure for the serial/ioctl interface of the driver */ -static struct file_operations megadev_fops = { +static const struct file_operations megadev_fops = { .owner = THIS_MODULE, .ioctl = megadev_ioctl, .open = megadev_open, diff --git a/drivers/scsi/megaraid/megaraid_mm.c b/drivers/scsi/megaraid/megaraid_mm.c index c1ff20c4747d..f33a678f0897 100644 --- a/drivers/scsi/megaraid/megaraid_mm.c +++ b/drivers/scsi/megaraid/megaraid_mm.c @@ -67,7 +67,7 @@ static struct list_head adapters_list_g; static wait_queue_head_t wait_q; -static struct file_operations lsi_fops = { +static const struct file_operations lsi_fops = { .open = mraid_mm_open, .ioctl = mraid_mm_ioctl, #ifdef CONFIG_COMPAT diff --git a/drivers/scsi/megaraid/megaraid_sas.c b/drivers/scsi/megaraid/megaraid_sas.c index b5bdd0d7a8bf..15e24fcc84f3 100644 --- a/drivers/scsi/megaraid/megaraid_sas.c +++ b/drivers/scsi/megaraid/megaraid_sas.c @@ -2913,7 +2913,7 @@ megasas_mgmt_compat_ioctl(struct file *file, unsigned int cmd, /* * File operations structure for management interface */ -static struct file_operations megasas_mgmt_fops = { +static const struct file_operations megasas_mgmt_fops = { .owner = THIS_MODULE, .open = megasas_mgmt_open, .release = megasas_mgmt_release, diff --git a/drivers/scsi/osst.c b/drivers/scsi/osst.c index bd6bbf61adb8..9668b73872c7 100644 --- a/drivers/scsi/osst.c +++ b/drivers/scsi/osst.c @@ -5522,7 +5522,7 @@ __setup("osst=", osst_setup); #endif -static struct file_operations osst_fops = { +static const struct file_operations osst_fops = { .owner = THIS_MODULE, .read = osst_read, .write = osst_write, diff --git a/drivers/scsi/scsi_proc.c b/drivers/scsi/scsi_proc.c index 524a5f7a5193..69d6e9b198c4 100644 --- a/drivers/scsi/scsi_proc.c +++ b/drivers/scsi/scsi_proc.c @@ -308,7 +308,7 @@ static int proc_scsi_open(struct inode *inode, struct file *file) return single_open(file, proc_scsi_show, NULL); } -static struct file_operations proc_scsi_operations = { +static const struct file_operations proc_scsi_operations = { .open = proc_scsi_open, .read = seq_read, .write = proc_scsi_write, diff --git a/drivers/scsi/scsi_tgt_if.c b/drivers/scsi/scsi_tgt_if.c index 37bbfbdb870f..f2344ab8deff 100644 --- a/drivers/scsi/scsi_tgt_if.c +++ b/drivers/scsi/scsi_tgt_if.c @@ -280,7 +280,7 @@ static int tgt_open(struct inode *inode, struct file *file) return 0; } -static struct file_operations tgt_fops = { +static const struct file_operations tgt_fops = { .owner = THIS_MODULE, .open = tgt_open, .poll = tgt_poll, diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c index 16e279be4a3e..3d2e02381e92 100644 --- a/drivers/scsi/st.c +++ b/drivers/scsi/st.c @@ -3864,7 +3864,7 @@ __setup("st=", st_setup); #endif -static struct file_operations st_fops = +static const struct file_operations st_fops = { .owner = THIS_MODULE, .read = st_read, diff --git a/drivers/telephony/ixj.c b/drivers/telephony/ixj.c index 58deaac5b373..71cb64e41a1b 100644 --- a/drivers/telephony/ixj.c +++ b/drivers/telephony/ixj.c @@ -6663,7 +6663,7 @@ static int ixj_fasync(int fd, struct file *file_p, int mode) return fasync_helper(fd, file_p, mode, &j->async_queue); } -static struct file_operations ixj_fops = +static const struct file_operations ixj_fops = { .owner = THIS_MODULE, .read = ixj_enhanced_read, diff --git a/drivers/telephony/phonedev.c b/drivers/telephony/phonedev.c index e41f49afd0f4..4d8c2a5b3297 100644 --- a/drivers/telephony/phonedev.c +++ b/drivers/telephony/phonedev.c @@ -127,7 +127,7 @@ void phone_unregister_device(struct phone_device *pfd) } -static struct file_operations phone_fops = +static const struct file_operations phone_fops = { .owner = THIS_MODULE, .open = phone_open, diff --git a/drivers/usb/misc/adutux.c b/drivers/usb/misc/adutux.c index af2934e016a7..75bfab95ab3c 100644 --- a/drivers/usb/misc/adutux.c +++ b/drivers/usb/misc/adutux.c @@ -644,7 +644,7 @@ exit: } /* file operations needed when we register this driver */ -static struct file_operations adu_fops = { +static const struct file_operations adu_fops = { .owner = THIS_MODULE, .read = adu_read, .write = adu_write, diff --git a/drivers/usb/misc/ftdi-elan.c b/drivers/usb/misc/ftdi-elan.c index 41c0161abdb9..0c1d66ddb812 100644 --- a/drivers/usb/misc/ftdi-elan.c +++ b/drivers/usb/misc/ftdi-elan.c @@ -1209,7 +1209,7 @@ error_1: return retval; } -static struct file_operations ftdi_elan_fops = { +static const struct file_operations ftdi_elan_fops = { .owner = THIS_MODULE, .llseek = no_llseek, .ioctl = ftdi_elan_ioctl, diff --git a/drivers/video/mbx/mbxdebugfs.c b/drivers/video/mbx/mbxdebugfs.c index 472a3ca3d92d..15b8b3c4330e 100644 --- a/drivers/video/mbx/mbxdebugfs.c +++ b/drivers/video/mbx/mbxdebugfs.c @@ -170,37 +170,37 @@ static ssize_t misc_read_file(struct file *file, char __user *userbuf, } -static struct file_operations sysconf_fops = { +static const struct file_operations sysconf_fops = { .read = sysconf_read_file, .write = write_file_dummy, .open = open_file_generic, }; -static struct file_operations clock_fops = { +static const struct file_operations clock_fops = { .read = clock_read_file, .write = write_file_dummy, .open = open_file_generic, }; -static struct file_operations display_fops = { +static const struct file_operations display_fops = { .read = display_read_file, .write = write_file_dummy, .open = open_file_generic, }; -static struct file_operations gsctl_fops = { +static const struct file_operations gsctl_fops = { .read = gsctl_read_file, .write = write_file_dummy, .open = open_file_generic, }; -static struct file_operations sdram_fops = { +static const struct file_operations sdram_fops = { .read = sdram_read_file, .write = write_file_dummy, .open = open_file_generic, }; -static struct file_operations misc_fops = { +static const struct file_operations misc_fops = { .read = misc_read_file, .write = write_file_dummy, .open = open_file_generic, diff --git a/drivers/zorro/proc.c b/drivers/zorro/proc.c index 60b05bc15642..b3ce8859a586 100644 --- a/drivers/zorro/proc.c +++ b/drivers/zorro/proc.c @@ -75,7 +75,7 @@ proc_bus_zorro_read(struct file *file, char __user *buf, size_t nbytes, loff_t * return nbytes; } -static struct file_operations proc_bus_zorro_operations = { +static const struct file_operations proc_bus_zorro_operations = { .llseek = proc_bus_zorro_lseek, .read = proc_bus_zorro_read, }; diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c index bf3901ab1744..8d130cc85322 100644 --- a/fs/debugfs/file.c +++ b/fs/debugfs/file.c @@ -254,7 +254,7 @@ static ssize_t read_file_blob(struct file *file, char __user *user_buf, blob->size); } -static struct file_operations fops_blob = { +static const struct file_operations fops_blob = { .read = read_file_blob, .open = default_open, }; diff --git a/fs/dlm/debug_fs.c b/fs/dlm/debug_fs.c index ca94a837a5bb..61ba670b9e02 100644 --- a/fs/dlm/debug_fs.c +++ b/fs/dlm/debug_fs.c @@ -287,7 +287,7 @@ static int rsb_open(struct inode *inode, struct file *file) return 0; } -static struct file_operations rsb_fops = { +static const struct file_operations rsb_fops = { .owner = THIS_MODULE, .open = rsb_open, .read = seq_read, @@ -331,7 +331,7 @@ static ssize_t waiters_read(struct file *file, char __user *userbuf, return rv; } -static struct file_operations waiters_fops = { +static const struct file_operations waiters_fops = { .owner = THIS_MODULE, .open = waiters_open, .read = waiters_read diff --git a/fs/dlm/user.c b/fs/dlm/user.c index d378b7fe2a1e..40db61dc95f2 100644 --- a/fs/dlm/user.c +++ b/fs/dlm/user.c @@ -25,7 +25,7 @@ static const char *name_prefix="dlm"; static struct miscdevice ctl_device; -static struct file_operations device_fops; +static const struct file_operations device_fops; #ifdef CONFIG_COMPAT @@ -759,7 +759,7 @@ static int ctl_device_close(struct inode *inode, struct file *file) return 0; } -static struct file_operations device_fops = { +static const struct file_operations device_fops = { .open = device_open, .release = device_close, .read = device_read, @@ -768,7 +768,7 @@ static struct file_operations device_fops = { .owner = THIS_MODULE, }; -static struct file_operations ctl_device_fops = { +static const struct file_operations ctl_device_fops = { .open = ctl_device_open, .release = ctl_device_close, .write = device_write, diff --git a/fs/gfs2/locking/dlm/plock.c b/fs/gfs2/locking/dlm/plock.c index 3799f19b282f..1dd4215b83d0 100644 --- a/fs/gfs2/locking/dlm/plock.c +++ b/fs/gfs2/locking/dlm/plock.c @@ -264,7 +264,7 @@ static unsigned int dev_poll(struct file *file, poll_table *wait) return 0; } -static struct file_operations dev_fops = { +static const struct file_operations dev_fops = { .read = dev_read, .write = dev_write, .poll = dev_poll, diff --git a/fs/nfs/client.c b/fs/nfs/client.c index 23ab145daa2d..ae9f36e393cf 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c @@ -1173,7 +1173,7 @@ static struct seq_operations nfs_server_list_ops = { .show = nfs_server_list_show, }; -static struct file_operations nfs_server_list_fops = { +static const struct file_operations nfs_server_list_fops = { .open = nfs_server_list_open, .read = seq_read, .llseek = seq_lseek, @@ -1193,7 +1193,7 @@ static struct seq_operations nfs_volume_list_ops = { .show = nfs_volume_list_show, }; -static struct file_operations nfs_volume_list_fops = { +static const struct file_operations nfs_volume_list_fops = { .open = nfs_volume_list_open, .read = seq_read, .llseek = seq_lseek, diff --git a/fs/ocfs2/dlm/dlmfs.c b/fs/ocfs2/dlm/dlmfs.c index b7f0ba97a1a2..30826242bf51 100644 --- a/fs/ocfs2/dlm/dlmfs.c +++ b/fs/ocfs2/dlm/dlmfs.c @@ -62,7 +62,7 @@ #include "cluster/masklog.h" static struct super_operations dlmfs_ops; -static struct file_operations dlmfs_file_operations; +static const struct file_operations dlmfs_file_operations; static struct inode_operations dlmfs_dir_inode_operations; static struct inode_operations dlmfs_root_inode_operations; static struct inode_operations dlmfs_file_inode_operations; @@ -540,7 +540,7 @@ static int dlmfs_fill_super(struct super_block * sb, return 0; } -static struct file_operations dlmfs_file_operations = { +static const struct file_operations dlmfs_file_operations = { .open = dlmfs_file_open, .release = dlmfs_file_release, .read = dlmfs_file_read, diff --git a/fs/proc/base.c b/fs/proc/base.c index 7fb37d6f2864..7b1ded63fa63 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c @@ -94,7 +94,7 @@ struct pid_entry { char *name; mode_t mode; struct inode_operations *iop; - struct file_operations *fop; + const struct file_operations *fop; union proc_op op; }; @@ -424,7 +424,7 @@ static unsigned mounts_poll(struct file *file, poll_table *wait) return res; } -static struct file_operations proc_mounts_operations = { +static const struct file_operations proc_mounts_operations = { .open = mounts_open, .read = seq_read, .llseek = seq_lseek, @@ -462,7 +462,7 @@ static int mountstats_open(struct inode *inode, struct file *file) return ret; } -static struct file_operations proc_mountstats_operations = { +static const struct file_operations proc_mountstats_operations = { .open = mountstats_open, .read = seq_read, .llseek = seq_lseek, @@ -501,7 +501,7 @@ out_no_task: return length; } -static struct file_operations proc_info_file_operations = { +static const struct file_operations proc_info_file_operations = { .read = proc_info_read, }; @@ -646,7 +646,7 @@ static loff_t mem_lseek(struct file * file, loff_t offset, int orig) return file->f_pos; } -static struct file_operations proc_mem_operations = { +static const struct file_operations proc_mem_operations = { .llseek = mem_lseek, .read = mem_read, .write = mem_write, @@ -710,7 +710,7 @@ static ssize_t oom_adjust_write(struct file *file, const char __user *buf, return end - buffer; } -static struct file_operations proc_oom_adjust_operations = { +static const struct file_operations proc_oom_adjust_operations = { .read = oom_adjust_read, .write = oom_adjust_write, }; @@ -777,7 +777,7 @@ out_free_page: return length; } -static struct file_operations proc_loginuid_operations = { +static const struct file_operations proc_loginuid_operations = { .read = proc_loginuid_read, .write = proc_loginuid_write, }; @@ -849,7 +849,7 @@ out_no_task: return result; } -static struct file_operations proc_seccomp_operations = { +static const struct file_operations proc_seccomp_operations = { .read = seccomp_read, .write = seccomp_write, }; @@ -908,7 +908,7 @@ static ssize_t proc_fault_inject_write(struct file * file, return end - buffer; } -static struct file_operations proc_fault_inject_operations = { +static const struct file_operations proc_fault_inject_operations = { .read = proc_fault_inject_read, .write = proc_fault_inject_write, }; @@ -1408,7 +1408,7 @@ out_no_task: return retval; } -static struct file_operations proc_fd_operations = { +static const struct file_operations proc_fd_operations = { .read = generic_read_dir, .readdir = proc_readfd, }; @@ -1623,7 +1623,7 @@ out_no_task: return length; } -static struct file_operations proc_pid_attr_operations = { +static const struct file_operations proc_pid_attr_operations = { .read = proc_pid_attr_read, .write = proc_pid_attr_write, }; @@ -1644,7 +1644,7 @@ static int proc_attr_dir_readdir(struct file * filp, attr_dir_stuff,ARRAY_SIZE(attr_dir_stuff)); } -static struct file_operations proc_attr_dir_operations = { +static const struct file_operations proc_attr_dir_operations = { .read = generic_read_dir, .readdir = proc_attr_dir_readdir, }; @@ -1834,7 +1834,7 @@ static int proc_pid_io_accounting(struct task_struct *task, char *buffer) /* * Thread groups */ -static struct file_operations proc_task_operations; +static const struct file_operations proc_task_operations; static struct inode_operations proc_task_inode_operations; static struct pid_entry tgid_base_stuff[] = { @@ -1894,7 +1894,7 @@ static int proc_tgid_base_readdir(struct file * filp, tgid_base_stuff,ARRAY_SIZE(tgid_base_stuff)); } -static struct file_operations proc_tgid_base_operations = { +static const struct file_operations proc_tgid_base_operations = { .read = generic_read_dir, .readdir = proc_tgid_base_readdir, }; @@ -2177,7 +2177,7 @@ static struct dentry *proc_tid_base_lookup(struct inode *dir, struct dentry *den tid_base_stuff, ARRAY_SIZE(tid_base_stuff)); } -static struct file_operations proc_tid_base_operations = { +static const struct file_operations proc_tid_base_operations = { .read = generic_read_dir, .readdir = proc_tid_base_readdir, }; @@ -2414,7 +2414,7 @@ static struct inode_operations proc_task_inode_operations = { .setattr = proc_setattr, }; -static struct file_operations proc_task_operations = { +static const struct file_operations proc_task_operations = { .read = generic_read_dir, .readdir = proc_task_readdir, }; diff --git a/fs/proc/generic.c b/fs/proc/generic.c index 853cb877d5f3..aa52f1080e62 100644 --- a/fs/proc/generic.c +++ b/fs/proc/generic.c @@ -39,7 +39,7 @@ int proc_match(int len, const char *name, struct proc_dir_entry *de) return !memcmp(name, de->name, len); } -static struct file_operations proc_file_operations = { +static const struct file_operations proc_file_operations = { .llseek = proc_file_lseek, .read = proc_file_read, .write = proc_file_write, @@ -497,7 +497,7 @@ out: unlock_kernel(); * use the in-memory "struct proc_dir_entry" tree to parse * the /proc directory. */ -static struct file_operations proc_dir_operations = { +static const struct file_operations proc_dir_operations = { .read = generic_read_dir, .readdir = proc_readdir, }; diff --git a/fs/proc/internal.h b/fs/proc/internal.h index 987c773dbb20..277dcd66ebe2 100644 --- a/fs/proc/internal.h +++ b/fs/proc/internal.h @@ -38,13 +38,13 @@ extern int proc_tgid_stat(struct task_struct *, char *); extern int proc_pid_status(struct task_struct *, char *); extern int proc_pid_statm(struct task_struct *, char *); -extern struct file_operations proc_maps_operations; -extern struct file_operations proc_numa_maps_operations; -extern struct file_operations proc_smaps_operations; +extern const struct file_operations proc_maps_operations; +extern const struct file_operations proc_numa_maps_operations; +extern const struct file_operations proc_smaps_operations; -extern struct file_operations proc_maps_operations; -extern struct file_operations proc_numa_maps_operations; -extern struct file_operations proc_smaps_operations; +extern const struct file_operations proc_maps_operations; +extern const struct file_operations proc_numa_maps_operations; +extern const struct file_operations proc_smaps_operations; void free_proc_entry(struct proc_dir_entry *de); diff --git a/fs/proc/nommu.c b/fs/proc/nommu.c index 5ec67257e5f9..22f789de3909 100644 --- a/fs/proc/nommu.c +++ b/fs/proc/nommu.c @@ -128,7 +128,7 @@ static int proc_nommu_vma_list_open(struct inode *inode, struct file *file) return seq_open(file, &proc_nommu_vma_list_seqop); } -static struct file_operations proc_nommu_vma_list_operations = { +static const struct file_operations proc_nommu_vma_list_operations = { .open = proc_nommu_vma_list_open, .read = seq_read, .llseek = seq_lseek, diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c index 5e2d4359c292..e2c4c0a5c90d 100644 --- a/fs/proc/proc_misc.c +++ b/fs/proc/proc_misc.c @@ -223,7 +223,7 @@ static int fragmentation_open(struct inode *inode, struct file *file) return seq_open(file, &fragmentation_op); } -static struct file_operations fragmentation_file_operations = { +static const struct file_operations fragmentation_file_operations = { .open = fragmentation_open, .read = seq_read, .llseek = seq_lseek, @@ -236,7 +236,7 @@ static int zoneinfo_open(struct inode *inode, struct file *file) return seq_open(file, &zoneinfo_op); } -static struct file_operations proc_zoneinfo_file_operations = { +static const struct file_operations proc_zoneinfo_file_operations = { .open = zoneinfo_open, .read = seq_read, .llseek = seq_lseek, @@ -261,7 +261,7 @@ static int cpuinfo_open(struct inode *inode, struct file *file) return seq_open(file, &cpuinfo_op); } -static struct file_operations proc_cpuinfo_operations = { +static const struct file_operations proc_cpuinfo_operations = { .open = cpuinfo_open, .read = seq_read, .llseek = seq_lseek, @@ -320,7 +320,7 @@ static int devinfo_open(struct inode *inode, struct file *filp) return seq_open(filp, &devinfo_ops); } -static struct file_operations proc_devinfo_operations = { +static const struct file_operations proc_devinfo_operations = { .open = devinfo_open, .read = seq_read, .llseek = seq_lseek, @@ -332,7 +332,7 @@ static int vmstat_open(struct inode *inode, struct file *file) { return seq_open(file, &vmstat_op); } -static struct file_operations proc_vmstat_file_operations = { +static const struct file_operations proc_vmstat_file_operations = { .open = vmstat_open, .read = seq_read, .llseek = seq_lseek, @@ -363,7 +363,7 @@ static int partitions_open(struct inode *inode, struct file *file) { return seq_open(file, &partitions_op); } -static struct file_operations proc_partitions_operations = { +static const struct file_operations proc_partitions_operations = { .open = partitions_open, .read = seq_read, .llseek = seq_lseek, @@ -375,7 +375,7 @@ static int diskstats_open(struct inode *inode, struct file *file) { return seq_open(file, &diskstats_op); } -static struct file_operations proc_diskstats_operations = { +static const struct file_operations proc_diskstats_operations = { .open = diskstats_open, .read = seq_read, .llseek = seq_lseek, @@ -389,7 +389,7 @@ static int modules_open(struct inode *inode, struct file *file) { return seq_open(file, &modules_op); } -static struct file_operations proc_modules_operations = { +static const struct file_operations proc_modules_operations = { .open = modules_open, .read = seq_read, .llseek = seq_lseek, @@ -404,7 +404,7 @@ static int slabinfo_open(struct inode *inode, struct file *file) { return seq_open(file, &slabinfo_op); } -static struct file_operations proc_slabinfo_operations = { +static const struct file_operations proc_slabinfo_operations = { .open = slabinfo_open, .read = seq_read, .write = slabinfo_write, @@ -438,7 +438,7 @@ static int slabstats_release(struct inode *inode, struct file *file) return seq_release(inode, file); } -static struct file_operations proc_slabstats_operations = { +static const struct file_operations proc_slabstats_operations = { .open = slabstats_open, .read = seq_read, .llseek = seq_lseek, @@ -551,7 +551,7 @@ static int stat_open(struct inode *inode, struct file *file) kfree(buf); return res; } -static struct file_operations proc_stat_operations = { +static const struct file_operations proc_stat_operations = { .open = stat_open, .read = seq_read, .llseek = seq_lseek, @@ -593,7 +593,7 @@ static int interrupts_open(struct inode *inode, struct file *filp) return seq_open(filp, &int_seq_ops); } -static struct file_operations proc_interrupts_operations = { +static const struct file_operations proc_interrupts_operations = { .open = interrupts_open, .read = seq_read, .llseek = seq_lseek, @@ -650,7 +650,7 @@ static ssize_t write_sysrq_trigger(struct file *file, const char __user *buf, return count; } -static struct file_operations proc_sysrq_trigger_operations = { +static const struct file_operations proc_sysrq_trigger_operations = { .write = write_sysrq_trigger, }; #endif diff --git a/fs/proc/proc_tty.c b/fs/proc/proc_tty.c index 15c4455b09eb..c1bbfbeb035e 100644 --- a/fs/proc/proc_tty.c +++ b/fs/proc/proc_tty.c @@ -138,7 +138,7 @@ static int tty_drivers_open(struct inode *inode, struct file *file) return seq_open(file, &tty_drivers_op); } -static struct file_operations proc_tty_drivers_operations = { +static const struct file_operations proc_tty_drivers_operations = { .open = tty_drivers_open, .read = seq_read, .llseek = seq_lseek, diff --git a/fs/proc/root.c b/fs/proc/root.c index 64d242b6dcfa..81c92e967a98 100644 --- a/fs/proc/root.c +++ b/fs/proc/root.c @@ -136,7 +136,7 @@ static int proc_root_readdir(struct file * filp, * directories. Thus we don't use the generic * directory handling functions for that.. */ -static struct file_operations proc_root_operations = { +static const struct file_operations proc_root_operations = { .read = generic_read_dir, .readdir = proc_root_readdir, }; diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index 55ade0d15621..7445980c8022 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c @@ -434,7 +434,7 @@ static int maps_open(struct inode *inode, struct file *file) return do_maps_open(inode, file, &proc_pid_maps_op); } -struct file_operations proc_maps_operations = { +const struct file_operations proc_maps_operations = { .open = maps_open, .read = seq_read, .llseek = seq_lseek, @@ -456,7 +456,7 @@ static int numa_maps_open(struct inode *inode, struct file *file) return do_maps_open(inode, file, &proc_pid_numa_maps_op); } -struct file_operations proc_numa_maps_operations = { +const struct file_operations proc_numa_maps_operations = { .open = numa_maps_open, .read = seq_read, .llseek = seq_lseek, @@ -469,7 +469,7 @@ static int smaps_open(struct inode *inode, struct file *file) return do_maps_open(inode, file, &proc_pid_smaps_op); } -struct file_operations proc_smaps_operations = { +const struct file_operations proc_smaps_operations = { .open = smaps_open, .read = seq_read, .llseek = seq_lseek, diff --git a/fs/proc/task_nommu.c b/fs/proc/task_nommu.c index fcc5caf93f55..7cddf6b8635a 100644 --- a/fs/proc/task_nommu.c +++ b/fs/proc/task_nommu.c @@ -220,7 +220,7 @@ static int maps_open(struct inode *inode, struct file *file) return ret; } -struct file_operations proc_maps_operations = { +const struct file_operations proc_maps_operations = { .open = maps_open, .read = seq_read, .llseek = seq_lseek, -- cgit v1.2.3 From 92e1d5be91a0e3ffa5c4697eeb09b2aa22792122 Mon Sep 17 00:00:00 2001 From: Arjan van de Ven Date: Mon, 12 Feb 2007 00:55:39 -0800 Subject: [PATCH] mark struct inode_operations const 2 Many struct inode_operations in the kernel can be "const". Marking them const moves these to the .rodata section, which avoids false sharing with potential dirty data. In addition it'll catch accidental writes at compile time to these shared resources. Signed-off-by: Arjan van de Ven Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- fs/gfs2/ops_inode.c | 8 ++++---- fs/gfs2/ops_inode.h | 8 ++++---- fs/hfs/dir.c | 2 +- fs/hfs/hfs_fs.h | 2 +- fs/hfs/inode.c | 4 ++-- fs/hfsplus/dir.c | 2 +- fs/hfsplus/inode.c | 4 ++-- fs/hostfs/hostfs_kern.c | 8 ++++---- fs/hpfs/file.c | 2 +- fs/hpfs/hpfs_fn.h | 4 ++-- fs/hpfs/namei.c | 2 +- fs/hppfs/hppfs_kern.c | 6 +++--- fs/hugetlbfs/inode.c | 8 ++++---- fs/isofs/dir.c | 2 +- fs/isofs/isofs.h | 2 +- fs/jffs/inode-v23.c | 8 ++++---- fs/jffs2/dir.c | 2 +- fs/jffs2/file.c | 2 +- fs/jffs2/os-linux.h | 6 +++--- fs/jffs2/symlink.c | 2 +- fs/jfs/file.c | 2 +- fs/jfs/jfs_inode.h | 6 +++--- fs/jfs/namei.c | 2 +- fs/jfs/symlink.c | 2 +- fs/libfs.c | 2 +- fs/minix/file.c | 2 +- fs/minix/inode.c | 2 +- fs/minix/minix.h | 4 ++-- fs/minix/namei.c | 2 +- fs/msdos/namei.c | 2 +- fs/namei.c | 2 +- fs/ncpfs/dir.c | 2 +- fs/ncpfs/file.c | 2 +- fs/ncpfs/inode.c | 2 +- fs/nfs/dir.c | 6 +++--- fs/nfs/file.c | 4 ++-- fs/nfs/namespace.c | 4 ++-- fs/nfs/nfs4_fs.h | 2 +- fs/nfs/nfs4proc.c | 2 +- fs/nfs/symlink.c | 2 +- fs/ntfs/file.c | 4 ++-- fs/ntfs/namei.c | 2 +- fs/ntfs/ntfs.h | 6 +++--- fs/ocfs2/dlm/dlmfs.c | 12 ++++++------ fs/ocfs2/file.c | 4 ++-- fs/ocfs2/file.h | 4 ++-- fs/ocfs2/namei.c | 2 +- fs/ocfs2/namei.h | 2 +- fs/ocfs2/symlink.c | 4 ++-- fs/ocfs2/symlink.h | 4 ++-- fs/openpromfs/inode.c | 2 +- ipc/mqueue.c | 4 ++-- kernel/cpuset.c | 2 +- mm/shmem.c | 20 ++++++++++---------- 54 files changed, 105 insertions(+), 105 deletions(-) (limited to 'fs/nfs') diff --git a/fs/gfs2/ops_inode.c b/fs/gfs2/ops_inode.c index f40a84807d75..60f47bf2e8e8 100644 --- a/fs/gfs2/ops_inode.c +++ b/fs/gfs2/ops_inode.c @@ -1115,7 +1115,7 @@ static int gfs2_removexattr(struct dentry *dentry, const char *name) return gfs2_ea_remove(GFS2_I(dentry->d_inode), &er); } -struct inode_operations gfs2_file_iops = { +const struct inode_operations gfs2_file_iops = { .permission = gfs2_permission, .setattr = gfs2_setattr, .getattr = gfs2_getattr, @@ -1125,7 +1125,7 @@ struct inode_operations gfs2_file_iops = { .removexattr = gfs2_removexattr, }; -struct inode_operations gfs2_dev_iops = { +const struct inode_operations gfs2_dev_iops = { .permission = gfs2_permission, .setattr = gfs2_setattr, .getattr = gfs2_getattr, @@ -1135,7 +1135,7 @@ struct inode_operations gfs2_dev_iops = { .removexattr = gfs2_removexattr, }; -struct inode_operations gfs2_dir_iops = { +const struct inode_operations gfs2_dir_iops = { .create = gfs2_create, .lookup = gfs2_lookup, .link = gfs2_link, @@ -1154,7 +1154,7 @@ struct inode_operations gfs2_dir_iops = { .removexattr = gfs2_removexattr, }; -struct inode_operations gfs2_symlink_iops = { +const struct inode_operations gfs2_symlink_iops = { .readlink = gfs2_readlink, .follow_link = gfs2_follow_link, .permission = gfs2_permission, diff --git a/fs/gfs2/ops_inode.h b/fs/gfs2/ops_inode.h index b15acb4fd34c..34f0caac1a03 100644 --- a/fs/gfs2/ops_inode.h +++ b/fs/gfs2/ops_inode.h @@ -12,9 +12,9 @@ #include -extern struct inode_operations gfs2_file_iops; -extern struct inode_operations gfs2_dir_iops; -extern struct inode_operations gfs2_symlink_iops; -extern struct inode_operations gfs2_dev_iops; +extern const struct inode_operations gfs2_file_iops; +extern const struct inode_operations gfs2_dir_iops; +extern const struct inode_operations gfs2_symlink_iops; +extern const struct inode_operations gfs2_dev_iops; #endif /* __OPS_INODE_DOT_H__ */ diff --git a/fs/hfs/dir.c b/fs/hfs/dir.c index e2e0358da335..7c69b98a2e45 100644 --- a/fs/hfs/dir.c +++ b/fs/hfs/dir.c @@ -320,7 +320,7 @@ const struct file_operations hfs_dir_operations = { .release = hfs_dir_release, }; -struct inode_operations hfs_dir_inode_operations = { +const struct inode_operations hfs_dir_inode_operations = { .create = hfs_create, .lookup = hfs_lookup, .unlink = hfs_unlink, diff --git a/fs/hfs/hfs_fs.h b/fs/hfs/hfs_fs.h index 735332dfd1b8..147374b6f675 100644 --- a/fs/hfs/hfs_fs.h +++ b/fs/hfs/hfs_fs.h @@ -170,7 +170,7 @@ extern void hfs_cat_build_key(struct super_block *, btree_key *, u32, struct qst /* dir.c */ extern const struct file_operations hfs_dir_operations; -extern struct inode_operations hfs_dir_inode_operations; +extern const struct inode_operations hfs_dir_inode_operations; /* extent.c */ extern int hfs_ext_keycmp(const btree_key *, const btree_key *); diff --git a/fs/hfs/inode.c b/fs/hfs/inode.c index 5cb7f8fee8d6..fafcba593871 100644 --- a/fs/hfs/inode.c +++ b/fs/hfs/inode.c @@ -18,7 +18,7 @@ #include "btree.h" static const struct file_operations hfs_file_operations; -static struct inode_operations hfs_file_inode_operations; +static const struct inode_operations hfs_file_inode_operations; /*================ Variable-like macros ================*/ @@ -612,7 +612,7 @@ static const struct file_operations hfs_file_operations = { .release = hfs_file_release, }; -static struct inode_operations hfs_file_inode_operations = { +static const struct inode_operations hfs_file_inode_operations = { .lookup = hfs_file_lookup, .truncate = hfs_file_truncate, .setattr = hfs_inode_setattr, diff --git a/fs/hfsplus/dir.c b/fs/hfsplus/dir.c index e886ac8460d3..78137007ccc1 100644 --- a/fs/hfsplus/dir.c +++ b/fs/hfsplus/dir.c @@ -471,7 +471,7 @@ static int hfsplus_rename(struct inode *old_dir, struct dentry *old_dentry, return res; } -struct inode_operations hfsplus_dir_inode_operations = { +const struct inode_operations hfsplus_dir_inode_operations = { .lookup = hfsplus_lookup, .create = hfsplus_create, .link = hfsplus_link, diff --git a/fs/hfsplus/inode.c b/fs/hfsplus/inode.c index 75e8c4d8aac3..642012ac3370 100644 --- a/fs/hfsplus/inode.c +++ b/fs/hfsplus/inode.c @@ -268,10 +268,10 @@ static int hfsplus_file_release(struct inode *inode, struct file *file) return 0; } -extern struct inode_operations hfsplus_dir_inode_operations; +extern const struct inode_operations hfsplus_dir_inode_operations; extern struct file_operations hfsplus_dir_operations; -static struct inode_operations hfsplus_file_inode_operations = { +static const struct inode_operations hfsplus_file_inode_operations = { .lookup = hfsplus_file_lookup, .truncate = hfsplus_file_truncate, .permission = hfsplus_permission, diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c index 69a376f35a68..fec208db5e46 100644 --- a/fs/hostfs/hostfs_kern.c +++ b/fs/hostfs/hostfs_kern.c @@ -52,8 +52,8 @@ static int append = 0; #define HOSTFS_SUPER_MAGIC 0x00c0ffee -static struct inode_operations hostfs_iops; -static struct inode_operations hostfs_dir_iops; +static const struct inode_operations hostfs_iops; +static const struct inode_operations hostfs_dir_iops; static const struct address_space_operations hostfs_link_aops; #ifndef MODULE @@ -880,7 +880,7 @@ int hostfs_getattr(struct vfsmount *mnt, struct dentry *dentry, return(0); } -static struct inode_operations hostfs_iops = { +static const struct inode_operations hostfs_iops = { .create = hostfs_create, .link = hostfs_link, .unlink = hostfs_unlink, @@ -894,7 +894,7 @@ static struct inode_operations hostfs_iops = { .getattr = hostfs_getattr, }; -static struct inode_operations hostfs_dir_iops = { +static const struct inode_operations hostfs_dir_iops = { .create = hostfs_create, .lookup = hostfs_lookup, .link = hostfs_link, diff --git a/fs/hpfs/file.c b/fs/hpfs/file.c index fb4c8915010a..b4eafc0f1e54 100644 --- a/fs/hpfs/file.c +++ b/fs/hpfs/file.c @@ -132,7 +132,7 @@ const struct file_operations hpfs_file_ops = .sendfile = generic_file_sendfile, }; -struct inode_operations hpfs_file_iops = +const struct inode_operations hpfs_file_iops = { .truncate = hpfs_truncate, .setattr = hpfs_notify_change, diff --git a/fs/hpfs/hpfs_fn.h b/fs/hpfs/hpfs_fn.h index 1c07aa82d327..42ff60ccf2a9 100644 --- a/fs/hpfs/hpfs_fn.h +++ b/fs/hpfs/hpfs_fn.h @@ -266,7 +266,7 @@ void hpfs_set_ea(struct inode *, struct fnode *, char *, char *, int); int hpfs_file_fsync(struct file *, struct dentry *, int); extern const struct file_operations hpfs_file_ops; -extern struct inode_operations hpfs_file_iops; +extern const struct inode_operations hpfs_file_iops; extern const struct address_space_operations hpfs_aops; /* inode.c */ @@ -302,7 +302,7 @@ void hpfs_decide_conv(struct inode *, unsigned char *, unsigned); /* namei.c */ -extern struct inode_operations hpfs_dir_iops; +extern const struct inode_operations hpfs_dir_iops; extern const struct address_space_operations hpfs_symlink_aops; static inline struct hpfs_inode_info *hpfs_i(struct inode *inode) diff --git a/fs/hpfs/namei.c b/fs/hpfs/namei.c index 2507e7393f3c..9953cf9a2f16 100644 --- a/fs/hpfs/namei.c +++ b/fs/hpfs/namei.c @@ -659,7 +659,7 @@ end1: return err; } -struct inode_operations hpfs_dir_iops = +const struct inode_operations hpfs_dir_iops = { .create = hpfs_create, .lookup = hpfs_lookup, diff --git a/fs/hppfs/hppfs_kern.c b/fs/hppfs/hppfs_kern.c index afd340a45da4..bd7116816314 100644 --- a/fs/hppfs/hppfs_kern.c +++ b/fs/hppfs/hppfs_kern.c @@ -212,7 +212,7 @@ static struct dentry *hppfs_lookup(struct inode *ino, struct dentry *dentry, return(ERR_PTR(err)); } -static struct inode_operations hppfs_file_iops = { +static const struct inode_operations hppfs_file_iops = { }; static ssize_t read_proc(struct file *file, char __user *buf, ssize_t count, @@ -693,11 +693,11 @@ static void* hppfs_follow_link(struct dentry *dentry, struct nameidata *nd) return ret; } -static struct inode_operations hppfs_dir_iops = { +static const struct inode_operations hppfs_dir_iops = { .lookup = hppfs_lookup, }; -static struct inode_operations hppfs_link_iops = { +static const struct inode_operations hppfs_link_iops = { .readlink = hppfs_readlink, .follow_link = hppfs_follow_link, }; diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index e6bd553fdc4c..26ba81fc7fab 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -36,8 +36,8 @@ static struct super_operations hugetlbfs_ops; static const struct address_space_operations hugetlbfs_aops; const struct file_operations hugetlbfs_file_operations; -static struct inode_operations hugetlbfs_dir_inode_operations; -static struct inode_operations hugetlbfs_inode_operations; +static const struct inode_operations hugetlbfs_dir_inode_operations; +static const struct inode_operations hugetlbfs_inode_operations; static struct backing_dev_info hugetlbfs_backing_dev_info = { .ra_pages = 0, /* No readahead */ @@ -563,7 +563,7 @@ const struct file_operations hugetlbfs_file_operations = { .get_unmapped_area = hugetlb_get_unmapped_area, }; -static struct inode_operations hugetlbfs_dir_inode_operations = { +static const struct inode_operations hugetlbfs_dir_inode_operations = { .create = hugetlbfs_create, .lookup = simple_lookup, .link = simple_link, @@ -576,7 +576,7 @@ static struct inode_operations hugetlbfs_dir_inode_operations = { .setattr = hugetlbfs_setattr, }; -static struct inode_operations hugetlbfs_inode_operations = { +static const struct inode_operations hugetlbfs_inode_operations = { .setattr = hugetlbfs_setattr, }; diff --git a/fs/isofs/dir.c b/fs/isofs/dir.c index 4af2548f97a9..0e94c31cad9b 100644 --- a/fs/isofs/dir.c +++ b/fs/isofs/dir.c @@ -24,7 +24,7 @@ const struct file_operations isofs_dir_operations = /* * directories can handle most operations... */ -struct inode_operations isofs_dir_inode_operations = +const struct inode_operations isofs_dir_inode_operations = { .lookup = isofs_lookup, }; diff --git a/fs/isofs/isofs.h b/fs/isofs/isofs.h index e6308c8b5735..efe2872cd4e3 100644 --- a/fs/isofs/isofs.h +++ b/fs/isofs/isofs.h @@ -174,7 +174,7 @@ isofs_normalize_block_and_offset(struct iso_directory_record* de, } } -extern struct inode_operations isofs_dir_inode_operations; +extern const struct inode_operations isofs_dir_inode_operations; extern const struct file_operations isofs_dir_operations; extern const struct address_space_operations isofs_symlink_aops; extern struct export_operations isofs_export_ops; diff --git a/fs/jffs/inode-v23.c b/fs/jffs/inode-v23.c index 6ee206688502..fe3347defe6c 100644 --- a/fs/jffs/inode-v23.c +++ b/fs/jffs/inode-v23.c @@ -56,9 +56,9 @@ static int jffs_remove(struct inode *dir, struct dentry *dentry, int type); static struct super_operations jffs_ops; static const struct file_operations jffs_file_operations; -static struct inode_operations jffs_file_inode_operations; +static const struct inode_operations jffs_file_inode_operations; static const struct file_operations jffs_dir_operations; -static struct inode_operations jffs_dir_inode_operations; +static const struct inode_operations jffs_dir_inode_operations; static const struct address_space_operations jffs_address_operations; struct kmem_cache *node_cache = NULL; @@ -1642,7 +1642,7 @@ static const struct file_operations jffs_file_operations = }; -static struct inode_operations jffs_file_inode_operations = +static const struct inode_operations jffs_file_inode_operations = { .lookup = jffs_lookup, /* lookup */ .setattr = jffs_setattr, @@ -1655,7 +1655,7 @@ static const struct file_operations jffs_dir_operations = }; -static struct inode_operations jffs_dir_inode_operations = +static const struct inode_operations jffs_dir_inode_operations = { .create = jffs_create, .lookup = jffs_lookup, diff --git a/fs/jffs2/dir.c b/fs/jffs2/dir.c index da6034d50718..cdbe2fe14e2d 100644 --- a/fs/jffs2/dir.c +++ b/fs/jffs2/dir.c @@ -46,7 +46,7 @@ const struct file_operations jffs2_dir_operations = }; -struct inode_operations jffs2_dir_inode_operations = +const struct inode_operations jffs2_dir_inode_operations = { .create = jffs2_create, .lookup = jffs2_lookup, diff --git a/fs/jffs2/file.c b/fs/jffs2/file.c index 242875f77cb3..e82eeaf7590d 100644 --- a/fs/jffs2/file.c +++ b/fs/jffs2/file.c @@ -54,7 +54,7 @@ const struct file_operations jffs2_file_operations = /* jffs2_file_inode_operations */ -struct inode_operations jffs2_file_inode_operations = +const struct inode_operations jffs2_file_inode_operations = { .permission = jffs2_permission, .setattr = jffs2_setattr, diff --git a/fs/jffs2/os-linux.h b/fs/jffs2/os-linux.h index 9f41fc01a371..e07a0edcdb4f 100644 --- a/fs/jffs2/os-linux.h +++ b/fs/jffs2/os-linux.h @@ -153,11 +153,11 @@ void jffs2_garbage_collect_trigger(struct jffs2_sb_info *c); /* dir.c */ extern const struct file_operations jffs2_dir_operations; -extern struct inode_operations jffs2_dir_inode_operations; +extern const struct inode_operations jffs2_dir_inode_operations; /* file.c */ extern const struct file_operations jffs2_file_operations; -extern struct inode_operations jffs2_file_inode_operations; +extern const struct inode_operations jffs2_file_inode_operations; extern const struct address_space_operations jffs2_file_address_operations; int jffs2_fsync(struct file *, struct dentry *, int); int jffs2_do_readpage_unlock (struct inode *inode, struct page *pg); @@ -166,7 +166,7 @@ int jffs2_do_readpage_unlock (struct inode *inode, struct page *pg); int jffs2_ioctl(struct inode *, struct file *, unsigned int, unsigned long); /* symlink.c */ -extern struct inode_operations jffs2_symlink_inode_operations; +extern const struct inode_operations jffs2_symlink_inode_operations; /* fs.c */ int jffs2_setattr (struct dentry *, struct iattr *); diff --git a/fs/jffs2/symlink.c b/fs/jffs2/symlink.c index b90d5aa3d969..7e4882c8a7ed 100644 --- a/fs/jffs2/symlink.c +++ b/fs/jffs2/symlink.c @@ -20,7 +20,7 @@ static void *jffs2_follow_link(struct dentry *dentry, struct nameidata *nd); -struct inode_operations jffs2_symlink_inode_operations = +const struct inode_operations jffs2_symlink_inode_operations = { .readlink = generic_readlink, .follow_link = jffs2_follow_link, diff --git a/fs/jfs/file.c b/fs/jfs/file.c index aa9132d04920..f7f8eff19b7b 100644 --- a/fs/jfs/file.c +++ b/fs/jfs/file.c @@ -88,7 +88,7 @@ static int jfs_release(struct inode *inode, struct file *file) return 0; } -struct inode_operations jfs_file_inode_operations = { +const struct inode_operations jfs_file_inode_operations = { .truncate = jfs_truncate, .setxattr = jfs_setxattr, .getxattr = jfs_getxattr, diff --git a/fs/jfs/jfs_inode.h b/fs/jfs/jfs_inode.h index 0d06ccfaff0e..6802837f757e 100644 --- a/fs/jfs/jfs_inode.h +++ b/fs/jfs/jfs_inode.h @@ -35,10 +35,10 @@ extern void jfs_set_inode_flags(struct inode *); extern int jfs_get_block(struct inode *, sector_t, struct buffer_head *, int); extern const struct address_space_operations jfs_aops; -extern struct inode_operations jfs_dir_inode_operations; +extern const struct inode_operations jfs_dir_inode_operations; extern const struct file_operations jfs_dir_operations; -extern struct inode_operations jfs_file_inode_operations; +extern const struct inode_operations jfs_file_inode_operations; extern const struct file_operations jfs_file_operations; -extern struct inode_operations jfs_symlink_inode_operations; +extern const struct inode_operations jfs_symlink_inode_operations; extern struct dentry_operations jfs_ci_dentry_operations; #endif /* _H_JFS_INODE */ diff --git a/fs/jfs/namei.c b/fs/jfs/namei.c index 7ab47561b68d..41c204771262 100644 --- a/fs/jfs/namei.c +++ b/fs/jfs/namei.c @@ -1503,7 +1503,7 @@ struct dentry *jfs_get_parent(struct dentry *dentry) return parent; } -struct inode_operations jfs_dir_inode_operations = { +const struct inode_operations jfs_dir_inode_operations = { .create = jfs_create, .lookup = jfs_lookup, .link = jfs_link, diff --git a/fs/jfs/symlink.c b/fs/jfs/symlink.c index cee43f36f51d..4af1a05aad0a 100644 --- a/fs/jfs/symlink.c +++ b/fs/jfs/symlink.c @@ -29,7 +29,7 @@ static void *jfs_follow_link(struct dentry *dentry, struct nameidata *nd) return NULL; } -struct inode_operations jfs_symlink_inode_operations = { +const struct inode_operations jfs_symlink_inode_operations = { .readlink = generic_readlink, .follow_link = jfs_follow_link, .setxattr = jfs_setxattr, diff --git a/fs/libfs.c b/fs/libfs.c index 503898d5c4a7..0f4ee02e0b16 100644 --- a/fs/libfs.c +++ b/fs/libfs.c @@ -186,7 +186,7 @@ const struct file_operations simple_dir_operations = { .fsync = simple_sync_file, }; -struct inode_operations simple_dir_inode_operations = { +const struct inode_operations simple_dir_inode_operations = { .lookup = simple_lookup, }; diff --git a/fs/minix/file.c b/fs/minix/file.c index 40eac2e60d25..f92baa1d7570 100644 --- a/fs/minix/file.c +++ b/fs/minix/file.c @@ -26,7 +26,7 @@ const struct file_operations minix_file_operations = { .sendfile = generic_file_sendfile, }; -struct inode_operations minix_file_inode_operations = { +const struct inode_operations minix_file_inode_operations = { .truncate = minix_truncate, .getattr = minix_getattr, }; diff --git a/fs/minix/inode.c b/fs/minix/inode.c index 9ddfcc148287..e56822bff948 100644 --- a/fs/minix/inode.c +++ b/fs/minix/inode.c @@ -369,7 +369,7 @@ static const struct address_space_operations minix_aops = { .bmap = minix_bmap }; -static struct inode_operations minix_symlink_inode_operations = { +static const struct inode_operations minix_symlink_inode_operations = { .readlink = generic_readlink, .follow_link = page_follow_link_light, .put_link = page_put_link, diff --git a/fs/minix/minix.h b/fs/minix/minix.h index e016ee91d936..73ef84f8fb0b 100644 --- a/fs/minix/minix.h +++ b/fs/minix/minix.h @@ -75,8 +75,8 @@ extern struct minix_dir_entry *minix_dotdot(struct inode*, struct page**); extern ino_t minix_inode_by_name(struct dentry*); extern int minix_sync_file(struct file *, struct dentry *, int); -extern struct inode_operations minix_file_inode_operations; -extern struct inode_operations minix_dir_inode_operations; +extern const struct inode_operations minix_file_inode_operations; +extern const struct inode_operations minix_dir_inode_operations; extern const struct file_operations minix_file_operations; extern const struct file_operations minix_dir_operations; extern struct dentry_operations minix_dentry_operations; diff --git a/fs/minix/namei.c b/fs/minix/namei.c index 299bb66e3bde..f4aa7a939040 100644 --- a/fs/minix/namei.c +++ b/fs/minix/namei.c @@ -291,7 +291,7 @@ out: /* * directories can handle most operations... */ -struct inode_operations minix_dir_inode_operations = { +const struct inode_operations minix_dir_inode_operations = { .create = minix_create, .lookup = minix_lookup, .link = minix_link, diff --git a/fs/msdos/namei.c b/fs/msdos/namei.c index 452461955cbd..30f7d0ae2215 100644 --- a/fs/msdos/namei.c +++ b/fs/msdos/namei.c @@ -646,7 +646,7 @@ out: return err; } -static struct inode_operations msdos_dir_inode_operations = { +static const struct inode_operations msdos_dir_inode_operations = { .create = msdos_create, .lookup = msdos_lookup, .unlink = msdos_unlink, diff --git a/fs/namei.c b/fs/namei.c index e4f108f08230..161e2225c757 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -2744,7 +2744,7 @@ int page_symlink(struct inode *inode, const char *symname, int len) mapping_gfp_mask(inode->i_mapping)); } -struct inode_operations page_symlink_inode_operations = { +const struct inode_operations page_symlink_inode_operations = { .readlink = generic_readlink, .follow_link = page_follow_link_light, .put_link = page_put_link, diff --git a/fs/ncpfs/dir.c b/fs/ncpfs/dir.c index 73747772c3bb..011ef0b6d2d4 100644 --- a/fs/ncpfs/dir.c +++ b/fs/ncpfs/dir.c @@ -58,7 +58,7 @@ const struct file_operations ncp_dir_operations = #endif }; -struct inode_operations ncp_dir_inode_operations = +const struct inode_operations ncp_dir_inode_operations = { .create = ncp_create, .lookup = ncp_lookup, diff --git a/fs/ncpfs/file.c b/fs/ncpfs/file.c index b91fea03b1c3..6b1f6d27099a 100644 --- a/fs/ncpfs/file.c +++ b/fs/ncpfs/file.c @@ -297,7 +297,7 @@ const struct file_operations ncp_file_operations = .fsync = ncp_fsync, }; -struct inode_operations ncp_file_inode_operations = +const struct inode_operations ncp_file_inode_operations = { .setattr = ncp_notify_change, }; diff --git a/fs/ncpfs/inode.c b/fs/ncpfs/inode.c index 67a90bf795d5..730433f3d237 100644 --- a/fs/ncpfs/inode.c +++ b/fs/ncpfs/inode.c @@ -229,7 +229,7 @@ static void ncp_set_attr(struct inode *inode, struct ncp_entry_info *nwinfo) } #if defined(CONFIG_NCPFS_EXTRAS) || defined(CONFIG_NCPFS_NFS_NS) -static struct inode_operations ncp_symlink_inode_operations = { +static const struct inode_operations ncp_symlink_inode_operations = { .readlink = generic_readlink, .follow_link = page_follow_link_light, .put_link = page_put_link, diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index d9ba8cb0ee75..f03a770bacb0 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c @@ -65,7 +65,7 @@ const struct file_operations nfs_dir_operations = { .fsync = nfs_fsync_dir, }; -struct inode_operations nfs_dir_inode_operations = { +const struct inode_operations nfs_dir_inode_operations = { .create = nfs_create, .lookup = nfs_lookup, .link = nfs_link, @@ -81,7 +81,7 @@ struct inode_operations nfs_dir_inode_operations = { }; #ifdef CONFIG_NFS_V3 -struct inode_operations nfs3_dir_inode_operations = { +const struct inode_operations nfs3_dir_inode_operations = { .create = nfs_create, .lookup = nfs_lookup, .link = nfs_link, @@ -104,7 +104,7 @@ struct inode_operations nfs3_dir_inode_operations = { #ifdef CONFIG_NFS_V4 static struct dentry *nfs_atomic_lookup(struct inode *, struct dentry *, struct nameidata *); -struct inode_operations nfs4_dir_inode_operations = { +const struct inode_operations nfs4_dir_inode_operations = { .create = nfs_create, .lookup = nfs_atomic_lookup, .link = nfs_link, diff --git a/fs/nfs/file.c b/fs/nfs/file.c index 9e4a2b70995a..8e66b5a2d490 100644 --- a/fs/nfs/file.c +++ b/fs/nfs/file.c @@ -68,14 +68,14 @@ const struct file_operations nfs_file_operations = { .check_flags = nfs_check_flags, }; -struct inode_operations nfs_file_inode_operations = { +const struct inode_operations nfs_file_inode_operations = { .permission = nfs_permission, .getattr = nfs_getattr, .setattr = nfs_setattr, }; #ifdef CONFIG_NFS_V3 -struct inode_operations nfs3_file_inode_operations = { +const struct inode_operations nfs3_file_inode_operations = { .permission = nfs_permission, .getattr = nfs_getattr, .setattr = nfs_setattr, diff --git a/fs/nfs/namespace.c b/fs/nfs/namespace.c index 371b804e7cc8..7f86e65182e4 100644 --- a/fs/nfs/namespace.c +++ b/fs/nfs/namespace.c @@ -155,12 +155,12 @@ out_follow: goto out; } -struct inode_operations nfs_mountpoint_inode_operations = { +const struct inode_operations nfs_mountpoint_inode_operations = { .follow_link = nfs_follow_mountpoint, .getattr = nfs_getattr, }; -struct inode_operations nfs_referral_inode_operations = { +const struct inode_operations nfs_referral_inode_operations = { .follow_link = nfs_follow_mountpoint, }; diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h index c26cd978c7cc..e2341766c4f0 100644 --- a/fs/nfs/nfs4_fs.h +++ b/fs/nfs/nfs4_fs.h @@ -151,7 +151,7 @@ struct nfs4_state_recovery_ops { }; extern struct dentry_operations nfs4_dentry_operations; -extern struct inode_operations nfs4_dir_inode_operations; +extern const struct inode_operations nfs4_dir_inode_operations; /* inode.c */ extern ssize_t nfs4_getxattr(struct dentry *, const char *, void *, size_t); diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index b3fd29baadc3..1daee65b517e 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -3625,7 +3625,7 @@ struct nfs4_state_recovery_ops nfs4_network_partition_recovery_ops = { .recover_lock = nfs4_lock_expired, }; -static struct inode_operations nfs4_file_inode_operations = { +static const struct inode_operations nfs4_file_inode_operations = { .permission = nfs_permission, .getattr = nfs_getattr, .setattr = nfs_setattr, diff --git a/fs/nfs/symlink.c b/fs/nfs/symlink.c index 525c136c7d8c..f4a0548b9ce8 100644 --- a/fs/nfs/symlink.c +++ b/fs/nfs/symlink.c @@ -78,7 +78,7 @@ read_failed: /* * symlinks can't do much... */ -struct inode_operations nfs_symlink_inode_operations = { +const struct inode_operations nfs_symlink_inode_operations = { .readlink = generic_readlink, .follow_link = nfs_follow_link, .put_link = page_put_link, diff --git a/fs/ntfs/file.c b/fs/ntfs/file.c index 076c9420c257..d69c4595ccd0 100644 --- a/fs/ntfs/file.c +++ b/fs/ntfs/file.c @@ -2328,7 +2328,7 @@ const struct file_operations ntfs_file_ops = { the data source. */ }; -struct inode_operations ntfs_file_inode_ops = { +const struct inode_operations ntfs_file_inode_ops = { #ifdef NTFS_RW .truncate = ntfs_truncate_vfs, .setattr = ntfs_setattr, @@ -2337,4 +2337,4 @@ struct inode_operations ntfs_file_inode_ops = { const struct file_operations ntfs_empty_file_ops = {}; -struct inode_operations ntfs_empty_inode_ops = {}; +const struct inode_operations ntfs_empty_inode_ops = {}; diff --git a/fs/ntfs/namei.c b/fs/ntfs/namei.c index eddb2247cec5..bff01a54675a 100644 --- a/fs/ntfs/namei.c +++ b/fs/ntfs/namei.c @@ -359,7 +359,7 @@ err_out: /** * Inode operations for directories. */ -struct inode_operations ntfs_dir_inode_ops = { +const struct inode_operations ntfs_dir_inode_ops = { .lookup = ntfs_lookup, /* VFS: Lookup directory. */ }; diff --git a/fs/ntfs/ntfs.h b/fs/ntfs/ntfs.h index a12847ae467d..d73f5a9ac341 100644 --- a/fs/ntfs/ntfs.h +++ b/fs/ntfs/ntfs.h @@ -61,13 +61,13 @@ extern const struct address_space_operations ntfs_aops; extern const struct address_space_operations ntfs_mst_aops; extern const struct file_operations ntfs_file_ops; -extern struct inode_operations ntfs_file_inode_ops; +extern const struct inode_operations ntfs_file_inode_ops; extern const struct file_operations ntfs_dir_ops; -extern struct inode_operations ntfs_dir_inode_ops; +extern const struct inode_operations ntfs_dir_inode_ops; extern const struct file_operations ntfs_empty_file_ops; -extern struct inode_operations ntfs_empty_inode_ops; +extern const struct inode_operations ntfs_empty_inode_ops; extern struct export_operations ntfs_export_ops; diff --git a/fs/ocfs2/dlm/dlmfs.c b/fs/ocfs2/dlm/dlmfs.c index 30826242bf51..84b33ffb42f1 100644 --- a/fs/ocfs2/dlm/dlmfs.c +++ b/fs/ocfs2/dlm/dlmfs.c @@ -63,9 +63,9 @@ static struct super_operations dlmfs_ops; static const struct file_operations dlmfs_file_operations; -static struct inode_operations dlmfs_dir_inode_operations; -static struct inode_operations dlmfs_root_inode_operations; -static struct inode_operations dlmfs_file_inode_operations; +static const struct inode_operations dlmfs_dir_inode_operations; +static const struct inode_operations dlmfs_root_inode_operations; +static const struct inode_operations dlmfs_file_inode_operations; static struct kmem_cache *dlmfs_inode_cache; struct workqueue_struct *user_dlm_worker; @@ -547,14 +547,14 @@ static const struct file_operations dlmfs_file_operations = { .write = dlmfs_file_write, }; -static struct inode_operations dlmfs_dir_inode_operations = { +static const struct inode_operations dlmfs_dir_inode_operations = { .create = dlmfs_create, .lookup = simple_lookup, .unlink = dlmfs_unlink, }; /* this way we can restrict mkdir to only the toplevel of the fs. */ -static struct inode_operations dlmfs_root_inode_operations = { +static const struct inode_operations dlmfs_root_inode_operations = { .lookup = simple_lookup, .mkdir = dlmfs_mkdir, .rmdir = simple_rmdir, @@ -568,7 +568,7 @@ static struct super_operations dlmfs_ops = { .drop_inode = generic_delete_inode, }; -static struct inode_operations dlmfs_file_inode_operations = { +static const struct inode_operations dlmfs_file_inode_operations = { .getattr = simple_getattr, }; diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index 10953a508f2f..f2cd3bf9efb2 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c @@ -1365,13 +1365,13 @@ bail: return ret; } -struct inode_operations ocfs2_file_iops = { +const struct inode_operations ocfs2_file_iops = { .setattr = ocfs2_setattr, .getattr = ocfs2_getattr, .permission = ocfs2_permission, }; -struct inode_operations ocfs2_special_file_iops = { +const struct inode_operations ocfs2_special_file_iops = { .setattr = ocfs2_setattr, .getattr = ocfs2_getattr, .permission = ocfs2_permission, diff --git a/fs/ocfs2/file.h b/fs/ocfs2/file.h index 601a453f18a8..cc973f01f6ce 100644 --- a/fs/ocfs2/file.h +++ b/fs/ocfs2/file.h @@ -28,8 +28,8 @@ extern const struct file_operations ocfs2_fops; extern const struct file_operations ocfs2_dops; -extern struct inode_operations ocfs2_file_iops; -extern struct inode_operations ocfs2_special_file_iops; +extern const struct inode_operations ocfs2_file_iops; +extern const struct inode_operations ocfs2_special_file_iops; struct ocfs2_alloc_context; enum ocfs2_alloc_restarted { diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c index f3d7803b4b46..f7fa52bb3f6b 100644 --- a/fs/ocfs2/namei.c +++ b/fs/ocfs2/namei.c @@ -2306,7 +2306,7 @@ leave: return status; } -struct inode_operations ocfs2_dir_iops = { +const struct inode_operations ocfs2_dir_iops = { .create = ocfs2_create, .lookup = ocfs2_lookup, .link = ocfs2_link, diff --git a/fs/ocfs2/namei.h b/fs/ocfs2/namei.h index 8425944fcccd..0975c7b7212b 100644 --- a/fs/ocfs2/namei.h +++ b/fs/ocfs2/namei.h @@ -26,7 +26,7 @@ #ifndef OCFS2_NAMEI_H #define OCFS2_NAMEI_H -extern struct inode_operations ocfs2_dir_iops; +extern const struct inode_operations ocfs2_dir_iops; struct dentry *ocfs2_get_parent(struct dentry *child); diff --git a/fs/ocfs2/symlink.c b/fs/ocfs2/symlink.c index 03b0191534d5..40dc1a51f4a9 100644 --- a/fs/ocfs2/symlink.c +++ b/fs/ocfs2/symlink.c @@ -170,12 +170,12 @@ bail: return ERR_PTR(status); } -struct inode_operations ocfs2_symlink_inode_operations = { +const struct inode_operations ocfs2_symlink_inode_operations = { .readlink = page_readlink, .follow_link = ocfs2_follow_link, .getattr = ocfs2_getattr, }; -struct inode_operations ocfs2_fast_symlink_inode_operations = { +const struct inode_operations ocfs2_fast_symlink_inode_operations = { .readlink = ocfs2_readlink, .follow_link = ocfs2_follow_link, .getattr = ocfs2_getattr, diff --git a/fs/ocfs2/symlink.h b/fs/ocfs2/symlink.h index 1ea9e4d9e9eb..65a6c9c6ad51 100644 --- a/fs/ocfs2/symlink.h +++ b/fs/ocfs2/symlink.h @@ -26,8 +26,8 @@ #ifndef OCFS2_SYMLINK_H #define OCFS2_SYMLINK_H -extern struct inode_operations ocfs2_symlink_inode_operations; -extern struct inode_operations ocfs2_fast_symlink_inode_operations; +extern const struct inode_operations ocfs2_symlink_inode_operations; +extern const struct inode_operations ocfs2_fast_symlink_inode_operations; /* * Test whether an inode is a fast symlink. diff --git a/fs/openpromfs/inode.c b/fs/openpromfs/inode.c index 99c0bc37ba09..327807b86fa1 100644 --- a/fs/openpromfs/inode.c +++ b/fs/openpromfs/inode.c @@ -169,7 +169,7 @@ static const struct file_operations openprom_operations = { static struct dentry *openpromfs_lookup(struct inode *, struct dentry *, struct nameidata *); -static struct inode_operations openprom_inode_operations = { +static const struct inode_operations openprom_inode_operations = { .lookup = openpromfs_lookup, }; diff --git a/ipc/mqueue.c b/ipc/mqueue.c index fafdef357e92..7a8ce610fda2 100644 --- a/ipc/mqueue.c +++ b/ipc/mqueue.c @@ -84,7 +84,7 @@ struct mqueue_inode_info { unsigned long qsize; /* size of queue in memory (sum of all msgs) */ }; -static struct inode_operations mqueue_dir_inode_operations; +static const struct inode_operations mqueue_dir_inode_operations; static const struct file_operations mqueue_file_operations; static struct super_operations mqueue_super_ops; static void remove_notification(struct mqueue_inode_info *info); @@ -1160,7 +1160,7 @@ out: return ret; } -static struct inode_operations mqueue_dir_inode_operations = { +static const struct inode_operations mqueue_dir_inode_operations = { .lookup = simple_lookup, .create = mqueue_create, .unlink = mqueue_unlink, diff --git a/kernel/cpuset.c b/kernel/cpuset.c index 232aed2b10f9..f382b0f775e1 100644 --- a/kernel/cpuset.c +++ b/kernel/cpuset.c @@ -1540,7 +1540,7 @@ static const struct file_operations cpuset_file_operations = { .release = cpuset_file_release, }; -static struct inode_operations cpuset_dir_inode_operations = { +static const struct inode_operations cpuset_dir_inode_operations = { .lookup = simple_lookup, .mkdir = cpuset_mkdir, .rmdir = cpuset_rmdir, diff --git a/mm/shmem.c b/mm/shmem.c index b38e17169271..882053031aa0 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -178,9 +178,9 @@ static inline void shmem_unacct_blocks(unsigned long flags, long pages) static struct super_operations shmem_ops; static const struct address_space_operations shmem_aops; static const struct file_operations shmem_file_operations; -static struct inode_operations shmem_inode_operations; -static struct inode_operations shmem_dir_inode_operations; -static struct inode_operations shmem_special_inode_operations; +static const struct inode_operations shmem_inode_operations; +static const struct inode_operations shmem_dir_inode_operations; +static const struct inode_operations shmem_special_inode_operations; static struct vm_operations_struct shmem_vm_ops; static struct backing_dev_info shmem_backing_dev_info __read_mostly = { @@ -1410,8 +1410,8 @@ shmem_get_inode(struct super_block *sb, int mode, dev_t dev) } #ifdef CONFIG_TMPFS -static struct inode_operations shmem_symlink_inode_operations; -static struct inode_operations shmem_symlink_inline_operations; +static const struct inode_operations shmem_symlink_inode_operations; +static const struct inode_operations shmem_symlink_inline_operations; /* * Normally tmpfs makes no use of shmem_prepare_write, but it @@ -1904,12 +1904,12 @@ static void shmem_put_link(struct dentry *dentry, struct nameidata *nd, void *co } } -static struct inode_operations shmem_symlink_inline_operations = { +static const struct inode_operations shmem_symlink_inline_operations = { .readlink = generic_readlink, .follow_link = shmem_follow_link_inline, }; -static struct inode_operations shmem_symlink_inode_operations = { +static const struct inode_operations shmem_symlink_inode_operations = { .truncate = shmem_truncate, .readlink = generic_readlink, .follow_link = shmem_follow_link, @@ -2335,7 +2335,7 @@ static const struct file_operations shmem_file_operations = { #endif }; -static struct inode_operations shmem_inode_operations = { +static const struct inode_operations shmem_inode_operations = { .truncate = shmem_truncate, .setattr = shmem_notify_change, .truncate_range = shmem_truncate_range, @@ -2349,7 +2349,7 @@ static struct inode_operations shmem_inode_operations = { }; -static struct inode_operations shmem_dir_inode_operations = { +static const struct inode_operations shmem_dir_inode_operations = { #ifdef CONFIG_TMPFS .create = shmem_create, .lookup = simple_lookup, @@ -2371,7 +2371,7 @@ static struct inode_operations shmem_dir_inode_operations = { #endif }; -static struct inode_operations shmem_special_inode_operations = { +static const struct inode_operations shmem_special_inode_operations = { #ifdef CONFIG_TMPFS_POSIX_ACL .setattr = shmem_notify_change, .setxattr = generic_setxattr, -- cgit v1.2.3 From ee9b6d61a2a43c5952eb43283f8db284a4e70b8a Mon Sep 17 00:00:00 2001 From: Josef 'Jeff' Sipek Date: Mon, 12 Feb 2007 00:55:41 -0800 Subject: [PATCH] Mark struct super_operations const This patch is inspired by Arjan's "Patch series to mark struct file_operations and struct inode_operations const". Compile tested with gcc & sparse. Signed-off-by: Josef 'Jeff' Sipek Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- fs/9p/vfs_super.c | 4 ++-- fs/adfs/super.c | 2 +- fs/affs/super.c | 2 +- fs/afs/super.c | 2 +- fs/autofs/inode.c | 2 +- fs/autofs4/inode.c | 2 +- fs/bfs/inode.c | 2 +- fs/binfmt_misc.c | 2 +- fs/block_dev.c | 2 +- fs/cifs/cifsfs.c | 4 ++-- fs/cifs/cifsfs.h | 2 +- fs/coda/inode.c | 2 +- fs/configfs/mount.c | 2 +- fs/cramfs/inode.c | 4 ++-- fs/devpts/inode.c | 2 +- fs/ecryptfs/ecryptfs_kernel.h | 2 +- fs/ecryptfs/super.c | 2 +- fs/efs/super.c | 2 +- fs/ext2/super.c | 2 +- fs/ext3/super.c | 2 +- fs/ext4/super.c | 2 +- fs/fat/inode.c | 2 +- fs/freevxfs/vxfs_super.c | 2 +- fs/fuse/inode.c | 2 +- fs/gfs2/ops_super.c | 2 +- fs/gfs2/ops_super.h | 2 +- fs/hfs/super.c | 2 +- fs/hfsplus/super.c | 2 +- fs/hostfs/hostfs_kern.c | 2 +- fs/hpfs/super.c | 2 +- fs/hppfs/hppfs_kern.c | 4 ++-- fs/hugetlbfs/inode.c | 4 ++-- fs/inode.c | 6 +++--- fs/isofs/inode.c | 2 +- fs/jffs/inode-v23.c | 4 ++-- fs/jffs2/super.c | 2 +- fs/jfs/super.c | 4 ++-- fs/libfs.c | 4 ++-- fs/minix/inode.c | 2 +- fs/ncpfs/inode.c | 2 +- fs/nfs/super.c | 4 ++-- fs/ntfs/super.c | 2 +- fs/ocfs2/dlm/dlmfs.c | 4 ++-- fs/ocfs2/super.c | 2 +- fs/openpromfs/inode.c | 2 +- fs/proc/inode.c | 2 +- fs/qnx4/inode.c | 4 ++-- fs/ramfs/inode.c | 4 ++-- fs/reiserfs/super.c | 2 +- fs/romfs/inode.c | 4 ++-- fs/smbfs/inode.c | 2 +- fs/super.c | 2 +- fs/sysfs/mount.c | 2 +- fs/sysv/inode.c | 2 +- fs/sysv/sysv.h | 2 +- fs/udf/super.c | 2 +- fs/ufs/super.c | 4 ++-- include/linux/fs.h | 4 ++-- 58 files changed, 75 insertions(+), 75 deletions(-) (limited to 'fs/nfs') diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c index 63320d4e15d2..0ec42f665457 100644 --- a/fs/9p/vfs_super.c +++ b/fs/9p/vfs_super.c @@ -45,7 +45,7 @@ #include "fid.h" static void v9fs_clear_inode(struct inode *); -static struct super_operations v9fs_super_ops; +static const struct super_operations v9fs_super_ops; /** * v9fs_clear_inode - release an inode @@ -263,7 +263,7 @@ v9fs_umount_begin(struct vfsmount *vfsmnt, int flags) v9fs_session_cancel(v9ses); } -static struct super_operations v9fs_super_ops = { +static const struct super_operations v9fs_super_ops = { .statfs = simple_statfs, .clear_inode = v9fs_clear_inode, .show_options = v9fs_show_options, diff --git a/fs/adfs/super.c b/fs/adfs/super.c index 5023351a7afe..2e5f2c8371ee 100644 --- a/fs/adfs/super.c +++ b/fs/adfs/super.c @@ -254,7 +254,7 @@ static void destroy_inodecache(void) kmem_cache_destroy(adfs_inode_cachep); } -static struct super_operations adfs_sops = { +static const struct super_operations adfs_sops = { .alloc_inode = adfs_alloc_inode, .destroy_inode = adfs_destroy_inode, .write_inode = adfs_write_inode, diff --git a/fs/affs/super.c b/fs/affs/super.c index 3de93e799949..a324045d8554 100644 --- a/fs/affs/super.c +++ b/fs/affs/super.c @@ -112,7 +112,7 @@ static void destroy_inodecache(void) kmem_cache_destroy(affs_inode_cachep); } -static struct super_operations affs_sops = { +static const struct super_operations affs_sops = { .alloc_inode = affs_alloc_inode, .destroy_inode = affs_destroy_inode, .read_inode = affs_read_inode, diff --git a/fs/afs/super.c b/fs/afs/super.c index 18d9b77ba40f..eb7e32349da3 100644 --- a/fs/afs/super.c +++ b/fs/afs/super.c @@ -56,7 +56,7 @@ struct file_system_type afs_fs_type = { .fs_flags = FS_BINARY_MOUNTDATA, }; -static struct super_operations afs_super_ops = { +static const struct super_operations afs_super_ops = { .statfs = simple_statfs, .alloc_inode = afs_alloc_inode, .drop_inode = generic_delete_inode, diff --git a/fs/autofs/inode.c b/fs/autofs/inode.c index f968d1342808..aa0b61ff8270 100644 --- a/fs/autofs/inode.c +++ b/fs/autofs/inode.c @@ -52,7 +52,7 @@ out_kill_sb: static void autofs_read_inode(struct inode *inode); -static struct super_operations autofs_sops = { +static const struct super_operations autofs_sops = { .read_inode = autofs_read_inode, .statfs = simple_statfs, }; diff --git a/fs/autofs4/inode.c b/fs/autofs4/inode.c index e8f6c5ad3e90..5e458e096ef6 100644 --- a/fs/autofs4/inode.c +++ b/fs/autofs4/inode.c @@ -196,7 +196,7 @@ static int autofs4_show_options(struct seq_file *m, struct vfsmount *mnt) return 0; } -static struct super_operations autofs4_sops = { +static const struct super_operations autofs4_sops = { .statfs = simple_statfs, .show_options = autofs4_show_options, }; diff --git a/fs/bfs/inode.c b/fs/bfs/inode.c index 134c99941a63..93d6219243ad 100644 --- a/fs/bfs/inode.c +++ b/fs/bfs/inode.c @@ -270,7 +270,7 @@ static void destroy_inodecache(void) kmem_cache_destroy(bfs_inode_cachep); } -static struct super_operations bfs_sops = { +static const struct super_operations bfs_sops = { .alloc_inode = bfs_alloc_inode, .destroy_inode = bfs_destroy_inode, .read_inode = bfs_read_inode, diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c index c2e08252af35..e6f57990b121 100644 --- a/fs/binfmt_misc.c +++ b/fs/binfmt_misc.c @@ -719,7 +719,7 @@ static const struct file_operations bm_status_operations = { /* Superblock handling */ -static struct super_operations s_ops = { +static const struct super_operations s_ops = { .statfs = simple_statfs, .clear_inode = bm_clear_inode, }; diff --git a/fs/block_dev.c b/fs/block_dev.c index fc7028b685f2..0c59b703e9d5 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -489,7 +489,7 @@ static void bdev_clear_inode(struct inode *inode) spin_unlock(&bdev_lock); } -static struct super_operations bdev_sops = { +static const struct super_operations bdev_sops = { .statfs = simple_statfs, .alloc_inode = bdev_alloc_inode, .destroy_inode = bdev_destroy_inode, diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 481e84f5f361..e8287c4c6eb3 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c @@ -64,7 +64,7 @@ extern struct task_struct * oplockThread; /* remove sparse warning */ struct task_struct * oplockThread = NULL; extern struct task_struct * dnotifyThread; /* remove sparse warning */ struct task_struct * dnotifyThread = NULL; -static struct super_operations cifs_super_ops; +static const struct super_operations cifs_super_ops; unsigned int CIFSMaxBufSize = CIFS_MAX_MSGSIZE; module_param(CIFSMaxBufSize, int, 0); MODULE_PARM_DESC(CIFSMaxBufSize,"Network buffer size (not including header). Default: 16384 Range: 8192 to 130048"); @@ -453,7 +453,7 @@ static int cifs_remount(struct super_block *sb, int *flags, char *data) return 0; } -static struct super_operations cifs_super_ops = { +static const struct super_operations cifs_super_ops = { .read_inode = cifs_read_inode, .put_super = cifs_put_super, .statfs = cifs_statfs, diff --git a/fs/cifs/cifsfs.h b/fs/cifs/cifsfs.h index ab9e20a863f3..01ae24af9cfd 100644 --- a/fs/cifs/cifsfs.h +++ b/fs/cifs/cifsfs.h @@ -36,7 +36,7 @@ extern const struct address_space_operations cifs_addr_ops; extern const struct address_space_operations cifs_addr_ops_smallbuf; /* Functions related to super block operations */ -/* extern struct super_operations cifs_super_ops;*/ +/* extern const struct super_operations cifs_super_ops;*/ extern void cifs_read_inode(struct inode *); extern void cifs_delete_inode(struct inode *); /* extern void cifs_write_inode(struct inode *); *//* BB not needed yet */ diff --git a/fs/coda/inode.c b/fs/coda/inode.c index 1562515efdb5..614175a3b02e 100644 --- a/fs/coda/inode.c +++ b/fs/coda/inode.c @@ -90,7 +90,7 @@ static int coda_remount(struct super_block *sb, int *flags, char *data) } /* exported operations */ -static struct super_operations coda_super_operations = +static const struct super_operations coda_super_operations = { .alloc_inode = coda_alloc_inode, .destroy_inode = coda_destroy_inode, diff --git a/fs/configfs/mount.c b/fs/configfs/mount.c index ed678529ebb2..6f573004cd7d 100644 --- a/fs/configfs/mount.c +++ b/fs/configfs/mount.c @@ -41,7 +41,7 @@ struct super_block * configfs_sb = NULL; struct kmem_cache *configfs_dir_cachep; static int configfs_mnt_count = 0; -static struct super_operations configfs_ops = { +static const struct super_operations configfs_ops = { .statfs = simple_statfs, .drop_inode = generic_delete_inode, }; diff --git a/fs/cramfs/inode.c b/fs/cramfs/inode.c index 0367d200a2de..facd0c89be8f 100644 --- a/fs/cramfs/inode.c +++ b/fs/cramfs/inode.c @@ -27,7 +27,7 @@ #include -static struct super_operations cramfs_ops; +static const struct super_operations cramfs_ops; static const struct inode_operations cramfs_dir_inode_operations; static const struct file_operations cramfs_directory_operations; static const struct address_space_operations cramfs_aops; @@ -522,7 +522,7 @@ static const struct inode_operations cramfs_dir_inode_operations = { .lookup = cramfs_lookup, }; -static struct super_operations cramfs_ops = { +static const struct super_operations cramfs_ops = { .put_super = cramfs_put_super, .remount_fs = cramfs_remount, .statfs = cramfs_statfs, diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c index 5f7b5a6025bf..643e57b622bd 100644 --- a/fs/devpts/inode.c +++ b/fs/devpts/inode.c @@ -91,7 +91,7 @@ static int devpts_remount(struct super_block *sb, int *flags, char *data) return 0; } -static struct super_operations devpts_sops = { +static const struct super_operations devpts_sops = { .statfs = simple_statfs, .remount_fs = devpts_remount, }; diff --git a/fs/ecryptfs/ecryptfs_kernel.h b/fs/ecryptfs/ecryptfs_kernel.h index 275445d17162..b3609b7cdf11 100644 --- a/fs/ecryptfs/ecryptfs_kernel.h +++ b/fs/ecryptfs/ecryptfs_kernel.h @@ -449,7 +449,7 @@ extern const struct file_operations ecryptfs_dir_fops; extern const struct inode_operations ecryptfs_main_iops; extern const struct inode_operations ecryptfs_dir_iops; extern const struct inode_operations ecryptfs_symlink_iops; -extern struct super_operations ecryptfs_sops; +extern const struct super_operations ecryptfs_sops; extern struct dentry_operations ecryptfs_dops; extern struct address_space_operations ecryptfs_aops; extern int ecryptfs_verbosity; diff --git a/fs/ecryptfs/super.c b/fs/ecryptfs/super.c index eaa5daaf106e..7b3f0cc09a6f 100644 --- a/fs/ecryptfs/super.c +++ b/fs/ecryptfs/super.c @@ -168,7 +168,7 @@ out: return rc; } -struct super_operations ecryptfs_sops = { +const struct super_operations ecryptfs_sops = { .alloc_inode = ecryptfs_alloc_inode, .destroy_inode = ecryptfs_destroy_inode, .drop_inode = generic_delete_inode, diff --git a/fs/efs/super.c b/fs/efs/super.c index dfebf21289f4..c2235e46edcd 100644 --- a/fs/efs/super.c +++ b/fs/efs/super.c @@ -105,7 +105,7 @@ static int efs_remount(struct super_block *sb, int *flags, char *data) return 0; } -static struct super_operations efs_superblock_operations = { +static const struct super_operations efs_superblock_operations = { .alloc_inode = efs_alloc_inode, .destroy_inode = efs_destroy_inode, .read_inode = efs_read_inode, diff --git a/fs/ext2/super.c b/fs/ext2/super.c index daaa243eee9b..a046a419d8af 100644 --- a/fs/ext2/super.c +++ b/fs/ext2/super.c @@ -231,7 +231,7 @@ static ssize_t ext2_quota_read(struct super_block *sb, int type, char *data, siz static ssize_t ext2_quota_write(struct super_block *sb, int type, const char *data, size_t len, loff_t off); #endif -static struct super_operations ext2_sops = { +static const struct super_operations ext2_sops = { .alloc_inode = ext2_alloc_inode, .destroy_inode = ext2_destroy_inode, .read_inode = ext2_read_inode, diff --git a/fs/ext3/super.c b/fs/ext3/super.c index a0623a84a4b2..4a4fcd6868c7 100644 --- a/fs/ext3/super.c +++ b/fs/ext3/super.c @@ -639,7 +639,7 @@ static struct quotactl_ops ext3_qctl_operations = { }; #endif -static struct super_operations ext3_sops = { +static const struct super_operations ext3_sops = { .alloc_inode = ext3_alloc_inode, .destroy_inode = ext3_destroy_inode, .read_inode = ext3_read_inode, diff --git a/fs/ext4/super.c b/fs/ext4/super.c index c63a18b574dd..61c4718e4a53 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -690,7 +690,7 @@ static struct quotactl_ops ext4_qctl_operations = { }; #endif -static struct super_operations ext4_sops = { +static const struct super_operations ext4_sops = { .alloc_inode = ext4_alloc_inode, .destroy_inode = ext4_destroy_inode, .read_inode = ext4_read_inode, diff --git a/fs/fat/inode.c b/fs/fat/inode.c index f268fec6ed0a..761073544217 100644 --- a/fs/fat/inode.c +++ b/fs/fat/inode.c @@ -618,7 +618,7 @@ int fat_sync_inode(struct inode *inode) EXPORT_SYMBOL_GPL(fat_sync_inode); static int fat_show_options(struct seq_file *m, struct vfsmount *mnt); -static struct super_operations fat_sops = { +static const struct super_operations fat_sops = { .alloc_inode = fat_alloc_inode, .destroy_inode = fat_destroy_inode, .write_inode = fat_write_inode, diff --git a/fs/freevxfs/vxfs_super.c b/fs/freevxfs/vxfs_super.c index ac28b0835ffc..647d600f0bc8 100644 --- a/fs/freevxfs/vxfs_super.c +++ b/fs/freevxfs/vxfs_super.c @@ -59,7 +59,7 @@ static void vxfs_put_super(struct super_block *); static int vxfs_statfs(struct dentry *, struct kstatfs *); static int vxfs_remount(struct super_block *, int *, char *); -static struct super_operations vxfs_super_ops = { +static const struct super_operations vxfs_super_ops = { .read_inode = vxfs_read_inode, .clear_inode = vxfs_clear_inode, .put_super = vxfs_put_super, diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index 220255110d76..5ab8e50e7808 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c @@ -446,7 +446,7 @@ static struct inode *get_root_inode(struct super_block *sb, unsigned mode) return fuse_iget(sb, 1, 0, &attr); } -static struct super_operations fuse_super_operations = { +static const struct super_operations fuse_super_operations = { .alloc_inode = fuse_alloc_inode, .destroy_inode = fuse_destroy_inode, .read_inode = fuse_read_inode, diff --git a/fs/gfs2/ops_super.c b/fs/gfs2/ops_super.c index 47369d011214..b89999d3a767 100644 --- a/fs/gfs2/ops_super.c +++ b/fs/gfs2/ops_super.c @@ -468,7 +468,7 @@ static void gfs2_destroy_inode(struct inode *inode) kmem_cache_free(gfs2_inode_cachep, inode); } -struct super_operations gfs2_super_ops = { +const struct super_operations gfs2_super_ops = { .alloc_inode = gfs2_alloc_inode, .destroy_inode = gfs2_destroy_inode, .write_inode = gfs2_write_inode, diff --git a/fs/gfs2/ops_super.h b/fs/gfs2/ops_super.h index 9de73f042f78..442a274c6272 100644 --- a/fs/gfs2/ops_super.h +++ b/fs/gfs2/ops_super.h @@ -12,6 +12,6 @@ #include -extern struct super_operations gfs2_super_ops; +extern const struct super_operations gfs2_super_ops; #endif /* __OPS_SUPER_DOT_H__ */ diff --git a/fs/hfs/super.c b/fs/hfs/super.c index a36987966004..623f509f1d47 100644 --- a/fs/hfs/super.c +++ b/fs/hfs/super.c @@ -154,7 +154,7 @@ static void hfs_destroy_inode(struct inode *inode) kmem_cache_free(hfs_inode_cachep, HFS_I(inode)); } -static struct super_operations hfs_super_operations = { +static const struct super_operations hfs_super_operations = { .alloc_inode = hfs_alloc_inode, .destroy_inode = hfs_destroy_inode, .write_inode = hfs_write_inode, diff --git a/fs/hfsplus/super.c b/fs/hfsplus/super.c index 0f513c6bf843..5a282f64c637 100644 --- a/fs/hfsplus/super.c +++ b/fs/hfsplus/super.c @@ -260,7 +260,7 @@ static int hfsplus_remount(struct super_block *sb, int *flags, char *data) return 0; } -static struct super_operations hfsplus_sops = { +static const struct super_operations hfsplus_sops = { .alloc_inode = hfsplus_alloc_inode, .destroy_inode = hfsplus_destroy_inode, .read_inode = hfsplus_read_inode, diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c index fec208db5e46..e965eb11d76f 100644 --- a/fs/hostfs/hostfs_kern.c +++ b/fs/hostfs/hostfs_kern.c @@ -309,7 +309,7 @@ static void hostfs_read_inode(struct inode *inode) read_inode(inode); } -static struct super_operations hostfs_sbops = { +static const struct super_operations hostfs_sbops = { .alloc_inode = hostfs_alloc_inode, .drop_inode = generic_delete_inode, .delete_inode = hostfs_delete_inode, diff --git a/fs/hpfs/super.c b/fs/hpfs/super.c index d4abc1a1d566..e0174e338526 100644 --- a/fs/hpfs/super.c +++ b/fs/hpfs/super.c @@ -426,7 +426,7 @@ static int hpfs_remount_fs(struct super_block *s, int *flags, char *data) /* Super operations */ -static struct super_operations hpfs_sops = +static const struct super_operations hpfs_sops = { .alloc_inode = hpfs_alloc_inode, .destroy_inode = hpfs_destroy_inode, diff --git a/fs/hppfs/hppfs_kern.c b/fs/hppfs/hppfs_kern.c index bd7116816314..affb7412125e 100644 --- a/fs/hppfs/hppfs_kern.c +++ b/fs/hppfs/hppfs_kern.c @@ -43,7 +43,7 @@ static inline struct hppfs_inode_info *HPPFS_I(struct inode *inode) #define HPPFS_SUPER_MAGIC 0xb00000ee -static struct super_operations hppfs_sbops; +static const struct super_operations hppfs_sbops; static int is_pid(struct dentry *dentry) { @@ -649,7 +649,7 @@ static void hppfs_destroy_inode(struct inode *inode) kfree(HPPFS_I(inode)); } -static struct super_operations hppfs_sbops = { +static const struct super_operations hppfs_sbops = { .alloc_inode = hppfs_alloc_inode, .destroy_inode = hppfs_destroy_inode, .read_inode = hppfs_read_inode, diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index 26ba81fc7fab..8c718a3d413f 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -33,7 +33,7 @@ /* some random number */ #define HUGETLBFS_MAGIC 0x958458f6 -static struct super_operations hugetlbfs_ops; +static const struct super_operations hugetlbfs_ops; static const struct address_space_operations hugetlbfs_aops; const struct file_operations hugetlbfs_file_operations; static const struct inode_operations hugetlbfs_dir_inode_operations; @@ -580,7 +580,7 @@ static const struct inode_operations hugetlbfs_inode_operations = { .setattr = hugetlbfs_setattr, }; -static struct super_operations hugetlbfs_ops = { +static const struct super_operations hugetlbfs_ops = { .alloc_inode = hugetlbfs_alloc_inode, .destroy_inode = hugetlbfs_destroy_inode, .statfs = hugetlbfs_statfs, diff --git a/fs/inode.c b/fs/inode.c index 5e32432a7608..5abb097ab1b0 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -1000,7 +1000,7 @@ EXPORT_SYMBOL(remove_inode_hash); */ void generic_delete_inode(struct inode *inode) { - struct super_operations *op = inode->i_sb->s_op; + const struct super_operations *op = inode->i_sb->s_op; list_del_init(&inode->i_list); list_del_init(&inode->i_sb_list); @@ -1093,7 +1093,7 @@ EXPORT_SYMBOL_GPL(generic_drop_inode); */ static inline void iput_final(struct inode *inode) { - struct super_operations *op = inode->i_sb->s_op; + const struct super_operations *op = inode->i_sb->s_op; void (*drop)(struct inode *) = generic_drop_inode; if (op && op->drop_inode) @@ -1113,7 +1113,7 @@ static inline void iput_final(struct inode *inode) void iput(struct inode *inode) { if (inode) { - struct super_operations *op = inode->i_sb->s_op; + const struct super_operations *op = inode->i_sb->s_op; BUG_ON(inode->i_state == I_CLEAR); diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c index ea55b6c469ec..64a96cdfe3a4 100644 --- a/fs/isofs/inode.c +++ b/fs/isofs/inode.c @@ -106,7 +106,7 @@ static int isofs_remount(struct super_block *sb, int *flags, char *data) return 0; } -static struct super_operations isofs_sops = { +static const struct super_operations isofs_sops = { .alloc_inode = isofs_alloc_inode, .destroy_inode = isofs_destroy_inode, .read_inode = isofs_read_inode, diff --git a/fs/jffs/inode-v23.c b/fs/jffs/inode-v23.c index fe3347defe6c..9602b925da08 100644 --- a/fs/jffs/inode-v23.c +++ b/fs/jffs/inode-v23.c @@ -54,7 +54,7 @@ static int jffs_remove(struct inode *dir, struct dentry *dentry, int type); -static struct super_operations jffs_ops; +static const struct super_operations jffs_ops; static const struct file_operations jffs_file_operations; static const struct inode_operations jffs_file_inode_operations; static const struct file_operations jffs_dir_operations; @@ -1774,7 +1774,7 @@ static int jffs_remount(struct super_block *sb, int *flags, char *data) return 0; } -static struct super_operations jffs_ops = +static const struct super_operations jffs_ops = { .read_inode = jffs_read_inode, .delete_inode = jffs_delete_inode, diff --git a/fs/jffs2/super.c b/fs/jffs2/super.c index 08a0e6c49e61..cc7e8e71ad46 100644 --- a/fs/jffs2/super.c +++ b/fs/jffs2/super.c @@ -66,7 +66,7 @@ static int jffs2_sync_fs(struct super_block *sb, int wait) return 0; } -static struct super_operations jffs2_super_operations = +static const struct super_operations jffs2_super_operations = { .alloc_inode = jffs2_alloc_inode, .destroy_inode =jffs2_destroy_inode, diff --git a/fs/jfs/super.c b/fs/jfs/super.c index 846ac8f34513..52d73d54a931 100644 --- a/fs/jfs/super.c +++ b/fs/jfs/super.c @@ -46,7 +46,7 @@ MODULE_LICENSE("GPL"); static struct kmem_cache * jfs_inode_cachep; -static struct super_operations jfs_super_operations; +static const struct super_operations jfs_super_operations; static struct export_operations jfs_export_operations; static struct file_system_type jfs_fs_type; @@ -716,7 +716,7 @@ out: #endif -static struct super_operations jfs_super_operations = { +static const struct super_operations jfs_super_operations = { .alloc_inode = jfs_alloc_inode, .destroy_inode = jfs_destroy_inode, .read_inode = jfs_read_inode, diff --git a/fs/libfs.c b/fs/libfs.c index 0f4ee02e0b16..7d487047dbb8 100644 --- a/fs/libfs.c +++ b/fs/libfs.c @@ -195,11 +195,11 @@ const struct inode_operations simple_dir_inode_operations = { * will never be mountable) */ int get_sb_pseudo(struct file_system_type *fs_type, char *name, - struct super_operations *ops, unsigned long magic, + const struct super_operations *ops, unsigned long magic, struct vfsmount *mnt) { struct super_block *s = sget(fs_type, NULL, set_anon_super, NULL); - static struct super_operations default_ops = {.statfs = simple_statfs}; + static const struct super_operations default_ops = {.statfs = simple_statfs}; struct dentry *dentry; struct inode *root; struct qstr d_name = {.name = name, .len = strlen(name)}; diff --git a/fs/minix/inode.c b/fs/minix/inode.c index e56822bff948..92e383af3709 100644 --- a/fs/minix/inode.c +++ b/fs/minix/inode.c @@ -95,7 +95,7 @@ static void destroy_inodecache(void) kmem_cache_destroy(minix_inode_cachep); } -static struct super_operations minix_sops = { +static const struct super_operations minix_sops = { .alloc_inode = minix_alloc_inode, .destroy_inode = minix_destroy_inode, .read_inode = minix_read_inode, diff --git a/fs/ncpfs/inode.c b/fs/ncpfs/inode.c index 730433f3d237..14939ddf74f1 100644 --- a/fs/ncpfs/inode.c +++ b/fs/ncpfs/inode.c @@ -90,7 +90,7 @@ static int ncp_remount(struct super_block *sb, int *flags, char* data) return 0; } -static struct super_operations ncp_sops = +static const struct super_operations ncp_sops = { .alloc_inode = ncp_alloc_inode, .destroy_inode = ncp_destroy_inode, diff --git a/fs/nfs/super.c b/fs/nfs/super.c index 76b980097621..baa28860ad27 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c @@ -82,7 +82,7 @@ struct file_system_type nfs_xdev_fs_type = { .fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA, }; -static struct super_operations nfs_sops = { +static const struct super_operations nfs_sops = { .alloc_inode = nfs_alloc_inode, .destroy_inode = nfs_destroy_inode, .write_inode = nfs_write_inode, @@ -126,7 +126,7 @@ struct file_system_type nfs4_referral_fs_type = { .fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA, }; -static struct super_operations nfs4_sops = { +static const struct super_operations nfs4_sops = { .alloc_inode = nfs_alloc_inode, .destroy_inode = nfs_destroy_inode, .write_inode = nfs_write_inode, diff --git a/fs/ntfs/super.c b/fs/ntfs/super.c index babf94d90def..1594c90b7164 100644 --- a/fs/ntfs/super.c +++ b/fs/ntfs/super.c @@ -2699,7 +2699,7 @@ static int ntfs_statfs(struct dentry *dentry, struct kstatfs *sfs) /** * The complete super operations. */ -static struct super_operations ntfs_sops = { +static const struct super_operations ntfs_sops = { .alloc_inode = ntfs_alloc_big_inode, /* VFS: Allocate new inode. */ .destroy_inode = ntfs_destroy_big_inode, /* VFS: Deallocate inode. */ #ifdef NTFS_RW diff --git a/fs/ocfs2/dlm/dlmfs.c b/fs/ocfs2/dlm/dlmfs.c index 84b33ffb42f1..de952eba29a9 100644 --- a/fs/ocfs2/dlm/dlmfs.c +++ b/fs/ocfs2/dlm/dlmfs.c @@ -61,7 +61,7 @@ #define MLOG_MASK_PREFIX ML_DLMFS #include "cluster/masklog.h" -static struct super_operations dlmfs_ops; +static const struct super_operations dlmfs_ops; static const struct file_operations dlmfs_file_operations; static const struct inode_operations dlmfs_dir_inode_operations; static const struct inode_operations dlmfs_root_inode_operations; @@ -560,7 +560,7 @@ static const struct inode_operations dlmfs_root_inode_operations = { .rmdir = simple_rmdir, }; -static struct super_operations dlmfs_ops = { +static const struct super_operations dlmfs_ops = { .statfs = simple_statfs, .alloc_inode = dlmfs_alloc_inode, .destroy_inode = dlmfs_destroy_inode, diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index 6e300a88a47e..6534f92424dd 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c @@ -116,7 +116,7 @@ static void ocfs2_destroy_inode(struct inode *inode); static unsigned long long ocfs2_max_file_offset(unsigned int blockshift); -static struct super_operations ocfs2_sops = { +static const struct super_operations ocfs2_sops = { .statfs = ocfs2_statfs, .alloc_inode = ocfs2_alloc_inode, .destroy_inode = ocfs2_destroy_inode, diff --git a/fs/openpromfs/inode.c b/fs/openpromfs/inode.c index 327807b86fa1..bde1c164417d 100644 --- a/fs/openpromfs/inode.c +++ b/fs/openpromfs/inode.c @@ -364,7 +364,7 @@ static int openprom_remount(struct super_block *sb, int *flags, char *data) return 0; } -static struct super_operations openprom_sops = { +static const struct super_operations openprom_sops = { .alloc_inode = openprom_alloc_inode, .destroy_inode = openprom_destroy_inode, .read_inode = openprom_read_inode, diff --git a/fs/proc/inode.c b/fs/proc/inode.c index e26945ba685b..f6722be37dde 100644 --- a/fs/proc/inode.c +++ b/fs/proc/inode.c @@ -132,7 +132,7 @@ static int proc_remount(struct super_block *sb, int *flags, char *data) return 0; } -static struct super_operations proc_sops = { +static const struct super_operations proc_sops = { .alloc_inode = proc_alloc_inode, .destroy_inode = proc_destroy_inode, .read_inode = proc_read_inode, diff --git a/fs/qnx4/inode.c b/fs/qnx4/inode.c index c047dc654d5c..83bc8e7824cd 100644 --- a/fs/qnx4/inode.c +++ b/fs/qnx4/inode.c @@ -30,7 +30,7 @@ #define QNX4_VERSION 4 #define QNX4_BMNAME ".bitmap" -static struct super_operations qnx4_sops; +static const struct super_operations qnx4_sops; #ifdef CONFIG_QNX4FS_RW @@ -129,7 +129,7 @@ static void qnx4_read_inode(struct inode *); static int qnx4_remount(struct super_block *sb, int *flags, char *data); static int qnx4_statfs(struct dentry *, struct kstatfs *); -static struct super_operations qnx4_sops = +static const struct super_operations qnx4_sops = { .alloc_inode = qnx4_alloc_inode, .destroy_inode = qnx4_destroy_inode, diff --git a/fs/ramfs/inode.c b/fs/ramfs/inode.c index 7a96b1d662a2..ff1f7639707b 100644 --- a/fs/ramfs/inode.c +++ b/fs/ramfs/inode.c @@ -40,7 +40,7 @@ /* some random number */ #define RAMFS_MAGIC 0x858458f6 -static struct super_operations ramfs_ops; +static const struct super_operations ramfs_ops; static const struct inode_operations ramfs_dir_inode_operations; static struct backing_dev_info ramfs_backing_dev_info = { @@ -155,7 +155,7 @@ static const struct inode_operations ramfs_dir_inode_operations = { .rename = simple_rename, }; -static struct super_operations ramfs_ops = { +static const struct super_operations ramfs_ops = { .statfs = simple_statfs, .drop_inode = generic_delete_inode, }; diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c index 58ad4551a7c1..f13a7f164dc6 100644 --- a/fs/reiserfs/super.c +++ b/fs/reiserfs/super.c @@ -593,7 +593,7 @@ static ssize_t reiserfs_quota_read(struct super_block *, int, char *, size_t, loff_t); #endif -static struct super_operations reiserfs_sops = { +static const struct super_operations reiserfs_sops = { .alloc_inode = reiserfs_alloc_inode, .destroy_inode = reiserfs_destroy_inode, .write_inode = reiserfs_write_inode, diff --git a/fs/romfs/inode.c b/fs/romfs/inode.c index 1e712cc1693b..fd601014813e 100644 --- a/fs/romfs/inode.c +++ b/fs/romfs/inode.c @@ -110,7 +110,7 @@ romfs_checksum(void *data, int size) return sum; } -static struct super_operations romfs_ops; +static const struct super_operations romfs_ops; static int romfs_fill_super(struct super_block *s, void *data, int silent) { @@ -598,7 +598,7 @@ static int romfs_remount(struct super_block *sb, int *flags, char *data) return 0; } -static struct super_operations romfs_ops = { +static const struct super_operations romfs_ops = { .alloc_inode = romfs_alloc_inode, .destroy_inode = romfs_destroy_inode, .read_inode = romfs_read_inode, diff --git a/fs/smbfs/inode.c b/fs/smbfs/inode.c index 84dfe3f3482e..5faba4f1c9ab 100644 --- a/fs/smbfs/inode.c +++ b/fs/smbfs/inode.c @@ -98,7 +98,7 @@ static int smb_remount(struct super_block *sb, int *flags, char *data) return 0; } -static struct super_operations smb_sops = +static const struct super_operations smb_sops = { .alloc_inode = smb_alloc_inode, .destroy_inode = smb_destroy_inode, diff --git a/fs/super.c b/fs/super.c index 3e7458c2bb76..60b1e50cbf53 100644 --- a/fs/super.c +++ b/fs/super.c @@ -285,7 +285,7 @@ int fsync_super(struct super_block *sb) */ void generic_shutdown_super(struct super_block *sb) { - struct super_operations *sop = sb->s_op; + const struct super_operations *sop = sb->s_op; if (sb->s_root) { shrink_dcache_for_umount(sb); diff --git a/fs/sysfs/mount.c b/fs/sysfs/mount.c index f6a87a824883..23a48a38e6af 100644 --- a/fs/sysfs/mount.c +++ b/fs/sysfs/mount.c @@ -21,7 +21,7 @@ struct kmem_cache *sysfs_dir_cachep; static void sysfs_clear_inode(struct inode *inode); -static struct super_operations sysfs_ops = { +static const struct super_operations sysfs_ops = { .statfs = simple_statfs, .drop_inode = sysfs_delete_inode, .clear_inode = sysfs_clear_inode, diff --git a/fs/sysv/inode.c b/fs/sysv/inode.c index 13dd75c4bc85..9311cac186fe 100644 --- a/fs/sysv/inode.c +++ b/fs/sysv/inode.c @@ -327,7 +327,7 @@ static void init_once(void *p, struct kmem_cache *cachep, unsigned long flags) inode_init_once(&si->vfs_inode); } -struct super_operations sysv_sops = { +const struct super_operations sysv_sops = { .alloc_inode = sysv_alloc_inode, .destroy_inode = sysv_destroy_inode, .read_inode = sysv_read_inode, diff --git a/fs/sysv/sysv.h b/fs/sysv/sysv.h index a320edcf541e..5b4fedf17cc4 100644 --- a/fs/sysv/sysv.h +++ b/fs/sysv/sysv.h @@ -165,7 +165,7 @@ extern const struct inode_operations sysv_fast_symlink_inode_operations; extern const struct file_operations sysv_file_operations; extern const struct file_operations sysv_dir_operations; extern const struct address_space_operations sysv_aops; -extern struct super_operations sysv_sops; +extern const struct super_operations sysv_sops; extern struct dentry_operations sysv_dentry_operations; diff --git a/fs/udf/super.c b/fs/udf/super.c index 1dbc2955f02e..8672b88f7ff2 100644 --- a/fs/udf/super.c +++ b/fs/udf/super.c @@ -160,7 +160,7 @@ static void destroy_inodecache(void) } /* Superblock operations */ -static struct super_operations udf_sb_ops = { +static const struct super_operations udf_sb_ops = { .alloc_inode = udf_alloc_inode, .destroy_inode = udf_destroy_inode, .write_inode = udf_write_inode, diff --git a/fs/ufs/super.c b/fs/ufs/super.c index cf74548aa85a..b5a6461ec66b 100644 --- a/fs/ufs/super.c +++ b/fs/ufs/super.c @@ -213,7 +213,7 @@ static void ufs_print_cylinder_stuff(struct super_block *sb, # define ufs_print_cylinder_stuff(sb, cg) /**/ #endif /* CONFIG_UFS_DEBUG */ -static struct super_operations ufs_super_ops; +static const struct super_operations ufs_super_ops; static char error_buf[1024]; @@ -1264,7 +1264,7 @@ static ssize_t ufs_quota_read(struct super_block *, int, char *,size_t, loff_t); static ssize_t ufs_quota_write(struct super_block *, int, const char *, size_t, loff_t); #endif -static struct super_operations ufs_super_ops = { +static const struct super_operations ufs_super_ops = { .alloc_inode = ufs_alloc_inode, .destroy_inode = ufs_destroy_inode, .read_inode = ufs_read_inode, diff --git a/include/linux/fs.h b/include/linux/fs.h index bab891bb2270..86ec3f4a7da6 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -907,7 +907,7 @@ struct super_block { unsigned char s_dirt; unsigned long long s_maxbytes; /* Max file size */ struct file_system_type *s_type; - struct super_operations *s_op; + const struct super_operations *s_op; struct dquot_operations *dq_op; struct quotactl_ops *s_qcop; struct export_operations *s_export_op; @@ -1383,7 +1383,7 @@ struct super_block *sget(struct file_system_type *type, int (*set)(struct super_block *,void *), void *data); extern int get_sb_pseudo(struct file_system_type *, char *, - struct super_operations *ops, unsigned long, + const struct super_operations *ops, unsigned long, struct vfsmount *mnt); extern int simple_set_mnt(struct vfsmount *mnt, struct super_block *sb); int __put_super(struct super_block *sb); -- cgit v1.2.3