search for: do_read

Displaying 20 results from an estimated 29 matches for "do_read".

Did you mean: io_read
2007 Dec 07
0
weird behavior of mocking ruby class methods
Hello everyone: After I played with Rspec for three months, I realized a weird behavior of mocking ruby classes (e.g. File). Please let me post a sample code before I point out the problems: #file_reader.rb (to be tested) class FileReader def do_read File.read(''asd.txt'') end end #file_reader_spec.rb describe FileReader, "do_read" do it "should throw File Not Found on non-existent file" do reader = FileReader.new() lambda { reader.do_read }.should raise_error(Er...
2016 Oct 28
3
Samba and BTRFS server-side copy
On Thu, Oct 27, 2016 at 05:22:14PM -0700, Jeremy Allison via samba wrote: > > Looking around inside that source code I also see: > > do_read (GVfsBackend *backend, > GVfsJobRead *job, > GVfsBackendHandle handle, > char *buffer, > gsize bytes_requested) > { > GVfsBackendSmb *op_backend = G_VFS_BACKEND_SMB (backend); > ssize_t res; > smbc_read_fn smbc_read; > > /*...
2012 Oct 12
9
[PATCH] Fits: tool to parse stream
...caltime(&tim); + printf("%04d-%02d-%02d %02d:%02d:%02d.%09d", + t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, + t->tm_hour, t->tm_min, t->tm_sec, nsec); + break; + case TYPE_LEN_ONLY: + printf("length %d", len); + break; + } + + return 0; +} + +int +do_read(void *buf, int len) +{ + int ret; + + if (len == 0) + return 0; + + ret = fread(buf, 1, len, stdin); + if (ret == 0) + return 1; + + if (ret != len) { + printf("read error on stdin: %d=%s\n", errno, strerror(errno)); + return -1; + } + return 0; +} + +int +main(int argc, char **argv)...
2016 Oct 28
2
Samba and BTRFS server-side copy
...Germain via samba: > On Thu, 27 Oct 2016 17:30:09 -0700, Jeremy Allison <jra at samba.org> > wrote : > >> On Thu, Oct 27, 2016 at 05:22:14PM -0700, Jeremy Allison via samba >> wrote: >>> Looking around inside that source code I also see: >>> >>> do_read (GVfsBackend *backend, >>> GVfsJobRead *job, >>> GVfsBackendHandle handle, >>> char *buffer, >>> gsize bytes_requested) >>> { >>> GVfsBackendSmb *op_backend = G_VFS_BACKEND_SMB (backend); >>>...
2016 Aug 01
1
[Qemu-devel] [PATCH 6/7] qemu: Implement virtio-pstore device
...> > > > So this seems to just be picking the first filename reported by > > readdir that isn't starting with '.'. Surely this can't the right > > logic when your corresponding do_write method can pick several > > different filenames, its potluck which do_read will give back. > > Do you mean that it'd be better to check a list of known filenames and > fail if not? No, I mean that you have several different VIRTIO_PSTORE_TYPE_nnn and use a different file for each constant. When reading this directory though you're not looking for the fi...
2016 Aug 01
1
[Qemu-devel] [PATCH 6/7] qemu: Implement virtio-pstore device
...> > > > So this seems to just be picking the first filename reported by > > readdir that isn't starting with '.'. Surely this can't the right > > logic when your corresponding do_write method can pick several > > different filenames, its potluck which do_read will give back. > > Do you mean that it'd be better to check a list of known filenames and > fail if not? No, I mean that you have several different VIRTIO_PSTORE_TYPE_nnn and use a different file for each constant. When reading this directory though you're not looking for the fi...
2016 Oct 28
3
Samba and BTRFS server-side copy
On Thu, 27 Oct 2016 16:57:13 -0700, Jeremy Allison <jra at samba.org> wrote : > On Fri, Oct 28, 2016 at 01:42:35AM +0200, Saint Germain via samba > wrote: > > On Thu, 27 Oct 2016 16:27:05 -0700, Jeremy Allison <jra at samba.org> > > > if you see any of these then it happened. > > > > Ok I understand how to check that it happened, but how can I make
2007 May 09
3
[patch 8/9] lguest: the block driver
...q, dma); +} + +static void do_write(struct blockdev *bd, struct request *req) +{ + struct lguest_dma send; + + pr_debug("lgb: WRITE sector %li\n", (long)req->sector); + setup_req(bd, 1, req, &send); + + hcall(LHCALL_SEND_DMA, bd->phys_addr, __pa(&send), 0); +} + +static void do_read(struct blockdev *bd, struct request *req) +{ + struct lguest_dma ping; + + pr_debug("lgb: READ sector %li\n", (long)req->sector); + setup_req(bd, 0, req, &bd->dma); + + empty_dma(&ping); + hcall(LHCALL_SEND_DMA, bd->phys_addr, __pa(&ping), 0); +} + +static void do_lgb...
2007 May 09
3
[patch 8/9] lguest: the block driver
...q, dma); +} + +static void do_write(struct blockdev *bd, struct request *req) +{ + struct lguest_dma send; + + pr_debug("lgb: WRITE sector %li\n", (long)req->sector); + setup_req(bd, 1, req, &send); + + hcall(LHCALL_SEND_DMA, bd->phys_addr, __pa(&send), 0); +} + +static void do_read(struct blockdev *bd, struct request *req) +{ + struct lguest_dma ping; + + pr_debug("lgb: READ sector %li\n", (long)req->sector); + setup_req(bd, 0, req, &bd->dma); + + empty_dma(&ping); + hcall(LHCALL_SEND_DMA, bd->phys_addr, __pa(&ping), 0); +} + +static void do_lgb...
2016 Jul 28
2
[Qemu-devel] [PATCH 6/7] qemu: Implement virtio-pstore device
...SSED; > + } > +} > + > +static ssize_t virtio_pstore_do_open(VirtIOPstore *s) > +{ > + s->dirp = opendir(s->directory); > + if (s->dirp == NULL) { > + return -1; > + } > + > + return 0; > +} > + > +static ssize_t virtio_pstore_do_read(VirtIOPstore *s, struct iovec *in_sg, > + unsigned int in_num, > + struct virtio_pstore_res *res) > +{ > + char path[PATH_MAX]; Don't declare PATH_MAX sized variables > + int fd; > + ssize_t len...
2016 Jul 28
2
[Qemu-devel] [PATCH 6/7] qemu: Implement virtio-pstore device
...SSED; > + } > +} > + > +static ssize_t virtio_pstore_do_open(VirtIOPstore *s) > +{ > + s->dirp = opendir(s->directory); > + if (s->dirp == NULL) { > + return -1; > + } > + > + return 0; > +} > + > +static ssize_t virtio_pstore_do_read(VirtIOPstore *s, struct iovec *in_sg, > + unsigned int in_num, > + struct virtio_pstore_res *res) > +{ > + char path[PATH_MAX]; Don't declare PATH_MAX sized variables > + int fd; > + ssize_t len...
2016 Oct 28
0
Samba and BTRFS server-side copy
...nd->smb_context); smbc_close = smbc_getFunctionClose (backend->smb_context); Which clearly doesn't use the splice call. That's broken. If there's anyone on the Gnome gvfs team please let me know and let's get this fixed. Looking around inside that source code I also see: do_read (GVfsBackend *backend, GVfsJobRead *job, GVfsBackendHandle handle, char *buffer, gsize bytes_requested) { GVfsBackendSmb *op_backend = G_VFS_BACKEND_SMB (backend); ssize_t res; smbc_read_fn smbc_read; /* libsmbclient limits blocksize to (64*1024)-2 for W...
2016 Oct 28
0
Samba and BTRFS server-side copy
On Thu, 27 Oct 2016 17:30:09 -0700, Jeremy Allison <jra at samba.org> wrote : > On Thu, Oct 27, 2016 at 05:22:14PM -0700, Jeremy Allison via samba > wrote: > > > > Looking around inside that source code I also see: > > > > do_read (GVfsBackend *backend, > > GVfsJobRead *job, > > GVfsBackendHandle handle, > > char *buffer, > > gsize bytes_requested) > > { > > GVfsBackendSmb *op_backend = G_VFS_BACKEND_SMB (backend); > > ssize_t res; > >...
2016 Nov 02
0
Samba and BTRFS server-side copy
...Oct 2016 17:30:09 -0700, Jeremy Allison <jra at samba.org> > > wrote : > > > >> On Thu, Oct 27, 2016 at 05:22:14PM -0700, Jeremy Allison via samba > >> wrote: > >>> Looking around inside that source code I also see: > >>> > >>> do_read (GVfsBackend *backend, > >>> GVfsJobRead *job, > >>> GVfsBackendHandle handle, > >>> char *buffer, > >>> gsize bytes_requested) > >>> { > >>> GVfsBackendSmb *op_backend = G_VFS_BACKEND...
2005 Aug 04
0
[PATCH 6/11] Xenstore watch rework
...send_error(conn, errno); + if (!dir) { + send_error(conn, errno); + return; + } while ((dirent = readdir(*dir)) != NULL) { int len = strlen(dirent->d_name) + 1; @@ -824,32 +826,35 @@ reply_len += len; } - return send_reply(conn, XS_DIRECTORY, reply, reply_len); -} - -static bool do_read(struct connection *conn, const char *node) + send_reply(conn, XS_DIRECTORY, reply, reply_len); +} + +static void do_read(struct connection *conn, const char *node) { char *value; unsigned int size; int *fd; node = canonicalize(conn, node); - if (!check_node_perms(conn, node, XS_PERM_READ...
2019 Sep 16
2
ssh client is setting O_NONBLOCK on a pipe shared with other processes
> So the make process gets an EAGAIN on the write syscall and doesn't > retry? That sounds like a bug in whatever make you're using, since > that could potentially occur in other circumstances too. What other circumstances? EAGAIN means that something put the device into non-blocking mode, and normally, that should only happen if the program calling write had itself previously
2007 Jun 07
4
[PATCH RFC 0/3] Virtio draft II
Hi again all, It turns out that networking really wants ordered requests, which the previous patches didn't allow. This patch changes it to a callback mechanism; kudos to Avi. The downside is that locking is more complicated, and after a few dead ends I implemented the simplest solution: the struct virtio_device contains the spinlock to use, and it's held when your callbacks get
2007 Jun 07
4
[PATCH RFC 0/3] Virtio draft II
Hi again all, It turns out that networking really wants ordered requests, which the previous patches didn't allow. This patch changes it to a callback mechanism; kudos to Avi. The downside is that locking is more complicated, and after a few dead ends I implemented the simplest solution: the struct virtio_device contains the spinlock to use, and it's held when your callbacks get
2007 Jun 07
4
[PATCH RFC 0/3] Virtio draft II
Hi again all, It turns out that networking really wants ordered requests, which the previous patches didn't allow. This patch changes it to a callback mechanism; kudos to Avi. The downside is that locking is more complicated, and after a few dead ends I implemented the simplest solution: the struct virtio_device contains the spinlock to use, and it's held when your callbacks get
2016 Jul 30
0
[Qemu-devel] [PATCH 6/7] qemu: Implement virtio-pstore device
...e_t virtio_pstore_do_open(VirtIOPstore *s) > > +{ > > + s->dirp = opendir(s->directory); > > + if (s->dirp == NULL) { > > + return -1; > > + } > > + > > + return 0; > > +} > > + > > +static ssize_t virtio_pstore_do_read(VirtIOPstore *s, struct iovec *in_sg, > > + unsigned int in_num, > > + struct virtio_pstore_res *res) > > +{ > > + char path[PATH_MAX]; > > Don't declare PATH_MAX sized variables Will chan...