Lines Matching refs:pri
47 static int connect_to_switch(struct daemon_data *pri) in connect_to_switch() argument
49 struct sockaddr_un *ctl_addr = pri->ctl_addr; in connect_to_switch()
50 struct sockaddr_un *local_addr = pri->local_addr; in connect_to_switch()
55 pri->control = socket(AF_UNIX, SOCK_STREAM, 0); in connect_to_switch()
56 if (pri->control < 0) { in connect_to_switch()
63 if (connect(pri->control, (struct sockaddr *) ctl_addr, in connect_to_switch()
97 n = write(pri->control, &req, sizeof(req)); in connect_to_switch()
105 n = read(pri->control, sun, sizeof(*sun)); in connect_to_switch()
113 pri->data_addr = sun; in connect_to_switch()
121 close(pri->control); in connect_to_switch()
127 struct daemon_data *pri = data; in daemon_user_init() local
135 if (!strcmp(pri->sock_type, "unix")) in daemon_user_init()
136 pri->ctl_addr = new_addr(pri->ctl_sock, in daemon_user_init()
137 strlen(pri->ctl_sock) + 1); in daemon_user_init()
142 pri->local_addr = new_addr(&name, sizeof(name)); in daemon_user_init()
143 pri->dev = dev; in daemon_user_init()
144 pri->fd = connect_to_switch(pri); in daemon_user_init()
145 if (pri->fd < 0) { in daemon_user_init()
146 kfree(pri->local_addr); in daemon_user_init()
147 pri->local_addr = NULL; in daemon_user_init()
148 return pri->fd; in daemon_user_init()
156 struct daemon_data *pri = data; in daemon_open() local
157 return pri->fd; in daemon_open()
162 struct daemon_data *pri = data; in daemon_remove() local
164 close(pri->fd); in daemon_remove()
165 pri->fd = -1; in daemon_remove()
166 close(pri->control); in daemon_remove()
167 pri->control = -1; in daemon_remove()
169 kfree(pri->data_addr); in daemon_remove()
170 pri->data_addr = NULL; in daemon_remove()
171 kfree(pri->ctl_addr); in daemon_remove()
172 pri->ctl_addr = NULL; in daemon_remove()
173 kfree(pri->local_addr); in daemon_remove()
174 pri->local_addr = NULL; in daemon_remove()
177 int daemon_user_write(int fd, void *buf, int len, struct daemon_data *pri) in daemon_user_write() argument
179 struct sockaddr_un *data_addr = pri->data_addr; in daemon_user_write()