nexmon – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 /* source: xio-nop.c */
2 /* Copyright Gerhard Rieger 2006-2007 */
3 /* Published under the GNU General Public License V.2, see file COPYING */
4  
5 /* this file contains the source for a degenerated address that just transfers
6 data */
7  
8 #include "xiosysincludes.h"
9 #include "xioopen.h"
10  
11 #include "xio-nop.h"
12  
13  
14 #if WITH_NOP
15  
16 static int xioopen_nop(int argc, const char *argv[], struct opt *opts,
17 int xioflags, xiofile_t *xxfd,
18 unsigned groups, int dummy1, int dummy2,
19 int dummy3);
20  
21 static const struct xioaddr_inter_desc xiointer_nop0ro = { XIOADDR_PROT, "nop", 0, XIOBIT_RDONLY, 0/*groups*/, XIOSHUT_CLOSE, XIOCLOSE_NONE, xioopen_nop, 0, 0, 0, XIOBIT_WRONLY HELP("") };
22 static const struct xioaddr_inter_desc xiointer_nop0wo = { XIOADDR_PROT, "nop", 0, XIOBIT_WRONLY, 0/*groups*/, XIOSHUT_CLOSE, XIOCLOSE_NONE, xioopen_nop, 0, 0, 0, XIOBIT_RDONLY HELP("") };
23 static const struct xioaddr_inter_desc xiointer_nop0rw = { XIOADDR_PROT, "nop", 0, XIOBIT_RDWR, 0/*groups*/, XIOSHUT_CLOSE, XIOCLOSE_NONE, xioopen_nop, 0, 0, 0, XIOBIT_RDWR HELP("") };
24  
25 const union xioaddr_desc *xioaddrs_nop[] = {
26 (union xioaddr_desc *)&xiointer_nop0ro,
27 (union xioaddr_desc *)&xiointer_nop0wo,
28 (union xioaddr_desc *)&xiointer_nop0rw,
29 NULL };
30  
31 static int xioopen_nop(int argc, const char *argv[], struct opt *opts,
32 int xioflags, xiofile_t *xxfd,
33 unsigned groups, int dummy, int dummy2,
34 int dummy3) {
35 struct single *xfd = &xxfd->stream;
36 int result;
37  
38 if (argc != 1) {
39 Error("address NOP takes no arguments");
40 return STAT_NORETRY;
41 }
42  
43 if (xfd->rfd < 0 && xfd->wfd < 0) { /*!!!*/
44 Error("NOP cannot be endpoint");
45 return STAT_NORETRY;
46 }
47  
48 applyopts(-1, opts, PH_INIT);
49 if (applyopts_single(xfd, opts, PH_INIT) < 0) return -1;
50  
51 Notice("opening NOP");
52  
53 xfd->dtype = XIODATA_STREAM;
54 /*xfd->fdtype = FDTYPE_DOUBLE;*/
55  
56 applyopts(xfd->rfd, opts, PH_ALL);
57  
58 if ((result = _xio_openlate(xfd, opts)) < 0)
59 return result;
60  
61 return 0;
62 }
63 #endif /* WITH_NOP */
64