fix(c/libuv): rename UvFile into File & remove unused File struct
Signed-off-by: hackerchai <i@hackerchai.com>
This commit is contained in:
@@ -47,7 +47,7 @@ func onOpen(req *libuv.Fs) {
|
|||||||
// Init buffer
|
// Init buffer
|
||||||
iov = libuv.InitBuf((*c.Char)(unsafe.Pointer(&buffer[0])), c.Uint(unsafe.Sizeof(buffer)))
|
iov = libuv.InitBuf((*c.Char)(unsafe.Pointer(&buffer[0])), c.Uint(unsafe.Sizeof(buffer)))
|
||||||
// Read the file
|
// Read the file
|
||||||
readRes := libuv.FsRead(loop, &readReq, libuv.UvFile(libuv.FsGetResult(req)), &iov, 1, -1, onRead)
|
readRes := libuv.FsRead(loop, &readReq, libuv.File(libuv.FsGetResult(req)), &iov, 1, -1, onRead)
|
||||||
if readRes != 0 {
|
if readRes != 0 {
|
||||||
c.Printf(c.Str("Error in FsRead: %s (code: %d)\n"), libuv.Strerror(libuv.Errno(readRes)), readRes)
|
c.Printf(c.Str("Error in FsRead: %s (code: %d)\n"), libuv.Strerror(libuv.Errno(readRes)), readRes)
|
||||||
libuv.LoopClose(loop)
|
libuv.LoopClose(loop)
|
||||||
@@ -63,7 +63,7 @@ func onRead(req *libuv.Fs) {
|
|||||||
} else if libuv.FsGetResult(req) == 0 {
|
} else if libuv.FsGetResult(req) == 0 {
|
||||||
c.Printf(c.Str("EOF\n"))
|
c.Printf(c.Str("EOF\n"))
|
||||||
// Close the file
|
// Close the file
|
||||||
closeRes := libuv.FsClose(loop, &closeReq, libuv.UvFile(libuv.FsGetResult(&openReq)), onClose)
|
closeRes := libuv.FsClose(loop, &closeReq, libuv.File(libuv.FsGetResult(&openReq)), onClose)
|
||||||
if closeRes != 0 {
|
if closeRes != 0 {
|
||||||
// Print the content
|
// Print the content
|
||||||
c.Printf(c.Str("Error in FsClose: %s (code: %d)\n"), libuv.Strerror(libuv.Errno(closeRes)), closeRes)
|
c.Printf(c.Str("Error in FsClose: %s (code: %d)\n"), libuv.Strerror(libuv.Errno(closeRes)), closeRes)
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ type FsType c.Int
|
|||||||
|
|
||||||
type DirentType c.Int
|
type DirentType c.Int
|
||||||
|
|
||||||
type UvFile c.Int
|
type File c.Int
|
||||||
|
|
||||||
// ----------------------------------------------
|
// ----------------------------------------------
|
||||||
|
|
||||||
@@ -85,11 +85,6 @@ type Dirent struct {
|
|||||||
Type DirentType
|
Type DirentType
|
||||||
}
|
}
|
||||||
|
|
||||||
type File struct {
|
|
||||||
Loop *Loop
|
|
||||||
Req *Fs
|
|
||||||
}
|
|
||||||
|
|
||||||
type Stat struct {
|
type Stat struct {
|
||||||
Unused [0]byte
|
Unused [0]byte
|
||||||
}
|
}
|
||||||
@@ -139,13 +134,13 @@ func DefaultLoop() *Loop
|
|||||||
func FsOpen(loop *Loop, req *Fs, path *c.Char, flags c.Int, mode c.Int, cb FsCb) c.Int
|
func FsOpen(loop *Loop, req *Fs, path *c.Char, flags c.Int, mode c.Int, cb FsCb) c.Int
|
||||||
|
|
||||||
//go:linkname FsClose C.uv_fs_close
|
//go:linkname FsClose C.uv_fs_close
|
||||||
func FsClose(loop *Loop, req *Fs, file UvFile, cb FsCb) c.Int
|
func FsClose(loop *Loop, req *Fs, file File, cb FsCb) c.Int
|
||||||
|
|
||||||
//go:linkname FsRead C.uv_fs_read
|
//go:linkname FsRead C.uv_fs_read
|
||||||
func FsRead(loop *Loop, req *Fs, file UvFile, bufs *Buf, nbufs c.Uint, offset c.LongLong, cb FsCb) c.Int
|
func FsRead(loop *Loop, req *Fs, file File, bufs *Buf, nbufs c.Uint, offset c.LongLong, cb FsCb) c.Int
|
||||||
|
|
||||||
//go:linkname FsWrite C.uv_fs_write
|
//go:linkname FsWrite C.uv_fs_write
|
||||||
func FsWrite(loop *Loop, req *Fs, file UvFile, bufs *Buf, nbufs c.Uint, offset c.LongLong, cb FsCb) c.Int
|
func FsWrite(loop *Loop, req *Fs, file File, bufs *Buf, nbufs c.Uint, offset c.LongLong, cb FsCb) c.Int
|
||||||
|
|
||||||
//go:linkname FsUnlink C.uv_fs_unlink
|
//go:linkname FsUnlink C.uv_fs_unlink
|
||||||
func FsUnlink(loop *Loop, req *Fs, path *c.Char, cb FsCb) c.Int
|
func FsUnlink(loop *Loop, req *Fs, path *c.Char, cb FsCb) c.Int
|
||||||
@@ -166,19 +161,19 @@ func FsRmdir(loop *Loop, req *Fs, path *c.Char, cb FsCb) c.Int
|
|||||||
func FsStat(loop *Loop, req *Fs, path *c.Char, cb FsCb) c.Int
|
func FsStat(loop *Loop, req *Fs, path *c.Char, cb FsCb) c.Int
|
||||||
|
|
||||||
//go:linkname FsFstat C.uv_fs_fstat
|
//go:linkname FsFstat C.uv_fs_fstat
|
||||||
func FsFstat(loop *Loop, req *Fs, file UvFile, cb FsCb) c.Int
|
func FsFstat(loop *Loop, req *Fs, file File, cb FsCb) c.Int
|
||||||
|
|
||||||
//go:linkname FsRename C.uv_fs_rename
|
//go:linkname FsRename C.uv_fs_rename
|
||||||
func FsRename(loop *Loop, req *Fs, path *c.Char, newPath *c.Char, cb FsCb) c.Int
|
func FsRename(loop *Loop, req *Fs, path *c.Char, newPath *c.Char, cb FsCb) c.Int
|
||||||
|
|
||||||
//go:linkname FsFsync C.uv_fs_fsync
|
//go:linkname FsFsync C.uv_fs_fsync
|
||||||
func FsFsync(loop *Loop, req *Fs, file UvFile, cb FsCb) c.Int
|
func FsFsync(loop *Loop, req *Fs, file File, cb FsCb) c.Int
|
||||||
|
|
||||||
//go:linkname FsFdatasync C.uv_fs_fdatasync
|
//go:linkname FsFdatasync C.uv_fs_fdatasync
|
||||||
func FsFdatasync(loop *Loop, req *Fs, file UvFile, cb FsCb) c.Int
|
func FsFdatasync(loop *Loop, req *Fs, file File, cb FsCb) c.Int
|
||||||
|
|
||||||
//go:linkname FsFtruncate C.uv_fs_ftruncate
|
//go:linkname FsFtruncate C.uv_fs_ftruncate
|
||||||
func FsFtruncate(loop *Loop, req *Fs, file UvFile, offset c.LongLong, cb FsCb) c.Int
|
func FsFtruncate(loop *Loop, req *Fs, file File, offset c.LongLong, cb FsCb) c.Int
|
||||||
|
|
||||||
//go:linkname FsSendfile C.uv_fs_sendfile
|
//go:linkname FsSendfile C.uv_fs_sendfile
|
||||||
func FsSendfile(loop *Loop, req *Fs, outFd c.Int, inFd c.Int, inOffset c.LongLong, length c.Int, cb FsCb) c.Int
|
func FsSendfile(loop *Loop, req *Fs, outFd c.Int, inFd c.Int, inOffset c.LongLong, length c.Int, cb FsCb) c.Int
|
||||||
@@ -190,13 +185,13 @@ func FsAccess(loop *Loop, req *Fs, path *c.Char, flags c.Int, cb FsCb) c.Int
|
|||||||
func FsChmod(loop *Loop, req *Fs, path *c.Char, mode c.Int, cb FsCb) c.Int
|
func FsChmod(loop *Loop, req *Fs, path *c.Char, mode c.Int, cb FsCb) c.Int
|
||||||
|
|
||||||
//go:linkname FsFchmod C.uv_fs_fchmod
|
//go:linkname FsFchmod C.uv_fs_fchmod
|
||||||
func FsFchmod(loop *Loop, req *Fs, file UvFile, mode c.Int, cb FsCb) c.Int
|
func FsFchmod(loop *Loop, req *Fs, file File, mode c.Int, cb FsCb) c.Int
|
||||||
|
|
||||||
//go:linkname FsUtime C.uv_fs_utime
|
//go:linkname FsUtime C.uv_fs_utime
|
||||||
func FsUtime(loop *Loop, req *Fs, path *c.Char, atime c.Int, mtime c.Int, cb FsCb) c.Int
|
func FsUtime(loop *Loop, req *Fs, path *c.Char, atime c.Int, mtime c.Int, cb FsCb) c.Int
|
||||||
|
|
||||||
//go:linkname FsFutime C.uv_fs_futime
|
//go:linkname FsFutime C.uv_fs_futime
|
||||||
func FsFutime(loop *Loop, req *Fs, file UvFile, atime c.Int, mtime c.Int, cb FsCb) c.Int
|
func FsFutime(loop *Loop, req *Fs, file File, atime c.Int, mtime c.Int, cb FsCb) c.Int
|
||||||
|
|
||||||
//go:linkname FsLutime C.uv_fs_lutime
|
//go:linkname FsLutime C.uv_fs_lutime
|
||||||
func FsLutime(loop *Loop, req *Fs, path *c.Char, atime c.Int, mtime c.Int, cb FsCb) c.Int
|
func FsLutime(loop *Loop, req *Fs, path *c.Char, atime c.Int, mtime c.Int, cb FsCb) c.Int
|
||||||
@@ -238,7 +233,7 @@ func FsStatfs(loop *Loop, req *Fs, path *c.Char, cb FsCb) c.Int
|
|||||||
func FsChown(loop *Loop, req *Fs, path *c.Char, uid c.Int, gid c.Int, cb FsCb) c.Int
|
func FsChown(loop *Loop, req *Fs, path *c.Char, uid c.Int, gid c.Int, cb FsCb) c.Int
|
||||||
|
|
||||||
//go:linkname FsFchown C.uv_fs_fchown
|
//go:linkname FsFchown C.uv_fs_fchown
|
||||||
func FsFchown(loop *Loop, req *Fs, file UvFile, uid c.Int, gid c.Int, cb FsCb) c.Int
|
func FsFchown(loop *Loop, req *Fs, file File, uid c.Int, gid c.Int, cb FsCb) c.Int
|
||||||
|
|
||||||
//go:linkname FsLchown C.uv_fs_lchown
|
//go:linkname FsLchown C.uv_fs_lchown
|
||||||
func FsLchown(loop *Loop, req *Fs, path *c.Char, uid c.Int, gid c.Int, cb FsCb) c.Int
|
func FsLchown(loop *Loop, req *Fs, path *c.Char, uid c.Int, gid c.Int, cb FsCb) c.Int
|
||||||
|
|||||||
@@ -297,7 +297,7 @@ func (handle *Handle) Fileno(fd *OsFd) c.Int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//go:linkname UvPipe C.uv_pipe
|
//go:linkname UvPipe C.uv_pipe
|
||||||
func UvPipe(fds [2]UvFile, readFlags c.Int, writeFlags c.Int) c.Int {
|
func UvPipe(fds [2]File, readFlags c.Int, writeFlags c.Int) c.Int {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user