XINU
Functions
rfsndmsg.c File Reference
#include <xinu.h>
Include dependency graph for rfsndmsg.c:

Go to the source code of this file.

Functions

status rfsndmsg (uint16 type, char *name)
 

Function Documentation

◆ rfsndmsg()

status rfsndmsg ( uint16  type,
char *  name 
)

Definition at line 9 of file rfsndmsg.c.

References htons, kprintf(), ntohl, OK, rfscomm(), SYSERR, and TIMEOUT.

Referenced by rfscontrol().

13 {
14  struct rf_msg_hdr req; /* Request message to send */
15  struct rf_msg_hdr resp; /* Buffer for response */
16  int32 retval; /* Return value */
17  char *to; /* Used during name copy */
18 
19  /* Form a request */
20 
21  req.rf_type = htons(type);
22  req.rf_status = htons(0);
23  req.rf_seq = 0; /* Rfscomm will set sequence */
24  to = req.rf_name;
25  while ( (*to++ = *name++) ) { /* Copy name to request */
26  ;
27  }
28 
29  /* Send message and receive response */
30 
31  retval = rfscomm(&req, sizeof(struct rf_msg_hdr),
32  &resp, sizeof(struct rf_msg_hdr) );
33 
34  /* Check response */
35 
36  if (retval == SYSERR) {
37  return SYSERR;
38  } else if (retval == TIMEOUT) {
39  kprintf("Timeout during remote file server access\n");
40  return SYSERR;
41  } else if (ntohl(resp.rf_status) != 0) {
42  return SYSERR;
43  }
44 
45  return OK;
46 }
syscall kprintf(char *fmt,...)
ポーリングI/Oを使用して、フォーマットされた文字列をコンソールに出力する。
Definition: kprintf.c:98
#define SYSERR
処理が失敗した場合
Definition: kernel.h:79
#define OK
処理が成功した場合
Definition: kernel.h:77
int32 rfscomm(struct rf_msg_hdr *, int32, struct rf_msg_hdr *, int32)
Definition: rfscomm.c:10
#define TIMEOUT
システムコールがタイムアウトした場合
Definition: kernel.h:83
#define ntohl(x)
Definition: prototypes.h:623
int int32
符号あり32ビット整数(int)
Definition: kernel.h:11
#define htons(x)
Definition: prototypes.h:619
Here is the call graph for this function:
Here is the caller graph for this function: