From f085c198ba2dd95ce46a66ec8f8e6b472c3cca14 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Sat, 29 Oct 2016 16:06:40 -0600 Subject: sys: replace FileoffType with IntType{Kind: IntFileoff} FileoffType is effectively an int, no need for a separate type. Also remove fd option from fileoff as it is unused and use story is unclear. --- sys/README.md | 5 ++--- sys/decl.go | 18 ++---------------- sys/sys.txt | 18 +++++++++--------- 3 files changed, 13 insertions(+), 28 deletions(-) (limited to 'sys') diff --git a/sys/README.md b/sys/README.md index 18b3c76ab..28b1b712a 100644 --- a/sys/README.md +++ b/sys/README.md @@ -23,7 +23,7 @@ Pseudo-formal grammar of syscall description: type = typename [ "[" type-options "]" ] typename = "const" | "intN" | "intptr" | "flags" | "array" | "ptr" | "buffer" | "string" | "strconst" | "filename" | - "fileoff" | "len" | "bytesize" | "vma" + "len" | "bytesize" | "vma" type-options = [type-opt ["," type-opt]] ``` common type-options include: @@ -48,8 +48,7 @@ rest of the type-options are type-specific: "strconst": a pointer to a constant string, type-options: the underlying string (for example "/dev/dsp") "filename": a file/link/dir name - "fileoff": offset within a file, type-options: - argname of the file + "fileoff": offset within a file "len": length of another field (for array it is number of elements), type-options: argname of the object "bytesize": similar to "len", but always denotes the size in bytes, type-options: diff --git a/sys/decl.go b/sys/decl.go index 997298e8a..d5ec9a547 100644 --- a/sys/decl.go +++ b/sys/decl.go @@ -97,21 +97,6 @@ func (t *ResourceType) Align() uintptr { return t.Desc.Type.Align() } -type FileoffType struct { - TypeCommon - TypeSize uintptr - BigEndian bool - File string -} - -func (t *FileoffType) Size() uintptr { - return t.TypeSize -} - -func (t *FileoffType) Align() uintptr { - return t.Size() -} - type BufferKind int const ( @@ -232,6 +217,7 @@ const ( IntSignalno IntInaddr IntInport + IntFileoff // offset within a file IntRange ) @@ -500,7 +486,7 @@ func ForeachType(meta *Call, f func(Type)) { for _, opt := range a.Options { rec(opt) } - case *ResourceType, *FileoffType, *BufferType, + case *ResourceType, *BufferType, *VmaType, *LenType, *FlagsType, *ConstType, *StrConstType, *IntType: default: diff --git a/sys/sys.txt b/sys/sys.txt index be0d10860..8ac03e8dc 100644 --- a/sys/sys.txt +++ b/sys/sys.txt @@ -79,14 +79,14 @@ openat(fd fd_dir, file filename, flags flags[open_flags], mode flags[open_mode]) creat(file filename, mode flags[open_mode]) fd close(fd fd) read(fd fd, buf buffer[out], count len[buf]) len[buf] -pread64(fd fd, buf buffer[out], count len[buf], pos fileoff[fd]) +pread64(fd fd, buf buffer[out], count len[buf], pos fileoff) readv(fd fd, vec ptr[in, array[iovec_out]], vlen len[vec]) -preadv(fd fd, vec ptr[in, array[iovec_out]], vlen len[vec], off fileoff[fd]) +preadv(fd fd, vec ptr[in, array[iovec_out]], vlen len[vec], off fileoff) write(fd fd, buf buffer[in], count len[buf]) len[buf] -pwrite64(fd fd, buf buffer[in], count len[buf], pos fileoff[fd]) +pwrite64(fd fd, buf buffer[in], count len[buf], pos fileoff) writev(fd fd, vec ptr[in, array[iovec_in]], vlen len[vec]) -pwritev(fd fd, vec ptr[in, array[iovec_in]], vlen len[vec], off fileoff[fd]) -lseek(fd fd, offset fileoff[fd], whence flags[seek_whence]) +pwritev(fd fd, vec ptr[in, array[iovec_in]], vlen len[vec], off fileoff) +lseek(fd fd, offset fileoff, whence flags[seek_whence]) dup(oldfd fd) fd dup2(oldfd fd, newfd fd) fd @@ -96,9 +96,9 @@ pipe(pipefd ptr[out, pipefd]) pipe2(pipefd ptr[out, pipefd], flags flags[pipe_flags]) tee(fdin fd, fdout fd, len int64, f flags[splice_flags]) -splice(fdin fd, offin fileoff[fdin], fdout fd, offout fileoff[fdout], len int64, f flags[splice_flags]) +splice(fdin fd, offin fileoff, fdout fd, offout fileoff, len int64, f flags[splice_flags]) vmsplice(fd fd, vec ptr[in, array[iovec_in]], vlen len[vec], f flags[splice_flags]) -sendfile(fdout fd, fdin fd, off ptr[inout, fileoff[fdin, int64], opt], count int64) +sendfile(fdout fd, fdin fd, off ptr[inout, fileoff[int64], opt], count int64) stat(file filename, statbuf ptr[out, stat]) lstat(file filename, statbuf ptr[out, stat]) @@ -136,14 +136,14 @@ ioctl$UFFDIO_WAKE(fd fd_uffd, cmd const[UFFDIO_WAKE], arg ptr[in, uffdio_range]) ioctl$UFFDIO_COPY(fd fd_uffd, cmd const[UFFDIO_WAKE], arg ptr[in, uffdio_range]) ioctl$UFFDIO_ZEROPAGE(fd fd_uffd, cmd const[UFFDIO_WAKE], arg ptr[in, uffdio_range]) -mmap(addr vma, len len[addr], prot flags[mmap_prot], flags flags[mmap_flags], fd fd, offset fileoff[fd]) vma +mmap(addr vma, len len[addr], prot flags[mmap_prot], flags flags[mmap_flags], fd fd, offset fileoff) vma munmap(addr vma, len len[addr]) mremap(addr vma, len len[addr], newlen len[newaddr], flags flags[mremap_flags], newaddr vma) vma remap_file_pages(addr vma, size len[addr], prot flags[mmap_prot], pgoff intptr, flags flags[mmap_flags]) mprotect(addr vma, len len[addr], prot flags[mmap_prot]) msync(addr vma, len len[addr], f flags[msync_flags]) madvise(addr vma, len len[addr], advice flags[madvise_flags]) -fadvise64(fd fd, offset fileoff[fd], len intptr, advice flags[fadvise_flags]) +fadvise64(fd fd, offset fileoff, len intptr, advice flags[fadvise_flags]) readahead(fd fd, off intptr, count intptr) mbind(addr vma, len len[addr], mode flags[mbind_mode], nodemask ptr[in, int64], maxnode intptr, flags flags[mbind_flags]) move_pages(pid pid, nr len[pages], pages ptr[in, array[vma]], nodes ptr[in, array[int32], opt], status ptr[out, array[int32]], flags flags[move_pages_flags]) -- cgit mrf-deployment