ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Linux-NBD/NBD.xs
(Generate patch)

Comparing Linux-NBD/NBD.xs (file contents):
Revision 1.2 by root, Fri May 9 00:15:14 2003 UTC vs.
Revision 1.3 by root, Tue Mar 8 20:19:57 2005 UTC

75MODULE = Linux::NBD PACKAGE = Linux::NBD::Server 75MODULE = Linux::NBD PACKAGE = Linux::NBD::Server
76 76
77void 77void
78_one_request (SV *obj, int fd) 78_one_request (SV *obj, int fd)
79 CODE: 79 CODE:
80{
80 struct nbd_request req; 81 struct nbd_request req;
81 82
82 if (read (fd, &req, sizeof (req)) == sizeof (req)) 83 if (read (fd, &req, sizeof (req)) == sizeof (req))
83 { 84 {
84 if (req.magic == htonl (NBD_REQUEST_MAGIC)) 85 if (req.magic == htonl (NBD_REQUEST_MAGIC))
103 } 104 }
104 } 105 }
105 } 106 }
106 107
107 XSRETURN_YES; 108 XSRETURN_YES;
109}
108 110
109SV * 111SV *
110_format_reply (SV *handle, unsigned int error = 0, SV *data = 0) 112_format_reply (SV *handle, unsigned int error = 0, SV *data = 0)
111 CODE: 113 CODE:
114{
112 struct nbd_reply rep; 115 struct nbd_reply rep;
113 STRLEN len; 116 STRLEN len;
114 char *h = SvPV (handle, len); 117 char *h = SvPV (handle, len);
115 118
116 if (len != sizeof (rep.handle)) 119 if (len != sizeof (rep.handle))
122 125
123 RETVAL = newSVpvn ((char *)&rep, sizeof (rep)); 126 RETVAL = newSVpvn ((char *)&rep, sizeof (rep));
124 127
125 if (data && !error) 128 if (data && !error)
126 sv_catsv (RETVAL, data); 129 sv_catsv (RETVAL, data);
127 130}
128 OUTPUT: 131 OUTPUT:
129 RETVAL 132 RETVAL
130 133

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines