summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2007-04-16 11:04:49 +0200
committerTobias Klauser <tklauser@xenon.tklauser.home>2007-04-16 11:04:49 +0200
commitb65101beb4db64847d9bd2b770fe55521b97c8ed (patch)
tree4e37b96dbf4920f335f46c050891bddd0b712cee
parentd7a9bccc00f2bc34dacd216ffd1a9bfa3bfa39fa (diff)
inotail.c: Really fix byte_to_offset() this time
Also make a bit more readable
-rw-r--r--inotail.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/inotail.c b/inotail.c
index 0c278e2..6f8be7c 100644
--- a/inotail.c
+++ b/inotail.c
@@ -198,12 +198,18 @@ static off_t lines_to_offset(struct file_struct *f, unsigned long n_lines)
static off_t bytes_to_offset(struct file_struct *f, unsigned long n_bytes)
{
- /* tail everything for 'inotail -c +0' or if n_bytes greater than the
- * total amount of chars in the file */
- if ((from_begin && n_bytes == 0) || ((off_t) n_bytes > f->st_size))
- return 0;
- else
- return (from_begin ? ((off_t) n_bytes - 1) : (f->st_size - (off_t) n_bytes));
+ off_t offset = 0;
+
+ /* tail everything for 'inotail -c +0' */
+ if (from_begin) {
+ if (n_bytes > 0)
+ offset = (off_t) n_bytes - 1;
+ } else {
+ if ((off_t) n_bytes < f->st_size)
+ offset = f->st_size - (off_t) n_bytes;
+ }
+
+ return offset;
}
static ssize_t tail_pipe(struct file_struct *f)
ksum Offload". Basically, for a tunneled packet the checksum of the outer header is 'constant' (because with the checksum field filled into the inner protocol header, the payload of the outer frame checksums to 'zero'), and we can take advantage of that in various ways. From Edward Cree" * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1548 commits) bonding: fix bond_get_stats() net: bcmgenet: fix dma api length mismatch net/mlx4_core: Fix backward compatibility on VFs phy: mdio-thunder: Fix some Kconfig typos lan78xx: add ndo_get_stats64 lan78xx: handle statistics counter rollover RDS: TCP: Remove unused constant RDS: TCP: Add sysctl tunables for sndbuf/rcvbuf on rds-tcp socket net: smc911x: convert pxa dma to dmaengine team: remove duplicate set of flag IFF_MULTICAST bonding: remove duplicate set of flag IFF_MULTICAST net: fix a comment typo ethernet: micrel: fix some error codes ip_tunnels, bpf: define IP_TUNNEL_OPTS_MAX and use it bpf, dst: add and use dst_tclassid helper bpf: make skb->tc_classid also readable net: mvneta: bm: clarify dependencies cls_bpf: reset class and reuse major in da ldmvsw: Checkpatch sunvnet.c and sunvnet_common.c ldmvsw: Add ldmvsw.c driver code ...
Diffstat (limited to 'net/nfc')
-rw-r--r--net/nfc/llcp_commands.c4
-rw-r--r--net/nfc/llcp_sock.c6
2 files changed, 8 insertions, 2 deletions
diff --git a/net/nfc/llcp_commands.c b/net/nfc/llcp_commands.c