Commit Graph

7 Commits

Author SHA1 Message Date
muagarwa 27a1824ca0 cephfs: implement wrappers for fchmod and fchown
Fchmod() implemenets ceph_fchmod()
Fchown() implements ceph_fchown()
To fix: https://github.com/ceph/go-ceph/issues/240

Signed-off-by: Mudit Agarwal muagarwa@redhat.com
2020-05-07 09:43:05 +02:00
John Mulligan 7b2e18b5e1 cephfs: reject negative offsets for ReadAt/WriteAt
Negative offsets that are passed through ReadAt/WriteAt to the ceph
calls cause them to behave like Read/Write and this is undesirable
at the go layer. Additionally, the os packages' file functions
reject negative offsets as well.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-04-28 17:49:49 +02:00
John Mulligan f7936e4ac4 cephfs: add a test to ensure behavior of mixed use of Read + ReadAt
Add a test case to ensure the behavior of a mixed used [1] of Read
and ReadAt calls is consistent and ReadAt doesn't side effect
the file position used by Read.

1 - Not recommended, but we should not break now or in the future.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-04-28 17:49:49 +02:00
John Mulligan 938506e1d3 cephfs: have Read/ReadAt return io.EOF error when nothing is read
Have Read and ReadAt functions return io.EOF when nothing is read
from the file so that it matches the current behavior of file types
in Go standard library.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-04-28 17:49:49 +02:00
John Mulligan 1899072b27 cephfs: add additional error handling and state checks to file funcs
Now, the close function is idempotent wrt being called multiple times
on a valid file. Additionally, check the state of the file in various
functions to produce sensible errors, matching those cephfs itself
returns, if the object was not constructed properly.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-04-28 17:49:49 +02:00
John Mulligan c37ec2104a cephfs: add an Unlink func implmenting ceph_unlink
The unlink function can now be used to clean up files from the other
existing test cases.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-04-28 17:49:49 +02:00
John Mulligan 854a834b1c cephfs: implement file IO functions for open/close/read/write/seek
Implement core file I/O functions based on a file handle wrapper.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-04-28 17:49:49 +02:00