[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: GCC 3.4 fixes and small io_seek fix
From: |
Jeroen Dekkers |
Subject: |
Re: GCC 3.4 fixes and small io_seek fix |
Date: |
Sat, 08 May 2004 15:33:17 +0200 |
User-agent: |
Wanderlust/2.10.1 (Watching The Wheels) SEMI/1.14.6 (Maruoka) FLIM/1.14.6 (Marutamachi) APEL/10.6 Emacs/21.3.50 (i686-pc-linux-gnu) MULE/5.0 (SAKAKI) |
At Fri, 7 May 2004 17:39:34 -0400 (EDT),
Roland McGrath wrote:
>
> > + (void)0; /* Silence GCC error. */
>
> Just use "break;" here (or ";" if not in a loop/switch), and no comment.
>
> > - /* CHECKSUM_UNNECESSARY */
> > + break; /* CHECKSUM_UNNECESSARY */
>
> Just insert the new line, don't modify the old line.
>
> > + if (pos < 0)
> > + err = EINVAL;
> > +
> > if (! err)
> > - *new_offs = op->offs;
> > + *new_offs = op->offs = pos;
>
> Use else.
Here is a new version of the patch:
libstore/
2004-05-08 Jeroen Dekkers <jeroen@dekkers.cx>
* libstore/store.h (STORE_STD_CLASS): Use attribute(used) instead
of unused.
pfinet/
2004-05-08 Jeroen Dekkers <jeroen@dekkers.cx>
* pfinet/linux-src/net/ipv4/arp.c (arp_constructor): Fight "label
at end of compound statement" error.
* pfinet/linux-src/net/ipv4/route.c (ip_rt_redirect): Likewise.
* pfinet/linux-src/net/ipv4/udp.c (udp_v4_get_port): Likewise.
* pfinet/linux-src/net/ipv4/tcp_ipv4.c (tcp_v4_get_port): Likewise.
(tcp_v4_rcv): Likewise.
(tcp_v4_connect): Pass __FUNCTION__ as argument to printk().
trans/
2004-05-08 Jeroen Dekkers <jeroen@dekkers.cx>
* trans/hello-mt.c (trivfs_S_io_seek): Return EINVAL when
resulting file position is smaller than 0.
* trans/hello.c (trivfs_S_io_seek): Likewise.
storio/
2004-05-08 Jeroen Dekkers <jeroen@dekkers.cx>
* storeio/open.c (open_seek): Return EINVAL when
resulting file position is smaller than 0.
libnetfs/
2004-05-08 Jeroen Dekkers <jeroen@dekkers.cx>
* libnetfs/io-seek.c (netfs_S_io_seek): Return EINVAL when
resulting file position is smaller than 0.
libdiskfs/
2004-05-08 Jeroen Dekkers <jeroen@dekkers.cx>
* libdiskfs/io-seek.c (diskfs_S_io_seek): Return EINVAL when
resulting file position is smaller than 0.
Index: libstore/store.h
===================================================================
RCS file: /cvsroot/hurd/hurd/libstore/store.h,v
retrieving revision 1.45
diff -u -p -r1.45 store.h
--- libstore/store.h 3 Dec 2002 17:47:06 -0000 1.45
+++ libstore/store.h 8 May 2004 09:56:23 -0000
@@ -1,6 +1,6 @@
/* Store I/O
- Copyright (C) 1995,96,97,98,99,2001,02 Free Software Foundation, Inc.
+ Copyright (C) 1995,96,97,98,99,2001,02,04 Free Software Foundation, Inc.
Written by Miles Bader <miles@gnu.org>
This file is part of the GNU Hurd.
@@ -627,7 +627,7 @@ extern const struct store_class store_mv
#define STORE_STD_CLASS(name) \
static const struct store_class *const store_std_classes_##name[] \
- __attribute__ ((unused, section ("store_std_classes"))) \
+ __attribute__ ((used, section ("store_std_classes"))) \
= { &store_##name##_class }
extern const struct store_class *const __start_store_std_classes[];
Index: pfinet/linux-src/net/ipv4/arp.c
===================================================================
RCS file: /cvsroot/hurd/hurd/pfinet/linux-src/net/ipv4/arp.c,v
retrieving revision 1.4
diff -u -p -r1.4 arp.c
--- pfinet/linux-src/net/ipv4/arp.c 5 Feb 2000 12:24:31 -0000 1.4
+++ pfinet/linux-src/net/ipv4/arp.c 8 May 2004 09:56:23 -0000
@@ -264,8 +264,8 @@ static int arp_constructor(struct neighb
switch (dev->type) {
default:
break;
- case ARPHRD_ROSE:
#if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE)
+ case ARPHRD_ROSE:
case ARPHRD_AX25:
#if defined(CONFIG_NETROM) || defined(CONFIG_NETROM_MODULE)
case ARPHRD_NETROM:
Index: pfinet/linux-src/net/ipv4/route.c
===================================================================
RCS file: /cvsroot/hurd/hurd/pfinet/linux-src/net/ipv4/route.c,v
retrieving revision 1.1.1.3
diff -u -p -r1.1.1.3 route.c
--- pfinet/linux-src/net/ipv4/route.c 5 Feb 2000 12:21:16 -0000 1.1.1.3
+++ pfinet/linux-src/net/ipv4/route.c 8 May 2004 09:56:23 -0000
@@ -712,7 +712,6 @@ void ip_rt_redirect(u32 old_gw, u32 dadd
}
}
}
- return;
reject_redirect:
#ifdef CONFIG_IP_ROUTE_VERBOSE
@@ -722,6 +721,7 @@ reject_redirect:
ntohl(old_gw), dev->name, ntohl(new_gw),
ntohl(saddr), ntohl(daddr), tos);
#endif
+ return;
}
static struct dst_entry *ipv4_negative_advice(struct dst_entry *dst)
Index: pfinet/linux-src/net/ipv4/tcp_ipv4.c
===================================================================
RCS file: /cvsroot/hurd/hurd/pfinet/linux-src/net/ipv4/tcp_ipv4.c,v
retrieving revision 1.1.1.3
diff -u -p -r1.1.1.3 tcp_ipv4.c
--- pfinet/linux-src/net/ipv4/tcp_ipv4.c 5 Feb 2000 12:21:16 -0000
1.1.1.3
+++ pfinet/linux-src/net/ipv4/tcp_ipv4.c 8 May 2004 09:56:23 -0000
@@ -228,6 +228,7 @@ static int tcp_v4_get_port(struct sock *
goto next;
break;
next:
+ ;
} while (--remaining > 0);
tcp_port_rover = rover;
@@ -592,7 +593,7 @@ int tcp_v4_connect(struct sock *sk, stru
if (usin->sin_family)
return(-EAFNOSUPPORT);
if (!complained++)
- printk(KERN_DEBUG "%s forgot to set AF_INET in "
__FUNCTION__ "\n", current->comm);
+ printk(KERN_DEBUG "%s forgot to set AF_INET in %s\n",
current->comm, __FUNCTION__);
}
nexthop = daddr = usin->sin_addr.s_addr;
@@ -1729,6 +1730,7 @@ int tcp_v4_rcv(struct sk_buff *skb, unsi
}
default:
/* CHECKSUM_UNNECESSARY */
+ break;
}
if((th->doff * 4) < sizeof(struct tcphdr) ||
Index: pfinet/linux-src/net/ipv4/udp.c
===================================================================
RCS file: /cvsroot/hurd/hurd/pfinet/linux-src/net/ipv4/udp.c,v
retrieving revision 1.2
diff -u -p -r1.2 udp.c
--- pfinet/linux-src/net/ipv4/udp.c 4 Feb 2000 06:32:39 -0000 1.2
+++ pfinet/linux-src/net/ipv4/udp.c 8 May 2004 09:56:23 -0000
@@ -157,6 +157,7 @@ static int udp_v4_get_port(struct sock *
best_size_so_far = size;
best = result;
next:
+ ;
}
result = best;
for(;; result += UDP_HTABLE_SIZE) {
Index: trans/hello-mt.c
===================================================================
RCS file: /cvsroot/hurd/hurd/trans/hello-mt.c,v
retrieving revision 1.4
diff -u -p -r1.4 hello-mt.c
--- trans/hello-mt.c 13 Jun 2002 21:26:39 -0000 1.4
+++ trans/hello-mt.c 8 May 2004 09:57:53 -0000
@@ -1,5 +1,5 @@
/* hello-mt.c - A trivial single-file translator, multithreaded version
- Copyright (C) 1998,99,2001,02 Free Software Foundation, Inc.
+ Copyright (C) 1998,99,2001,02,04 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -186,6 +186,7 @@ trivfs_S_io_seek (struct trivfs_protid *
{
struct open *op;
error_t err = 0;
+ off_t pos;
if (! cred)
return EOPNOTSUPP;
@@ -196,18 +197,23 @@ trivfs_S_io_seek (struct trivfs_protid *
switch (whence)
{
case SEEK_SET:
- op->offs = offs; break;
+ pos = offs; break;
case SEEK_CUR:
- op->offs += offs; break;
+ pos = op->offs + offs; break;
case SEEK_END:
- op->offs = contents_len - offs; break;
+ pos = contents_len + offs; break;
default:
err = EINVAL;
}
if (! err)
- *new_offs = op->offs;
-
+ {
+ if (pos < 0)
+ err = EINVAL;
+ else
+ *new_offs = op->offs = pos;
+ }
+
mutex_unlock (&op->lock);
return err;
Index: trans/hello.c
===================================================================
RCS file: /cvsroot/hurd/hurd/trans/hello.c,v
retrieving revision 1.5
diff -u -p -r1.5 hello.c
--- trans/hello.c 13 Jun 2002 21:26:39 -0000 1.5
+++ trans/hello.c 8 May 2004 09:57:53 -0000
@@ -1,5 +1,5 @@
/* hello.c - A trivial single-file translator
- Copyright (C) 1998, 1999,2001,02 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999,2001,02,04 Free Software Foundation, Inc.
Gordon Matzigkeit <gord@fig.org>, 1999
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -165,6 +165,7 @@ trivfs_S_io_seek (struct trivfs_protid *
{
struct open *op;
error_t err = 0;
+ off_t pos;
if (! cred)
return EOPNOTSUPP;
@@ -172,18 +173,23 @@ trivfs_S_io_seek (struct trivfs_protid *
switch (whence)
{
case SEEK_SET:
- op->offs = offs; break;
+ pos = offs; break;
case SEEK_CUR:
- op->offs += offs; break;
+ pos = op->offs + offs; break;
case SEEK_END:
- op->offs = contents_len - offs; break;
+ pos = contents_len + offs; break;
default:
err = EINVAL;
}
if (! err)
- *new_offs = op->offs;
-
+ {
+ if (pos < 0)
+ err = EINVAL;
+ else
+ *new_offs = op->offs = pos;
+ }
+
return err;
}
Index: storeio/open.c
===================================================================
RCS file: /cvsroot/hurd/hurd/storeio/open.c,v
retrieving revision 1.2
diff -u -p -r1.2 open.c
--- storeio/open.c 23 Sep 1996 19:58:26 -0000 1.2
+++ storeio/open.c 8 May 2004 09:57:53 -0000
@@ -1,6 +1,6 @@
/* Per-open information for storeio
- Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1996, 2004 Free Software Foundation, Inc.
Written by Miles Bader <miles@gnu.ai.mit.edu>
@@ -100,24 +100,30 @@ error_t
open_seek (struct open *open, off_t offs, int whence, off_t *new_offs)
{
error_t err = 0;
+ off_t pos;
mutex_lock (&open->lock);
switch (whence)
{
case SEEK_SET:
- open->offs = offs; break;
+ pos = offs; break;
case SEEK_CUR:
- open->offs += offs; break;
+ pos = open->offs + offs; break;
case SEEK_END:
- open->offs = open->dev->store->size - offs; break;
+ pos = open->dev->store->size + offs; break;
default:
err = EINVAL;
}
if (! err)
- *new_offs = open->offs;
-
+ {
+ if (pos < 0)
+ err = EINVAL;
+ else
+ *new_offs = open->offs = pos;
+ }
+
mutex_unlock (&open->lock);
return err;
Index: libnetfs/io-seek.c
===================================================================
RCS file: /cvsroot/hurd/hurd/libnetfs/io-seek.c,v
retrieving revision 1.7
diff -u -p -r1.7 io-seek.c
--- libnetfs/io-seek.c 30 Dec 2000 18:22:28 -0000 1.7
+++ libnetfs/io-seek.c 8 May 2004 09:57:53 -0000
@@ -1,5 +1,5 @@
/*
- Copyright (C) 1995, 1996, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1996, 2000, 2004 Free Software Foundation, Inc.
Written by Michael I. Bushnell, p/BSG.
This file is part of the GNU Hurd.
@@ -28,7 +28,8 @@ netfs_S_io_seek (struct protid *user,
int whence,
off_t *newoffset)
{
- error_t err;
+ error_t err = 0;
+ off_t pos;
if (!user)
return EOPNOTSUPP;
@@ -36,13 +37,11 @@ netfs_S_io_seek (struct protid *user,
switch (whence)
{
case SEEK_SET:
- err = 0;
- user->po->filepointer = offset;
+ pos = offset;
break;
case SEEK_CUR:
- err = 0;
- user->po->filepointer += offset;
+ pos = user->po->filepointer + offset;
break;
case SEEK_END:
@@ -54,7 +53,7 @@ netfs_S_io_seek (struct protid *user,
err = netfs_validate_stat (np, user->user);
if (!err)
- user->po->filepointer = np->nn_stat.st_size + offset;
+ pos = np->nn_stat.st_size + offset;
mutex_unlock (&np->lock);
@@ -66,7 +65,14 @@ netfs_S_io_seek (struct protid *user,
break;
}
- *newoffset = user->po->filepointer;
+ if (!err)
+ {
+ if (pos < 0)
+ err = EINVAL;
+ else
+ *newoffset = user->po->filepointer = pos;
+ }
+
return err;
}
Index: libdiskfs/io-seek.c
===================================================================
RCS file: /cvsroot/hurd/hurd/libdiskfs/io-seek.c,v
retrieving revision 1.7
diff -u -p -r1.7 io-seek.c
--- libdiskfs/io-seek.c 18 Jul 2000 21:33:33 -0000 1.7
+++ libdiskfs/io-seek.c 8 May 2004 09:57:53 -0000
@@ -1,5 +1,5 @@
/*
- Copyright (C) 1994, 1995, 1996, 2000 Free Software Foundation
+ Copyright (C) 1994, 1995, 1996, 2000, 2004 Free Software Foundation
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -28,6 +28,7 @@ diskfs_S_io_seek (struct protid *cred,
{
error_t err = 0;
struct node *np;
+ off_t pos;
if (!cred)
return EOPNOTSUPP;
@@ -40,20 +41,27 @@ diskfs_S_io_seek (struct protid *cred,
switch (whence)
{
case SEEK_SET:
- cred->po->filepointer = offset;
+ pos = offset;
break;
case SEEK_CUR:
- cred->po->filepointer += offset;
+ pos = cred->po->filepointer + offset;
break;
case SEEK_END:
- cred->po->filepointer = (np->dn_stat.st_size + offset);
+ pos = (np->dn_stat.st_size + offset);
break;
default:
err = EINVAL;
break;
}
- *newoffset = cred->po->filepointer;
+ if (!err)
+ {
+ if (pos < 0)
+ err = EINVAL;
+ else
+ *newoffset = cred->po->filepointer = pos;
+ }
+
mutex_unlock (&np->lock);
return err;
}