struct kernel_oplocks *irix_init_kernel_oplocks(void) { int pfd[2]; static struct kernel_oplocks koplocks; if (!irix_oplocks_available()) return NULL; if(pipe(pfd) != 0) { DEBUG(0,("setup_kernel_oplock_pipe: Unable to create pipe. " "Error was %s\n", strerror(errno) )); return False; } oplock_pipe_read = pfd[0]; oplock_pipe_write = pfd[1]; koplocks.receive_message = irix_oplock_receive_message; koplocks.set_oplock = irix_set_kernel_oplock; koplocks.release_oplock = irix_release_kernel_oplock; koplocks.msg_waiting = irix_oplock_msg_waiting; koplocks.notification_fd = oplock_pipe_read; return &koplocks; }
struct kernel_oplocks *irix_init_kernel_oplocks(struct smbd_server_connection *sconn) { struct kernel_oplocks *_ctx; struct irix_oplocks_context *ctx; int pfd[2]; if (!irix_oplocks_available()) return NULL; _ctx = talloc_zero(sconn, struct kernel_oplocks); if (!_ctx) { return NULL; } ctx = talloc_zero(_ctx, struct irix_oplocks_context); if (!ctx) { talloc_free(_ctx); return NULL; } _ctx->ops = &irix_koplocks; _ctx->private_data = ctx; ctx->ctx = _ctx; ctx->sconn = sconn; if(pipe(pfd) != 0) { talloc_free(_ctx); DEBUG(0,("setup_kernel_oplock_pipe: Unable to create pipe. " "Error was %s\n", strerror(errno) )); return False; } ctx->read_fd = pfd[0]; ctx->write_fd = pfd[1]; ctx->read_fde = event_add_fd(sconn->ev_ctx, ctx, ctx->read_fd, EVENT_FD_READ, irix_oplocks_read_fde_handler, ctx); return _ctx; }