summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--inotail.c13
-rw-r--r--inotail.h15
2 files changed, 11 insertions, 17 deletions
diff --git a/inotail.c b/inotail.c
index 670d9fe..877a96d 100644
--- a/inotail.c
+++ b/inotail.c
@@ -289,7 +289,12 @@ static int tail_pipe_from_begin(struct file_struct *f, unsigned long n_units, co
static int tail_pipe_lines(struct file_struct *f, unsigned long n_lines)
{
- struct line_buf *first, *last, *tmp;
+ struct line_buf {
+ char buf[BUFSIZ];
+ size_t n_lines;
+ size_t n_bytes;
+ struct line_buf *next;
+ } *first, *last, *tmp;
int rc;
unsigned long total_lines = 0;
const char *p;
@@ -404,7 +409,11 @@ out:
/* TODO: Merge some parts (especially buffer handling) with tail_pipe_lines() */
static int tail_pipe_bytes(struct file_struct *f, unsigned long n_bytes)
{
- struct char_buf *first, *last, *tmp;
+ struct char_buf {
+ char buf[BUFSIZ];
+ size_t n_bytes;
+ struct char_buf *next;
+ } *first, *last, *tmp;
int rc;
unsigned long total_bytes = 0;
unsigned long i = 0; /* Index into buffer */
diff --git a/inotail.h b/inotail.h
index 93011e6..3d6c232 100644
--- a/inotail.h
+++ b/inotail.h
@@ -28,21 +28,6 @@ struct file_struct {
int i_watch; /* Inotify watch associated with file_struct */
};
-/* struct for linked list of buffers/lines in tail_pipe_lines */
-struct line_buf {
- char buf[BUFSIZ];
- size_t n_lines;
- size_t n_bytes;
- struct line_buf *next;
-};
-
-/* struct for linked list of byte buffers in tail_pipe_bytes */
-struct char_buf {
- char buf[BUFSIZ];
- size_t n_bytes;
- struct char_buf *next;
-};
-
#define IS_PIPELIKE(mode) \
(S_ISFIFO(mode) || S_ISSOCK(mode))
nion dentry is set to the same as the type of the lower dentry. However, if you know d_inode is not NULL at the call site, then you can use the d_is_xxx() functions even in a filesystem. There is one further complication: a 0,0 chardev dentry may be labelled DCACHE_WHITEOUT_TYPE rather than DCACHE_SPECIAL_TYPE. Strictly, this was intended for special directory entry types that don't have attached inodes. The following perl+coccinelle script was used: use strict; my @callers; open($fd, 'git grep -l \'S_IS[A-Z].*->d_inode\' |') || die "Can't grep for S_ISDIR and co. callers"; @callers = <$fd>; close($fd); unless (@callers) { print "No matches\n"; exit(0); } my @cocci = ( '@@', 'expression E;', '@@', '', '- S_ISLNK(E->d_inode->i_mode)', '+ d_is_symlink(E)', '', '@@', 'expression E;', '@@', '', '- S_ISDIR(E->d_inode->i_mode)', '+ d_is_dir(E)', '', '@@', 'expression E;', '@@', '', '- S_ISREG(E->d_inode->i_mode)', '+ d_is_reg(E)' ); my $coccifile = "tmp.sp.cocci"; open($fd, ">$coccifile") || die $coccifile; print($fd "$_\n") || die $coccifile foreach (@cocci); close($fd); foreach my $file (@callers) { chomp $file; print "Processing ", $file, "\n"; system("spatch", "--sp-file", $coccifile, $file, "--in-place", "--no-show-diff") == 0 || die "spatch failed"; } [AV: overlayfs parts skipped] Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> 2014-09-26fs/cachefiles: add missing \n to kerror conversionsFabian Frederick1-15/+15 Commit 0227d6abb378 ("fs/cachefiles: replace kerror by pr_err") didn't include newline featuring in original kerror definition Signed-off-by: Fabian Frederick <fabf@skynet.be> Reported-by: David Howells <dhowells@redhat.com> Acked-by: David Howells <dhowells@redhat.com> Cc: <stable@vger.kernel.org> [3.16.x] Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> 2014-06-06fs/cachefiles: replace kerror by pr_errFabian Frederick1-16/+15 Also add pr_fmt in internal.h Signed-off-by: Fabian Frederick <fabf@skynet.be> Cc: David Howells <dhowells@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>