'\" t .\" Title: seq_open .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.79.1 .\" Date: September 2017 .\" Manual: The Linux VFS .\" Source: Kernel Hackers Manual 4.12.13 .\" Language: English .\" .TH "SEQ_OPEN" "9" "September 2017" "Kernel Hackers Manual 4\&.12\&" "The Linux VFS" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" seq_open \- initialize sequential file .SH "SYNOPSIS" .HP \w'int\ seq_open('u .BI "int seq_open(struct\ file\ *\ " "file" ", const\ struct\ seq_operations\ *\ " "op" ");" .SH "ARGUMENTS" .PP \fIstruct file * file\fR .RS 4 file we initialize .RE .PP \fIconst struct seq_operations * op\fR .RS 4 method table describing the sequence .RE .SH "DESCRIPTION" .PP \fBseq_open\fR sets \fIfile\fR, associating it with a sequence described by \fIop\fR\&. \fIop\fR\->\fBstart\fR sets the iterator up and returns the first element of sequence\&. \fIop\fR\->\fBstop\fR shuts it down\&. \fIop\fR\->\fBnext\fR returns the next element of sequence\&. \fIop\fR\->\fBshow\fR prints element into the buffer\&. In case of error \->\fBstart\fR and \->\fBnext\fR return ERR_PTR(error)\&. In the end of sequence they return \fBNULL\fR\&. \->\fBshow\fR returns 0 in case of success and negative number in case of error\&. Returning SEQ_SKIP means \(lqdiscard this element and move on\(rq\&. .SH "NOTE" .PP \fBseq_open\fR will allocate a struct seq_file and store its pointer in \fIfile\fR\->private_data\&. This pointer should not be modified\&. .SH "COPYRIGHT" .br